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: v9.1.2^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=e662368955e44bbffb797c6ed6fe233db5b0ddeb;p=osm%2FRO.git 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-SDN-dpb/osm_rosdn_dpb/wimconn_dpb.py b/RO-SDN-dpb/osm_rosdn_dpb/wimconn_dpb.py index e08cdfdf..b8a9123b 100755 --- a/RO-SDN-dpb/osm_rosdn_dpb/wimconn_dpb.py +++ b/RO-SDN-dpb/osm_rosdn_dpb/wimconn_dpb.py @@ -36,7 +36,7 @@ from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError class DpbSshInterface: - """ Communicate with the DPB via SSH """ + """Communicate with the DPB via SSH""" __LOGGER_NAME_EXT = ".ssh" __FUNCTION_MAP_POS = 1 @@ -191,7 +191,7 @@ class DpbSshInterface: class DpbRestInterface: - """ Communicate with the DPB via the REST API """ + """Communicate with the DPB via the REST API""" __LOGGER_NAME_EXT = ".rest" __FUNCTION_MAP_POS = 0 @@ -230,7 +230,7 @@ class DpbRestInterface: class DpbConnector(SdnConnectorBase): - """ Use the DPB to establish multipoint connections """ + """Use the DPB to establish multipoint connections""" __LOGGER_NAME = "ro.sdn.dpb" __SUPPORTED_SERV_TYPES = ["ELAN (L2)", "ELINE (L2)"] diff --git a/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py b/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py index c9c05a72..59bc0d9c 100644 --- a/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py +++ b/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py @@ -225,7 +225,7 @@ class WimconnectorIETFL2VPN(SdnConnectorBase): connection_point["service_endpoint_encapsulation_type"] == "dot1q" ): - """ The connection is a VLAN """ + """The connection is a VLAN""" connection["encapsulation-type"] = "dot1q-vlan-tagged" tagged = {} tagged_interf = {} @@ -383,7 +383,7 @@ class WimconnectorIETFL2VPN(SdnConnectorBase): if connection_point["service_endpoint_encapsulation_type"] != "none": if connection_point["service_endpoint_encapsulation_type"] == "dot1q": - """ The connection is a VLAN """ + """The connection is a VLAN""" connection["encapsulation-type"] = "dot1q-vlan-tagged" tagged = {} tagged_interf = {} diff --git a/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py b/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py index 04943931..af7184ee 100644 --- a/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py +++ b/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py @@ -26,7 +26,7 @@ from osm_rosdn_juniper_contrail.rest_lib import NotFound class UnderlayApi: - """ Class with CRUD operations for the underlay API """ + """Class with CRUD operations for the underlay API""" def __init__(self, url, config=None, user=None, password=None, logger=None): self.logger = logger or logging.getLogger("ro.sdn.junipercontrail.sdnapi") 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 diff --git a/RO-VIM-openvim/osm_rovim_openvim/vimconn_openvim.py b/RO-VIM-openvim/osm_rovim_openvim/vimconn_openvim.py index eab0e75a..18d2cd61 100644 --- a/RO-VIM-openvim/osm_rovim_openvim/vimconn_openvim.py +++ b/RO-VIM-openvim/osm_rovim_openvim/vimconn_openvim.py @@ -798,7 +798,7 @@ class vimconnector(vimconn.VimConnector): self._format_request_exception(e) def new_image(self, image_dict): - """ Adds a tenant image to VIM, returns image_id""" + """Adds a tenant image to VIM, returns image_id""" try: self._get_my_tenant() new_image_dict = {"name": image_dict["name"][:64]}