openapi: 3.0.0
info:
  version: '1.0.0'
  title: 'NRF NFDiscovery Service'
  description: 'NRF NFDiscovery  Service'
paths:
  /nf-instances:
    get:
      summary: Search a collection of NF Instances
      operationId: SearchNFInstances
      tags:
        - NF Instances (Store)
      parameters:
        - name: service-names
          in: query
          description: Name of the service offered by the NF
          required: true
          schema:
            type: array
            items:
              type: string
        - name: target-nf-type
          in: query
          description: Type of the target NF
          required: true
          schema:
            $ref: '#/components/schemas/NFType'
        - name: requester-nf-type
          in: query
          description: Type of the requester NF
          required: true
          schema:
            $ref: '#/components/schemas/NFType'
        - name: target-plmn
          in: query
          description: Id of the PLMN where the target NF is located
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlmnId'
        - name: requester-plmn
          in: query
          description: Id of the PLMN where the NF issuing the Discovery request is located
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlmnId'
        - name: snssais
          in: query
          description: Slice info of the target NF
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Snssai'
        - name: dnn
          in: query
          description: Dnn supported by the SMF
          schema:
            $ref: '#/components/schemas/Dnn'
        - name: smf-serving-area
          in: query
          schema:
            type: string
        - name: tai
          in: query
          description: Tracking Area Identity
          schema:
            $ref: '#/components/schemas/Tai'
        - name: ecgi
          in: query
          description: EPS Cell Global Identity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ecgi'
        - name: ncgi
          in: query
          description: NR Cell Global Identity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ncgi'
        - name: supi
          in: query
          description: SUPI of the user
          schema:
            $ref: '#/components/schemas/Supi'
        - name: supported-features
          in: query
          description: Features required to be supported by the target NF
          schema:
            $ref: '#/components/schemas/SupportedFeatures'
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResult'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          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'
components:
  schemas:
    SearchResult:
      type: object
      properties:
        validityPeriod:
          type: integer
        nfInstances:
          type: array
          items:
            $ref: '#/components/schemas/NFProfile'
    NFProfile:
      type: object
      required:
        - nfInstanceId
        - nfType
      properties:
        nfInstanceId:
          type: string
          format: uuid
        nfType:
          $ref: '#/components/schemas/NFType'
        plmn:
          $ref: '#/components/schemas/PlmnId'
        sNssais:
          type: array
          items:
            $ref: '#/components/schemas/Snssai'
        fqdn:
          $ref: '#/components/schemas/Fqdn'
        ipv4Address:
          type: array
          items:
            $ref: '#/components/schemas/Ipv4Addr'
        ipv6Address:
          type: array
          items:
            $ref: '#/components/schemas/Ipv6Addr'
        ipv6Prefix:
          type: array
          items:
            $ref: '#/components/schemas/Ipv6Prefix'
        capacity:
          type: integer
        priority:
          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'
        ipEndPoints:
          type: array
          items:
            $ref: '#/components/schemas/IpEndPoint'
        apiPrefix:
          type: string
        defaultNotificationSubscriptions:
          type: array
          items:
            $ref: '#/components/schemas/DefaultNotificationSubscription'
        capacity:
          type: integer
        priority:
          type: integer
        supportedFeatures:
          $ref: '#/components/schemas/SupportedFeatures'
#
# Types from TS 29.510 – NFManagement API (To be deleted once referenced)
#
    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
    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  
    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
    TransportProtocol:
      anyOf:
        - type: string
          enum:
            - TCP
        - 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
    Supi:
      type: string
      pattern: "^imsi-[0-9]{5,15}|nai-.+$"
    Tai:
      type: object
      required:
        - plmnId
        - tac
      properties:
        plmnId:
          $ref: '#/components/schemas/PlmnId'
        tac:
          $ref: '#/components/schemas/Tac'
    Tac:
      type: string
      pattern: '(^[A-Fa-f0-9]{4}$)|(^[A-Fa-f0-9]{6}$)'
    Ecgi:
      type: object
      required:
        - plmnId
        - eutraCellId
      properties:
        plmnId:
          $ref: '#/components/schemas/PlmnId'
        eutraCellId:
          $ref: '#/components/schemas/EutraCellId'
    Ncgi:
      type: object
      required:
        - plmnId
        - nrCellId
      properties:
        plmnId:
          $ref: '#/components/schemas/PlmnId'
        nrCellId:
          $ref: '#/components/schemas/NrCellId'
    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}$"
    EutraCellId:
      type: string
      pattern: "^[A-Fa-f0-9]{7}$"
    NrCellId:
      type: string
      pattern: "^[A-Fa-f0-9]{9}$"
    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/'
