From: sousaedu Date: Thu, 17 Jun 2021 14:39:29 +0000 (+0100) Subject: Fix bug 1572 - Reading availability-zone-hint for neutron from config X-Git-Tag: release-v11.0-start~4 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=commitdiff_plain;h=2aa5f80ee003615f352d8bbe0e242c03385fa319 Fix bug 1572 - Reading availability-zone-hint for neutron from config Fixes bug 1572 by reading the neutron-availability-zone-hint from VIM plugin configuration, which is then applied at network-creation time. Note: this patch also fixes some formatting issues that black showed. Change-Id: Iaf152657ae31748ea6b4a123e8b0a0d9513cb692 Signed-off-by: sousaedu --- diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index c59bf904..d3837ab9 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -864,6 +864,14 @@ class vimconnector(vimconn.VimConnector): if self.config.get("disable_network_port_security"): network_dict["port_security_enabled"] = False + if self.config.get("neutron_availability_zone_hints"): + hints = self.config.get("neutron_availability_zone_hints") + + if isinstance(hints, str): + hints = [hints] + + network_dict["availability_zone_hints"] = hints + new_net = self.neutron.create_network({"network": network_dict}) # print new_net # create subnetwork, even if there is no profile