X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Fdata_utils%2Fvca.py;h=ff52d229a5fde02a6ea719d8b543b2666d476136;hb=9e9a923448e6673fc0396265732115b55f1df9da;hp=21165492e0c1343f2a3848327e52a8e9b27f305a;hpb=b4ebcd0dd81e08d7294156c2aca10d84ca9bb824;p=osm%2FLCM.git diff --git a/osm_lcm/data_utils/vca.py b/osm_lcm/data_utils/vca.py index 2116549..ff52d22 100644 --- a/osm_lcm/data_utils/vca.py +++ b/osm_lcm/data_utils/vca.py @@ -123,6 +123,7 @@ class EERelation(dict): class Relation(dict): """Represents a relation""" + def __init__(self, name, provider: EERelation, requirer: EERelation) -> NoReturn: """ Args: @@ -151,7 +152,8 @@ class Relation(dict): class DeployedComponent(dict): - """Represents a deployed component (nsr["_admin"]["deployed"])""" + """Represents a deployed component (nsr["_admin"]["deployed"]["VCA" | "K8s"])""" + def __init__(self, data: Dict[str, Any]): """ Args: @@ -176,13 +178,14 @@ class DeployedComponent(dict): class DeployedK8sResource(DeployedComponent): """Represents a deployed component for a kdu resource""" + def __init__(self, data: Dict[str, Any]): super().__init__(data) @property def ee_id(self): """Returns the execution environment id""" - model = self["kdu-instance"] + model = self["namespace"] application_name = self["resource-name"] return f"{model}.{application_name}.k8s" @@ -193,6 +196,7 @@ class DeployedK8sResource(DeployedComponent): class DeployedVCA(DeployedComponent): """Represents a VCA deployed component""" + def __init__(self, nsr_id: str, deployed_vca: Dict[str, Any]) -> NoReturn: """ Args: @@ -220,3 +224,7 @@ class DeployedVCA(DeployedComponent): @property def config_sw_installed(self) -> bool: return self.get("config_sw_installed", False) + + @property + def target_element(self) -> str: + return self.get("target_element", "")