Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

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


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 uuid.

Inputs

Header

Yaml


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: "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


[
  {
    "id": "string",
    "name": "string",
    "resourceType": "string",
    "dataQuality": {
      "status": "ok",
      "errorText": "string"
    },
    "attributeList": [
      {
        "name": "adminState",
        "value": "string",
        "dataQuality": {
          "status": "ok",
          "errorText": "string"
        }
      }
    ]
  }
]

Error Reporting


  • No labels