Report vfc-lcm subnet resource to aai 69/18669/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Fri, 13 Oct 2017 02:57:51 +0000 (10:57 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Fri, 13 Oct 2017 02:57:51 +0000 (10:57 +0800)
Change-Id: I30b805fb5f16727f571159672cd443757b6dc4ec
Issue-ID: VFC-532
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/ns/vls/create_vls.py
lcm/ns/vls/delete_vls.py
resources/dbscripts/mysql/vfc-nfvo-lcm-createobj.sql

index 15dee54..dc72101 100644 (file)
@@ -57,7 +57,7 @@ class CreateVls(object):
             self.create_vl_to_resmgr()
             self.save_vl_to_db()
             if REPORT_TO_AAI:
-                self.create_network_in_aai()
+                self.create_network_and_subnet_in_aai()
             return {"result": 0, "detail": "instantiation vl success", "vlId": self.vl_inst_id}
         except NSLCMException as e:
             return self.exception_handle(e)
@@ -194,7 +194,7 @@ class CreateVls(object):
         # do_biz_with_share_lock("create-vllist-in-vnffg-%s" % self.owner_id, self.create_vl_inst_id_in_vnffg)
         self.create_vl_inst_id_in_vnffg()
 
-    def create_network_in_aai(self):
+    def create_network_and_subnet_in_aai(self):
         logger.debug("CreateVls::create_network_in_aai::report network[%s] to aai." % self.vl_inst_id)
         data = {
             "network-id": self.vl_inst_id,
@@ -203,6 +203,14 @@ class CreateVls(object):
             "is-provider-network": True,
             "is-shared-network": True,
             "is-external-network": True,
+            "subnets": {
+                "subnet": [
+                    {
+                        "subnet-id": self.related_subnetwork_id,
+                        "dhcp-enabled": False
+                    }
+                ]
+            },
             "relationship-list": {
                 "relationship": [
                     {
index 4ed7bc8..8c089b1 100644 (file)
@@ -43,7 +43,7 @@ class DeleteVls(object):
             self.delete_vl_from_vim(vim_id, subnetwork_id_list, network_id)
             self.delete_vl_from_resmgr()
             if REPORT_TO_AAI:
-                self.delete_network_in_aai()
+                self.delete_network_and_subnet_in_aai()
             self.delete_vl_from_db(vl_inst_info)
             return {"result": 0, "detail": "delete vl success"}
         except NSLCMException as e:
@@ -83,7 +83,7 @@ class DeleteVls(object):
             new_vl_id_list = new_vl_id_list[:-1]
             VNFFGInstModel.objects.filter(vnffginstid=vnffg_info.vnffginstid).update(vllist=new_vl_id_list)
 
-    def delete_network_in_aai(self):
+    def delete_network_and_subnet_in_aai(self):
         logger.debug("DeleteVls::delete_network_in_aai::delete network[%s] in aai." % self.vl_inst_id)
 
         # query network in aai, get resource_version
index 79c4850..f42915f 100644 (file)
@@ -145,7 +145,7 @@ CREATE TABLE NFVO_NSINST (
   `CREATETIME` varchar(200) NULL, 
   `LASTUPTIME` varchar(200) NULL,
   `GLOBALCUSTOMERID` varchar(50) NULL,
-   `SERVICETYPE` varchar(50) NULL
+  `SERVICETYPE` varchar(50) NULL
 );
 
 DROP TABLE IF EXISTS NFVO_PORTINST;