From: Zhang Rong(Jon) Date: Sat, 31 Dec 2022 04:23:35 +0000 (+0800) Subject: Docs: Update all API docs with example X-Git-Tag: 2.0.1~5^2 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=78b9ca23e5bdec562703ed3e54f07e08eac1ec21;p=pti%2Fo2.git Docs: Update all API docs with example Issue-ID: INF-387 Signed-off-by: Zhang Rong(Jon) Change-Id: I96c0b4fb9a27dbe638a747e4800a7f27b22b8399 --- diff --git a/docs/swagger.json b/docs/swagger.json index d72a757..0330644 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -6,7 +6,10 @@ "get": { "responses": { "200": { - "description": "Success" + "description": "Success", + "schema": { + "$ref": "#/definitions/InventoryAPIVersion" + } } }, "operationId": "Get Inventory Version", @@ -109,7 +112,10 @@ "get": { "responses": { "200": { - "description": "Success" + "description": "Success", + "schema": { + "$ref": "#/definitions/InventoryV1APIVersion" + } } }, "operationId": "Get Inventory API version", @@ -582,30 +588,6 @@ } }, "/o2ims-infrastructureInventory/v1/subscriptions": { - "post": { - "responses": { - "201": { - "description": "Success", - "schema": { - "$ref": "#/definitions/SubscriptionGetDto" - } - } - }, - "operationId": "Create a Subscription", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#/definitions/SubscriptionCreateDto" - } - } - ], - "tags": [ - "O2IMS-InfrastructureInventory" - ] - }, "get": { "responses": { "200": { @@ -661,6 +643,30 @@ "tags": [ "O2IMS-InfrastructureInventory" ] + }, + "post": { + "responses": { + "201": { + "description": "Success", + "schema": { + "$ref": "#/definitions/SubscriptionGetDto" + } + } + }, + "operationId": "Create a Subscription", + "parameters": [ + { + "name": "payload", + "required": true, + "in": "body", + "schema": { + "$ref": "#/definitions/SubscriptionCreateDto" + } + } + ], + "tags": [ + "O2IMS-InfrastructureInventory" + ] } }, "/o2ims-infrastructureInventory/v1/subscriptions/{subscriptionID}": { @@ -735,7 +741,10 @@ "get": { "responses": { "200": { - "description": "Success" + "description": "Success", + "schema": { + "$ref": "#/definitions/MonitoringAPIVersion" + } } }, "operationId": "Get Monitoring Version", @@ -745,30 +754,6 @@ } }, "/o2ims-infrastructureMonitoring/v1/alarmSubscriptions": { - "post": { - "responses": { - "201": { - "description": "Success", - "schema": { - "$ref": "#/definitions/AlarmSubscriptionGetDto" - } - } - }, - "operationId": "Create a Alarm Subscription", - "parameters": [ - { - "name": "payload", - "required": true, - "in": "body", - "schema": { - "$ref": "#/definitions/AlarmSubscriptionCreateDto" - } - } - ], - "tags": [ - "O2IMS-InfrastructureMonitoring" - ] - }, "get": { "responses": { "200": { @@ -824,6 +809,30 @@ "tags": [ "O2IMS-InfrastructureMonitoring" ] + }, + "post": { + "responses": { + "201": { + "description": "Success", + "schema": { + "$ref": "#/definitions/AlarmSubscriptionGetDto" + } + } + }, + "operationId": "Create a Alarm Subscription", + "parameters": [ + { + "name": "payload", + "required": true, + "in": "body", + "schema": { + "$ref": "#/definitions/AlarmSubscriptionCreateDto" + } + } + ], + "tags": [ + "O2IMS-InfrastructureMonitoring" + ] } }, "/o2ims-infrastructureMonitoring/v1/alarmSubscriptions/{alarmSubscriptionID}": { @@ -1008,7 +1017,13 @@ "get": { "responses": { "200": { - "description": "Success" + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/MonitoringV1APIVersion" + } + } } }, "operationId": "Get Monitoring API version", @@ -1040,6 +1055,86 @@ } ], "definitions": { + "InventoryAPIVersion": { + "required": [ + "uriPrefix" + ], + "properties": { + "uriPrefix": { + "type": "string", + "description": "Specifies the URI prefix for the API", + "example": "https://128.224.115.36:30205/o2ims-infrastructureInventory" + }, + "apiVersions": { + "type": "array", + "description": "Version(s) supported for the API signaled by the uriPrefix attribute.", + "example": [ + { + "version": "1.0.0" + } + ], + "items": { + "$ref": "#/definitions/InventoryApiVersionStructure" + } + } + }, + "x-mask": "{uriPrefix,apiVersions}", + "type": "object" + }, + "InventoryApiVersionStructure": { + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string", + "description": "Identifies a supported version.", + "example": "1.0.0" + } + }, + "x-mask": "{version}", + "type": "object" + }, + "InventoryV1APIVersion": { + "required": [ + "uriPrefix" + ], + "properties": { + "uriPrefix": { + "type": "string", + "description": "Specifies the URI prefix for the API", + "example": "https://128.224.115.36:30205/o2ims-infrastructureInventory/v1" + }, + "apiVersions": { + "type": "array", + "description": "Version(s) supported for the API signaled by the uriPrefix attribute.", + "example": [ + { + "version": "1.0.0" + } + ], + "items": { + "$ref": "#/definitions/InventoryV1ApiVersionStructure" + } + } + }, + "x-mask": "{uriPrefix,apiVersions}", + "type": "object" + }, + "InventoryV1ApiVersionStructure": { + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string", + "description": "Identifies a supported version.", + "example": "1.0.0" + } + }, + "x-mask": "{version}", + "type": "object" + }, "OcloudDto": { "required": [ "oCloudId" @@ -1091,28 +1186,41 @@ "properties": { "resourceTypeId": { "type": "string", - "description": "Resource type ID" + "description": "Identifier for the Resource Type.", + "example": "60cba7be-e2cd-3b8c-a7ff-16e0f10573f9" }, "name": { - "type": "string" + "type": "string", + "description": "Human readable name of the resource type.", + "example": "pserver" }, "description": { - "type": "string" + "type": "string", + "description": "Human readable description of the resource type.", + "example": "The Physical Server resource type" }, "vendor": { - "type": "string" + "type": "string", + "description": "Provider of the Resource.", + "example": "" }, "model": { - "type": "string" + "type": "string", + "description": "Information about the model of the resource as defined by its provider.", + "example": "" }, "version": { - "type": "string" + "type": "string", + "description": "Version or generation of the resource as defined by its provider.", + "example": "" }, "alarmDictionary": { "$ref": "#/definitions/AlarmDictionaryDto" }, "extensions": { - "type": "string" + "type": "string", + "description": "List of metadata key-value pairs used to associate meaningful metadata to the related resource type.", + "example": "" } }, "x-mask": "{resourceTypeId,name,description,model,vendor,version}", @@ -1121,28 +1229,44 @@ "AlarmDictionaryDto": { "properties": { "id": { - "type": "string" + "type": "string", + "description": "Identifier for the Alarm Dictionary.", + "example": "7e1e59c3-c99e-3d1c-9934-21548a3a699a" }, "alarmDictionaryVersion": { - "type": "string" + "type": "string", + "description": "Version of the Alarm Dictionary.", + "example": "0.1" }, "alarmDictionarySchemaVersion": { - "type": "string" + "type": "string", + "description": "Version of the Alarm Dictionary Schema to which this alarm dictionary conforms.", + "example": "0.1" }, "entityType": { - "type": "string" + "type": "string", + "description": "O-RAN entity type emitting the alarm: This shall be unique per vendor ResourceType.model and ResourceType.version", + "example": "pserver" }, "vendor": { - "type": "string" + "type": "string", + "description": "Vendor of the Entity Type to whom this Alarm Dictionary applies. This should be the same value as in the ResourceType.vendor attribute.", + "example": "" }, "managementInterfaceId": { - "type": "string" + "type": "string", + "description": "List of management interface over which alarms are transmitted for this Entity Type.", + "example": "O2IMS" }, "pkNotificationField": { - "type": "string" + "type": "string", + "description": "Identifies which field or list of fields in the alarm notification contains the primary key (PK) into the Alarm Dictionary for this interface; i.e. which field contains the Alarm Definition ID.", + "example": "" }, "alarmDefinition": { "type": "array", + "description": "Contains the list of alarms that can be detected against this ResourceType.", + "example": "", "items": { "$ref": "#/definitions/AlarmDefinitionDto" } @@ -1153,34 +1277,54 @@ "AlarmDefinitionDto": { "properties": { "alarmDefinitionId": { - "type": "string" + "type": "string", + "description": "Provides a unique identifier of the alarm being raised.", + "example": "eaefa070-7cb6-3403-be46-177bd9ccc2d3" }, "alarmName": { - "type": "string" + "type": "string", + "description": "Provides short name for the alarm.", + "example": "100.104" }, "alarmLastChange": { - "type": "string" + "type": "string", + "description": "Indicates the Alarm Dictionary Version in which this alarm last changed.", + "example": "0.1" }, "alarmChangeType": { - "type": "string" + "type": "string", + "description": "Indicates the type of change that occurred during the alarm last change; added, deleted, modified.", + "example": "ADDED" }, "alarmDescription": { - "type": "string" + "type": "string", + "description": "Provides a longer descriptive meaning of the alarm condition and a description of the consequences of the alarm condition.", + "example": "host=.filesystem=\n File System threshold exceeded; threshold x%, actual y% .\n CRITICAL @ 90%\n MAJOR @ 80%\nOR\nhost=.volumegroup=\n Monitor and if condition persists, consider addin ..." }, "proposedRepairActions": { - "type": "string" + "type": "string", + "description": "Provides guidance for proposed repair actions.", + "example": "Reduce usage or resize filesystem." }, "clearingType": { - "type": "string" + "type": "string", + "description": "Identifies whether alarm is cleared automatically or manually.", + "example": "MANUAL" }, "managementInterfaceId": { - "type": "string" + "type": "string", + "description": "List of management interface over which alarms are transmitted for this Entity Type.", + "example": "O2IMS" }, "pkNotificationField": { - "type": "string" + "type": "string", + "description": "Identifies which field or list of fields in the alarm notification contains the primary key (PK) into the Alarm Dictionary for this interface; i.e. which field contains the Alarm Definition ID.", + "example": "" }, "alarmAdditionalFields": { - "type": "string" + "type": "string", + "description": "List of metadata key-value pairs used to associate meaningful metadata to the related resource type.", + "example": "" } }, "type": "object" @@ -1236,22 +1380,33 @@ "properties": { "resourceId": { "type": "string", - "description": "Resource ID" + "description": "Identifier for the Resource.", + "example": "5b3a2da8-17da-466c-b5f7-972590c7baf2" }, "resourceTypeId": { - "type": "string" + "type": "string", + "description": "Identifier for the Resource Type of this resource.", + "example": "60cba7be-e2cd-3b8c-a7ff-16e0f10573f9" }, "resourcePoolId": { - "type": "string" + "type": "string", + "description": "Identifier of the Resource Pool containing this resource.", + "example": "f078a1d3-56df-46c2-88a2-dd659aa3f6bd" }, "globalAssetId": { - "type": "string" + "type": "string", + "description": "Identifier or serial number of the resource.", + "example": "" }, "parentId": { - "type": "string" + "type": "string", + "description": "Identifier for the parent resource.", + "example": "None" }, "description": { - "type": "string" + "type": "string", + "description": "Human readable description of the resource.", + "example": "id:1;hostname:controller-0;mgmt_mac:00:00:00:00:00:00;mgmt_ip:192.168.204.2;personality:controller;subfunctions:controller,worker;administrative:unlocked;operational:enabled;availability:available;clock_synchronization:ntp;capabilities:{'is_max_cpu_configurable': 'configurable', 'stor_function': 'monitor', 'Personality': 'Controller-Active'};boot_device:/dev/disk/by-path/pci-0000:02:00.0-scsi-0:1:0:0;rootfs_device:/dev/disk/by-path/pci-0000:02:00.0-scsi-0:1:0:0;software_load:22.12;install_state:None;max_cpu_mhz_allowed:None" }, "extensions": { "type": "object" @@ -1267,22 +1422,33 @@ "properties": { "resourceId": { "type": "string", - "description": "Resource ID" + "description": "Identifier for the Resource.", + "example": "eee8b101-6b7f-4f0a-b54b-89adc0f3f906" }, "resourceTypeId": { - "type": "string" + "type": "string", + "description": "Identifier for the Resource Type of this resource.", + "example": "a45983bb-199a-30ec-b7a1-eab2455f333c" }, "resourcePoolId": { - "type": "string" + "type": "string", + "description": "Identifier of the Resource Pool containing this resource.", + "example": "f078a1d3-56df-46c2-88a2-dd659aa3f6bd" }, "globalAssetId": { - "type": "string" + "type": "string", + "description": "Identifier or serial number of the resource.", + "example": "" }, "parentId": { - "type": "string" + "type": "string", + "description": "Identifier for the parent resource.", + "example": "5b3a2da8-17da-466c-b5f7-972590c7baf2" }, "description": { - "type": "string" + "type": "string", + "description": "Human readable description of the resource.", + "example": "cpu:0;core:0;thread:0;cpu_family:6;cpu_model:Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz;allocated_function:Platform;numa_node:0" }, "extensions": { "type": "object" @@ -1304,22 +1470,33 @@ "properties": { "resourceId": { "type": "string", - "description": "Resource ID" + "description": "Identifier for the Resource.", + "example": "eee8b101-6b7f-4f0a-b54b-89adc0f3f906" }, "resourceTypeId": { - "type": "string" + "type": "string", + "description": "Identifier for the Resource Type of this resource.", + "example": "a45983bb-199a-30ec-b7a1-eab2455f333c" }, "resourcePoolId": { - "type": "string" + "type": "string", + "description": "Identifier of the Resource Pool containing this resource.", + "example": "f078a1d3-56df-46c2-88a2-dd659aa3f6bd" }, "globalAssetId": { - "type": "string" + "type": "string", + "description": "Identifier or serial number of the resource.", + "example": "" }, "parentId": { - "type": "string" + "type": "string", + "description": "Identifier for the parent resource.", + "example": "5b3a2da8-17da-466c-b5f7-972590c7baf2" }, "description": { - "type": "string" + "type": "string", + "description": "Human readable description of the resource.", + "example": "cpu:0;core:0;thread:0;cpu_family:6;cpu_model:Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz;allocated_function:Platform;numa_node:0" }, "extensions": { "type": "object" @@ -1341,22 +1518,33 @@ "properties": { "resourceId": { "type": "string", - "description": "Resource ID" + "description": "Identifier for the Resource.", + "example": "eee8b101-6b7f-4f0a-b54b-89adc0f3f906" }, "resourceTypeId": { - "type": "string" + "type": "string", + "description": "Identifier for the Resource Type of this resource.", + "example": "a45983bb-199a-30ec-b7a1-eab2455f333c" }, "resourcePoolId": { - "type": "string" + "type": "string", + "description": "Identifier of the Resource Pool containing this resource.", + "example": "f078a1d3-56df-46c2-88a2-dd659aa3f6bd" }, "globalAssetId": { - "type": "string" + "type": "string", + "description": "Identifier or serial number of the resource.", + "example": "" }, "parentId": { - "type": "string" + "type": "string", + "description": "Identifier for the parent resource.", + "example": "5b3a2da8-17da-466c-b5f7-972590c7baf2" }, "description": { - "type": "string" + "type": "string", + "description": "Human readable description of the resource.", + "example": "cpu:0;core:0;thread:0;cpu_family:6;cpu_model:Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz;allocated_function:Platform;numa_node:0" }, "extensions": { "type": "object" @@ -1372,29 +1560,43 @@ "properties": { "deploymentManagerId": { "type": "string", - "description": "Deployment manager ID" + "description": "Identifier for the Deployment Manager.", + "example": "c765516a-a84e-30c9-b954-9c3031bf71c8" }, "name": { - "type": "string" + "type": "string", + "description": "Human readable name of the deployment manager.", + "example": "95b818b8-b315-4d9f-af37-b82c492101f1.kubernetes" }, "description": { - "type": "string" + "type": "string", + "description": "Human readable description of the deployment manager.", + "example": "A DMS" }, "oCloudId": { - "type": "string" + "type": "string", + "description": "Identifier for the containing O-Cloud.", + "example": "f078a1d3-56df-46c2-88a2-dd659aa3f6bd" }, "serviceUri": { - "type": "string" + "type": "string", + "description": "The fully qualified URI to a Deployment Management server for O2dms services.", + "example": "https://128.224.115.51:6443" }, "profileSupportList": { "type": "array", - "description": "Profile support list, use default for the return endpoint", + "description": "Profile support list, use default for the return endpoint", + "example": [ + "native_k8sapi" + ], "items": { "type": "string" } }, "extensions": { - "type": "string" + "type": "string", + "description": "List of metadata key-value pairs used to associate meaningful metadata to the related Deployment Manager", + "example": "" } }, "x-mask": "{deploymentManagerId,name,description,oCloudId,serviceUri,profileSupportList}", @@ -1407,19 +1609,28 @@ "properties": { "deploymentManagerId": { "type": "string", - "description": "Deployment manager ID" + "description": "Identifier for the Deployment Manager.", + "example": "c765516a-a84e-30c9-b954-9c3031bf71c8" }, "name": { - "type": "string" + "type": "string", + "description": "Human readable name of the deployment manager.", + "example": "95b818b8-b315-4d9f-af37-b82c492101f1.kubernetes" }, "description": { - "type": "string" + "type": "string", + "description": "Human readable description of the deployment manager.", + "example": "A DMS" }, "oCloudId": { - "type": "string" + "type": "string", + "description": "Identifier for the containing O-Cloud.", + "example": "f078a1d3-56df-46c2-88a2-dd659aa3f6bd" }, "serviceUri": { - "type": "string" + "type": "string", + "description": "The fully qualified URI to a Deployment Management server for O2dms services.", + "example": "https://128.224.115.51:6443" }, "extensions": { "$ref": "#/definitions/DeploymentManagerExtensions" @@ -1431,7 +1642,9 @@ "DeploymentManagerExtensions": { "properties": { "profileName": { - "type": "string" + "type": "string", + "description": "", + "example": "" }, "profileData": { "$ref": "#/definitions/DeploymentManagerGetDtoProfile" @@ -1442,31 +1655,49 @@ "DeploymentManagerGetDtoProfile": { "properties": { "cluster_api_endpoint": { - "type": "string" + "type": "string", + "description": "Kubernetes Cluster API Endpoint", + "example": "https://128.224.115.51:6443" }, "cluster_ca_cert": { - "type": "string" + "type": "string", + "description": "Kubernetes Cluster CA cert", + "example": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZEakNDQX....." }, "admin_user": { - "type": "string" + "type": "string", + "description": "Kubernetes Admin username", + "example": "kubernetes-admin" }, "admin_client_cert": { - "type": "string" + "type": "string", + "description": "Kubernetes Admin client cert", + "example": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVJRENDQW....." }, "admin_client_key": { - "type": "string" + "type": "string", + "description": "Kubernetes Admin client key", + "example": "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcE....." }, "helmcli_host_with_port": { - "type": "string" + "type": "string", + "description": "Helm CLI Host address with SSH port", + "example": "128.224.115.34:30022" }, "helmcli_username": { - "type": "string" + "type": "string", + "description": "Helm CLI SSH login username", + "example": "helm" }, "helmcli_password": { - "type": "string" + "type": "string", + "description": "Helm CLI SSH login password", + "example": "password" }, "helmcli_kubeconfig": { - "type": "string" + "type": "string", + "description": "Helm CLI KUBECONFIG path", + "example": "/share/kubeconfig_c765516a.config" } }, "type": "object" @@ -1478,13 +1709,18 @@ "properties": { "callback": { "type": "string", - "description": "Subscription callback address" + "description": "Identifier for the Subscription.", + "example": "https://128.224.115.15:1081/smo/v1/o2ims_inventory_observer" }, "consumerSubscriptionId": { - "type": "string" + "type": "string", + "description": "Identifier for the consumer of events sent due to the Subscription.", + "example": "3F20D850-AF4F-A84F-FB5A-0AD585410361" }, "filter": { - "type": "string" + "type": "string", + "description": "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported.", + "example": "" } }, "type": "object" @@ -1496,21 +1732,108 @@ "properties": { "subscriptionId": { "type": "string", - "description": "Subscription ID" + "description": "Identifier for the Subscription.", + "example": "0bea3e71-d2f7-4bf3-9c06-41d8d35806f9" }, "callback": { - "type": "string" + "type": "string", + "description": "The fully qualified URI to a consumer procedure which can process a Post of the InventoryEventNotification.", + "example": "https://128.224.115.15:1081/smo/v1/o2ims_inventory_observer" }, "consumerSubscriptionId": { - "type": "string" + "type": "string", + "description": "Identifier for the consumer of events sent due to the Subscription.", + "example": "3F20D850-AF4F-A84F-FB5A-0AD585410361" }, "filter": { - "type": "string" + "type": "string", + "description": "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported.", + "example": "" } }, "x-mask": "{subscriptionId,callback}", "type": "object" }, + "MonitoringAPIVersion": { + "required": [ + "uriPrefix" + ], + "properties": { + "uriPrefix": { + "type": "string", + "description": "Specifies the URI prefix for the API", + "example": "https://128.224.115.36:30205/o2ims-infrastructureMonitoring" + }, + "apiVersions": { + "type": "array", + "description": "Version(s) supported for the API signaled by the uriPrefix attribute.", + "example": [ + { + "version": "1.0.0" + } + ], + "items": { + "$ref": "#/definitions/MonitoringApiVersionStructure" + } + } + }, + "x-mask": "{uriPrefix,apiVersions}", + "type": "object" + }, + "MonitoringApiVersionStructure": { + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string", + "description": "Identifies a supported version.", + "example": "1.0.0" + } + }, + "x-mask": "{version}", + "type": "object" + }, + "MonitoringV1APIVersion": { + "required": [ + "uriPrefix" + ], + "properties": { + "uriPrefix": { + "type": "string", + "description": "Specifies the URI prefix for the API", + "example": "https://128.224.115.36:30205/o2ims-infrastructureMonitoring/v1" + }, + "apiVersions": { + "type": "array", + "description": "Version(s) supported for the API signaled by the uriPrefix attribute.", + "example": [ + { + "version": "1.0.0" + } + ], + "items": { + "$ref": "#/definitions/MonitoringV1ApiVersionStructure" + } + } + }, + "x-mask": "{uriPrefix,apiVersions}", + "type": "object" + }, + "MonitoringV1ApiVersionStructure": { + "required": [ + "version" + ], + "properties": { + "version": { + "type": "string", + "description": "Identifies a supported version.", + "example": "1.0.0" + } + }, + "x-mask": "{version}", + "type": "object" + }, "AlarmGetDto": { "required": [ "alarmEventRecordId" @@ -1518,47 +1841,73 @@ "properties": { "alarmEventRecordId": { "type": "string", - "description": "Alarm Event Record ID", - "example": "f078a1d3-56df-46c2-88a2-dd659aa3f6bd" + "description": "The identifier for the AlarmEventRecord Object.", + "example": "97cc2b01-0e71-4a93-a911-2e87f04d996f" }, "resourceTypeId": { - "type": "string" + "type": "string", + "description": "A reference to the type of resource which caused the alarm.", + "example": "60cba7be-e2cd-3b8c-a7ff-16e0f10573f9" }, "resourceTypeID": { - "type": "string" + "type": "string", + "description": "A reference to the type of resource which caused the alarm.(Specification)", + "example": "60cba7be-e2cd-3b8c-a7ff-16e0f10573f9" }, "resourceId": { - "type": "string" + "type": "string", + "description": "A reference to the resource instance which caused the alarm.", + "example": "5b3a2da8-17da-466c-b5f7-972590c7baf2" }, "resourceID": { - "type": "string" + "type": "string", + "description": "A reference to the resource instance which caused the alarm.(Specification)", + "example": "5b3a2da8-17da-466c-b5f7-972590c7baf2" }, "alarmDefinitionId": { - "type": "string" + "type": "string", + "description": "A reference to the Alarm Definition record in the Alarm Dictionary associated with the referenced Resource Type.", + "example": "1197f463-b3d4-3aa3-9c14-faa493baa069" }, "alarmDefinitionID": { - "type": "string" + "type": "string", + "description": "A reference to the Alarm Definition record in the Alarm Dictionary associated with the referenced Resource Type.(Specification)", + "example": "1197f463-b3d4-3aa3-9c14-faa493baa069" }, "probableCauseId": { - "type": "string" + "type": "string", + "description": "A reference to the ProbableCause of the Alarm.", + "example": "f52054c9-6f3c-39a0-aab8-e00e01d8c4d3" }, "probableCauseID": { - "type": "string" + "type": "string", + "description": "A reference to the ProbableCause of the Alarm.(Specification)", + "example": "f52054c9-6f3c-39a0-aab8-e00e01d8c4d3" }, "alarmRaisedTime": { - "type": "string" + "type": "string", + "description": "Date/Time stamp value when the AlarmEventRecord has been created.", + "example": "2022-12-22 09:42:53" }, "alarmChangedTime": { - "type": "string" + "type": "string", + "description": "Date/Time stamp value when any value of the AlarmEventRecord has been modified.", + "example": "" }, "alarmAcknowledgeTime": { - "type": "string" + "type": "string", + "description": "Date/Time stamp value when the alarm condition is acknowledged.", + "example": "" }, "alarmAcknowledged": { - "type": "boolean" + "type": "boolean", + "description": "Boolean value indicating of a management system has acknowledged the alarm.", + "example": false }, "perceivedSeverity": { - "type": "string" + "type": "string", + "description": "One of the following values: \n 0 for \"CRITICAL\" \n1 for \"MAJOR\" \n2 for \"MINOR\" \n3 for \"WARNING\" \n4 for \"INDETERMINATE\" \n5 for \"CLEARED\"", + "example": "1" }, "extensions": { "type": "object" @@ -1573,13 +1922,18 @@ "properties": { "callback": { "type": "string", - "description": "Alarm Subscription callback address" + "description": "The fully qualified URI to a consumer procedure which can process a Post of the InventoryEventNotification.", + "example": "https://128.224.115.15:1081/smo/v1/o2ims_alarm_observer" }, "consumerSubscriptionId": { - "type": "string" + "type": "string", + "description": "Identifier for the consumer of events sent due to the Subscription.", + "example": "3F20D850-AF4F-A84F-FB5A-0AD585410361" }, "filter": { - "type": "string" + "type": "string", + "description": "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported.", + "example": "" } }, "type": "object" @@ -1591,16 +1945,23 @@ "properties": { "alarmSubscriptionId": { "type": "string", - "description": "Alarm Subscription ID" + "description": "Identifier for the Alarm Subscription.", + "example": "e320da6d-27a8-4948-8b52-3bf3355b45f3" }, "callback": { - "type": "string" + "type": "string", + "description": "The fully qualified URI to a consumer procedure which can process a Post of the InventoryEventNotification.", + "example": "https://128.224.115.15:1081/smo/v1/o2ims_alarm_observer" }, "consumerSubscriptionId": { - "type": "string" + "type": "string", + "description": "Identifier for the consumer of events sent due to the Subscription.", + "example": "3F20D850-AF4F-A84F-FB5A-0AD585410361" }, "filter": { - "type": "string" + "type": "string", + "description": "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported.", + "example": "" } }, "x-mask": "{alarmSubscriptionId,callback}", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b6529c5..485b6c4 100755 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -24,6 +24,8 @@ paths: responses: "200": description: Success + schema: + $ref: '#/definitions/InventoryAPIVersion' /o2ims-infrastructureInventory/v1: get: tags: @@ -99,6 +101,8 @@ paths: responses: "200": description: Success + schema: + $ref: '#/definitions/InventoryV1APIVersion' /o2ims-infrastructureInventory/v1/deploymentManagers: get: tags: @@ -565,6 +569,8 @@ paths: responses: "200": description: Success + schema: + $ref: '#/definitions/MonitoringAPIVersion' /o2ims-infrastructureMonitoring/v1/alarmSubscriptions: get: tags: @@ -768,7 +774,65 @@ paths: responses: "200": description: Success + schema: + type: array + items: + $ref: '#/definitions/MonitoringV1APIVersion' definitions: + InventoryAPIVersion: + type: object + required: + - uriPrefix + properties: + uriPrefix: + type: string + example: https://128.224.115.36:30205/o2ims-infrastructureInventory + description: Specifies the URI prefix for the API + apiVersions: + type: array + example: + - version: 1.0.0 + description: Version(s) supported for the API signaled by the uriPrefix attribute. + items: + $ref: '#/definitions/InventoryApiVersionStructure' + x-mask: "{uriPrefix,apiVersions}" + InventoryApiVersionStructure: + type: object + required: + - version + properties: + version: + type: string + example: 1.0.0 + description: Identifies a supported version. + x-mask: "{version}" + InventoryV1APIVersion: + type: object + required: + - uriPrefix + properties: + uriPrefix: + type: string + example: https://128.224.115.36:30205/o2ims-infrastructureInventory/v1 + description: Specifies the URI prefix for the API + apiVersions: + type: array + example: + - version: 1.0.0 + description: Version(s) supported for the API signaled by the uriPrefix attribute. + items: + $ref: '#/definitions/InventoryV1ApiVersionStructure' + x-mask: "{uriPrefix,apiVersions}" + InventoryV1ApiVersionStructure: + type: object + required: + - version + properties: + version: + type: string + example: 1.0.0 + description: Identifies a supported version. + x-mask: "{version}" OcloudDto: type: object required: @@ -810,41 +874,70 @@ definitions: properties: resourceTypeId: type: string - description: Resource type ID + example: 60cba7be-e2cd-3b8c-a7ff-16e0f10573f9 + description: Identifier for the Resource Type. name: type: string + example: pserver + description: Human readable name of the resource type. description: type: string + example: The Physical Server resource type + description: Human readable description of the resource type. vendor: type: string + example: "" + description: Provider of the Resource. model: type: string + example: "" + description: Information about the model of the resource as defined by its provider. version: type: string + example: "" + description: Version or generation of the resource as defined by its provider. alarmDictionary: $ref: '#/definitions/AlarmDictionaryDto' extensions: type: string + example: "" + description: List of metadata key-value pairs used to associate meaningful metadata to the related resource type. x-mask: "{resourceTypeId,name,description,model,vendor,version}" AlarmDictionaryDto: type: object properties: id: type: string + example: 7e1e59c3-c99e-3d1c-9934-21548a3a699a + description: Identifier for the Alarm Dictionary. alarmDictionaryVersion: type: string + example: "0.1" + description: Version of the Alarm Dictionary. alarmDictionarySchemaVersion: type: string + example: "0.1" + description: Version of the Alarm Dictionary Schema to which this alarm dictionary conforms. entityType: type: string + example: pserver + description: "O-RAN entity type emitting the alarm: This shall be unique per vendor ResourceType.model and ResourceType.version" vendor: type: string + example: "" + description: Vendor of the Entity Type to whom this Alarm Dictionary applies. This should be the same value as in the ResourceType.vendor attribute. managementInterfaceId: type: string + example: O2IMS + description: List of management interface over which alarms are transmitted for this Entity Type. pkNotificationField: type: string + example: "" + description: Identifies which field or list of fields in the alarm notification contains the primary key (PK) into the Alarm Dictionary for this interface; i.e. which field contains the Alarm Definition ID. alarmDefinition: type: array + example: "" + description: Contains the list of alarms that can be detected against this ResourceType. items: $ref: '#/definitions/AlarmDefinitionDto' AlarmDefinitionDto: @@ -852,24 +945,51 @@ definitions: properties: alarmDefinitionId: type: string + example: eaefa070-7cb6-3403-be46-177bd9ccc2d3 + description: Provides a unique identifier of the alarm being raised. alarmName: type: string + example: "100.104" + description: Provides short name for the alarm. alarmLastChange: type: string + example: "0.1" + description: Indicates the Alarm Dictionary Version in which this alarm last changed. alarmChangeType: type: string + example: ADDED + description: "Indicates the type of change that occurred during the alarm last change; added, deleted, modified." alarmDescription: type: string + example: |- + host=.filesystem= + File System threshold exceeded; threshold x%, actual y% . + CRITICAL @ 90% + MAJOR @ 80% + OR + host=.volumegroup= + Monitor and if condition persists, consider addin ... + description: Provides a longer descriptive meaning of the alarm condition and a description of the consequences of the alarm condition. proposedRepairActions: type: string + example: Reduce usage or resize filesystem. + description: Provides guidance for proposed repair actions. clearingType: type: string + example: MANUAL + description: Identifies whether alarm is cleared automatically or manually. managementInterfaceId: type: string + example: O2IMS + description: List of management interface over which alarms are transmitted for this Entity Type. pkNotificationField: type: string + example: "" + description: Identifies which field or list of fields in the alarm notification contains the primary key (PK) into the Alarm Dictionary for this interface; i.e. which field contains the Alarm Definition ID. alarmAdditionalFields: type: string + example: "" + description: List of metadata key-value pairs used to associate meaningful metadata to the related resource type. ResourcePoolGetDto: type: object required: @@ -911,17 +1031,28 @@ definitions: properties: resourceId: type: string - description: Resource ID + example: 5b3a2da8-17da-466c-b5f7-972590c7baf2 + description: Identifier for the Resource. resourceTypeId: type: string + example: 60cba7be-e2cd-3b8c-a7ff-16e0f10573f9 + description: Identifier for the Resource Type of this resource. resourcePoolId: type: string + example: f078a1d3-56df-46c2-88a2-dd659aa3f6bd + description: Identifier of the Resource Pool containing this resource. globalAssetId: type: string + example: "" + description: Identifier or serial number of the resource. parentId: type: string + example: None + description: Identifier for the parent resource. description: type: string + example: "id:1;hostname:controller-0;mgmt_mac:00:00:00:00:00:00;mgmt_ip:192.168.204.2;personality:controller;subfunctions:controller,worker;administrative:unlocked;operational:enabled;availability:available;clock_synchronization:ntp;capabilities:{'is_max_cpu_configurable': 'configurable', 'stor_function': 'monitor', 'Personality': 'Controller-Active'};boot_device:/dev/disk/by-path/pci-0000:02:00.0-scsi-0:1:0:0;rootfs_device:/dev/disk/by-path/pci-0000:02:00.0-scsi-0:1:0:0;software_load:22.12;install_state:None;max_cpu_mhz_allowed:None" + description: Human readable description of the resource. extensions: type: object properties: {} @@ -933,17 +1064,28 @@ definitions: properties: resourceId: type: string - description: Resource ID + example: eee8b101-6b7f-4f0a-b54b-89adc0f3f906 + description: Identifier for the Resource. resourceTypeId: type: string + example: a45983bb-199a-30ec-b7a1-eab2455f333c + description: Identifier for the Resource Type of this resource. resourcePoolId: type: string + example: f078a1d3-56df-46c2-88a2-dd659aa3f6bd + description: Identifier of the Resource Pool containing this resource. globalAssetId: type: string + example: "" + description: Identifier or serial number of the resource. parentId: type: string + example: 5b3a2da8-17da-466c-b5f7-972590c7baf2 + description: Identifier for the parent resource. description: type: string + example: cpu:0;core:0;thread:0;cpu_family:6;cpu_model:Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz;allocated_function:Platform;numa_node:0 + description: Human readable description of the resource. extensions: type: object properties: {} @@ -959,17 +1101,28 @@ definitions: properties: resourceId: type: string - description: Resource ID + example: eee8b101-6b7f-4f0a-b54b-89adc0f3f906 + description: Identifier for the Resource. resourceTypeId: type: string + example: a45983bb-199a-30ec-b7a1-eab2455f333c + description: Identifier for the Resource Type of this resource. resourcePoolId: type: string + example: f078a1d3-56df-46c2-88a2-dd659aa3f6bd + description: Identifier of the Resource Pool containing this resource. globalAssetId: type: string + example: "" + description: Identifier or serial number of the resource. parentId: type: string + example: 5b3a2da8-17da-466c-b5f7-972590c7baf2 + description: Identifier for the parent resource. description: type: string + example: cpu:0;core:0;thread:0;cpu_family:6;cpu_model:Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz;allocated_function:Platform;numa_node:0 + description: Human readable description of the resource. extensions: type: object properties: {} @@ -985,17 +1138,28 @@ definitions: properties: resourceId: type: string - description: Resource ID + example: eee8b101-6b7f-4f0a-b54b-89adc0f3f906 + description: Identifier for the Resource. resourceTypeId: type: string + example: a45983bb-199a-30ec-b7a1-eab2455f333c + description: Identifier for the Resource Type of this resource. resourcePoolId: type: string + example: f078a1d3-56df-46c2-88a2-dd659aa3f6bd + description: Identifier of the Resource Pool containing this resource. globalAssetId: type: string + example: "" + description: Identifier or serial number of the resource. parentId: type: string + example: 5b3a2da8-17da-466c-b5f7-972590c7baf2 + description: Identifier for the parent resource. description: type: string + example: cpu:0;core:0;thread:0;cpu_family:6;cpu_model:Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz;allocated_function:Platform;numa_node:0 + description: Human readable description of the resource. extensions: type: object properties: {} @@ -1007,22 +1171,35 @@ definitions: properties: deploymentManagerId: type: string - description: Deployment manager ID + example: c765516a-a84e-30c9-b954-9c3031bf71c8 + description: Identifier for the Deployment Manager. name: type: string + example: 95b818b8-b315-4d9f-af37-b82c492101f1.kubernetes + description: Human readable name of the deployment manager. description: type: string + example: A DMS + description: Human readable description of the deployment manager. oCloudId: type: string + example: f078a1d3-56df-46c2-88a2-dd659aa3f6bd + description: Identifier for the containing O-Cloud. serviceUri: type: string + example: https://128.224.115.51:6443 + description: The fully qualified URI to a Deployment Management server for O2dms services. profileSupportList: type: array - description: "Profile support list, use default for the return endpoint" + example: + - native_k8sapi + description: "Profile support list, use default for the return endpoint" items: type: string extensions: type: string + example: "" + description: List of metadata key-value pairs used to associate meaningful metadata to the related Deployment Manager x-mask: "{deploymentManagerId,name,description,oCloudId,serviceUri,profileSupportList}" DeploymentManagerGetDto: type: object @@ -1031,15 +1208,24 @@ definitions: properties: deploymentManagerId: type: string - description: Deployment manager ID + example: c765516a-a84e-30c9-b954-9c3031bf71c8 + description: Identifier for the Deployment Manager. name: type: string + example: 95b818b8-b315-4d9f-af37-b82c492101f1.kubernetes + description: Human readable name of the deployment manager. description: type: string + example: A DMS + description: Human readable description of the deployment manager. oCloudId: type: string + example: f078a1d3-56df-46c2-88a2-dd659aa3f6bd + description: Identifier for the containing O-Cloud. serviceUri: type: string + example: https://128.224.115.51:6443 + description: The fully qualified URI to a Deployment Management server for O2dms services. extensions: $ref: '#/definitions/DeploymentManagerExtensions' x-mask: "{deploymentManagerId,name,description,oCloudId,serviceUri,extensions,profileName,profileData}" @@ -1048,6 +1234,8 @@ definitions: properties: profileName: type: string + example: "" + description: "" profileData: $ref: '#/definitions/DeploymentManagerGetDtoProfile' DeploymentManagerGetDtoProfile: @@ -1055,22 +1243,40 @@ definitions: properties: cluster_api_endpoint: type: string + example: https://128.224.115.51:6443 + description: Kubernetes Cluster API Endpoint cluster_ca_cert: type: string + example: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZEakNDQX..... + description: Kubernetes Cluster CA cert admin_user: type: string + example: kubernetes-admin + description: Kubernetes Admin username admin_client_cert: type: string + example: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVJRENDQW..... + description: Kubernetes Admin client cert admin_client_key: type: string + example: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcE..... + description: Kubernetes Admin client key helmcli_host_with_port: type: string + example: 128.224.115.34:30022 + description: Helm CLI Host address with SSH port helmcli_username: type: string + example: helm + description: Helm CLI SSH login username helmcli_password: type: string + example: password + description: Helm CLI SSH login password helmcli_kubeconfig: type: string + example: /share/kubeconfig_c765516a.config + description: Helm CLI KUBECONFIG path SubscriptionCreateDto: type: object required: @@ -1078,11 +1284,16 @@ definitions: properties: callback: type: string - description: Subscription callback address + example: https://128.224.115.15:1081/smo/v1/o2ims_inventory_observer + description: Identifier for the Subscription. consumerSubscriptionId: type: string + example: 3F20D850-AF4F-A84F-FB5A-0AD585410361 + description: Identifier for the consumer of events sent due to the Subscription. filter: type: string + example: "" + description: "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported." SubscriptionGetDto: type: object required: @@ -1090,14 +1301,75 @@ definitions: properties: subscriptionId: type: string - description: Subscription ID + example: 0bea3e71-d2f7-4bf3-9c06-41d8d35806f9 + description: Identifier for the Subscription. callback: type: string + example: https://128.224.115.15:1081/smo/v1/o2ims_inventory_observer + description: The fully qualified URI to a consumer procedure which can process a Post of the InventoryEventNotification. consumerSubscriptionId: type: string + example: 3F20D850-AF4F-A84F-FB5A-0AD585410361 + description: Identifier for the consumer of events sent due to the Subscription. filter: type: string + example: "" + description: "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported." x-mask: "{subscriptionId,callback}" + MonitoringAPIVersion: + type: object + required: + - uriPrefix + properties: + uriPrefix: + type: string + example: https://128.224.115.36:30205/o2ims-infrastructureMonitoring + description: Specifies the URI prefix for the API + apiVersions: + type: array + example: + - version: 1.0.0 + description: Version(s) supported for the API signaled by the uriPrefix attribute. + items: + $ref: '#/definitions/MonitoringApiVersionStructure' + x-mask: "{uriPrefix,apiVersions}" + MonitoringApiVersionStructure: + type: object + required: + - version + properties: + version: + type: string + example: 1.0.0 + description: Identifies a supported version. + x-mask: "{version}" + MonitoringV1APIVersion: + type: object + required: + - uriPrefix + properties: + uriPrefix: + type: string + example: https://128.224.115.36:30205/o2ims-infrastructureMonitoring/v1 + description: Specifies the URI prefix for the API + apiVersions: + type: array + example: + - version: 1.0.0 + description: Version(s) supported for the API signaled by the uriPrefix attribute. + items: + $ref: '#/definitions/MonitoringV1ApiVersionStructure' + x-mask: "{uriPrefix,apiVersions}" + MonitoringV1ApiVersionStructure: + type: object + required: + - version + properties: + version: + type: string + example: 1.0.0 + description: Identifies a supported version. + x-mask: "{version}" AlarmGetDto: type: object required: @@ -1105,34 +1377,60 @@ definitions: properties: alarmEventRecordId: type: string - example: f078a1d3-56df-46c2-88a2-dd659aa3f6bd - description: Alarm Event Record ID + example: 97cc2b01-0e71-4a93-a911-2e87f04d996f + description: The identifier for the AlarmEventRecord Object. resourceTypeId: type: string + example: 60cba7be-e2cd-3b8c-a7ff-16e0f10573f9 + description: A reference to the type of resource which caused the alarm. resourceTypeID: type: string + example: 60cba7be-e2cd-3b8c-a7ff-16e0f10573f9 + description: A reference to the type of resource which caused the alarm.(Specification) resourceId: type: string + example: 5b3a2da8-17da-466c-b5f7-972590c7baf2 + description: A reference to the resource instance which caused the alarm. resourceID: type: string + example: 5b3a2da8-17da-466c-b5f7-972590c7baf2 + description: A reference to the resource instance which caused the alarm.(Specification) alarmDefinitionId: type: string + example: 1197f463-b3d4-3aa3-9c14-faa493baa069 + description: A reference to the Alarm Definition record in the Alarm Dictionary associated with the referenced Resource Type. alarmDefinitionID: type: string + example: 1197f463-b3d4-3aa3-9c14-faa493baa069 + description: A reference to the Alarm Definition record in the Alarm Dictionary associated with the referenced Resource Type.(Specification) probableCauseId: type: string + example: f52054c9-6f3c-39a0-aab8-e00e01d8c4d3 + description: A reference to the ProbableCause of the Alarm. probableCauseID: type: string + example: f52054c9-6f3c-39a0-aab8-e00e01d8c4d3 + description: A reference to the ProbableCause of the Alarm.(Specification) alarmRaisedTime: type: string + example: 2022-12-22 09:42:53 + description: Date/Time stamp value when the AlarmEventRecord has been created. alarmChangedTime: type: string + example: "" + description: Date/Time stamp value when any value of the AlarmEventRecord has been modified. alarmAcknowledgeTime: type: string + example: "" + description: Date/Time stamp value when the alarm condition is acknowledged. alarmAcknowledged: type: boolean + example: false + description: Boolean value indicating of a management system has acknowledged the alarm. perceivedSeverity: type: string + example: "1" + description: "One of the following values: \n 0 for \"CRITICAL\" \n1 for \"MAJOR\" \n2 for \"MINOR\" \n3 for \"WARNING\" \n4 for \"INDETERMINATE\" \n5 for \"CLEARED\"" extensions: type: object properties: {} @@ -1143,11 +1441,16 @@ definitions: properties: callback: type: string - description: Alarm Subscription callback address + example: https://128.224.115.15:1081/smo/v1/o2ims_alarm_observer + description: The fully qualified URI to a consumer procedure which can process a Post of the InventoryEventNotification. consumerSubscriptionId: type: string + example: 3F20D850-AF4F-A84F-FB5A-0AD585410361 + description: Identifier for the consumer of events sent due to the Subscription. filter: type: string + example: "" + description: "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported." AlarmSubscriptionGetDto: type: object required: @@ -1155,13 +1458,20 @@ definitions: properties: alarmSubscriptionId: type: string - description: Alarm Subscription ID + example: e320da6d-27a8-4948-8b52-3bf3355b45f3 + description: Identifier for the Alarm Subscription. callback: type: string + example: https://128.224.115.15:1081/smo/v1/o2ims_alarm_observer + description: The fully qualified URI to a consumer procedure which can process a Post of the InventoryEventNotification. consumerSubscriptionId: type: string + example: 3F20D850-AF4F-A84F-FB5A-0AD585410361 + description: Identifier for the consumer of events sent due to the Subscription. filter: type: string + example: "" + description: "Criteria for events which do not need to be reported or will be filtered by the subscription notification service. Therefore, if a filter is not provided then all events are reported." x-mask: "{alarmSubscriptionId,callback}" responses: ParseError: diff --git a/o2ims/views/alarm_dto.py b/o2ims/views/alarm_dto.py index f4aac49..3028a84 100644 --- a/o2ims/views/alarm_dto.py +++ b/o2ims/views/alarm_dto.py @@ -18,6 +18,38 @@ from o2common.views.flask_restx_fields import Json2Dict from o2ims.views.api_ns import api_ims_monitoring as api_monitoring_v1 +class MonitoringApiV1DTO: + + api_version = api_monitoring_v1.model( + 'MonitoringV1ApiVersionStructure', + { + 'version': fields.String( + required=True, + example='1.0.0', + description='Identifies a supported version.' + ) + }, + mask='{version,}' + ) + + api_version_info_get = api_monitoring_v1.model( + "MonitoringV1APIVersion", + { + 'uriPrefix': fields.String( + required=True, + example='https://128.224.115.36:30205/' + + 'o2ims-infrastructureMonitoring/v1', + description='Specifies the URI prefix for the API'), + 'apiVersions': fields.List( + fields.Nested(api_version), + example=[{'version': '1.0.0'}], + description='Version(s) supported for the API ' + + 'signaled by the uriPrefix attribute.'), + }, + mask='{uriPrefix,apiVersions}' + ) + + class AlarmDTO: alarm_event_record_get = api_monitoring_v1.model( @@ -25,21 +57,70 @@ class AlarmDTO: { 'alarmEventRecordId': fields.String( required=True, - example='f078a1d3-56df-46c2-88a2-dd659aa3f6bd', - description='Alarm Event Record ID'), - 'resourceTypeId': fields.String, - 'resourceTypeID': fields.String(attribute='resourceTypeId'), - 'resourceId': fields.String, - 'resourceID': fields.String(attribute='resourceId'), - 'alarmDefinitionId': fields.String, - 'alarmDefinitionID': fields.String(attribute='alarmDefinitionId'), - 'probableCauseId': fields.String, - 'probableCauseID': fields.String(attribute='probableCauseId'), - 'alarmRaisedTime': fields.String, - 'alarmChangedTime': fields.String, - 'alarmAcknowledgeTime': fields.String, - 'alarmAcknowledged': fields.Boolean, - 'perceivedSeverity': fields.String, + example='97cc2b01-0e71-4a93-a911-2e87f04d996f', + description='The identifier for the AlarmEventRecord Object.'), + 'resourceTypeId': fields.String( + example='60cba7be-e2cd-3b8c-a7ff-16e0f10573f9', + description='A reference to the type of resource which ' + + 'caused the alarm.'), + 'resourceTypeID': fields.String( + attribute='resourceTypeId', + example='60cba7be-e2cd-3b8c-a7ff-16e0f10573f9', + description='A reference to the type of resource which ' + + 'caused the alarm.(Specification)'), + 'resourceId': fields.String( + example='5b3a2da8-17da-466c-b5f7-972590c7baf2', + description='A reference to the resource instance which ' + + 'caused the alarm.'), + 'resourceID': fields.String( + attribute='resourceId', + example='5b3a2da8-17da-466c-b5f7-972590c7baf2', + description='A reference to the resource instance which ' + + 'caused the alarm.(Specification)'), + 'alarmDefinitionId': fields.String( + example='1197f463-b3d4-3aa3-9c14-faa493baa069', + description='A reference to the Alarm Definition record ' + + 'in the Alarm Dictionary associated with the referenced ' + + 'Resource Type.'), + 'alarmDefinitionID': fields.String( + attribute='alarmDefinitionId', + example='1197f463-b3d4-3aa3-9c14-faa493baa069', + description='A reference to the Alarm Definition record ' + + 'in the Alarm Dictionary associated with the referenced ' + + 'Resource Type.(Specification)'), + 'probableCauseId': fields.String( + example='f52054c9-6f3c-39a0-aab8-e00e01d8c4d3', + description='A reference to the ProbableCause of the Alarm.'), + 'probableCauseID': fields.String( + attribute='probableCauseId', + example='f52054c9-6f3c-39a0-aab8-e00e01d8c4d3', + description='A reference to the ProbableCause of the ' + + 'Alarm.(Specification)'), + 'alarmRaisedTime': fields.String( + example='2022-12-22 09:42:53', + description='Date/Time stamp value when the ' + + 'AlarmEventRecord has been created.'), + 'alarmChangedTime': fields.String( + example='', + description='Date/Time stamp value when any value of ' + + 'the AlarmEventRecord has been modified.'), + 'alarmAcknowledgeTime': fields.String( + example='', + description='Date/Time stamp value when the alarm ' + + 'condition is acknowledged.'), + 'alarmAcknowledged': fields.Boolean( + example=False, + description='Boolean value indicating of a management ' + + 'system has acknowledged the alarm.'), + 'perceivedSeverity': fields.String( + example='1', + description='One of the following values: \n ' + + '0 for "CRITICAL" \n' + + '1 for "MAJOR" \n' + + '2 for "MINOR" \n' + + '3 for "WARNING" \n' + + '4 for "INDETERMINATE" \n' + + '5 for "CLEARED"'), 'extensions': Json2Dict(attribute='extensions') } # mask='{alarmEventRecordId,resourceTypeID,resourceID,' + @@ -56,10 +137,24 @@ class SubscriptionDTO: { 'alarmSubscriptionId': fields.String( required=True, - description='Alarm Subscription ID'), - 'callback': fields.String, - 'consumerSubscriptionId': fields.String, - 'filter': fields.String, + example='e320da6d-27a8-4948-8b52-3bf3355b45f3', + description='Identifier for the Alarm Subscription.'), + 'callback': fields.String( + example='https://128.224.115.15:1081/smo/v1/' + + 'o2ims_alarm_observer', + description='The fully qualified URI to a consumer ' + + 'procedure which can process a Post of the ' + + 'InventoryEventNotification.'), + 'consumerSubscriptionId': fields.String( + example='3F20D850-AF4F-A84F-FB5A-0AD585410361', + description='Identifier for the consumer of events sent ' + + 'due to the Subscription.'), + 'filter': fields.String( + example='', + description='Criteria for events which do not need to be ' + + 'reported or will be filtered by the subscription ' + + 'notification service. Therefore, if a filter is not ' + + 'provided then all events are reported.'), }, mask='{alarmSubscriptionId,callback}' ) @@ -69,8 +164,20 @@ class SubscriptionDTO: { 'callback': fields.String( required=True, - description='Alarm Subscription callback address'), - 'consumerSubscriptionId': fields.String, - 'filter': fields.String, + example='https://128.224.115.15:1081/smo/v1/' + + 'o2ims_alarm_observer', + description='The fully qualified URI to a consumer ' + + 'procedure which can process a Post of the ' + + 'InventoryEventNotification.'), + 'consumerSubscriptionId': fields.String( + example='3F20D850-AF4F-A84F-FB5A-0AD585410361', + description='Identifier for the consumer of events sent ' + + 'due to the Subscription.'), + 'filter': fields.String( + example='', + description='Criteria for events which do not need to be ' + + 'reported or will be filtered by the subscription ' + + 'notification service. Therefore, if a filter is not ' + + 'provided then all events are reported.'), } ) diff --git a/o2ims/views/alarm_route.py b/o2ims/views/alarm_route.py index 4f0b15c..e7a6425 100644 --- a/o2ims/views/alarm_route.py +++ b/o2ims/views/alarm_route.py @@ -21,7 +21,8 @@ from o2common.views.route_exception import NotFoundException, \ BadRequestException from o2ims.views import alarm_view from o2ims.views.api_ns import api_ims_monitoring as api_monitoring_v1 -from o2ims.views.alarm_dto import AlarmDTO, SubscriptionDTO +from o2ims.views.alarm_dto import AlarmDTO, SubscriptionDTO, \ + MonitoringApiV1DTO from o2common.helper import o2logging logger = o2logging.get_logger(__name__) @@ -36,7 +37,10 @@ def configure_api_route(): # ---------- API versions ---------- # @api_monitoring_v1.route("/v1/api_versions") class VersionRouter(Resource): + model = MonitoringApiV1DTO.api_version_info_get + @api_monitoring_v1.doc('Get Monitoring API version') + @api_monitoring_v1.marshal_list_with(model) def get(self): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0], diff --git a/o2ims/views/api_ns.py b/o2ims/views/api_ns.py index b52c3e9..5f3cf23 100644 --- a/o2ims/views/api_ns.py +++ b/o2ims/views/api_ns.py @@ -13,7 +13,7 @@ # limitations under the License. from flask import request -from flask_restx import Resource +from flask_restx import Resource, fields from o2common.views.route import O2Namespace @@ -33,7 +33,36 @@ api_ims_monitoring = O2Namespace( @api_ims_inventory.route('/api_versions') class InventoryVersion(Resource): + api_version = api_ims_inventory.model( + 'InventoryApiVersionStructure', + { + 'version': fields.String( + required=True, + example='1.0.0', + description='Identifies a supported version.' + ) + }, + mask='{version,}' + ) + model = api_ims_inventory.model( + "InventoryAPIVersion", + { + 'uriPrefix': fields.String( + required=True, + example='https://128.224.115.36:30205/' + + 'o2ims-infrastructureInventory', + description='Specifies the URI prefix for the API'), + 'apiVersions': fields.List( + fields.Nested(api_version), + example=[{'version': '1.0.0'}], + description='Version(s) supported for the API ' + + 'signaled by the uriPrefix attribute.'), + }, + mask='{uriPrefix,apiVersions}' + ) + @api_ims_inventory.doc('Get Inventory Version') + @api_ims_inventory.marshal_with(model) def get(self): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0], @@ -47,7 +76,36 @@ class InventoryVersion(Resource): @api_ims_monitoring.route('/api_versions') class MonitoringVersion(Resource): + api_version = api_ims_inventory.model( + 'MonitoringApiVersionStructure', + { + 'version': fields.String( + required=True, + example='1.0.0', + description='Identifies a supported version.' + ) + }, + mask='{version,}' + ) + model = api_ims_inventory.model( + "MonitoringAPIVersion", + { + 'uriPrefix': fields.String( + required=True, + example='https://128.224.115.36:30205/' + + 'o2ims-infrastructureMonitoring', + description='Specifies the URI prefix for the API'), + 'apiVersions': fields.List( + fields.Nested(api_version), + example=[{'version': '1.0.0'}], + description='Version(s) supported for the API ' + + 'signaled by the uriPrefix attribute.'), + }, + mask='{uriPrefix,apiVersions}' + ) + @api_ims_monitoring.doc('Get Monitoring Version') + @api_ims_monitoring.marshal_with(model) def get(self): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0], diff --git a/o2ims/views/ocloud_dto.py b/o2ims/views/ocloud_dto.py index 26f9d10..3007024 100644 --- a/o2ims/views/ocloud_dto.py +++ b/o2ims/views/ocloud_dto.py @@ -18,6 +18,38 @@ from o2ims.views.api_ns import api_ims_inventory as api_ims_inventory_v1 from o2common.views.flask_restx_fields import Json2Dict +class InventoryApiV1DTO: + + api_version = api_ims_inventory_v1.model( + 'InventoryV1ApiVersionStructure', + { + 'version': fields.String( + required=True, + example='1.0.0', + description='Identifies a supported version.' + ) + }, + mask='{version,}' + ) + + api_version_info_get = api_ims_inventory_v1.model( + "InventoryV1APIVersion", + { + 'uriPrefix': fields.String( + required=True, + example='https://128.224.115.36:30205/' + + 'o2ims-infrastructureInventory/v1', + description='Specifies the URI prefix for the API'), + 'apiVersions': fields.List( + fields.Nested(api_version), + example=[{'version': '1.0.0'}], + description='Version(s) supported for the API ' + + 'signaled by the uriPrefix attribute.'), + }, + mask='{uriPrefix,apiVersions}' + ) + + class OcloudDTO: ocloud = api_ims_inventory_v1.model( @@ -70,49 +102,132 @@ class ResourceTypeDTO: alarm_definition = api_ims_inventory_v1.model( "AlarmDefinitionDto", { - 'alarmDefinitionId': fields.String, - 'alarmName': fields.String, - 'alarmLastChange': fields.String, - 'alarmChangeType': fields.String, - 'alarmDescription': fields.String, - 'proposedRepairActions': fields.String, - 'clearingType': fields.String, - 'managementInterfaceId': fields.String, - 'pkNotificationField': fields.String, - 'alarmAdditionalFields': fields.String, + 'alarmDefinitionId': fields.String( + example='eaefa070-7cb6-3403-be46-177bd9ccc2d3', + description='Provides a unique identifier of the alarm ' + + 'being raised.'), + 'alarmName': fields.String( + example='100.104', + description='Provides short name for the alarm.'), + 'alarmLastChange': fields.String( + example='0.1', + description='Indicates the Alarm Dictionary Version in ' + + 'which this alarm last changed.'), + 'alarmChangeType': fields.String( + example='ADDED', + description='Indicates the type of change that occurred ' + + 'during the alarm last change; added, deleted, modified.'), + 'alarmDescription': fields.String( + example='host=.filesystem=\n ' + + 'File System threshold exceeded; threshold x%, actual y% .\n' + + ' CRITICAL @ 90%\n ' + + 'MAJOR @ 80%\nOR\n' + + 'host=.volumegroup=\n ' + + 'Monitor and if condition persists, consider addin ...', + description='Provides a longer descriptive meaning of ' + + 'the alarm condition and a description of the ' + + 'consequences of the alarm condition.'), + 'proposedRepairActions': fields.String( + example='Reduce usage or resize filesystem.', + description='Provides guidance for proposed repair actions.'), + 'clearingType': fields.String( + example='MANUAL', + description='Identifies whether alarm is cleared ' + + 'automatically or manually.'), + 'managementInterfaceId': fields.String( + example='O2IMS', + description='List of management interface over which ' + + 'alarms are transmitted for this Entity Type.'), + 'pkNotificationField': fields.String( + example='', + description='Identifies which field or list of fields in ' + + 'the alarm notification contains the primary key (PK) into ' + + 'the Alarm Dictionary for this interface; i.e. which ' + + 'field contains the Alarm Definition ID.'), + 'alarmAdditionalFields': fields.String( + example='', + description='List of metadata key-value pairs used to ' + + 'associate meaningful metadata to the related resource type.'), } ) alarm_dictionary = api_ims_inventory_v1.model( "AlarmDictionaryDto", { - 'id': fields.String, - 'alarmDictionaryVersion': fields.String, - 'alarmDictionarySchemaVersion': fields.String, - 'entityType': fields.String, - 'vendor': fields.String, - 'managementInterfaceId': fields.String, - 'pkNotificationField': fields.String, + 'id': fields.String( + example='7e1e59c3-c99e-3d1c-9934-21548a3a699a', + description='Identifier for the Alarm Dictionary.'), + 'alarmDictionaryVersion': fields.String( + example='0.1', + description='Version of the Alarm Dictionary.'), + 'alarmDictionarySchemaVersion': fields.String( + example='0.1', + description='Version of the Alarm Dictionary Schema to ' + + 'which this alarm dictionary conforms.'), + 'entityType': fields.String( + example='pserver', + description='O-RAN entity type emitting the alarm: This ' + + 'shall be unique per vendor ResourceType.model and ' + + 'ResourceType.version'), + 'vendor': fields.String( + example='', + description='Vendor of the Entity Type to whom this ' + + 'Alarm Dictionary applies. This should be the same value ' + + 'as in the ResourceType.vendor attribute.'), + 'managementInterfaceId': fields.String( + example='O2IMS', + description='List of management interface over which ' + + 'alarms are transmitted for this Entity Type.'), + 'pkNotificationField': fields.String( + example='', + description='Identifies which field or list of fields in ' + + 'the alarm notification contains the primary key (PK) into ' + + 'the Alarm Dictionary for this interface; i.e. which field ' + + 'contains the Alarm Definition ID.'), # 'alarmDefinition': fields.String, - 'alarmDefinition': fields.List(fields.Nested(alarm_definition), - attribute='alarmDefinition'), + 'alarmDefinition': fields.List( + fields.Nested(alarm_definition), + attribute='alarmDefinition', + example='', + description='Contains the list of alarms that can be ' + + 'detected against this ResourceType.'), } ) resource_type_get = api_ims_inventory_v1.model( "ResourceTypeGetDto", { - 'resourceTypeId': fields.String(required=True, - description='Resource type ID'), - 'name': fields.String, - 'description': fields.String, - 'vendor': fields.String, - 'model': fields.String, - 'version': fields.String, - 'alarmDictionary': fields.Nested(alarm_dictionary, False, True), + 'resourceTypeId': fields.String( + required=True, + example='60cba7be-e2cd-3b8c-a7ff-16e0f10573f9', + description='Identifier for the Resource Type.'), + 'name': fields.String( + example='pserver', + description='Human readable name of the resource type.'), + 'description': fields.String( + example='The Physical Server resource type', + description='Human readable description of the resource ' + + 'type.'), + 'vendor': fields.String( + example='', + description='Provider of the Resource.'), + 'model': fields.String( + example='', + description='Information about the model of the resource ' + + 'as defined by its provider.'), + 'version': fields.String( + example='', + description='Version or generation of the resource as ' + + 'defined by its provider.'), + 'alarmDictionary': fields.Nested( + alarm_dictionary, False, True), + # description='Dictionary of alarms for this resource type.'), # 'resourceKind': fields.String, # 'resourceClass': fields.String, - 'extensions': fields.String + 'extensions': fields.String( + example='', + description='List of metadata key-value pairs used to ' + + 'associate meaningful metadata to the related resource type.'), }, mask='{resourceTypeId,name,description,model,vendor,version}' ) @@ -161,14 +276,38 @@ class ResourceDTO: resource_list = api_ims_inventory_v1.model( "ResourceListDto", { - 'resourceId': fields.String(required=True, - description='Resource ID'), - 'resourceTypeId': fields.String, - 'resourcePoolId': fields.String, - 'globalAssetId': fields.String, + 'resourceId': fields.String( + required=True, + example='5b3a2da8-17da-466c-b5f7-972590c7baf2', + description='Identifier for the Resource.'), + 'resourceTypeId': fields.String( + example='60cba7be-e2cd-3b8c-a7ff-16e0f10573f9', + description='Identifier for the Resource Type of ' + + 'this resource.'), + 'resourcePoolId': fields.String( + example='f078a1d3-56df-46c2-88a2-dd659aa3f6bd', + description='Identifier of the Resource Pool containing ' + + 'this resource.'), + 'globalAssetId': fields.String( + example='', + description='Identifier or serial number of the resource.'), # 'name': fields.String, - 'parentId': fields.String, - 'description': fields.String, + 'parentId': fields.String( + example='None', + description='Identifier for the parent resource.'), + 'description': fields.String( + example="id:1;hostname:controller-0;mgmt_mac:00:00:00:00:" + + "00:00;mgmt_ip:192.168.204.2;personality:controller;" + + "subfunctions:controller,worker;administrative:unlocked;" + + "operational:enabled;availability:available;" + + "clock_synchronization:ntp;capabilities:" + + "{'is_max_cpu_configurable': 'configurable', " + + "'stor_function': 'monitor', 'Personality': " + + "'Controller-Active'};boot_device:/dev/disk/by-path" + + "/pci-0000:02:00.0-scsi-0:1:0:0;rootfs_device:/dev/disk/" + + "by-path/pci-0000:02:00.0-scsi-0:1:0:0;software_load:" + + "22.12;install_state:None;max_cpu_mhz_allowed:None", + description='Human readable description of the resource.'), # 'elements': fields.String, # 'extensions': fields.String 'extensions': Json2Dict(attribute='extensions') @@ -179,14 +318,30 @@ class ResourceDTO: def recursive_resource_mapping(iteration_number=2): resource_json_mapping = { - 'resourceId': fields.String(required=True, - description='Resource ID'), - 'resourceTypeId': fields.String, - 'resourcePoolId': fields.String, - 'globalAssetId': fields.String, + 'resourceId': fields.String( + required=True, + example='eee8b101-6b7f-4f0a-b54b-89adc0f3f906', + description='Identifier for the Resource.'), + 'resourceTypeId': fields.String( + example='a45983bb-199a-30ec-b7a1-eab2455f333c', + description='Identifier for the Resource Type of ' + + 'this resource.'), + 'resourcePoolId': fields.String( + example='f078a1d3-56df-46c2-88a2-dd659aa3f6bd', + description='Identifier of the Resource Pool containing ' + + 'this resource.'), + 'globalAssetId': fields.String( + example='', + description='Identifier or serial number of the resource.'), # 'name': fields.String, - 'parentId': fields.String, - 'description': fields.String, + 'parentId': fields.String( + example='5b3a2da8-17da-466c-b5f7-972590c7baf2', + description='Identifier for the parent resource.'), + 'description': fields.String( + example="cpu:0;core:0;thread:0;cpu_family:6;cpu_model:" + + "Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz;" + + "allocated_function:Platform;numa_node:0", + description='Human readable description of the resource.'), # 'elements': fields.String, # 'extensions': fields.String 'extensions': Json2Dict(attribute='extensions') @@ -209,11 +364,23 @@ class DeploymentManagerDTO: { 'deploymentManagerId': fields.String( required=True, - description='Deployment manager ID'), - 'name': fields.String, - 'description': fields.String, - 'oCloudId': fields.String, - 'serviceUri': fields.String(attribute='serviceUri'), + example='c765516a-a84e-30c9-b954-9c3031bf71c8', + description='Identifier for the Deployment Manager.'), + 'name': fields.String( + example='95b818b8-b315-4d9f-af37-b82c492101f1.kubernetes', + description='Human readable name of the deployment manager.'), + 'description': fields.String( + example='A DMS', + description='Human readable description of the deployment ' + + 'manager.'), + 'oCloudId': fields.String( + example='f078a1d3-56df-46c2-88a2-dd659aa3f6bd', + description='Identifier for the containing O-Cloud.'), + 'serviceUri': fields.String( + attribute='serviceUri', + example='https://128.224.115.51:6443', + description='The fully qualified URI to a Deployment ' + + 'Management server for O2dms services.'), # 'deploymentManagementServiceEndpoint': fields.String( # attribute='serviceUri'), # 'supportedLocations': fields.String, @@ -221,9 +388,14 @@ class DeploymentManagerDTO: # 'capacity': fields.String, 'profileSupportList': fields.List( fields.String, - description='Profile support list, use default for the return \ - endpoint'), - 'extensions': fields.String + example=['native_k8sapi'], + description='Profile support list, use default for the ' + + 'return endpoint'), + 'extensions': fields.String( + example='', + description='List of metadata key-value pairs used to ' + + 'associate meaningful metadata to the related Deployment ' + + 'Manager'), }, mask='{deploymentManagerId,name,description,oCloudId,serviceUri,' + \ 'profileSupportList}' @@ -231,21 +403,48 @@ class DeploymentManagerDTO: profile = api_ims_inventory_v1.model("DeploymentManagerGetDtoProfile", { 'cluster_api_endpoint': fields.String( - attribute='cluster_api_endpoint'), - 'cluster_ca_cert': fields.String(attribute='cluster_ca_cert'), - 'admin_user': fields.String(attribute='admin_user'), - 'admin_client_cert': fields.String(attribute='admin_client_cert'), - 'admin_client_key': fields.String(attribute='admin_client_key'), + attribute='cluster_api_endpoint', + example='https://128.224.115.51:6443', + description='Kubernetes Cluster API Endpoint'), + 'cluster_ca_cert': fields.String( + attribute='cluster_ca_cert', + example='LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZEakNDQX.....', + description='Kubernetes Cluster CA cert'), + 'admin_user': fields.String( + attribute='admin_user', + example='kubernetes-admin', + description='Kubernetes Admin username'), + 'admin_client_cert': fields.String( + attribute='admin_client_cert', + example='LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVJRENDQW.....', + description='Kubernetes Admin client cert'), + 'admin_client_key': fields.String( + attribute='admin_client_key', + example='LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcE.....', + description='Kubernetes Admin client key'), # 'kube_config_file': fields.String(attribute='kube_config_file') 'helmcli_host_with_port': fields.String( - attribute='helmcli_host_with_port'), - 'helmcli_username': fields.String(attribute='helmcli_username'), - 'helmcli_password': fields.String(attribute='helmcli_password'), - 'helmcli_kubeconfig': fields.String(attribute='helmcli_kubeconfig'), + attribute='helmcli_host_with_port', + example='128.224.115.34:30022', + description='Helm CLI Host address with SSH port'), + 'helmcli_username': fields.String( + attribute='helmcli_username', + example='helm', + description='Helm CLI SSH login username'), + 'helmcli_password': fields.String( + attribute='helmcli_password', + example='password', + description='Helm CLI SSH login password'), + 'helmcli_kubeconfig': fields.String( + attribute='helmcli_kubeconfig', + example='/share/kubeconfig_c765516a.config', + description='Helm CLI KUBECONFIG path'), }) extensions = api_ims_inventory_v1.model("DeploymentManagerExtensions", { - 'profileName': fields.String, + 'profileName': fields.String( + example='', + description=''), 'profileData': fields.Nested(profile, False, True), }) @@ -254,11 +453,23 @@ class DeploymentManagerDTO: { 'deploymentManagerId': fields.String( required=True, - description='Deployment manager ID'), - 'name': fields.String, - 'description': fields.String, - 'oCloudId': fields.String, - 'serviceUri': fields.String(attribute='serviceUri'), + example='c765516a-a84e-30c9-b954-9c3031bf71c8', + description='Identifier for the Deployment Manager.'), + 'name': fields.String( + example='95b818b8-b315-4d9f-af37-b82c492101f1.kubernetes', + description='Human readable name of the deployment manager.'), + 'description': fields.String( + example='A DMS', + description='Human readable description of the deployment ' + + 'manager.'), + 'oCloudId': fields.String( + example='f078a1d3-56df-46c2-88a2-dd659aa3f6bd', + description='Identifier for the containing O-Cloud.'), + 'serviceUri': fields.String( + attribute='serviceUri', + example='https://128.224.115.51:6443', + description='The fully qualified URI to a Deployment ' + + 'Management server for O2dms services.'), # 'deploymentManagementServiceEndpoint': fields.String( # attribute='serviceUri'), # 'supportedLocations': fields.String, @@ -276,11 +487,26 @@ class SubscriptionDTO: subscription_get = api_ims_inventory_v1.model( "SubscriptionGetDto", { - 'subscriptionId': fields.String(required=True, - description='Subscription ID'), - 'callback': fields.String, - 'consumerSubscriptionId': fields.String, - 'filter': fields.String, + 'subscriptionId': fields.String( + required=True, + example='0bea3e71-d2f7-4bf3-9c06-41d8d35806f9', + description='Identifier for the Subscription.'), + 'callback': fields.String( + example='https://128.224.115.15:1081/smo/v1/' + + 'o2ims_inventory_observer', + description='The fully qualified URI to a consumer ' + + 'procedure which can process a Post of the ' + + 'InventoryEventNotification.'), + 'consumerSubscriptionId': fields.String( + example='3F20D850-AF4F-A84F-FB5A-0AD585410361', + description='Identifier for the consumer of events sent due ' + + 'to the Subscription.'), + 'filter': fields.String( + example='', + description='Criteria for events which do not need to be ' + + 'reported or will be filtered by the subscription ' + + 'notification service. Therefore, if a filter is not ' + + 'provided then all events are reported.'), }, mask='{subscriptionId,callback}' ) @@ -289,8 +515,19 @@ class SubscriptionDTO: "SubscriptionCreateDto", { 'callback': fields.String( - required=True, description='Subscription callback address'), - 'consumerSubscriptionId': fields.String, - 'filter': fields.String, + required=True, + example='https://128.224.115.15:1081/smo/v1/' + + 'o2ims_inventory_observer', + description='Identifier for the Subscription.'), + 'consumerSubscriptionId': fields.String( + example='3F20D850-AF4F-A84F-FB5A-0AD585410361', + description='Identifier for the consumer of events sent due ' + + 'to the Subscription.'), + 'filter': fields.String( + example='', + description='Criteria for events which do not need to be ' + + 'reported or will be filtered by the subscription ' + + 'notification service. Therefore, if a filter is not ' + + 'provided then all events are reported.'), } ) diff --git a/o2ims/views/ocloud_route.py b/o2ims/views/ocloud_route.py index 8b0ccf5..aef2151 100644 --- a/o2ims/views/ocloud_route.py +++ b/o2ims/views/ocloud_route.py @@ -23,7 +23,8 @@ from o2ims.domain import ocloud from o2ims.views import ocloud_view from o2ims.views.api_ns import api_ims_inventory as api_ims_inventory_v1 from o2ims.views.ocloud_dto import OcloudDTO, ResourceTypeDTO,\ - ResourcePoolDTO, ResourceDTO, DeploymentManagerDTO, SubscriptionDTO + ResourcePoolDTO, ResourceDTO, DeploymentManagerDTO, SubscriptionDTO, \ + InventoryApiV1DTO from o2common.helper import o2logging logger = o2logging.get_logger(__name__) @@ -38,7 +39,10 @@ def configure_api_route(): # ---------- API versions ---------- # @api_ims_inventory_v1.route("/v1/api_versions") class VersionRouter(Resource): + model = InventoryApiV1DTO.api_version_info_get + @api_ims_inventory_v1.doc('Get Inventory API version') + @api_ims_inventory_v1.marshal_with(model) def get(self): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0],