X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Finstance_topics.py;h=d4441166abde6e2392257ded138017bdde9be328;hp=8ca35d06343f8346042ec36608c48890a7e5e630;hb=22577435288d15904b339b2ad3d580f9ad2edc6f;hpb=f318b3045ae5e005f6241ec170ea943c92cc67d6 diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 8ca35d0..d444116 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -18,7 +18,8 @@ from uuid import uuid4 from http import HTTPStatus from time import time from copy import copy, deepcopy -from osm_nbi.validation import validate_input, ValidationError, ns_instantiate, ns_action, ns_scale, nsi_instantiate +from osm_nbi.validation import validate_input, ValidationError, ns_instantiate, ns_terminate, ns_action, ns_scale,\ + nsi_instantiate from osm_nbi.base_topic import BaseTopic, EngineException, get_iterable, deep_get # from descriptor_topics import DescriptorTopic from yaml import safe_dump @@ -240,7 +241,7 @@ class NsrTopic(BaseTopic): "deploymentStatus": None, "configurationStatus": None, "vcaStatus": None, - "nsd": nsd, + "nsd": {k: v for k, v in nsd.items() if k in ("vld", "_id", "id", "constituent-vnfd", "name")}, "datacenter": ns_request["vimAccountId"], "resource-orchestrator": "osmopenmano", "description": ns_request.get("nsDescription", ""), @@ -270,10 +271,7 @@ class NsrTopic(BaseTopic): ns_request["nsr_id"] = nsr_id # Create vld if nsd.get("vld"): - nsr_descriptor["vld"] = [] - for nsd_vld in nsd.get("vld"): - nsr_descriptor["vld"].append( - {key: nsd_vld[key] for key in ("id", "vim-network-name", "vim-network-id") if key in nsd_vld}) + nsr_descriptor["vld"] = nsd["vld"] # Create VNFR needed_vnfds = {} @@ -485,7 +483,7 @@ class NsLcmOpTopic(BaseTopic): "instantiate": ns_instantiate, "action": ns_action, "scale": ns_scale, - "terminate": None, + "terminate": ns_terminate, } def __init__(self, db, fs, msg, auth): @@ -759,12 +757,13 @@ class NsLcmOpTopic(BaseTopic): vnfr_update[iface_text + ".{}".format(k)] = v vnfr_update_rollback[iface_text + ".{}".format(k)] = vdur_interface.get(v) if pdu_interface.get("ip-address"): - if vdur_interface.get("mgmt-interface"): + if vdur_interface.get("mgmt-interface") or vdur_interface.get("mgmt-vnf"): vnfr_update_rollback[vdu_text + ".ip-address"] = vdur.get("ip-address") vnfr_update[vdu_text + ".ip-address"] = pdu_interface["ip-address"] if vdur_interface.get("mgmt-vnf"): vnfr_update_rollback["ip-address"] = vnfr.get("ip-address") vnfr_update["ip-address"] = pdu_interface["ip-address"] + vnfr_update[vdu_text + ".ip-address"] = pdu_interface["ip-address"] if pdu_interface.get("vim-network-name") or pdu_interface.get("vim-network-id"): ifaces_forcing_vim_network.append({ "name": vdur_interface.get("vnf-vld-id") or vdur_interface.get("ns-vld-id"), @@ -983,7 +982,7 @@ class NsLcmOpTopic(BaseTopic): try: # Override descriptor with query string kwargs - self._update_input_with_kwargs(indata, kwargs) + self._update_input_with_kwargs(indata, kwargs, yaml_format=True) operation = indata["lcmOperationType"] nsInstanceId = indata["nsInstanceId"]