Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


 Created using https://swagger.io/swagger-editor/

Image Removed

TO DO:

  • Decide if resourceType will be hard coded in the Swagger for this release.
    • VM
    • l3Network
  • Add/update descriptions for fields
  • Explain longer term plans for interface (model-driven, etc)
  • Better explain what dataQuality is intended to be. Consider new name. It does report on the reliability of the information.
  • Consider renaming returned item from resource to networkResource
  • clarify that resourceId is like uuidn

    HeaderImage Removed

notification-url  Address to send back asynchronous results  (verify name and add to swagger)

Inputs

Yaml

Code Block
collapsetrue
swagger: "2.0"
info:
  description: "This is the Network Discovery API."
  version: "0.0.1"
  title: "Network Discovery API"
  termsOfService: "http://onap.org"
  contact:
    email: "sharon.chisholm@amdocs.com"
host: "onap.org"
basePath: "/v1"
tags:
- name: "resource"
  description: "resource Instances"
  externalDocs:
    description: "Find out more"
    url: "http://onap.org"
schemes:
- "http"
paths:
  /prefix/network/resource:
    get:
      summary: "Get Network Information"
      description: "Retrieve information from primary data sources"
      operationId: "findbyResourceIdAndType"
      produces:
      - "application/json"
      parameters:
      - name: "X-ONAP-RequestID"
        in: "header"
        description: "Transaction identifier to enable end to end tracing"
        type: "string"
      - name: "resourceType"
        in: "query"
        description: "Type of resource to be discovered"
        type: "string"
        required: true
      - name: resourceId
        in: "query"
        description: "Identifier(s) of resource to be discovered"
        type: array 
        items:
            type: string
        required: true
      responses:
        200:
          description: "successful operation"
          schema:
            type: "array"
            items:
              $ref: "#/definitions/Resource"
        400:
          description: "Missing  manadatory field in the request or HTTP header."
        404:
          description: "Error: Requested '%1' resource was not found."
        405:
          description: "Method  Not Allowed  :  Invalid HTTP method type used ( PUT,DELETE,POST will be rejected)"
        500:
          description: "The GET request failed either due to internal Context Builder problem."
      security:
      - petstore_auth:
        - "write:pets"
        - "read:pets"
   
securityDefinitions:
  petstore_auth:
    type: "oauth2"
    authorizationUrl: "http://petstore.swagger.io/oauth/dialog"
    flow: "implicit"
    scopes:
      write:pets: "modify pets in your account"
      read:pets: "read your pets"
  api_key:
    type: "apiKey"
    name: "api_key"
    in: "header"
definitions:
  Resource:
    type: "object"
    properties:
      id:
        type: "string"
        description: "Universal indentifier"
      name:
        type: "string"
        description: "Network Resource Name"       
      resourceType:
        type: "string"
        description: "Network Resource Type"  
      dataQuality:
          $ref: "#/components/schemas/dataQuality"
      attributeList:
        type: "array"
        items:
          $ref: "#/components/schemas/attribute"  
    required:
      - id
      - resourceType
      - dataQuality
    xml:
      name: "Resource"
components:
  schemas:
   dataQuality:
    type: "object"
    description: "An indication of the reliability of the information"  
    properties:
      status:
        type: "string"
        enum: [ok, error]
      errorText:
        type: "string"
    required:
      - status
    xml:
      name: "dataQuality"
   attribute:
    type: "object"
    description: "A particular piece of information about a resource."  
    properties:
      name:
        $ref: "#/components/schemas/fieldName"
      value:
        type: "string"
      dataQuality:
          $ref: "#/components/schemas/dataQuality"
    required:
      - name
      - dataQuality
   fieldName:
    description: "Unique name for a particular piece of information"
    type: string
    enum:
       - adminState
       - flavorDisk
       - flavorEphemoral
       - flavorHwCpuModel
       - flavorHwCpuPolicy
       - flavorHwMemPageSize
       - flavorOriginalName
       - flavorRam
       - flavorSwap
       - flavorVcpus
       - imageId
       - inMaintenance
       - hostId
       - host
       - hostname
       - hostStatus
       - status
       - securityGroupName
       - serverName
       - sharedNetwork
       - subNets
       - userId
       - tenantId
       - vmState
  ApiResponse:
    type: "object"
    properties:
      code:
        type: "integer"
        format: "int32"
      type:
        type: "string"
      message:
        type: "string"
externalDocs:
  description: "Find out more about Swagger"
  url: "http://swagger.io"

JSON Example

Code Block
languagexml
{
    "service": {
        "uuid": "c6456519-6acf-4adb-997c-3c363dd4caaf",
        "dataQuality": {
            "status": "ok"
        },
        "attributeList": []
    },
    "dataQuality": {
        "status": "ok"
    },
    "attributeList": [],
    "vfList": [
        {
            "dataQuality": {
                "status": "ok"
            },
            "attributeList": [],
            "vfModuleList": [
                {
                    "maxInstances": 0,
                    "minInstances": 0,
                    "dataQuality": {
                        "status": "ok"
                    },
                    "attributeList": [],
                    "vmList": [
                        {
                            "uuid": "25fb07ab-0478-465e-a021-6384ac299671",
                            "nfNamingCode": "vserver",
                            "dataQuality": {
                                "status": "ok"
                            },
                            "attributeList": [
                                {
                                    "name": "adminState",
                                    "value": "active",
                                    "dataQuality": {
                                        "status": "ok"
                                    }
                                }
                            ]
                        },
                        {
                            "uuid": "25fb07ab-0478-465e-a021-6384ac299672",
                            "nfNamingCode": "vserver",
                            "dataQuality": {
                                "status": "error",
                                "errorText": "ENRICHER-202, The adaptor returned no data for the requested object"
                            },
                            "attributeList": []
                        }
                    ],
                    "networkList": [
                        {
                            "uuid": "HNP1d77c-1222-41ec-b7f3-94bb30951870",
                            "type": "l3-network",
                            "dataQuality": {
                                "status": "error",
                                "errorText": "ENRICHER-312, Unknown SoT as Enricher could not recognize the SoT reference."
                            },
                            "attributeList": []
                        }
                    ]
                }
            ],
            "vnfcList": []
        },
        {
            "dataQuality": {
                "status": "ok"
            },
            "attributeList": [],
            "vfModuleList": [
                {
                    "maxInstances": 0,
                    "minInstances": 0,
                    "dataQuality": {
                        "status": "ok"
                    },
                    "attributeList": [],
                    "vmList": [
                        {
                            "uuid": "b494cd6e-b9f3-45e0-afe7-e1d1a5f5d74b",
                            "nfNamingCode": "vserver",
                            "dataQuality": {
                                "status": "error",
                                "errorText": "ENRICHER-202, The adaptor returned no data for the requested object"
                            },
                            "attributeList": []
                        }
                    ],
                    "networkList": [
                        {
                            "uuid": "HNP1d77c-1222-41ec-b7f3-94bb30951870",
                            "type": "l3-network",
                            "dataQuality": {
                                "status": "error",
                                "errorText": "ENRICHER-312, Unknown SoT as Enricher could not recognize the SoT reference."
                            },
                            "attributeList": []
                        }
                    ]
                }
            ],
            "vnfcList": []
        }
    ]
}

Error Reporting

...

Info

The Network Discovery microservice was first introduced in Casablanca but had no southbound integration. The Dublin release introduces the integration of Network Discovery with the Openstack API.

See Network Discovery Microservice (Dublin release)