aboutsummaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authoryangyan <yangyanyj@chinamobile.com>2019-10-18 10:47:12 +0800
committerYan Yang <yangyanyj@chinamobile.com>2019-10-18 03:02:55 +0000
commit34a113ebbcb594862be0cee3ff543a102d0fcf6b (patch)
tree71edd0298f16ff796b4d947420fde1e2eb564746 /lcm
parenta2ade2d515091b0ff22e7566e2fc82cc6ed59c69 (diff)
separate create subnet and network in aai
Change-Id: I1d1f7e343ea1c850e18abfab63d736a090c73dfc Issue-ID: VFC-1555 Signed-off-by: yangyan <yangyanyj@chinamobile.com>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/ns_vls/biz/create_vls.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/lcm/ns_vls/biz/create_vls.py b/lcm/ns_vls/biz/create_vls.py
index c087892e..7d322310 100644
--- a/lcm/ns_vls/biz/create_vls.py
+++ b/lcm/ns_vls/biz/create_vls.py
@@ -22,7 +22,7 @@ from lcm.pub.config.config import REPORT_TO_AAI
from lcm.pub.database.models import VLInstModel, NSInstModel, VNFFGInstModel
from lcm.pub.exceptions import NSLCMException
from lcm.pub.msapi import extsys, resmgr
-from lcm.pub.msapi.aai import create_network_aai
+from lcm.pub.msapi.aai import create_network_aai, create_subnet_aai
from lcm.pub.nfvi.vim import const
from lcm.pub.nfvi.vim import vimadaptor
from lcm.pub.utils.values import ignore_case_get
@@ -58,7 +58,7 @@ class CreateVls(object):
self.create_vl_to_resmgr()
self.save_vl_to_db()
if REPORT_TO_AAI:
- self.create_network_and_subnet_in_aai()
+ self.create_network_aai()
return {"result": 0, "detail": "instantiation vl success", "vlId": self.vl_inst_id}
except NSLCMException as e:
return self.exception_handle(e)
@@ -201,7 +201,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_and_subnet_in_aai(self):
+ def create_network_aai(self):
logger.debug("CreateVls::create_network_in_aai::report network[%s] to aai." % self.vl_inst_id)
try:
ns_insts = NSInstModel.objects.filter(id=self.owner_id)
@@ -250,3 +250,24 @@ class CreateVls(object):
logger.debug("Fail to create network[%s] to aai, detail message: %s" % (self.vl_inst_id, e.args[0]))
except:
logger.error(traceback.format_exc())
+
+ def create_subnet_in_aai(self):
+ logger.debug("CreateVls::create_subnet_in_aai::report subnet[%s] to aai." % self.related_subnetwork_id)
+ try:
+ data = {
+ "subnets": {
+ "subnet": [
+ {
+ "subnet-id": self.related_subnetwork_id,
+ "dhcp-enabled": False
+ }
+ ]
+ },
+ }
+ resp_data, resp_status = create_subnet_aai(self.vl_inst_id, self.related_subnetwork_id, data)
+ logger.debug("Success to create subnet[%s] to aai: [%s].", self.related_subnetwork_id, resp_status)
+ except NSLCMException as e:
+ logger.debug("Fail to create subnet[%s] to aai, detail message: %s" % (
+ self.related_subnetwork_id, e.args[0]))
+ except:
+ logger.error(traceback.format_exc())