X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=n2vc%2Fn2vc_juju_conn.py;h=da09fdb66313bad15d58b019737f7a2d810c80c9;hb=d1f257efe741f230f09fc6e52b49e88ffba33f4b;hp=c6d00a8df5e7e3bf74643cfc99667625d395f6f6;hpb=015abee87f591b8e28f6b982ae4fb9c67e8791bb;p=osm%2FN2VC.git diff --git a/n2vc/n2vc_juju_conn.py b/n2vc/n2vc_juju_conn.py index c6d00a8..da09fdb 100644 --- a/n2vc/n2vc_juju_conn.py +++ b/n2vc/n2vc_juju_conn.py @@ -1294,6 +1294,7 @@ class N2VCJujuConnector(N2VCConnector): vnfrs: dict, vca_records: list, vnf_count: str = None, + vdu_id: str = None, vdu_count: str = None, ) -> str: """Generate application name to make the relevant charm of VDU/KDU @@ -1301,10 +1302,11 @@ class N2VCJujuConnector(N2VCConnector): Limiting the app name to 50 characters. Args: - charm_level (str): VNF ID - vnfrs (dict): VDU ID + charm_level (str): level of charm + vnfrs (dict): vnf record dict vca_records (list): db_nsr["_admin"]["deployed"]["VCA"] as list vnf_count (str): vnf count index + vdu_id (str): VDU ID vdu_count (str): vdu count index Returns: @@ -1344,26 +1346,26 @@ class N2VCJujuConnector(N2VCConnector): # Charms are also used for deployments with Helm charts. # If deployment unit is a Helm chart/KDU, # vdu_profile_id and vdu_count will be empty string. - vdu_profile_id = "" - if vdu_count is None: vdu_count = "" - elif vdu_count: - vdu_profile_id = vnfrs["vdur"][int(vdu_count)]["vdu-id-ref"] - # If vnf/vdu is scaled, more than one VCA record may be included in vca_records # but ee_descriptor_id is same. # Shorten the ee_descriptor_id, member-vnf-index-ref and vdu_profile_id # to first 12 characters. + if not vdu_id: + raise N2VCException(message="vdu-id should be provided.") + vca_record = next( + filter(lambda record: record["vdu_id"] == vdu_id, vca_records), {} + ) application_name = ( - vca_records[0]["ee_descriptor_id"][:12] + vca_record["ee_descriptor_id"][:12] + "-" + vnf_count + "-" + vnfrs["member-vnf-index-ref"][:12] + "-" - + vdu_profile_id[:12] + + vdu_id[:12] + "-" + vdu_count + "-vdu" @@ -1474,6 +1476,7 @@ class N2VCJujuConnector(N2VCConnector): db_vnfr, vca_records, vnf_count=vnf_count, + vdu_id=vdu_id, vdu_count=vdu_count, ) else: