Versions Compared

Key

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

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


TO DO:

  • Update names of attributes.
  • Decide if resourceType will be hard coded in the Swagger for this release.
    • VM
    • l3Network
  • Add/update descriptions for fieldsMake resourceType and resourceIdentifier mandatory query parameters
  • Explain longer term plans for interface (model-driven, etc)
  • Better explain what dataQuality is intended to be
  • Return resourceType in the response
  • Consider renaming returned item from resource to networkResource

...

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: "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: "UnivseralUniversal indentifier"
      name:
        type: "string"
        description: "ServiceNetwork 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"
   identifierattribute:
    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
      - valuedataQuality
   attributefieldName:
    typedescription: "objectUnique name for a particular piece of information"
    propertiestype: string
    enum:
   name:    - adminState
   $ref: "#/components/schemas/fieldName"   - flavorDisk
  value:     - flavorEphemoral
  type: "string"    - flavorHwCpuModel
 dataQuality:      - flavorHwCpuPolicy
   $ref: "#/components/schemas/dataQuality"   - flavorHwMemPageSize
required:       - nameflavorOriginalName
       - flavorRam
 dataQuality    fieldName:  - flavorSwap
 type: string     enum:- flavorVcpus
       - adminState
 imageId
       - inMaintenance
       - ipAddress
  hostId
       - host
       - hostName
 hostname
       - hostStatus
       - lockedBoolean
status
       - macAddress
securityGroupName
       - networkTypeserverName
        - networkTechnology
sharedNetwork
       - physicalNetworkNamesubNets
        - sharedNetworkBooleanuserId
        - networkRole
tenantId
       - routerExternalBooleanvmState
  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"

...

Code Block
[
  {
    "id": "string",
    "name": "string",
    "resourceType": "string",
    "dataQuality": {
      "status": "ok",
      "errorText": "string"
    },
    "attributeList": [
      {
        "name": "adminState - ipAddress - hostName - lockedBoolean - macAddress - networkType - networkTechnology - physicalNetworkName - sharedNetworkBoolean - networkRole - routerExternalBoolean",
        "value": "string",
        "dataQuality": {
          "status": "ok",
          "errorText": "string"
        }
      }
    ]
  }
]

...