openapi: 3.0.0
info:
  version: '1.0.0'
  title: 'NRF NFManagement Service'
  description: 'NRF NFManagement Service'
paths:
  /nf-instances:
    get:
      summary: Retrieves a collection of NF Instances
      operationId: GetNFInstances
      tags:
        - NF Instances (Store)
      parameters:
        - name: nf-type
          in: query
          description: Type of NF
          required: false
          schema:
            $ref: '#/components/schemas/NFType'
        - name: limit
          in: query
          description: How many items to return at one time
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Uri'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        default:
          description: Unexpected error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /nf-instances/{nfInstanceID}:
    get:
      summary: Read the profile of a given NF Instance
      operationId: GetNFInstance
      tags:
        - NF Instance ID (Document)
      parameters:
        - name: nfInstanceID
          in: path
          description: Unique ID of the NF Instance
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NFProfile'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        default:
          description: Unexpected error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    put:
      summary: Register a new NF Instance
      operationId: RegisterNFInstance
      tags:
        - NF Instance ID (Document)
      parameters:
        - name: nfInstanceID
          in: path
          required: true
          description: Unique ID of the NF Instance to register
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NFProfile'
        required: true
      responses:
        '200':
          description: OK (Profile Replacement)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NFProfile'
        '201':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NFRegistrationData'
        '400':
          description: Bad request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        default:
          description: Unexpected error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    patch:
      summary: Update NF Instance profile
      operationId: UpdateNFInstance
      tags:
        - NF Instance ID (Document)
      parameters:
        - name: nfInstanceID
          in: path
          required: true
          description: Unique ID of the NF Instance to update
          schema:
            type: string
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchDocument'
        required: true
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NFProfile'
        default:
          description: Unexpected error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    delete:
      summary: Deregisters a given NF Instance
      operationId: DeregisterNFInstance
      tags:
        - NF Instance ID (Document)
      parameters:
        - name: nfInstanceID
          in: path
          required: true
          description: Unique ID of the NF Instance to deregister
          schema:
            type: string
      responses:
        '204':
          description: Expected response to a successful deregistration
  /nf-instances/{nfInstanceID}/nf-subscriptions:
    post:
      summary: Create a new subscription to a given NF Instance
      operationId: CreateNFSubscription
      tags:
        - NF Subscriptions (Collection)
      parameters:
        - name: nfInstanceID
          in: path
          required: true
          description: Unique ID of the NF Instance
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NFSubscriptionData'
        required: true
      responses:
        '201':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NFSubscriptionData'
        default:
          description: Unexpected error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      callbacks:
        onNFProfileChange:
          '{$request.body#/callbackUri}':
            post:
              requestBody:
                description: Notification Payload
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/NFNotificationData'
              responses:
                '200':
                  description: Expected response to a successful callback processing
  /nf-instances/{nfInstanceID}/nf-subscriptions/{nfSubscriptionID}:
    delete:
      summary: Deletes a NF Subscription
      operationId: RemoveNFSubscription
      tags:
        - NF Subscription ID (Document)
      parameters:
        - name: nfInstanceID
          in: path
          required: true
          description: Unique ID of the NF Instance
          schema:
            type: string
        - name: nfSubscriptionID
          in: path
          required: true
          description: Unique ID of the subscription to remove
          schema:
            type: string
      responses:
        '204':
          description: Expected response to a successful subscription removal
  /subscriptions:
    post:
      summary: Create a new subscription
      operationId: CreateSubscription
      tags:
        - Subscriptions (Collection)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionData'
        required: true
      responses:
        '201':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionData'
        default:
          description: Unexpected error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      callbacks:
        onNFRegistration:
          '{$request.body#/callbackUri}':
            post:
              requestBody:
                description: Notification Payload
                content:
                  application/json:
                    schema:
                      $ref: '#/components/schemas/NotificationData'
              responses:
                '200':
                  description: Expected response to a successful callback processing
  /subscriptions/{subscriptionID}:
    delete:
      summary: Deletes a subscription
      operationId: RemoveSubscription
      tags:
        - Subscription ID (Document)
      parameters:
        - name: subscriptionID
          in: path
          required: true
          description: Unique ID of the subscription to remove
          schema:
            type: string
      responses:
        '204':
          description: Expected response to a successful subscription removal
