summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-19 10:27:15 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-09-19 10:27:15 +0800
commite2e3b79adf202e4fd0a7f82c00cdda8f654e9c08 (patch)
tree6f5a54fe0e883bf1b27aa056a29b23cf9aa525b9 /lcm
parent93e05ab19eade085beb74419b1a5d8e258ab81d8 (diff)
Change gvnfm-vnflcm aai config
Change-Id: Ia1181259408628dd9a3f4106b9e6ef8d173403ef Issue-ID: VFC-377 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py123
-rw-r--r--lcm/lcm/nf/vnfs/tests/test_vnf_create.py192
-rw-r--r--lcm/lcm/nf/vnfs/tests/test_vnf_query.py16
-rw-r--r--lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py4
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py36
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py17
-rw-r--r--lcm/lcm/pub/config/config.py9
7 files changed, 299 insertions, 98 deletions
diff --git a/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py b/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
index dee84622..c3e4b38c 100644
--- a/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
+++ b/lcm/lcm/nf/vnfs/tests/test_vnf_cancel.py
@@ -32,18 +32,55 @@ from lcm.pub.vimapi import api
class TestNFTerminate(TestCase):
def setUp(self):
self.client = Client()
- StorageInstModel.objects.create(storageid="1", vimid="1", resouceid="11", insttype=0, instid="1111",
+ StorageInstModel.objects.create(storageid="1",
+ vimid="1",
+ resouceid="11",
+ insttype=0,
+ instid="1111",
is_predefined=1)
- NetworkInstModel.objects.create(networkid='1', vimid='1', resouceid='1', name='pnet_network',
- is_predefined=1, tenant='admin', insttype=0, instid='1111')
- SubNetworkInstModel.objects.create(subnetworkid='1', vimid='1', resouceid='1', networkid='1',
- is_predefined=1, name='sub_pnet', tenant='admin', insttype=0, instid='1111')
- PortInstModel.objects.create(portid='1', networkid='1', subnetworkid='1', vimid='1', resouceid='1',
- is_predefined=1, name='aaa_pnet_cp', tenant='admin', insttype=0, instid='1111')
- FlavourInstModel.objects.create(flavourid="1", vimid="1", resouceid="11", instid="1111", is_predefined=1)
- VmInstModel.objects.create(vmid="1", vimid="1", resouceid="11", insttype=0, instid="1111", vmname="test_01",
- is_predefined=1, operationalstate=1)
- NfvoRegInfoModel.objects.create(nfvoid='1111', vnfminstid='11111', apiurl='1')
+ NetworkInstModel.objects.create(networkid='1',
+ vimid='1',
+ resouceid='1',
+ name='pnet_network',
+ is_predefined=1,
+ tenant='admin',
+ insttype=0,
+ instid='1111')
+ SubNetworkInstModel.objects.create(subnetworkid='1',
+ vimid='1',
+ resouceid='1',
+ networkid='1',
+ is_predefined=1,
+ name='sub_pnet',
+ tenant='admin',
+ insttype=0,
+ instid='1111')
+ PortInstModel.objects.create(portid='1',
+ networkid='1',
+ subnetworkid='1',
+ vimid='1',
+ resouceid='1',
+ is_predefined=1,
+ name='aaa_pnet_cp',
+ tenant='admin',
+ insttype=0,
+ instid='1111')
+ FlavourInstModel.objects.create(flavourid="1",
+ vimid="1",
+ resouceid="11",
+ instid="1111",
+ is_predefined=1)
+ VmInstModel.objects.create(vmid="1",
+ vimid="1",
+ resouceid="11",
+ insttype=0,
+ instid="1111",
+ vmname="test_01",
+ is_predefined=1,
+ operationalstate=1)
+ NfvoRegInfoModel.objects.create(nfvoid='1111',
+ vnfminstid='11111',
+ apiurl='1')
def tearDown(self):
@@ -54,19 +91,28 @@ class TestNFTerminate(TestCase):
def assert_job_result(self, job_id, job_progress, job_detail):
- jobs = JobStatusModel.objects.filter(
- jobid=job_id,
- progress=job_progress,
- descp=job_detail)
+ jobs = JobStatusModel.objects.filter(jobid=job_id,
+ progress=job_progress,
+ descp=job_detail)
self.assertEqual(1, len(jobs))
@mock.patch.object(restcall, 'call_req')
def test_delete_vnf_identifier(self, mock_call_req):
- NfInstModel.objects.create(nfinstid='1111', nf_name='2222', package_id='todo', version='', vendor='',
- netype='', vnfd_model='', status='NOT_INSTANTIATED', nf_desc='', vnfdid='',
- vnfSoftwareVersion='', vnfConfigurableProperties='todo',
- localizationLanguage='EN_US', create_time=now_time())
+ NfInstModel.objects.create(nfinstid='1111',
+ nf_name='2222',
+ package_id='todo',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='NOT_INSTANTIATED',
+ nf_desc='',
+ vnfdid='',
+ vnfSoftwareVersion='',
+ vnfConfigurableProperties='todo',
+ localizationLanguage='EN_US',
+ create_time=now_time())
r1_create_vnf_to_aai = [0, json.JSONEncoder().encode({}), '200']
mock_call_req.side_effect = [r1_create_vnf_to_aai]
response = self.client.delete("/api/vnflcm/v1/vnf_instances/1111")
@@ -87,8 +133,10 @@ class TestNFTerminate(TestCase):
def test_terminate_vnf_when_inst_id_not_exist(self):
- data = {"terminationType": "GRACEFUL",
- "gracefulTerminationTimeout": 120}
+ data = {
+ "terminationType": "GRACEFUL",
+ "gracefulTerminationTimeout": 120
+ }
self.nf_inst_id = str(uuid.uuid4())
self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
@@ -99,17 +147,36 @@ class TestNFTerminate(TestCase):
@mock.patch.object(restcall, 'call_req')
@mock.patch.object(api, 'call')
def test_terminate_vnf_success(self, mock_call, mock_call_req):
- NfInstModel.objects.create(nfinstid='1111', nf_name='2222', package_id='todo', version='', vendor='',
- netype='', vnfd_model='', status='VNF_INSTANTIATED', nf_desc='', vnfdid='',
- vnfSoftwareVersion='', vnfConfigurableProperties='todo',
- localizationLanguage='EN_US', create_time=now_time())
+ NfInstModel.objects.create(nfinstid='1111',
+ nf_name='2222',
+ package_id='todo',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='VNF_INSTANTIATED',
+ nf_desc='',
+ vnfdid='',
+ vnfSoftwareVersion='',
+ vnfConfigurableProperties='todo',
+ localizationLanguage='EN_US',
+ create_time=now_time())
t1_apply_grant_result = [0, json.JSONEncoder().encode(
- {"vim": {"vimid": 'vimid_1', "accessinfo": {"tenant": 'tenantname_1'}}}), '200']
+ {
+ "vim":{
+ "vimid": 'vimid_1',
+ "accessinfo":{
+ "tenant": 'tenantname_1'
+ }
+ }
+ }), '200']
t2_lcm_notify_result = [0, json.JSONEncoder().encode(''), '200']
mock_call_req.side_effect = [t1_apply_grant_result, t2_lcm_notify_result]
mock_call.return_value = None
- data = {"terminationType": "FORCEFUL",
- "gracefulTerminationTimeout": 120}
+ data = {
+ "terminationType": "FORCEFUL",
+ "gracefulTerminationTimeout": 120
+ }
self.nf_inst_id = '1111'
self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
diff --git a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
index c715ced2..6669fafe 100644
--- a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
+++ b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
@@ -39,10 +39,9 @@ class TestNFInstantiate(TestCase):
pass
def assert_job_result(self, job_id, job_progress, job_detail):
- jobs = JobStatusModel.objects.filter(
- jobid=job_id,
- progress=job_progress,
- descp=job_detail)
+ jobs = JobStatusModel.objects.filter(jobid=job_id,
+ progress=job_progress,
+ descp=job_detail)
self.assertEqual(1, len(jobs))
def test_swagger_ok(self):
@@ -51,16 +50,24 @@ class TestNFInstantiate(TestCase):
@mock.patch.object(restcall, 'call_req')
def test_create_vnf_identifier(self, mock_call_req):
- r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode({'csars':[{'package_id': '222',
- 'csarId': '2222',
- 'vnfdId': '111'}]}), '200']
+ r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode(
+ {
+ 'csars': [
+ {
+ 'package_id': '222',
+ 'csarId': '2222',
+ 'vnfdId': '111'
+ }
+ ]
+ }), '200']
r2_get_rawdata_from_catalog = [0, json.JSONEncoder().encode(vnfd_rawdata), '200']
r3_create_vnf_to_aai = [0, json.JSONEncoder().encode({}), '200']
mock_call_req.side_effect = [r1_get_csarid_by_vnfdid, r2_get_rawdata_from_catalog, r3_create_vnf_to_aai]
data = {
"vnfdId": "111",
"vnfInstanceName": "vFW_01",
- "vnfInstanceDescription": "vFW in Nanjing TIC Edge"}
+ "vnfInstanceDescription": "vFW in Nanjing TIC Edge"
+ }
response = self.client.post("/api/vnflcm/v1/vnf_instances", data=data, format='json')
self.failUnlessEqual(status.HTTP_201_CREATED, response.status_code)
context = json.loads(response.content)
@@ -76,10 +83,9 @@ class TestNFInstantiate(TestCase):
self.nf_inst_id = str(uuid.uuid4())
self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY")
- jobs = JobStatusModel.objects.filter(
- jobid=self.job_id,
- progress=0,
- descp="INST_VNF_READY")
+ jobs = JobStatusModel.objects.filter(jobid=self.job_id,
+ progress=0,
+ descp="INST_VNF_READY")
self.assertEqual(1, len(jobs))
data = inst_req_data
InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run()
@@ -87,12 +93,27 @@ class TestNFInstantiate(TestCase):
@mock.patch.object(restcall, 'call_req')
def test_instantiate_vnf_when_get_package_info_by_vnfdid_failed(self, mock_call_req):
- NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
- version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
- nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
- r1_get_csarid_by_vnfdid = [1, json.JSONEncoder().encode({'csars':[{'package_id': '222',
- 'csarId': '2222',
- 'vnfdId': '111'}]}), '200']
+ NfInstModel.objects.create(nfinstid='1111',
+ nf_name='vFW_01',
+ package_id='222',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='NOT_INSTANTIATED',
+ nf_desc='vFW in Nanjing TIC Edge',
+ vnfdid='111',
+ create_time=now_time())
+ r1_get_csarid_by_vnfdid = [1, json.JSONEncoder().encode(
+ {
+ 'csars': [
+ {
+ 'package_id': '222',
+ 'csarId': '2222',
+ 'vnfdId': '111'
+ }
+ ]
+ }), '200']
mock_call_req.side_effect = [r1_get_csarid_by_vnfdid]
self.nf_inst_id = '1111'
self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
@@ -103,12 +124,27 @@ class TestNFInstantiate(TestCase):
@mock.patch.object(restcall, 'call_req')
def test_instantiate_vnf_when_get_rawdata_by_csarid_failed(self, mock_call_req):
- NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
- version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
- nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
- r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode({'csars':[{'package_id': '222',
- 'csarId': '2222',
- 'vnfdId': '111'}]}), '200']
+ NfInstModel.objects.create(nfinstid='1111',
+ nf_name='vFW_01',
+ package_id='222',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='NOT_INSTANTIATED',
+ nf_desc='vFW in Nanjing TIC Edge',
+ vnfdid='111',
+ create_time=now_time())
+ r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode(
+ {
+ 'csars': [
+ {
+ 'package_id': '222',
+ 'csarId': '2222',
+ 'vnfdId': '111'
+ }
+ ]
+ }), '200']
r2_get_rawdata_from_catalog = [1, json.JSONEncoder().encode(vnfd_rawdata), '200']
mock_call_req.side_effect = [r1_get_csarid_by_vnfdid, r2_get_rawdata_from_catalog]
self.nf_inst_id = '1111'
@@ -120,15 +156,37 @@ class TestNFInstantiate(TestCase):
@mock.patch.object(restcall, 'call_req')
def test_instantiate_vnf_when_applay_grant_failed(self, mock_call_req):
- NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
- version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
- nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
- r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode({'csars':[{'package_id': '222',
- 'csarId': '2222',
- 'vnfdId': '111'}]}), '200']
+ NfInstModel.objects.create(nfinstid='1111',
+ nf_name='vFW_01',
+ package_id='222',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='NOT_INSTANTIATED',
+ nf_desc='vFW in Nanjing TIC Edge',
+ vnfdid='111',
+ create_time=now_time())
+ r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode(
+ {
+ 'csars': [
+ {
+ 'package_id': '222',
+ 'csarId': '2222',
+ 'vnfdId': '111'
+ }
+ ]
+ }), '200']
r2_get_rawdata_from_catalog = [0, json.JSONEncoder().encode(vnfd_rawdata), '200']
r3_apply_grant_result = [1, json.JSONEncoder().encode(
- {"vim": {"vimid": 'vimid_1', "accessinfo": {"tenant": 'tenantname_1'}}}), '200']
+ {
+ "vim": {
+ "vimid": 'vimid_1',
+ "accessinfo": {
+ "tenant": 'tenantname_1'
+ }
+ }
+ }), '200']
mock_call_req.side_effect = [r1_get_csarid_by_vnfdid, r2_get_rawdata_from_catalog, r3_apply_grant_result]
self.nf_inst_id = '1111'
self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id)
@@ -140,15 +198,37 @@ class TestNFInstantiate(TestCase):
@mock.patch.object(restcall, 'call_req')
@mock.patch.object(api, 'call')
def test_instantiate_vnf_when_unexpected_exception(self, mock_call, mock_call_req):
- NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
- version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
- nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
- r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode({'csars':[{'package_id': '222',
- 'csarId': '2222',
- 'vnfdId': '111'}]}), '200']
+ NfInstModel.objects.create(nfinstid='1111',
+ nf_name='vFW_01',
+ package_id='222',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='NOT_INSTANTIATED',
+ nf_desc='vFW in Nanjing TIC Edge',
+ vnfdid='111',
+ create_time=now_time())
+ r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode(
+ {
+ 'csars': [
+ {
+ 'package_id': '222',
+ 'csarId': '2222',
+ 'vnfdId': '111'
+ }
+ ]
+ }), '200']
r2_get_rawdata_from_catalog = [0, json.JSONEncoder().encode(vnfd_rawdata), '200']
r3_apply_grant_result = [0, json.JSONEncoder().encode(
- {"vim": {"vimid": 'vimid_1', "accessinfo": {"tenant": 'tenantname_1'}}}), '200']
+ {
+ "vim": {
+ "vimid": 'vimid_1',
+ "accessinfo": {
+ "tenant": 'tenantname_1'
+ }
+ }
+ }), '200']
mock_call_req.side_effect = [r1_get_csarid_by_vnfdid, r2_get_rawdata_from_catalog, r3_apply_grant_result]
mock_call.side_effect = [c1_data_get_tenant_id, c2_data_create_volume, c3_data_get_volume]
self.nf_inst_id = '1111'
@@ -161,15 +241,37 @@ class TestNFInstantiate(TestCase):
@mock.patch.object(restcall, 'call_req')
@mock.patch.object(api, 'call')
def test_instantiate_vnf_success(self, mock_call, mock_call_req):
- NfInstModel.objects.create(nfinstid='1111', nf_name='vFW_01', package_id='222',
- version='', vendor='', netype='', vnfd_model='', status='NOT_INSTANTIATED',
- nf_desc='vFW in Nanjing TIC Edge', vnfdid='111', create_time=now_time())
- r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode({'csars':[{'package_id': '222',
- 'csarId': '2222',
- 'vnfdId': '111'}]}), '200']
+ NfInstModel.objects.create(nfinstid='1111',
+ nf_name='vFW_01',
+ package_id='222',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='NOT_INSTANTIATED',
+ nf_desc='vFW in Nanjing TIC Edge',
+ vnfdid='111',
+ create_time=now_time())
+ r1_get_csarid_by_vnfdid = [0, json.JSONEncoder().encode(
+ {
+ 'csars': [
+ {
+ 'package_id': '222',
+ 'csarId': '2222',
+ 'vnfdId': '111'
+ }
+ ]
+ }), '200']
r2_get_rawdata_from_catalog = [0, json.JSONEncoder().encode(vnfd_rawdata), '200']
r3_apply_grant_result = [0, json.JSONEncoder().encode(
- {"vim": {"vimid": 'vimid_1', "accessinfo": {"tenant": 'tenantname_1'}}}), '200']
+ {
+ "vim": {
+ "vimid": 'vimid_1',
+ "accessinfo": {
+ "tenant": 'tenantname_1'
+ }
+ }
+ }), '200']
r4_lcm_notify_result = [0, json.JSONEncoder().encode(''), '200']
mock_call_req.side_effect = [r1_get_csarid_by_vnfdid, r2_get_rawdata_from_catalog,
r3_apply_grant_result, r4_lcm_notify_result]
diff --git a/lcm/lcm/nf/vnfs/tests/test_vnf_query.py b/lcm/lcm/nf/vnfs/tests/test_vnf_query.py
index 42295085..acaa5e84 100644
--- a/lcm/lcm/nf/vnfs/tests/test_vnf_query.py
+++ b/lcm/lcm/nf/vnfs/tests/test_vnf_query.py
@@ -114,16 +114,24 @@ class ResourceTest(TestCase):
def test_get_vnf(self):
vnf_inst_id = "1"
NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1').save()
- StorageInstModel(storageid='s02', vimid='vim01', resouceid='resource01', insttype=1, instid=vnf_inst_id).save()
+ StorageInstModel(storageid='s02',
+ vimid='vim01',
+ resouceid='resource01',
+ insttype=1,
+ instid=vnf_inst_id).save()
response = self.client.get("/api/vnflcm/v1/vnf_instances/%s" % vnf_inst_id, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(self.test_data_single_vnf, response.data)
def test_get_vnfs(self):
for i in range(1, 3):
- NfInstModel(nfinstid='%s' % i, nf_name='VNF%s' % i).save()
- StorageInstModel(storageid='s0%s' % i, vimid='vim0%s' % i, resouceid='resource0%s' % i,
- insttype=1, instid='%s' % i).save()
+ NfInstModel(nfinstid='%s' % i,
+ nf_name='VNF%s' % i).save()
+ StorageInstModel(storageid='s0%s' % i,
+ vimid='vim0%s' % i,
+ resouceid='resource0%s' % i,
+ insttype=1,
+ instid='%s' % i).save()
response = self.client.get("/api/vnflcm/v1/vnf_instances", format='json')
self.failUnlessEqual(status.HTTP_200_OK, response.status_code)
self.assertEqual(self.test_data_multi_vnf, response.data)
diff --git a/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py b/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
index af83ec1f..3ae64458 100644
--- a/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
+++ b/lcm/lcm/nf/vnfs/vnf_cancel/delete_vnf_identifier.py
@@ -14,6 +14,7 @@
import logging
+from lcm.pub.config.config import REPORT_TO_AAI
from lcm.pub.database.models import NfInstModel, NfvoRegInfoModel
from lcm.pub.exceptions import NFLCMException
from lcm.pub.msapi.aai import query_vnf_aai, delete_vnf_aai
@@ -30,7 +31,8 @@ class DeleteVnf:
try:
self.check_parameter()
self.delete_info_from_db()
- self.delete_vnf_in_aai()
+ if REPORT_TO_AAI:
+ self.delete_vnf_in_aai()
except NFLCMException as e:
logger.debug('Delete VNF instance[%s] from AAI failed' % self.nf_inst_id)
except:
diff --git a/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
index 683b3baa..3b0e3751 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py
@@ -16,6 +16,7 @@ import json
import logging
import uuid
+from lcm.pub.config.config import REPORT_TO_AAI
from lcm.pub.database.models import NfInstModel
from lcm.pub.exceptions import NFLCMException
from lcm.pub.msapi.aai import create_vnf_aai
@@ -45,14 +46,23 @@ class CreateVnf:
self.check_vnf_name_valid()
self.get_vnfd_info()
self.save_info_to_db()
- self.create_vnf_in_aai()
+ if REPORT_TO_AAI:
+ self.create_vnf_in_aai()
except NFLCMException as e:
logger.debug('Create VNF instance[%s] to AAI failed' % self.nf_inst_id)
except:
- NfInstModel.objects.create(nfinstid=self.nf_inst_id, nf_name=self.vnf_instance_mame, package_id='',
- version='', vendor='', netype='', vnfd_model='',
- status='NOT_INSTANTIATED', nf_desc=self.description, vnfdid=self.vnfd_id,
- vnfSoftwareVersion='', create_time=now_time())
+ NfInstModel.objects.create(nfinstid=self.nf_inst_id,
+ nf_name=self.vnf_instance_mame,
+ package_id='',
+ version='',
+ vendor='',
+ netype='',
+ vnfd_model='',
+ status='NOT_INSTANTIATED',
+ nf_desc=self.description,
+ vnfdid=self.vnfd_id,
+ vnfSoftwareVersion='',
+ create_time=now_time())
vnf_inst = NfInstModel.objects.get(nfinstid=self.nf_inst_id)
logger.debug('id is [%s],name is [%s],vnfd_id is [%s],vnfd_model is [%s],'
@@ -87,10 +97,18 @@ class CreateVnf:
netype = ignore_case_get(metadata, "vnf_type")
vnfsoftwareversion = ignore_case_get(metadata, "version")
vnfd_model = self.vnfd
- NfInstModel.objects.create(nfinstid=self.nf_inst_id, nf_name=self.vnf_instance_mame, package_id=self.package_id,
- version=version, vendor=vendor, netype=netype, vnfd_model=vnfd_model,
- status='NOT_INSTANTIATED', nf_desc=self.description, vnfdid=self.vnfd_id,
- vnfSoftwareVersion=vnfsoftwareversion, create_time=now_time())
+ NfInstModel.objects.create(nfinstid=self.nf_inst_id,
+ nf_name=self.vnf_instance_mame,
+ package_id=self.package_id,
+ version=version,
+ vendor=vendor,
+ netype=netype,
+ vnfd_model=vnfd_model,
+ status='NOT_INSTANTIATED',
+ nf_desc=self.description,
+ vnfdid=self.vnfd_id,
+ vnfSoftwareVersion=vnfsoftwareversion,
+ create_time=now_time())
def create_vnf_in_aai(self):
logger.debug("CreateVnf::create_vnf_in_aai::report vnf instance[%s] to aai." % self.nf_inst_id)
diff --git a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
index 5ad002e0..b12d81ec 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
@@ -18,7 +18,6 @@ import traceback
import uuid
from threading import Thread
-from lcm.nf.vnfs.const import vnfd_model_dict
from lcm.pub.database.models import NfInstModel, VmInstModel, NetworkInstModel, \
SubNetworkInstModel, PortInstModel, StorageInstModel, FlavourInstModel, VNFCInstModel, NfvoRegInfoModel
from lcm.pub.exceptions import NFLCMException
@@ -99,10 +98,18 @@ class InstVnf(Thread):
vnfsoftwareversion = ignore_case_get(metadata, "version")
vnfd_model = self.vnfd_info
NfInstModel.objects.filter(nfinstid=self.nf_inst_id).\
- update(package_id=self.package_id, flavour_id=ignore_case_get(self.data, "flavourId"), version=version,
- vendor=vendor, netype=netype, vnfd_model=vnfd_model, status='NOT_INSTANTIATED', vnfdid=self.vnfd_id,
- localizationLanguage=ignore_case_get(self.data, 'localizationLanguage'), input_params=self.data,
- vnfSoftwareVersion=vnfsoftwareversion, lastuptime=now_time())
+ update(package_id=self.package_id,
+ flavour_id=ignore_case_get(self.data, "flavourId"),
+ version=version,
+ vendor=vendor,
+ netype=netype,
+ vnfd_model=vnfd_model,
+ status='NOT_INSTANTIATED',
+ vnfdid=self.vnfd_id,
+ localizationLanguage=ignore_case_get(self.data, 'localizationLanguage'),
+ input_params=self.data,
+ vnfSoftwareVersion=vnfsoftwareversion,
+ lastuptime=now_time())
logger.info("self.vim_id = %s" % self.vim_id)
NfvoRegInfoModel.objects.create(nfvoid=self.nf_inst_id,
diff --git a/lcm/lcm/pub/config/config.py b/lcm/lcm/pub/config/config.py
index 650d6755..1b95acc0 100644
--- a/lcm/lcm/pub/config/config.py
+++ b/lcm/lcm/pub/config/config.py
@@ -19,14 +19,11 @@ MSB_SERVICE_IP = '127.0.0.1'
MSB_SERVICE_PORT = '80'
# [AAI]
-AAI_SERVICE_IP = '127.0.0.1'
-AAI_SERVICE_PORT = '8443'
-AAI_BASE_URL = "https://%s:%s/aai/v8" % (AAI_SERVICE_IP, AAI_SERVICE_PORT)
+AAI_BASE_URL = "https://127.0.0.1:8443/aai/v11"
AAI_USER = "AAI"
AAI_PASSWORD = "AAI"
-CLOUD_OWNER = "11"
-CLOUD_REGION_ID = ""
-TENANT_ID = ""
+REPORT_TO_AAI = False
+
# [REDIS]
REDIS_HOST = '127.0.0.1'