X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=o2ims%2Fservice%2Fauditor%2Fdms_handler.py;h=33b7296363d89b1d57903ddd2ae5dc8d2aa44802;hb=refs%2Fchanges%2F72%2F11072%2F1;hp=070c929f3bdcad23add1018132ae5627e49d6af2;hpb=209906139ba3d55342e5e95dd7cdb804c7b61943;p=pti%2Fo2.git diff --git a/o2ims/service/auditor/dms_handler.py b/o2ims/service/auditor/dms_handler.py index 070c929..33b7296 100644 --- a/o2ims/service/auditor/dms_handler.py +++ b/o2ims/service/auditor/dms_handler.py @@ -23,7 +23,6 @@ from o2ims.domain.subscription_obj import NotificationEventEnum from o2common.service.unit_of_work import AbstractUnitOfWork from o2ims.domain.resource_type import MismatchedModel from o2ims.domain.ocloud import DeploymentManager -from o2common.config import config # if TYPE_CHECKING: # from . import unit_of_work @@ -76,14 +75,16 @@ def is_outdated(ocloud: DeploymentManager, stxobj: StxGenericModel): def create_by(stxobj: StxGenericModel, parentid: str) -> DeploymentManager: - dmsendpoint = config.get_api_url() +\ - config.get_o2dms_api_base() + "/" + stxobj.id description = "A DMS" ocloudid = parentid + content = json.loads(stxobj.content) + # logger.info(stxobj) + # logger.info(content) supportedLocations = '' - capabilities = '' + capabilities = content['capabilities'] capacity = '' - profile = _convert_content(stxobj.content) + dmsendpoint = content['cluster_api_endpoint'] + profile = _convert_content(content) localmodel = DeploymentManager( stxobj.id, stxobj.name, ocloudid, dmsendpoint, description, supportedLocations, capabilities, capacity, profile) @@ -104,13 +105,16 @@ def update_by(target: DeploymentManager, stxobj: StxGenericModel, parentid: str) -> None: if target.deploymentManagerId != stxobj.id: raise MismatchedModel("Mismatched Id") + content = json.loads(stxobj.content) + # logger.info(content) target.name = stxobj.name target.createtime = stxobj.createtime target.updatetime = stxobj.updatetime target.hash = stxobj.hash target.oCloudId = parentid + target.capabilities = content['capabilities'] target.version_number = target.version_number + 1 - target.profile = _convert_content(stxobj.content) + target.profile = _convert_content(content) target.events.append(events.DmsChanged( id=stxobj.id, @@ -119,9 +123,9 @@ def update_by(target: DeploymentManager, stxobj: StxGenericModel, )) -def _convert_content(stxobj_content: str): +def _convert_content(content: str): # Convert api retrun content to dict object - content = json.loads(stxobj_content) + # content = json.loads(stxobj_content) admin_user = content["admin_user"] cluster_api_endpoint = content["cluster_api_endpoint"] cluster_ca_cert = _b64_encode_str(content["cluster_ca_cert"])