aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuanHong Deng <dengyuanhong@chinamobile.com>2020-05-12 16:12:25 +0800
committerYuanhong Deng <dengyuanhong@chinamobile.com>2020-05-12 09:37:17 +0000
commit8cfa32e6b48fc50d1e0540240c79d1db64426196 (patch)
tree36336c81ae4c4c988f9a27e73732ba1f23fa7605
parent551f3ad639cf9f705905e57f11465428b0eca59c (diff)
Accept the instance data from gvnfm to nfvo and process it
Change-Id: I874ccdbbad57207b8f8d3f2b3c272fdd4f200441 Issue-ID: VFC-1657 Signed-off-by: YuanHong Deng <dengyuanhong@chinamobile.com>
-rw-r--r--lcm/ns_vnfs/biz/handle_notification.py26
-rw-r--r--lcm/ns_vnfs/tests/tests.py32
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')