From 30205c32449e05ca31999d8280fb57c013143fff Mon Sep 17 00:00:00 2001 From: Joseph Vazhappilly Date: Mon, 7 Dec 2020 11:38:15 +0530 Subject: [PATCH 1/2] Add controller resource APIs --- openapi-spec/swagger.yaml | 201 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) diff --git a/openapi-spec/swagger.yaml b/openapi-spec/swagger.yaml index a2001a60e..5dc93f05a 100644 --- a/openapi-spec/swagger.yaml +++ b/openapi-spec/swagger.yaml @@ -587,6 +587,166 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorSpec' + /v1/controllers: + get: + tags: + - Controllers + description: List all controllers. + parameters: + - name: limit + in: query + description: Requests a page size of items. Returns a number of items up to a limit value. Use the limit parameter to make an initial limited request and use the ID of the last-seen item from the response as the marker parameter value in a subsequent limited request. + required: false + style: form + explode: true + schema: + minimum: 1 + type: integer + format: int32 + - name: offset + in: query + description: Used in conjunction with limit to return a slice of items. offset is where to start in the list. + required: false + style: form + explode: true + schema: + minimum: 0 + type: integer + format: int32 + - name: sort + in: query + description: >- + Comma-separated list of sort keys and optional sort directions in + the form of key:val + required: false + style: form + explode: true + schema: + type: string + example: 'sort=name:desc,id:asc' + - name: name + in: query + description: The controller name + required: false + style: form + explode: true + schema: + type: string + - name: id + in: query + description: Database ID created for a controller. + required: false + style: form + explode: true + schema: + type: string + - name: native_controller_id + in: query + description: Actual ID of the controller in the storage backend. + required: false + style: form + explode: true + schema: + type: string + - name: storage_id + in: query + description: Database ID created for a storage backend. + required: false + style: form + explode: true + schema: + type: string + - name: status + in: query + description: The controller status + required: false + style: form + explode: true + schema: + type: string + enum: + - normal + - offline + - unknown + responses: + '200': + description: List controllers query was success + content: + application/json: + schema: + type: object + required: + - controllers + additionalProperties: true + properties: + controllers: + type: array + title: the controllers schema + items: + $ref: '#/components/schemas/ControllerSpec' + '401': + description: NotAuthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '500': + description: An unexpected error occured. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '/v1/controllers/{id}': + get: + tags: + - Controllers + description: Get controller detail by controller ID. + parameters: + - name: id + in: path + description: Database ID created for a controller. + required: true + style: simple + explode: false + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ControllerSpec' + '401': + description: NotAuthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '404': + description: The resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '500': + description: An unexpected error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' /v1/volumes: get: tags: @@ -1322,6 +1482,47 @@ components: free_capacity: type: integer format: int64 + + ControllerSpec: + description: >- + A controller is discovered and updated by task manager. + allOf: + - $ref: '#/components/schemas/BaseModel' + - required: + - id + - name + type: object + properties: + name: + type: string + id: + type: string + readOnly: true + example: 084bf71e-a102-11e7-88a8-e31fe6d52248 + storage_id: + type: string + readOnly: true + example: 084bf71e-a102-11e7-88a8-e31fe6d52248 + native_controller_id: + type: string + readOnly: true + example: Controller_A + soft_version: + type: string + location: + type: string + status: + type: string + enum: + - normal + - offline + - unknown + cpu_info: + type: string + memory_size: + type: integer + format: int64 + VolumeRespSpec: description: Volume is an device created by storage service, it can be attached to From 2e414d45598b8976e222d2226e0ba252d1d59cb9 Mon Sep 17 00:00:00 2001 From: Joseph Vazhappilly Date: Mon, 7 Dec 2020 14:09:53 +0530 Subject: [PATCH 2/2] Add port and disk resource APIs --- openapi-spec/swagger.yaml | 486 +++++++++++++++++++++++++++++++++++++- 1 file changed, 485 insertions(+), 1 deletion(-) diff --git a/openapi-spec/swagger.yaml b/openapi-spec/swagger.yaml index 5dc93f05a..f90917d39 100644 --- a/openapi-spec/swagger.yaml +++ b/openapi-spec/swagger.yaml @@ -747,6 +747,346 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorSpec' + /v1/ports: + get: + tags: + - Ports + description: List all ports. + parameters: + - name: limit + in: query + description: Requests a page size of items. Returns a number of items up to a limit value. Use the limit parameter to make an initial limited request and use the ID of the last-seen item from the response as the marker parameter value in a subsequent limited request. + required: false + style: form + explode: true + schema: + minimum: 1 + type: integer + format: int32 + - name: offset + in: query + description: Used in conjunction with limit to return a slice of items. offset is where to start in the list. + required: false + style: form + explode: true + schema: + minimum: 0 + type: integer + format: int32 + - name: sort + in: query + description: >- + Comma-separated list of sort keys and optional sort directions in + the form of key:val + required: false + style: form + explode: true + schema: + type: string + example: 'sort=name:desc,id:asc' + - name: name + in: query + description: The port name + required: false + style: form + explode: true + schema: + type: string + - name: id + in: query + description: Database ID created for a port. + required: false + style: form + explode: true + schema: + type: string + - name: native_port_id + in: query + description: Actual ID of the port in the storage backend. + required: false + style: form + explode: true + schema: + type: string + - name: storage_id + in: query + description: Database ID created for a storage backend. + required: false + style: form + explode: true + schema: + type: string + - name: connection_status + in: query + description: The port connection_status + required: false + style: form + explode: true + schema: + type: string + enum: + - connected + - disconnected + - unknown + - name: health_status + in: query + description: The port health_status + required: false + style: form + explode: true + schema: + type: string + enum: + - normal + - abnormal + - unknown + responses: + '200': + description: List port query was success + content: + application/json: + schema: + type: object + required: + - ports + additionalProperties: true + properties: + controllers: + type: array + title: the port schema + items: + $ref: '#/components/schemas/PortSpec' + '401': + description: NotAuthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '500': + description: An unexpected error occured. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '/v1/ports/{id}': + get: + tags: + - Ports + description: Get port detail by port ID. + parameters: + - name: id + in: path + description: Database ID created for a port. + required: true + style: simple + explode: false + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PortSpec' + '401': + description: NotAuthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '404': + description: The resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '500': + description: An unexpected error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + /v1/disks: + get: + tags: + - Disks + description: List all disks. + parameters: + - name: limit + in: query + description: Requests a page size of items. Returns a number of items up to a limit value. Use the limit parameter to make an initial limited request and use the ID of the last-seen item from the response as the marker parameter value in a subsequent limited request. + required: false + style: form + explode: true + schema: + minimum: 1 + type: integer + format: int32 + - name: offset + in: query + description: Used in conjunction with limit to return a slice of items. offset is where to start in the list. + required: false + style: form + explode: true + schema: + minimum: 0 + type: integer + format: int32 + - name: sort + in: query + description: >- + Comma-separated list of sort keys and optional sort directions in + the form of key:val + required: false + style: form + explode: true + schema: + type: string + example: 'sort=name:desc,id:asc' + - name: name + in: query + description: The disk name + required: false + style: form + explode: true + schema: + type: string + - name: id + in: query + description: Database ID created for a disk. + required: false + style: form + explode: true + schema: + type: string + - name: native_disk_id + in: query + description: Actual ID of the port in the storage backend. + required: false + style: form + explode: true + schema: + type: string + - name: storage_id + in: query + description: Database ID created for a storage backend. + required: false + style: form + explode: true + schema: + type: string + - name: native_disk_group_id + in: query + description: Database ID created for a disk group. + required: false + style: form + explode: true + schema: + type: string + - name: status + in: query + description: The disk status + required: false + style: form + explode: true + schema: + type: string + enum: + - normal + - offline + - abnormal + responses: + '200': + description: List port query was success + content: + application/json: + schema: + type: object + required: + - ports + additionalProperties: true + properties: + controllers: + type: array + title: the disk schema + items: + $ref: '#/components/schemas/DiskSpec' + '401': + description: NotAuthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '500': + description: An unexpected error occured. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '/v1/disks/{id}': + get: + tags: + - Disks + description: Get disk detail by disk ID. + parameters: + - name: id + in: path + description: Database ID created for a disk. + required: true + style: simple + explode: false + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DiskSpec' + '401': + description: NotAuthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '403': + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '404': + description: The resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' + '500': + description: An unexpected error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorSpec' /v1/volumes: get: tags: @@ -1482,7 +1822,6 @@ components: free_capacity: type: integer format: int64 - ControllerSpec: description: >- A controller is discovered and updated by task manager. @@ -1522,6 +1861,151 @@ components: memory_size: type: integer format: int64 + PortSpec: + description: >- + A port is discovered and updated by task manager. + allOf: + - $ref: '#/components/schemas/BaseModel' + - required: + - id + - name + type: object + properties: + name: + type: string + id: + type: string + readOnly: true + example: 084bf71e-a102-11e7-88a8-e31fe6d52248 + storage_id: + type: string + readOnly: true + example: 084bf71e-a102-11e7-88a8-e31fe6d52248 + native_port_id: + type: string + readOnly: true + example: Port_A + native_parent_id: + type: string + readOnly: true + example: Controller_A + speed: + type: integer + max_speed: + type: integer + location: + type: string + connection_status: + type: string + enum: + - connected + - disconnected + - unknown + health_status: + type: string + enum: + - normal + - abnormal + - unknown + type: + type: string + enum: + - fc + - iscsi + - ficon + - fcoe + - eth + - sas + - ib + - other + logical_type: + type: string + enum: + - frontend + - backend + - service + - management + - internal + - maintenance + - interconnect + - other + wwn: + type: string + mac_address: + type: string + ipv4: + type: string + ipv4_mask: + type: string + ipv6: + type: string + ipv6_mask: + type: string + DiskSpec: + description: >- + A disk is discovered and updated by task manager. + allOf: + - $ref: '#/components/schemas/BaseModel' + - required: + - id + - name + type: object + properties: + name: + type: string + id: + type: string + readOnly: true + example: 084bf71e-a102-11e7-88a8-e31fe6d52248 + storage_id: + type: string + readOnly: true + example: 084bf71e-a102-11e7-88a8-e31fe6d52248 + native_disk_id: + type: string + readOnly: true + example: Disk_A + serial_number: + type: string + readOnly: true + example: SN00112233 + manufacturer: + type: string + model: + type: string + firmware: + type: string + speed: + type: integer + capacity: + type: integer + location: + type: string + status: + type: string + enum: + - normal + - offline + - abnormal + physical_type: + type: string + enum: + - sata + - sas + - ssd + - nl-sas + - unknown + logical_type: + type: string + enum: + - free + - member + - hotspare + - cache + health_score: + type: integer + native_disk_group_id: + type: string VolumeRespSpec: description: