Adding vim-network-id parameter to instantiation 66/7066/2
authorgcalvino <guillermo.calvinosanchez@altran.com>
Mon, 17 Dec 2018 15:19:33 +0000 (16:19 +0100)
committergcalvino <guillermo.calvinosanchez@altran.com>
Mon, 17 Dec 2018 15:27:10 +0000 (16:27 +0100)
Change-Id: I3be6b0b5b0de1ea0f1379a48546f27b45f946b5e
Signed-off-by: gcalvino <guillermo.calvinosanchez@altran.com>
osm_ro/nfvo.py
osm_ro/openmano_schemas.py

index 56062c7..7225da5 100644 (file)
@@ -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:
index d10f862..b53bbac 100644 (file)
@@ -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,
                                         }