From: gcalvino Date: Mon, 17 Dec 2018 15:19:33 +0000 (+0100) Subject: Adding vim-network-id parameter to instantiation X-Git-Tag: v5.0.3~11 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F7066%2F2;p=osm%2FRO.git Adding vim-network-id parameter to instantiation Change-Id: I3be6b0b5b0de1ea0f1379a48546f27b45f946b5e Signed-off-by: gcalvino --- diff --git a/osm_ro/nfvo.py b/osm_ro/nfvo.py index 56062c70..7225da5d 100644 --- a/osm_ro/nfvo.py +++ b/osm_ro/nfvo.py @@ -3123,6 +3123,8 @@ def create_instance(mydb, tenant_id, instance_dict): raise NfvoException("Invalid net id or name '{}' at instance:vnfs:networks".format(net_id), httperrors.Bad_Request) if net_instance_desc.get("vim-network-name"): scenario_net["vim-network-name"] = net_instance_desc["vim-network-name"] + if net_instance_desc.get("vim-network-id"): + scenario_net["vim-network-id"] = net_instance_desc["vim-network-id"] if net_instance_desc.get("name"): scenario_net["name"] = net_instance_desc["name"] if 'ip-profile' in net_instance_desc: @@ -3634,8 +3636,12 @@ def instantiate_vnf(mydb, sce_vnf, params, params_out, rollbackList): } db_instance_nets.append(db_net) + lookfor_filter = {} if net.get("vim-network-name"): - lookfor_filter = {"name": net["vim-network-name"]} + lookfor_filter["name"] = net["vim-network-name"] + if net.get("vim-network-id"): + lookfor_filter["id"] = net["vim-network-id"] + if lookfor_filter: task_action = "FIND" task_extra = {"params": (lookfor_filter,)} else: diff --git a/osm_ro/openmano_schemas.py b/osm_ro/openmano_schemas.py index d10f8621..b53bbacf 100644 --- a/osm_ro/openmano_schemas.py +++ b/osm_ro/openmano_schemas.py @@ -1056,6 +1056,7 @@ instance_scenario_create_schema_v01 = { "type": "object", "properties": { "vim-network-name": name_schema, + "vim-network-id": name_schema, "ip-profile": ip_profile_schema, "name": name_schema, } @@ -1080,7 +1081,8 @@ instance_scenario_create_schema_v01 = { "properties":{ "ip_address": ip_schema, "datacenter": name_schema, - "vim-network-name": name_schema + "vim-network-name": name_schema, + "vim-network-id": name_schema }, "patternProperties":{ ".": {"type": "string"} @@ -1105,6 +1107,7 @@ instance_scenario_create_schema_v01 = { #In oder words, it is the same as 'try to map to the VIM network (netmap-use) if exist, and if not create the network (netmap-create) "netmap-use": name_schema, # "vim-network-name": name_schema, #override network name + "vim-network-id": name_schema, #"ip-profile": ip_profile_schema, "datacenter": name_schema, }