From: gcalvino Date: Mon, 17 Dec 2018 15:26:21 +0000 (+0100) Subject: Adding vim-network-id parameter to instantiation X-Git-Tag: v5.0.3~13 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=17d5b732835f010396a9df8b66382b24ecc77972;p=osm%2FNBI.git Adding vim-network-id parameter to instantiation Change-Id: If61207db6a63c68d2af542dbcf078d61ed4455de Signed-off-by: gcalvino --- diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index d31218a..ac0dba9 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -147,7 +147,7 @@ class NsrTopic(BaseTopic): 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") if key in nsd_vld}) + {key: nsd_vld[key] for key in ("id", "vim-network-name", "vim-network-id") if key in nsd_vld}) # Create VNFR needed_vnfds = {} @@ -185,7 +185,8 @@ class NsrTopic(BaseTopic): vnfr_descriptor["vld"] = [] for vnfd_vld in vnfd.get("internal-vld"): vnfr_descriptor["vld"].append( - {key: vnfd_vld[key] for key in ("id", "vim-network-name") if key in vnfd_vld}) + {key: vnfd_vld[key] for key in ("id", "vim-network-name", "vim-network-id") if key in + vnfd_vld}) vnfd_mgmt_cp = vnfd["mgmt-interface"].get("cp") for cp in vnfd.get("connection-point", ()): @@ -541,13 +542,17 @@ class NsLcmOpTopic(BaseTopic): if vdur_interface.get("mgmt-vnf"): vnfr_update_rollback["ip-address"] = vnfr.get("ip-address") vnfr_update["ip-address"] = pdu_interface["ip-address"] - if pdu_interface.get("vim-network-name"): # or pdu_interface.get("vim-network-id"): + if pdu_interface.get("vim-network-name") or pdu_interface.get("vim-network-id"): ifaces_forcing_vim_network.append({ - # "vim-network-id": pdu_interface.get("vim-network-id"), - "vim-network-name": pdu_interface.get("vim-network-name"), "name": vdur_interface.get("vnf-vld-id") or vdur_interface.get("ns-vld-id"), "vnf-vld-id": vdur_interface.get("vnf-vld-id"), "ns-vld-id": vdur_interface.get("ns-vld-id")}) + if pdu_interface.get("vim-network-id"): + ifaces_forcing_vim_network.append({ + "vim-network-id": pdu_interface.get("vim-network-id")}) + if pdu_interface.get("vim-network-name"): + ifaces_forcing_vim_network.append({ + "vim-network-name": pdu_interface.get("vim-network-name")}) break return ifaces_forcing_vim_network @@ -844,8 +849,11 @@ class NsiTopic(BaseTopic): # Adding vim-network-name defined by the user to vld if instantiation_parameters.get("netslice-vld"): for ins_param in instantiation_parameters["netslice-vld"]: - if ins_param["name"] == netslice_vlds["name"] and ins_param.get("vim-network-name"): + if ins_param["name"] == netslice_vlds["name"]: + if ins_param.get("vim-network-name"): nsi_vld["vim-network-name"] = ins_param.get("vim-network-name") + if ins_param.get("vim-network-id"): + nsi_vld["vim-network-id"] = ins_param.get("vim-network-id") nsi_vlds.append(nsi_vld) nsi_descriptor["_admin"]["netslice-vld"] = nsi_vlds diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index bb966e2..3579c11 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -178,6 +178,7 @@ ns_instantiate_internal_vld = { "properties": { "name": name_schema, "vim-network-name": name_schema, + "vim-network-id": name_schema, "ip-profile": ip_profile_update_schema, "internal-connection-point": { "type": "array", @@ -247,6 +248,7 @@ ns_instantiate = { "properties": { "name": string_schema, "vim-network-name": {"OneOf": [string_schema, object_schema]}, + "vim-network-id": {"OneOf": [string_schema, object_schema]}, "ip-profile": object_schema, "vnfd-connection-point-ref": { "type": "array", @@ -482,7 +484,7 @@ pdu_interface = { # TODO, add user, password, ssh-key "mac-address": mac_schema, "vim-network-name": nameshort_schema, # interface is connected to one vim network, or switch port - # TODO "vim-network-id": nameshort_schema, + "vim-network-id": nameshort_schema, # # provide this in case SDN assist must deal with this interface # "switch-dpid": dpid_Schema, # "switch-port": nameshort_schema, @@ -624,6 +626,7 @@ nsi_vld_instantiate = { "properties": { "name": string_schema, "vim-network-name": {"OneOf": [string_schema, object_schema]}, + "vim-network-id": {"OneOf": [string_schema, object_schema]}, "ip-profile": object_schema, }, "required": ["name"],