From: KIRAN KASHALKAR Date: Fri, 21 Oct 2016 15:31:59 +0000 (+0000) Subject: Model changes to change leaf-lists to lists X-Git-Tag: v1.0.1~2^2~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=f6914d7d8e3153683139096480a86afec5b07302;p=osm%2FSO.git Model changes to change leaf-lists to lists Signed-off-by: KIRAN KASHALKAR --- diff --git a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py index 5348e00b..d84a912e 100755 --- a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# +# # Copyright 2016 RIFT.IO Inc # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -214,12 +214,18 @@ class VirtualNetworkFunction(ManoDescriptor): node = vdu.guest_epa.numa_node_policy.node.add() node.id = 0 node.memory_mb = 512 - node.vcpu = [0, 1] + vcpu = node.vcpu.add() + vcpu.id = 0 + vcpu = node.vcpu.add() + vcpu.id = 1 node = vdu.guest_epa.numa_node_policy.node.add() node.id = 1 node.memory_mb = 512 - node.vcpu = [2, 3] + vcpu = node.vcpu.add() + vcpu.id = 2 + vcpu = node.vcpu.add() + vcpu.id = 3 # specify the vswitch EPA vdu.vswitch_epa.ovs_acceleration = 'DISABLED' @@ -254,7 +260,8 @@ class VirtualNetworkFunction(ManoDescriptor): internal_cp.name = cp_name + "/icp{}".format(i) internal_cp.id = cp_name + "/icp{}".format(i) internal_cp.type_yang = 'VPORT' - internal_vlds[i].internal_connection_point_ref.append(internal_cp.id) + ivld_cp = internal_vlds[i].internal_connection_point_ref.add() + ivld_cp.id_ref = internal_cp.id internal_interface = vdu.internal_interface.add() internal_interface.name = 'fab%d' % i @@ -637,7 +644,7 @@ exit 0 ip_profile.ip_profile_params.ip_version = "ipv4" ip_profile.ip_profile_params.subnet_address = "31.31.31.0/24" ip_profile.ip_profile_params.gateway_address = "31.31.31.210" - + vld_id = 1 for cpgroup in cpgroup_list: vld = nsd.vld.add() diff --git a/models/openmano/python/rift/openmano/rift2openmano.py b/models/openmano/python/rift/openmano/rift2openmano.py index 2772f8f9..56522851 100755 --- a/models/openmano/python/rift/openmano/rift2openmano.py +++ b/models/openmano/python/rift/openmano/rift2openmano.py @@ -398,8 +398,8 @@ def rift2openmano_vnfd(rift_vnfd): } # Add the specific VDU connection points - for int_cp_ref in vld.internal_connection_point_ref: - vdu, int_if = find_vdu_and_int_if_by_cp_ref(int_cp_ref) + for int_cp in vld.internal_connection_point: + vdu, int_if = find_vdu_and_int_if_by_cp_ref(int_cp.id_ref) connection["elements"].append({ "VNFC": vdu.name, "local_iface_name": int_if.name, @@ -475,7 +475,7 @@ def rift2openmano_vnfd(rift_vnfd): if vdu.host_epa.has_field("om_cpu_feature"): vnfc["processor"]["features"] = [] for feature in vdu.host_epa.om_cpu_feature: - vnfc["processor"]["features"].append(feature) + vnfc["processor"]["features"].append(feature.feature) vnf["VNFC"].append(vnfc) diff --git a/models/plugins/yang/mano-types.yang b/models/plugins/yang/mano-types.yang index 3c723f4c..e7c7d3d6 100644 --- a/models/plugins/yang/mano-types.yang +++ b/models/plugins/yang/mano-types.yang @@ -717,10 +717,13 @@ module mano-types type uint64; } - leaf-list cpu-feature { - description - "List of CPU features."; - type cpu-feature-type; + list cpu-feature { + key "feature"; + description "List of CPU features."; + leaf feature { + description "CPU feature."; + type cpu-feature-type; + } } @@ -729,9 +732,13 @@ module mano-types type string; } - leaf-list om-cpu-feature { - description "Openmano CPU features"; - type string; + list om-cpu-feature { + key "feature"; + description "List of openmano CPU features"; + leaf feature { + description "CPU feature"; + type string; + } } } } @@ -873,11 +880,16 @@ module mano-types type uint64; } - leaf-list vcpu { + list vcpu { + key "id"; description "List of vcpus to allocate on this numa node."; - type uint64; + leaf id { + type uint64; + description "List of vcpus ids to allocate on + this numa node"; + } } leaf memory-mb { diff --git a/models/plugins/yang/vnfd.yang b/models/plugins/yang/vnfd.yang index c035bd3b..2cc43d3e 100644 --- a/models/plugins/yang/vnfd.yang +++ b/models/plugins/yang/vnfd.yang @@ -268,12 +268,16 @@ module vnfd type uint64; } - leaf-list internal-connection-point-ref { - type leafref { - path "../../vdu/internal-connection-point/id"; + list internal-connection-point { + key "id-ref"; + description "List of internal connection points in this VLD"; + leaf id-ref { + description "reference to the internal connection point id"; + type leafref { + path "../../../vdu/internal-connection-point/id"; + } } } - uses manotypes:provider-network; } diff --git a/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py b/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py index f0095f1f..19eea3b3 100644 --- a/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py +++ b/rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py @@ -581,7 +581,7 @@ class RwcalOpenstackPlugin(GObject.Object, RwCal.Cloud): if guest_epa.numa_node_policy.has_field('node'): for node in guest_epa.numa_node_policy.node: if node.has_field('vcpu') and node.vcpu: - epa_specs['hw:numa_cpus.'+str(node.id)] = ','.join([str(j) for j in node.vcpu]) + epa_specs['hw:numa_cpus.'+str(node.id)] = ','.join([str(j.id) for j in node.vcpu]) if node.memory_mb: epa_specs['hw:numa_mem.'+str(node.id)] = str(node.memory_mb) @@ -635,7 +635,7 @@ class RwcalOpenstackPlugin(GObject.Object, RwCal.Cloud): cpu_features = [] espec_cpu_features = [] for feature in host_epa.cpu_feature: - cpu_features.append(feature) + cpu_features.append(feature.feature) espec_cpu_features = espec_utils.host.mano_to_extra_spec_cpu_features(cpu_features) if espec_cpu_features is not None: epa_specs['capabilities:cpu_info:features'] = espec_cpu_features @@ -771,7 +771,9 @@ class RwcalOpenstackPlugin(GObject.Object, RwCal.Cloud): numa_node = getattr(flavor,'guest_epa').numa_node_policy.node.add() numa_node.id = int(node_id) - numa_node.vcpu = [ int(x) for x in flavor_info['extra_specs'][attr].split(',') ] + for x in flavor_info['extra_specs'][attr].split(','): + numa_node_vcpu = numa_node.vcpu.add() + numa_node_vcpu.id = int(x) elif attr.startswith('hw:numa_mem.'): node_id = attr.split('.')[1] diff --git a/rwcal/test/test_rwcal_openstack.py b/rwcal/test/test_rwcal_openstack.py index 4ce494be..119c22b1 100644 --- a/rwcal/test/test_rwcal_openstack.py +++ b/rwcal/test/test_rwcal_openstack.py @@ -1,5 +1,5 @@ -# +# # Copyright 2016 RIFT.IO Inc # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,7 +34,7 @@ from rift.rwcal.openstack.openstack_drv import KeystoneDriver, NovaDriver logger = logging.getLogger('rwcal-openstack') # -# Important information about openstack installation. This needs to be manually verified +# Important information about openstack installation. This needs to be manually verified # openstack_info = { 'username' : 'pluto', @@ -81,7 +81,7 @@ def get_cal_plugin(): logger.error("ERROR:Cal plugin instantiation failed. Aborting tests") else: logger.info("Openstack Cal plugin successfully instantiated") - return cal + return cal class OpenStackTest(unittest.TestCase): @@ -94,7 +94,7 @@ class OpenStackTest(unittest.TestCase): HostTrust = "trusted" PCIPassThroughAlias = "PCI_10G_ALIAS" SEG_ID = openstack_info['segmentation_id'] - + def setUp(self): """ Assumption: @@ -108,7 +108,7 @@ class OpenStackTest(unittest.TestCase): logger.info("Openstack-CAL-Test: setUp") self.cal = get_cal_plugin() logger.info("Openstack-CAL-Test: setUpEND") - + # First check for VM Flavor and Image and get the corresponding IDs rc, rs = self.cal.get_flavor_list(self._acct) self.assertEqual(rc, RwStatus.SUCCESS) @@ -129,10 +129,10 @@ class OpenStackTest(unittest.TestCase): networks = [ network for network in rs.networkinfo_list if (network.network_name == 'rift.cal.unittest.network' or network.network_name == 'rift.cal.virtual_link') ] for network in networks: self.cal.delete_virtual_link(self._acct, network.network_id) - + def tearDown(self): logger.info("Openstack-CAL-Test: tearDown") - + def _md5(fname, blksize=1048576): hash_md5 = hashlib.md5() @@ -141,7 +141,7 @@ class OpenStackTest(unittest.TestCase): hash_md5.update(chunk) return hash_md5.hexdigest() - @unittest.skip("Skipping test_list_flavors") + @unittest.skip("Skipping test_list_flavors") def test_list_flavor(self): """ List existing flavors from openstack installation @@ -154,8 +154,8 @@ class OpenStackTest(unittest.TestCase): rc, flv = self.cal.get_flavor(self._acct, flavor.id) self.assertEqual(rc, RwStatus.SUCCESS) self.assertEqual(flavor.id, flv.id) - - @unittest.skip("Skipping test_list_images") + + @unittest.skip("Skipping test_list_images") def test_list_images(self): """ List existing images from openstack installation @@ -168,8 +168,8 @@ class OpenStackTest(unittest.TestCase): # rc, img = self.cal.get_image(self._acct, image.id) # self.assertEqual(rc, RwStatus.SUCCESS) # self.assertEqual(image.id, img.id) - - @unittest.skip("Skipping test_list_vms") + + @unittest.skip("Skipping test_list_vms") def test_list_vms(self): """ List existing VMs from openstack installation @@ -181,8 +181,8 @@ class OpenStackTest(unittest.TestCase): for vm in rsp.vminfo_list: rc, server = self.cal.get_vm(self._acct, vm.vm_id) self.assertEqual(vm.vm_id, server.vm_id) - - @unittest.skip("Skipping test_list_networks") + + @unittest.skip("Skipping test_list_networks") def test_list_networks(self): """ List existing Network from openstack installation @@ -194,8 +194,8 @@ class OpenStackTest(unittest.TestCase): for network in rsp.networkinfo_list: rc, net = self.cal.get_network(self._acct, network.network_id) self.assertEqual(network.network_id, net.network_id) - - @unittest.skip("Skipping test_list_ports") + + @unittest.skip("Skipping test_list_ports") def test_list_ports(self): """ List existing Ports from openstack installation @@ -237,8 +237,8 @@ class OpenStackTest(unittest.TestCase): else: time.sleep(2) # Sleep for a second return rs - - @unittest.skip("Skipping test_create_delete_image") + + @unittest.skip("Skipping test_create_delete_image") def test_create_delete_image(self): """ Create/Query/Delete a new image in openstack installation @@ -266,7 +266,7 @@ class OpenStackTest(unittest.TestCase): flavor = RwcalYang.FlavorInfoItem() flavor.name = 'rift.cal.unittest.flavor' flavor.vm_flavor.memory_mb = 16384 # 16GB - flavor.vm_flavor.vcpu_count = 4 + flavor.vm_flavor.vcpu_count = 4 flavor.vm_flavor.storage_gb = 40 # 40GB flavor.guest_epa.mempage_size = OpenStackTest.MemoryPageSize flavor.guest_epa.cpu_pinning_policy = OpenStackTest.CpuPolicy @@ -276,16 +276,22 @@ class OpenStackTest(unittest.TestCase): node = flavor.guest_epa.numa_node_policy.node.add() node.id = i if i == 0: - node.vcpu = [0,1] + vcpu = node.vcpu.add() + vcpu.id = 0 + vcpu = node.vcpu.add() + vcpu.id = 1 elif i == 1: - node.vcpu = [2,3] + vcpu = node.vcpu.add() + vcpu.id = 2 + vcpu = node.vcpu.add() + vcpu.id = 3 node.memory_mb = 8196 dev = flavor.guest_epa.pcie_device.add() dev.device_id = OpenStackTest.PCIPassThroughAlias dev.count = 1 return flavor - - @unittest.skip("Skipping test_create_delete_flavor") + + @unittest.skip("Skipping test_create_delete_flavor") def test_create_delete_flavor(self): """ Create/Query/Delete a new flavor in openstack installation @@ -299,11 +305,11 @@ class OpenStackTest(unittest.TestCase): if flavor_list: rc = self.cal.delete_flavor(self._acct, flavor_list[0].id) self.assertEqual(rc, RwStatus.SUCCESS) - + flavor = self._get_flavor_info_request() rc, flavor_id = self.cal.create_flavor(self._acct, flavor) self.assertEqual(rc, RwStatus.SUCCESS) - + logger.info("Openstack-CAL-Test: Created new flavor with flavor_id : %s" %(flavor_id)) rc, rs = self.cal.get_flavor(self._acct, flavor_id) self.assertEqual(rc, RwStatus.SUCCESS) @@ -342,7 +348,7 @@ class OpenStackTest(unittest.TestCase): def _check_vm_state(self, vm_id, expected_state): """ - Wait until VM reaches particular state (expected_state). + Wait until VM reaches particular state (expected_state). """ # Wait while VM goes to required state @@ -369,7 +375,7 @@ class OpenStackTest(unittest.TestCase): if port_list: for port_id in port_list: port = vm.port_list.add() - port.port_id = port_id + port.port_id = port_id rc, vm_id = self.cal.create_vm(self._acct, vm) self.assertEqual(rc, RwStatus.SUCCESS) @@ -409,7 +415,7 @@ class OpenStackTest(unittest.TestCase): vm_list = [vm for vm in rs.vminfo_list if vm.vm_id == vm_id] if not len(vm_list): break - + rc, rs = self.cal.get_vm_list(self._acct) self.assertEqual(rc, RwStatus.SUCCESS) vm_list = [vm for vm in rs.vminfo_list if vm.vm_id == vm_id] @@ -427,8 +433,8 @@ class OpenStackTest(unittest.TestCase): self.assertEqual(rc, RwStatus.SUCCESS) ### Ensure that VM state is SHUTOFF self._check_vm_state(vm_id, 'SHUTOFF') - - + + def _start_vm(self, vm_id): """ Starts VM and performs validity checks @@ -442,7 +448,7 @@ class OpenStackTest(unittest.TestCase): ### Ensure that VM state is ACTIVE self._check_vm_state(vm_id, 'ACTIVE') - + def _reboot_vm(self, vm_id): """ Reboot VM and perform validity checks @@ -498,7 +504,7 @@ class OpenStackTest(unittest.TestCase): logger.info("Openstack-CAL-Test: Starting VM(EPA) create/delete test") flavor = self._get_flavor_info_request() - + rc, flavor_id = self.cal.do_create_flavor(self._acct, flavor) self.assertEqual(rc, RwStatus.SUCCESS) flavor.id = flavor_id @@ -558,7 +564,7 @@ class OpenStackTest(unittest.TestCase): flavors = nova.flavor_list() self.assertTrue(len(flavors) > 1) - @unittest.skip("Skipping test_vm_operations") + @unittest.skip("Skipping test_vm_operations") def test_vm_operations(self): """ Primary goal: Create/Query/Delete VM in openstack installation. @@ -583,7 +589,7 @@ class OpenStackTest(unittest.TestCase): ### Delete the VM self._delete_vm(vm_id) - + def _get_network_info_request(self): """ Returns request object of type RwcalYang.NetworkInfoItem @@ -629,16 +635,16 @@ class OpenStackTest(unittest.TestCase): logger.info("Openstack-CAL-Test: Deleting a network with id : %s. " %(net_id)) rc = self.cal.delete_network(self._acct, net_id) self.assertEqual(rc, RwStatus.SUCCESS) - + # Verify that network is no longer available via get_network_list API rc, rs = self.cal.get_network_list(self._acct) self.assertEqual(rc, RwStatus.SUCCESS) network_info = [ network for network in rs.networkinfo_list if network.network_id == net_id ] self.assertEqual(len(network_info), 0) logger.info("Openstack-CAL-Test: Successfully deleted Network with id : %s" %(net_id)) - - - @unittest.skip("Skipping test_network_operations") + + + @unittest.skip("Skipping test_network_operations") def test_network_operations(self): """ Create/Delete Networks @@ -693,7 +699,7 @@ class OpenStackTest(unittest.TestCase): ### Delete Port self.cal.delete_port(self._acct, port_id) - + rc, rs = self.cal.get_port_list(self._acct) self.assertEqual(rc, RwStatus.SUCCESS) port_list = [ port for port in rs.portinfo_list if port.port_id == port_id ] @@ -714,7 +720,7 @@ class OpenStackTest(unittest.TestCase): self.assertEqual(rc, RwStatus.SUCCESS) self.assertEqual(rs.port_state, expected_state) logger.info("Openstack-CAL-Test: Port with port_id : %s reached expected state : %s" %(port_id, rs.port_state)) - + @unittest.skip("Skipping test_port_operations_with_vm") def test_port_operations_with_vm(self): """ @@ -736,7 +742,7 @@ class OpenStackTest(unittest.TestCase): ### Delete VM self._delete_vm(vm_id) - + ### Delete Port self._delete_port(port_id) @@ -764,7 +770,7 @@ class OpenStackTest(unittest.TestCase): ### Delete VM self._delete_vm(vm_id) - + ### Delete Port self._delete_port(port_id) @@ -813,7 +819,7 @@ class OpenStackTest(unittest.TestCase): vlink.provider_network.segmentation_id = OpenStackTest.SEG_ID OpenStackTest.SEG_ID += 1 return vlink - + def _get_vdu_request_info(self, virtual_link_id): """ Returns object of type RwcalYang.VDUInitParams @@ -840,9 +846,9 @@ class OpenStackTest(unittest.TestCase): c1 = vdu.connection_points_add.add() c1.name = "c_modify1" c1.virtual_link_id = virtual_link_id - - return vdu - + + return vdu + #@unittest.skip("Skipping test_create_delete_virtual_link_and_vdu") def test_create_delete_virtual_link_and_vdu(self): """ @@ -855,7 +861,7 @@ class OpenStackTest(unittest.TestCase): self.assertEqual(rc, RwStatus.SUCCESS) logger.info("Openstack-CAL-Test: Created virtual_link with Id: %s" %rsp) vlink_id = rsp - + #Check if virtual_link create is successful rc, rsp = self.cal.get_virtual_link(self._acct, rsp) self.assertEqual(rc, RwStatus.SUCCESS) @@ -887,7 +893,7 @@ class OpenStackTest(unittest.TestCase): self.assertEqual(rs.state, 'active') logger.info("Openstack-CAL-Test: VDU with id : %s reached expected state : %s" %(vdu_id, rs.state)) logger.info("Openstack-CAL-Test: VDUInfo: %s" %(rs)) - + vlink_req = self._get_virtual_link_request_info() ### Create another virtual_link diff --git a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py index 48833211..cf038578 100755 --- a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py +++ b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py @@ -1,4 +1,4 @@ -# +# # Copyright 2016 RIFT.IO Inc # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -515,7 +515,7 @@ class VirtualLinkRecord(object): self._vlr_id = str(uuid.uuid4()) self._state = VlRecordState.INIT self._prev_state = None - + @property def xpath(self): """ path for this object """ @@ -1816,11 +1816,11 @@ class NetworkServiceRecord(object): @asyncio.coroutine def _create_vls(self, vld, cloud_account,om_datacenter): """Create a VLR in the cloud account specified using the given VLD - + Args: vld : VLD yang obj cloud_account : Cloud account name - + Returns: VirtualLinkRecord """ @@ -2982,22 +2982,22 @@ class NsrRpcDtsHandler(object): rpc_op = NsrYang.YangOutput_Nsr_StartNetworkService.from_dict({ "nsr_id":str(uuid.uuid4()) }) - + if not ('name' in rpc_ip and 'nsd_ref' in rpc_ip and ('cloud_account' in rpc_ip or 'om_datacenter' in rpc_ip)): self._log.error("Mandatory parameters name or nsd_ref or cloud account not found in start-network-service {}".format(rpc_ip)) - + self._log.debug("start-network-service RPC input: {}".format(rpc_ip)) try: # Add used value to the pool self._log.debug("RPC output: {}".format(rpc_op)) - + nsd_copy = self.nsm.get_nsd(rpc_ip.nsd_ref) #if not self._manager: # self._manager = yield from self._connect() - + self._log.debug("Configuring ns-instance-config with name %s nsd-ref: %s", rpc_ip.name, rpc_ip.nsd_ref) @@ -3202,10 +3202,10 @@ class NsrDtsHandler(object): def get_nsr_key_pairs(dts_member_reg, xact): key_pairs = {} for instance_cfg, keyspec in dts_member_reg.get_xact_elements(xact, include_keyspec=True): - self._log.debug("Key pair received is {} KS: {}".format(instance_cfg, keyspec)) + self._log.debug("Key pair received is {} KS: {}".format(instance_cfg, keyspec)) xpath = keyspec.to_xpath(RwNsrYang.get_schema()) key_pairs[instance_cfg.name] = instance_cfg - return key_pairs + return key_pairs def on_apply(dts, acg, xact, action, scratch): """Apply the configuration""" @@ -3790,7 +3790,7 @@ class NsManager(object): # msg.nsr_id_ref, # msg.scaling_group_name_ref, # msg.instance_id) - + def nsr_update_cfg(self, nsr_id, msg): nsr = self._nsrs[nsr_id] nsr.nsr_cfg_msg= msg @@ -3966,7 +3966,7 @@ class NsManager(object): self.create_nsd(nsd) else: self._log.debug("Updating NSD id = %s, nsd = %s", nsd.id, nsd) - self._nsds[nsd.id].update(nsd) + self._nsds[nsd.id].update(nsd) def delete_nsd(self, nsd_id): """ Delete the Network service descriptor with the passed id """ @@ -4018,9 +4018,6 @@ class NsManager(object): """ Update the virtual network function descriptor """ self._log.debug("Update virtual network function descriptor- %s", vnfd) - # Hack to remove duplicates from leaf-lists - to be fixed by RIFT-6511 - for ivld in vnfd.internal_vld: - ivld.internal_connection_point_ref = list(set(ivld.internal_connection_point_ref)) if vnfd.id not in self._vnfds: self._log.debug("No VNFD found - creating VNFD id = %s", vnfd.id) diff --git a/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py b/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py index 17e6fbf7..2c6c1024 100755 --- a/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py +++ b/rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py @@ -1,4 +1,4 @@ -# +# # Copyright 2016 RIFT.IO Inc # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -564,7 +564,7 @@ class VirtualDeploymentUnitRecord(object): if (vlr.has_field('ip_profile_params')) and (vlr.ip_profile_params.has_field('security_group')): cp_info['security_group'] = vlr.ip_profile_params.security_group - + cp_list.append(cp_info) for intf, cp, vlr in self._int_intf: @@ -1311,7 +1311,7 @@ class VirtualNetworkFunctionRecord(object): for ivld_msg in self.vnfd.msg.internal_vld: self._log.debug("Creating internal vld:" " %s, int_cp_ref = %s", - ivld_msg, ivld_msg.internal_connection_point_ref + ivld_msg, ivld_msg.internal_connection_point ) vlr = InternalVirtualLinkRecord(dts=self._dts, log=self._log, @@ -1322,14 +1322,14 @@ class VirtualNetworkFunctionRecord(object): ) self._vlrs.append(vlr) - for int_cp in ivld_msg.internal_connection_point_ref: - if int_cp in self._vlr_by_cp: + for int_cp in ivld_msg.internal_connection_point: + if int_cp.id_ref in self._vlr_by_cp: msg = ("Connection point %s already " - " bound %s" % (int_cp, self._vlr_by_cp[int_cp])) + " bound %s" % (int_cp.id_ref, self._vlr_by_cp[int_cp.id_ref])) raise InternalVirtualLinkRecordError(msg) self._log.debug("Setting vlr %s to internal cp = %s", - vlr, int_cp) - self._vlr_by_cp[int_cp] = vlr + vlr, int_cp.id_ref) + self._vlr_by_cp[int_cp.id_ref] = vlr @asyncio.coroutine def instantiate_vls(self, xact, restart_mode=False): @@ -1964,7 +1964,7 @@ class VnfrConsoleOperdataDtsHandler(object): if not vdur._state == VDURecordState.READY: self._log.debug("VDUR state is not READY. current state is {}".format(vdur._state)) xact_info.respond_xpath(rsp_code=rwdts.XactRspCode.ACK) - return + return with self._dts.transaction() as new_xact: resp = yield from vdur.read_resource(new_xact) vdur_console = RwVnfrYang.YangData_RwVnfr_VnfrConsole_Vnfr_Vdur() @@ -1979,7 +1979,7 @@ class VnfrConsoleOperdataDtsHandler(object): vdur_console = RwVnfrYang.YangData_RwVnfr_VnfrConsole_Vnfr_Vdur() vdur_console.id = self._vdur_id vdur_console.console_url = 'none' - + xact_info.respond_xpath(rsp_code=rwdts.XactRspCode.ACK, xpath=self.vnfr_vdu_console_xpath, msg=vdur_console) @@ -1987,8 +1987,8 @@ class VnfrConsoleOperdataDtsHandler(object): #raise VnfRecordError("Not supported operation %s" % action) self._log.error("Not supported operation %s" % action) xact_info.respond_xpath(rsp_code=rwdts.XactRspCode.ACK) - return - + return + self._log.debug("Registering for VNFR VDU using xpath: %s", self.vnfr_vdu_console_xpath) @@ -2602,10 +2602,6 @@ class VnfManager(object): """ update the Virtual Network Function descriptor """ self._log.debug("Update virtual network function descriptor - %s", vnfd) - # Hack to remove duplicates from leaf-lists - to be fixed by RIFT-6511 - for ivld in vnfd.internal_vld: - ivld.internal_connection_point_ref = list(set(ivld.internal_connection_point_ref)) - if vnfd.id not in self._vnfds: self._log.debug("No VNFD found - creating VNFD id = %s", vnfd.id) self.create_vnfd(vnfd)