X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=common%2Fpython%2Frift%2Fmano%2Ftosca_translator%2Frwmano%2Ftosca%2Ftosca_nfv_vnf.py;h=8f8bbbd77b20a2e171d4bff75fd1db4c6a4d0f5f;hb=f314b4af9744068a7ed7a6a6314220c3aa857523;hp=e4e045e3f7aa8dbf1184b6a297eb6770f5cd6b3a;hpb=6f1a3fe149e4a6b9803382cb299c902f4cf58ec9;p=osm%2FSO.git diff --git a/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py b/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py index e4e045e3..8f8bbbd7 100644 --- a/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py +++ b/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_nfv_vnf.py @@ -26,7 +26,7 @@ try: import gi gi.require_version('RwVnfdYang', '1.0') - from gi.repository import RwVnfdYang + from gi.repository import RwVnfdYang as RwVnfdYang except ImportError: pass except ValueError: @@ -61,7 +61,9 @@ class ToscaNfvVnf(ManoResource): self._policies = [] self._cps = [] self.vnf_type = nodetemplate.type + self.member_vnf_id = None self._reqs = {} + self.logo = None def map_tosca_name_to_mano(self, name): new_name = super().map_tosca_name_to_mano(name) @@ -120,6 +122,7 @@ class ToscaNfvVnf(ManoResource): if key == 'id': self._const_vnfd['member-vnf-index'] = int(value) self._const_vnfd['vnfd-id-ref'] = self.id + self.member_vnf_id = int(value) elif key == 'vnf_configuration': self._vnf_config = get_vnf_config(value) else: @@ -145,6 +148,8 @@ class ToscaNfvVnf(ManoResource): vnf_props.pop('start_by_default') if 'logo' in self.metadata: vnf_props['logo'] = self.metadata['logo'] + self.logo = self.metadata['logo'] + self.log.debug(_("VNF {0} with constituent vnf: {1}"). format(self.name, self._const_vnfd)) @@ -295,6 +300,12 @@ class ToscaNfvVnf(ManoResource): nsd['constituent-vnfd'] = [] nsd['constituent-vnfd'].append(self._const_vnfd) + def generate_nsd_constiuent(self, nsd, vnf_id): + self._const_vnfd['vnfd-id-ref'] = vnf_id + props = convert_keys_to_python(self._const_vnfd) + nsd.constituent_vnfd.add().from_dict(props) + + def get_member_vnf_index(self): return self._const_vnfd['member-vnf-index'] @@ -311,3 +322,10 @@ class ToscaNfvVnf(ManoResource): 'type': 'cloud_init', 'name': vdu.cloud_init, },) + if self.logo is not None: + files[desc_id] = [] + file_location = "../icons/{}".format(self.logo) + files[desc_id].append({ + 'type': 'icons', + 'name': file_location, + },)