components:
  schemas:
    NFProfile:
      type: object
      required:
        - nfInstanceId
        - nfType
        - nfStatus
      properties:
        nfInstanceId:
          type: string
          format: uuid
        nfType:
          $ref: '#/components/schemas/NFType'
        nfStatus:
          $ref: '#/components/schemas/NFStatus'
        plmn:
          $ref: '#/components/schemas/PlmnId'
        sNssais:
          type: array
          items:
            $ref: '#/components/schemas/Snssai'
        fqdn:
          $ref: '#/components/schemas/Fqdn'
        interPlmnFqdn:
          $ref: '#/components/schemas/Fqdn'
        ipv4Addresses:
          type: array
          items:
            $ref: '#/components/schemas/Ipv4Addr'
        ipv6Addresses:
          type: array
          items:
            $ref: '#/components/schemas/Ipv6Addr'
        ipv6Prefixes:
          type: array
          items:
            $ref: '#/components/schemas/Ipv6Prefix'
        capacity:
          type: integer
        udrInfo:
          $ref: '#/components/schemas/UdrInfo'
        amfInfo:
          $ref: '#/components/schemas/AmfInfo'
        smfInfo:
          $ref: '#/components/schemas/SmfInfo'
        upfInfo:
          $ref: '#/components/schemas/UpfInfo'
        nfServices:
          type: array
          items:
            $ref: '#/components/schemas/NFService'
    NFService:
      type: object
      required:
        - serviceInstanceId
        - serviceName
        - version
        - schema
      properties:
        serviceInstanceId:
          type: string
        serviceName:
          type: string
        version:
          type: string
        schema:
          type: string
        fqdn:
          $ref: '#/components/schemas/Fqdn'
        interPlmnFqdn:
          $ref: '#/components/schemas/Fqdn'
        ipEndPoints:
          type: array
          items:
            $ref: '#/components/schemas/IpEndPoint'
        apiPrefix:
          type: string
        defaultNotificationSubscriptions:
          type: array
          items:
            $ref: '#/components/schemas/DefaultNotificationSubscription'
        allowedPlmns:
          type: array
          items:
            $ref: '#/components/schemas/PlmnId'
        allowedNfTypes:
          type: array
          items:
            $ref: '#/components/schemas/NFType'
        allowedNssais:
          type: array
          items:
            $ref: '#/components/schemas/Snssai'
        capacity:
          type: integer
        supportedFeatures:
          $ref: '#/components/schemas/SupportedFeatures'
    NFType:
      anyOf:
        - type: string
          enum:
            - NRF
            - UDM
            - AMF
            - SMF
            - AUSF
            - NEF
            - PCF
            - SMSF
            - NSSF
            - UDR
            - LMF
            - GMLC
            - 5G_EIR
            - SEPP
            - UPF
            - N3IWF
            - AF
            - UDSF
        - type: string
    Fqdn:
      type: string
    IpEndPoint:
      type: object
      properties:
        ipv4Address:
          $ref: '#/components/schemas/Ipv4Addr'
        ipv6Address:
          $ref: '#/components/schemas/Ipv6Addr'
        ipv6Prefix:
          $ref: '#/components/schemas/Ipv6Prefix'
        transport:
          $ref: '#/components/schemas/TransportProtocol'
        port:
          type: integer  
    SubscriptionData:
      type: object
      required:
        - callbackUri
      properties:
        callbackUri:
          type: string
        nfType:
          $ref: '#/components/schemas/NFType'
        serviceName:
          type: string
    NFSubscriptionData:
      type: object
      required:
        - callbackUri
      properties:
        callbackUri:
          type: string
    UdrInfo:
      type: object
      required:
        - supiRanges
      properties:
        supiRanges:
          type: array
          items:
            $ref: '#/components/schemas/SupiRange'
    SupiRange:
      type: object
      properties:
        start:
          type: string
        end:
          type: string
        pattern:
          type: string
    AmfInfo:
      type: object
      required:
        - amfSetId
      properties:
        amfSetId:
          type: string
    SmfInfo:
      type: object
      required:
        - dnnList
      properties:
        dnnList:
          type: array
          items:
            $ref: '#/components/schemas/Dnn'
        servingArea:
          type: array
          items:
            type: string
    UpfInfo:
      type: object
      required:
        - sNssaiUpfInfoList
      properties:
        sNssaiUpfInfoList:
          type: array
          items:
            $ref: '#/components/schemas/SnssaiUpfInfoItem'
          minItems: 1
    SnssaiUpfInfoItem:
      type: object
      required:
        - sNssai
        - dnnUpfInfoList
      properties:
        sNssai:
          $ref: '#/components/schemas/Snssai'
        dnnUpfInfoList:
          type: array
          items:
            $ref: '#/components/schemas/DnnUpfInfoItem'
          minItems: 1
    DnnUpfInfoItem:
      type: object
      required:
        - dnn
      properties:
        dnn:
          $ref: '#/components/schemas/Dnn'
    DefaultNotificationSubscription:
      type: object
      required:
        - notificationType
        - callbackUri
      properties:
        notificationType:
          $ref: '#/components/schemas/NotificationType'
        callbackUri:
          $ref: '#/components/schemas/Uri'
        n1MessageClass:
          $ref: '#/components/schemas/N1MessageClass'
        n2InformationClass:
          $ref: '#/components/schemas/N2InformationClass'
    NotificationType:
      anyOf:
        - type: string
          enum:
            - N1_MESSAGES
            - N2_INFORMATION
            - LOCATION_NOTIFICATION
        - type: string
    TransportProtocol:
      anyOf:
        - type: string
          enum:
            - TCP
        - type: string
    NotificationEventType:
      anyOf:
        - type: string
          enum:
            - NF_REGISTERED
            - NF_DEREGISTERED
            - NF_PROFILE_CHANGED
        - type: string    
    NotificationData:
      type: object
      required:
        - event
      properties:
        event:
          $ref: '#/components/schemas/NotificationEventType'
        nfInstanceUri:
          $ref: '#/components/schemas/Uri'
    NFNotificationData:
      type: object
      required:
        - event
        - nfInstanceUri
      properties:
        event:
          $ref: '#/components/schemas/NotificationEventType'
        nfInstanceUri:
          $ref: '#/components/schemas/Uri'
        newProfile:
          $ref: '#/components/schemas/NFProfile'
    NFStatus:
      anyOf:
        - type: string
          enum:
            - REGISTERED
            - SUSPENDED
        - type: string
    NFRegistrationData:
      type: object
      required:
        - heartBeatTimer
        - nfProfile
      properties:
        heartBeatTimer:
          type: integer
        nfProfile:
          $ref: '#/components/schemas/NFProfile'
    PatchDocument:
      type: array
      items:
        $ref: '#/components/schemas/PatchItem'
    PatchItem:
      type: object
      required:
        - op
        - path
      properties:
        op:
          type: string
          enum:
            - add
            - remove
            - replace
            - move
            - copy
            - test
        path:
          type: string
        value:
          nullable: true
        from:
          type: string
