X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=RO-VIM-gcp%2Fosm_rovim_gcp%2Fvimconn_gcp.py;fp=RO-VIM-gcp%2Fosm_rovim_gcp%2Fvimconn_gcp.py;h=ecfdb0682c2cb071a574714c84084c838788fa01;hp=73b77baba9aa9278912e85f8382f4d901cf3c677;hb=fc07fc2873743e0716656014267b74a564f0d181;hpb=34aa3a943db5a61291e58676224a828819d332ee diff --git a/RO-VIM-gcp/osm_rovim_gcp/vimconn_gcp.py b/RO-VIM-gcp/osm_rovim_gcp/vimconn_gcp.py index 73b77bab..ecfdb068 100644 --- a/RO-VIM-gcp/osm_rovim_gcp/vimconn_gcp.py +++ b/RO-VIM-gcp/osm_rovim_gcp/vimconn_gcp.py @@ -926,12 +926,12 @@ class vimconnector(vimconn.VimConnector): ] = "regions/%s/subnetworks/" % self.region + net.get("name") else: net_iface["subnetwork"] = net.get("net_id") - # According to documentation "type" can be only ONE_TO_ONE_NAT and the recomended value for "name" is "External NAT", - # so an external IP will be generated for the instance - # TODO: check if it's possible to allow internet access to the instance with no external IP - net_iface["accessConfigs"] = [ - {"type": "ONE_TO_ONE_NAT", "name": "External NAT"} - ] + # In order to get an external IP address, the key "accessConfigs" must be used + # in the interace. It has to be of type "ONE_TO_ONE_NAT" and name "External NAT" + if net.get("floating_ip", False) or (net["use"] == "mgmt" and self.config.get("use_floating_ip")): + net_iface["accessConfigs"] = [ + {"type": "ONE_TO_ONE_NAT", "name": "External NAT"} + ] network_interfaces.append(net_iface)