From 0a48054ff0fa22026ec2fec206d6d93ad195672e Mon Sep 17 00:00:00 2001 From: gcalvino Date: Mon, 17 Dec 2018 16:19:33 +0100 Subject: [PATCH] Adding vim-network-id parameter to instantiation Change-Id: I3be6b0b5b0de1ea0f1379a48546f27b45f946b5e Signed-off-by: gcalvino --- osm_ro/nfvo.py | 8 +++++++- osm_ro/openmano_schemas.py | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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, } -- 2.25.1