#
# Types from TS 29.518 (To be deleted once referenced)
#
    N1MessageClass:
      anyOf:
        - type: string
          enum:
            - 5GMM
            - SM
            - LPP
            - SMS
        - type: string
    N2InformationClass:
      anyOf:
        - type: string
          enum:
            - SM
            - NRPPA
        - type: string
#
# Types from TS 29.571 (To be deleted once referenced)
#
    Uri:
      type: string
    PlmnId:
      type: object
      required:
        - mcc
        - mnc
      properties:
        mcc:
          $ref: '#/components/schemas/Mcc'
        mnc:
          $ref: '#/components/schemas/Mnc'
    Mcc:
      type: string
      pattern: "^[0-9]{3}$"
    Mnc:
      type: string
      pattern: "^[0-9]{2,3}$"
    Snssai:
      type: object
      required:
        - sst
      properties:
        sst:
          type: integer
          minimum: 0
          maximum: 255
        sd:
          type: string
    Ipv4Addr:
      type: string
    Ipv6Addr:
      type: string
    Ipv6Prefix:
      type: string
    Dnn:
      type: string
    SupportedFeatures:
      type: string
      pattern: '^[A-Fa-f0-9]+$'
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        instance:
          type: string
        cause:
          type: string
        invalidParams:
          type: array
          items:
            $ref: '#/components/schemas/InvalidParam'
    InvalidParam:
      type: object
      required:
        - param
      properties:
        param:
          type: string
        reason:
          type: string
externalDocs:
  description: Documentation
  url: 'http://www.3gpp.org/ftp/Specs/archive/29_series/29.510/'
