From 94e6f93c3434e5f9a9529246d97d2666a2479299 Mon Sep 17 00:00:00 2001 From: "Zhang Rong(Jon)" Date: Sun, 30 Oct 2022 21:15:42 +0800 Subject: [PATCH] Fix api_versions request failed issue, Add oCloudId in the DMS query Issue-ID: INF-301 Issue-ID: INF-311 Signed-off-by: Zhang Rong(Jon) Change-Id: Ibd3eb71000188a95d546416bf960fa45ed3c20a0 --- o2app/entrypoints/flask_application.py | 6 +++--- o2ims/views/__init__.py | 2 +- o2ims/views/alarm_route.py | 2 +- o2ims/views/api_ns.py | 9 +++++---- o2ims/views/ocloud_dto.py | 2 ++ o2ims/views/ocloud_route.py | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/o2app/entrypoints/flask_application.py b/o2app/entrypoints/flask_application.py index 53e7e19..c1f5c8a 100644 --- a/o2app/entrypoints/flask_application.py +++ b/o2app/entrypoints/flask_application.py @@ -18,7 +18,6 @@ from flask_restx import Api from o2app import bootstrap from o2ims.views import configure_namespace as ims_route_configure_namespace -from o2dms.api import configure_namespace as dms_route_configure_namespace from o2ims.adapter.clients.alarm_dict_client import load_alarm_definition from o2common.authmw import authmiddleware @@ -40,6 +39,8 @@ def _get_k8s_url(): raise Exception('Get k8s token review url failed') +FLASK_API_VERSION = '1.0.0' + if auth: # perform service account identity&privilege check. _get_k8s_url() @@ -50,13 +51,12 @@ if auth: app.config.SWAGGER_UI_DOC_EXPANSION = 'list' # app.config['RESTX_MASK_HEADER'] = 'fields' app.config['RESTX_MASK_SWAGGER'] = False -api = Api(app, version='1.0.0', +api = Api(app, version=FLASK_API_VERSION, title='INF O2 Services API', description='Swagger OpenAPI document for the INF O2 Services', ) bus = bootstrap.bootstrap() ims_route_configure_namespace(api) -dms_route_configure_namespace(api) load_alarm_definition(bus.uow) diff --git a/o2ims/views/__init__.py b/o2ims/views/__init__.py index 42ba58c..58d5f69 100644 --- a/o2ims/views/__init__.py +++ b/o2ims/views/__init__.py @@ -26,7 +26,7 @@ def configure_namespace(app): apimonitoring = config.get_o2ims_monitoring_api_base() logger.info( "Expose the O2 IMS API:{}\n \ - \nExpose Monitoring API: {}". + Expose Monitoring API: {}". format(apiims, apimonitoring)) ocloud_route.configure_api_route() diff --git a/o2ims/views/alarm_route.py b/o2ims/views/alarm_route.py index 113fc46..74b8b5f 100644 --- a/o2ims/views/alarm_route.py +++ b/o2ims/views/alarm_route.py @@ -38,7 +38,7 @@ class VersionRouter(Resource): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0], 'apiVersions': [{ - 'version': '1', + 'version': '1.0.0', # 'isDeprecated': 'False', # 'retirementDate': '' }] diff --git a/o2ims/views/api_ns.py b/o2ims/views/api_ns.py index 711d5d2..0ee29c4 100644 --- a/o2ims/views/api_ns.py +++ b/o2ims/views/api_ns.py @@ -14,6 +14,7 @@ from flask import request from flask_restx import Resource + from o2common.views.route import O2Namespace @@ -32,11 +33,11 @@ api_ims_monitoring = O2Namespace( @api_ims_inventory.route('/api_versions') class InventoryVersion(Resource): - def get(): + def get(self): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0], 'apiVersions': [{ - 'version': '1', + 'version': '1.0.0', # 'isDeprecated': 'False', # 'retirementDate': '' }] @@ -45,11 +46,11 @@ class InventoryVersion(Resource): @api_ims_monitoring.route('/api_versions') class MonitoringVersion(Resource): - def get(): + def get(self): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0], 'apiVersions': [{ - 'version': '1', + 'version': '1.0.0', # 'isDeprecated': 'False', # 'retirementDate': '' }] diff --git a/o2ims/views/ocloud_dto.py b/o2ims/views/ocloud_dto.py index 0b3291f..aeb44e4 100644 --- a/o2ims/views/ocloud_dto.py +++ b/o2ims/views/ocloud_dto.py @@ -139,6 +139,7 @@ class DeploymentManagerDTO: description='Deployment manager ID'), 'name': fields.String, 'description': fields.String, + 'oCloudId': fields.String, 'serviceUri': fields.String(attribute='serviceUri'), # 'deploymentManagementServiceEndpoint': fields.String( # attribute='serviceUri'), @@ -176,6 +177,7 @@ class DeploymentManagerDTO: description='Deployment manager ID'), 'name': fields.String, 'description': fields.String, + 'oCloudId': fields.String, 'serviceUri': fields.String(attribute='serviceUri'), # 'deploymentManagementServiceEndpoint': fields.String( # attribute='serviceUri'), diff --git a/o2ims/views/ocloud_route.py b/o2ims/views/ocloud_route.py index 70d3aec..2490d4a 100644 --- a/o2ims/views/ocloud_route.py +++ b/o2ims/views/ocloud_route.py @@ -39,7 +39,7 @@ class VersionRouter(Resource): return { 'uriPrefix': request.base_url.rsplit('/', 1)[0], 'apiVersions': [{ - 'version': '1', + 'version': '1.0.0', # 'isDeprecated': 'False', # 'retirementDate': '' }] -- 2.16.6