summaryrefslogtreecommitdiffstats
path: root/lcm/lcm/nf/biz
diff options
context:
space:
mode:
Diffstat (limited to 'lcm/lcm/nf/biz')
-rw-r--r--lcm/lcm/nf/biz/common.py3
-rw-r--r--lcm/lcm/nf/biz/create_vnf.py1
-rw-r--r--lcm/lcm/nf/biz/instantiate_vnf.py9
-rw-r--r--lcm/lcm/nf/biz/terminate_vnf.py11
4 files changed, 16 insertions, 8 deletions
diff --git a/lcm/lcm/nf/biz/common.py b/lcm/lcm/nf/biz/common.py
index 3c21ab5a..212c74c8 100644
--- a/lcm/lcm/nf/biz/common.py
+++ b/lcm/lcm/nf/biz/common.py
@@ -121,6 +121,7 @@ def vm_save(job_id, nf_inst_id, ret):
JobUtil.add_job_status(job_id, 70, 'Create vms!')
vm_id = str(uuid.uuid4())
nics = ignore_case_get(ret, "nicArray")
+ volumes = ignore_case_get(ret, "volumeArray")
VmInstModel.objects.create(
vmid=vm_id,
vmname=ignore_case_get(ret, "name"),
@@ -129,7 +130,7 @@ def vm_save(job_id, nf_inst_id, ret):
tenant=ignore_case_get(ret, "tenantId"),
nic_array=nics if nics else "null",
metadata=ignore_case_get(ret, "metadata"),
- volume_array=ignore_case_get(ret, "volumeArray"),
+ volume_array=volumes if volumes else "null",
server_group=ignore_case_get(ret, "serverGroup"),
availability_zone=str(ignore_case_get(ret, "availabilityZone", "undefined")),
flavor_id=ignore_case_get(ret, "flavorId"),
diff --git a/lcm/lcm/nf/biz/create_vnf.py b/lcm/lcm/nf/biz/create_vnf.py
index 09f5e76a..fc0891ac 100644
--- a/lcm/lcm/nf/biz/create_vnf.py
+++ b/lcm/lcm/nf/biz/create_vnf.py
@@ -52,6 +52,7 @@ class CreateVnf:
netype = ignore_case_get(metadata, "type", "undefined")
vnfsoftwareversion = ignore_case_get(metadata, "version", "undefined")
NfInstModel.objects.create(nfinstid=self.nf_inst_id,
+ vnfminstid=ignore_case_get(self.data, "vnfmInstId", "undefined"),
nf_name=self.vnf_instance_mame,
package_id=self.csar_id,
version=version,
diff --git a/lcm/lcm/nf/biz/instantiate_vnf.py b/lcm/lcm/nf/biz/instantiate_vnf.py
index 203a12be..101c96fd 100644
--- a/lcm/lcm/nf/biz/instantiate_vnf.py
+++ b/lcm/lcm/nf/biz/instantiate_vnf.py
@@ -20,7 +20,7 @@ from threading import Thread
from lcm.pub.database.models import NfInstModel
from lcm.pub.exceptions import NFLCMException
from lcm.pub.msapi.gvnfmdriver import prepare_notification_data
-# from lcm.pub.msapi.gvnfmdriver import notify_lcm_to_nfvo
+from lcm.pub.msapi.gvnfmdriver import notify_lcm_to_nfvo
from lcm.pub.msapi.sdc_run_catalog import query_vnfpackage_by_id
from lcm.pub.utils.jobutil import JobUtil
from lcm.pub.utils.timeutil import now_time
@@ -136,8 +136,11 @@ class InstantiateVnf(Thread):
def lcm_notify(self):
notification_content = prepare_notification_data(self.nf_inst_id, self.job_id, CHANGE_TYPE.ADDED, OPERATION_TYPE.INSTANTIATE)
logger.info('Notify request data = %s' % notification_content)
- # resp = notify_lcm_to_nfvo(json.dumps(notification_content))
- # logger.info('Lcm notify end, response %s' % resp)
+ try:
+ resp = notify_lcm_to_nfvo(json.dumps(notification_content))
+ logger.info('Lcm notify end, response %s' % resp)
+ except Exception as e:
+ logger.error("Lcm instantiate notify failed: %s", e.message)
NotificationsUtil().send_notification(notification_content)
def vnf_inst_failed_handle(self, error_msg):
diff --git a/lcm/lcm/nf/biz/terminate_vnf.py b/lcm/lcm/nf/biz/terminate_vnf.py
index 250ce7fa..b9e6dd3a 100644
--- a/lcm/lcm/nf/biz/terminate_vnf.py
+++ b/lcm/lcm/nf/biz/terminate_vnf.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# import json
+import json
import logging
import traceback
from threading import Thread
@@ -25,7 +25,7 @@ from lcm.pub.database.models import (
)
from lcm.pub.exceptions import NFLCMException
from lcm.pub.msapi.gvnfmdriver import prepare_notification_data
-# from lcm.pub.msapi.gvnfmdriver import notify_lcm_to_nfvo
+from lcm.pub.msapi.gvnfmdriver import notify_lcm_to_nfvo
from lcm.pub.utils.jobutil import JobUtil
from lcm.pub.utils.timeutil import now_time
from lcm.pub.utils.notificationsutil import NotificationsUtil
@@ -122,8 +122,11 @@ class TerminateVnf(Thread):
def lcm_notify(self):
NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='NOT_INSTANTIATED', lastuptime=now_time())
logger.info('Send notify request to nfvo')
- # resp = notify_lcm_to_nfvo(json.dumps(self.notify_data))
- # logger.info('Lcm notify end, response: %s' % resp)
+ try:
+ resp = notify_lcm_to_nfvo(json.dumps(self.notify_data))
+ logger.info('Lcm notify end, response: %s' % resp)
+ except Exception as e:
+ logger.error("Lcm terminate notify failed: %s", e.message)
NotificationsUtil().send_notification(self.notify_data)
def vnf_term_failed_handle(self, error_msg):