Fix api_versions request failed issue, Add oCloudId in the DMS query 30/9430/3
authorZhang Rong(Jon) <rong.zhang@windriver.com>
Sun, 30 Oct 2022 13:15:42 +0000 (21:15 +0800)
committerZhang Rong(Jon) <rong.zhang@windriver.com>
Mon, 31 Oct 2022 01:57:42 +0000 (09:57 +0800)
Issue-ID: INF-301
Issue-ID: INF-311
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
Change-Id: Ibd3eb71000188a95d546416bf960fa45ed3c20a0

o2app/entrypoints/flask_application.py
o2ims/views/__init__.py
o2ims/views/alarm_route.py
o2ims/views/api_ns.py
o2ims/views/ocloud_dto.py
o2ims/views/ocloud_route.py

index 53e7e19..c1f5c8a 100644 (file)
@@ -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)
index 42ba58c..58d5f69 100644 (file)
@@ -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()
index 113fc46..74b8b5f 100644 (file)
@@ -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': ''
             }]
index 711d5d2..0ee29c4 100644 (file)
@@ -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': ''
             }]
index 0b3291f..aeb44e4 100644 (file)
@@ -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'),
index 70d3aec..2490d4a 100644 (file)
@@ -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': ''
             }]