diff options
-rw-r--r-- | lcm/ns_vnfs/biz/handle_notification.py | 26 | ||||
-rw-r--r-- | lcm/ns_vnfs/tests/tests.py | 32 |
2 files changed, 37 insertions, 21 deletions
diff --git a/lcm/ns_vnfs/biz/handle_notification.py b/lcm/ns_vnfs/biz/handle_notification.py index 4e957d1a..edcebbb2 100644 --- a/lcm/ns_vnfs/biz/handle_notification.py +++ b/lcm/ns_vnfs/biz/handle_notification.py @@ -133,18 +133,22 @@ class HandleVnfLcmOocNotification(object): vimId = ignore_case_get(portResource, 'vimConnectionId') resourceId = ignore_case_get(portResource, 'resourceId') resourceName = ignore_case_get(portResource, 'resourceId') # replaced with resouceId temporarily - # tenant = ignore_case_get(portResource, 'tenant') - # ipAddress = ignore_case_get(portResource, 'ipAddress') - # macAddress = ignore_case_get(portResource, 'macAddress') - # instId = ignore_case_get(portResource, 'instId') - portid = str(uuid.uuid4()) - - PortInstModel(portid=portid, networkid='unknown', subnetworkid='unknown', vimid=vimId, - resourceid=resourceId, name=resourceName, instid="unknown", cpinstanceid=cpInstanceId, - bandwidth='unknown', operationalstate='active', ipaddress="unkown", - macaddress='unknown', + tenant = ignore_case_get(portResource, 'tenant') + ipAddress = ignore_case_get(portResource, 'ipAddress') + macAddress = ignore_case_get(portResource, 'macAddress') + instId = ignore_case_get(portResource, 'instId') + portid = ignore_case_get(portResource, 'portId') + networkId = ignore_case_get(portResource, 'networkId') + subnetId = ignore_case_get(portResource, 'subnetId') + + # portid = str(uuid.uuid4()) + + PortInstModel(portid=portid, networkid=networkId, subnetworkid=subnetId, vimid=vimId, + resourceid=resourceId, name=resourceName, instid=instId, cpinstanceid=cpInstanceId, + bandwidth='unknown', operationalstate='active', ipaddress=ipAddress, + macaddress=macAddress, floatipaddress='unknown', serviceipaddress='unknown', typevirtualnic='unknown', - sfcencapsulation='gre', direction='unknown', tenant="unkown").save() + sfcencapsulation='gre', direction='unknown', tenant=tenant).save() relatedportId = portid CPInstModel(cpinstanceid=cpInstanceId, cpdid=cpdId, ownertype=ownertype, ownerid=ownerid, diff --git a/lcm/ns_vnfs/tests/tests.py b/lcm/ns_vnfs/tests/tests.py index b4904329..c3d3008e 100644 --- a/lcm/ns_vnfs/tests/tests.py +++ b/lcm/ns_vnfs/tests/tests.py @@ -2270,7 +2270,13 @@ class TestVnfNotifyView(TestCase): "id": "cpd_id", "resourceHandle": { "vimConnectionId": "vim_connection_id", - "resourceId": "resource_id" + "resourceId": "resource_id", + "tenant": "tenant", + "ipAddress": "ipAddress", + "macAddress": "macAddress", + "instId": "instId", + "networkId": "networkId", + "subnetId": "subnetId" } }], }] @@ -2307,13 +2313,13 @@ class TestVnfNotifyView(TestCase): vlinstancename="resource_id", ownertype=0, ownerid=self.nf_inst_id, relatednetworkid="resource_id", vltype=0) self.assertIsInstance(vl_inst, VLInstModel) - port_inst = PortInstModel.objects.get(networkid='unknown', subnetworkid='unknown', vimid="vim_connection_id", - resourceid="resource_id", name="resource_id", instid="unknown", + port_inst = PortInstModel.objects.get(networkid='networkId', subnetworkid='subnetId', vimid="vim_connection_id", + resourceid="resource_id", name="resource_id", instid="instId", cpinstanceid="cp_instance_id", bandwidth='unknown', - operationalstate='active', ipaddress="unkown", macaddress='unknown', + operationalstate='active', ipaddress="ipAddress", macaddress='macAddress', floatipaddress='unknown', serviceipaddress='unknown', typevirtualnic='unknown', sfcencapsulation='gre', direction='unknown', - tenant="unkown") + tenant="tenant") self.assertIsInstance(port_inst, PortInstModel) cp_inst = CPInstModel.objects.get(cpinstanceid="cp_instance_id", cpdid="cpd_id", ownertype=0, ownerid=self.nf_inst_id, relatedtype=2, status='active') @@ -2406,7 +2412,13 @@ class TestVnfNotifyView(TestCase): "id": "cpd_id", "resourceHandle": { "vimConnectionId": "vim_connection_id", - "resourceId": "resource_id" + "resourceId": "resource_id", + "tenant": "tenant", + "ipAddress": "ipAddress", + "macAddress": "macAddress", + "instId": "instId", + "networkId": "networkId", + "subnetId": "subnetId" } }], }] @@ -2419,13 +2431,13 @@ class TestVnfNotifyView(TestCase): vlinstancename="resource_id", ownertype=0, ownerid=self.nf_inst_id, relatednetworkid="resource_id", vltype=0) self.assertIsInstance(vl_inst, VLInstModel) - port_inst = PortInstModel.objects.get(networkid='unknown', subnetworkid='unknown', vimid="vim_connection_id", - resourceid="resource_id", name="resource_id", instid="unknown", + port_inst = PortInstModel.objects.get(networkid='networkId', subnetworkid='subnetId', vimid="vim_connection_id", + resourceid="resource_id", name="resource_id", instid="instId", cpinstanceid="cp_instance_id", bandwidth='unknown', - operationalstate='active', ipaddress="unkown", macaddress='unknown', + operationalstate='active', ipaddress="ipAddress", macaddress='macAddress', floatipaddress='unknown', serviceipaddress='unknown', typevirtualnic='unknown', sfcencapsulation='gre', direction='unknown', - tenant="unkown") + tenant="tenant") self.assertIsInstance(port_inst, PortInstModel) cp_inst = CPInstModel.objects.get(cpinstanceid="cp_instance_id", cpdid="cpd_id", ownertype=0, ownerid=self.nf_inst_id, relatedtype=2, status='active') |