X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO-SDN-ietfl2vpn%2Fosm_rosdn_ietfl2vpn%2Fwimconn_ietfl2vpn.py;h=2052bf11268e52834c28be96c20375c2fb90de8c;hb=aca8cb5e63ebd11cc69373323d8df62b5d8cbfe2;hp=c9c05a7207599a5e5aea09b4e3df6722f31d0463;hpb=80135b928ab442c38898750b4751480205b4affc;p=osm%2FRO.git diff --git a/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py b/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py index c9c05a72..2052bf11 100644 --- a/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py +++ b/RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py @@ -30,12 +30,12 @@ This SDN/WIM connector implements the standard IETF RFC 8466 "A YANG Data It receives the endpoints and the necessary details to request the Layer 2 service. """ -import requests -import uuid + import logging -from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError +import uuid -"""Check layer where we move it""" +from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError +import requests class WimconnectorIETFL2VPN(SdnConnectorBase): @@ -48,12 +48,16 @@ class WimconnectorIETFL2VPN(SdnConnectorBase): """ self.logger = logging.getLogger("ro.sdn.ietfl2vpn") super().__init__(wim, wim_account, config, logger) + if len(self.service_endpoint_mapping) == 0 and self.config.get( + "wim_port_mapping" + ): + self.service_endpoint_mapping = self.config.get("wim_port_mapping", []) self.headers = {"Content-Type": "application/json"} self.mappings = { m["service_endpoint_id"]: m for m in self.service_endpoint_mapping } self.user = wim_account.get("user") - self.passwd = wim_account.get("passwordd") + self.passwd = wim_account.get("password") if self.user and self.passwd is not None: self.auth = (self.user, self.passwd) @@ -172,11 +176,11 @@ class WimconnectorIETFL2VPN(SdnConnectorBase): if len(connection_points) < 2: raise SdnConnectorError("Connections must be of at least 2 endpoints") - """ First step, create the vpn service """ + """First step, create the vpn service""" uuid_l2vpn = str(uuid.uuid4()) vpn_service = {} vpn_service["vpn-id"] = uuid_l2vpn - vpn_service["vpn-scv-type"] = "vpws" + vpn_service["vpn-svc-type"] = "vpws" vpn_service["svc-topo"] = "any-to-any" vpn_service["customer-name"] = "osm" vpn_service_list = [] @@ -214,7 +218,7 @@ class WimconnectorIETFL2VPN(SdnConnectorBase): http_code=response_service_creation.status_code, ) - """ Second step, create the connections and vpn attachments """ + """Second step, create the connections and vpn attachments""" for connection_point in connection_points: connection_point_wan_info = self.search_mapp(connection_point) site_network_access = {} @@ -225,7 +229,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 = {} @@ -259,9 +263,9 @@ class WimconnectorIETFL2VPN(SdnConnectorBase): site_network_accesses = {} site_network_access_list = [] site_network_access_list.append(site_network_access) - site_network_accesses[ - "ietf-l2vpn-svc:site-network-access" - ] = site_network_access_list + site_network_accesses["ietf-l2vpn-svc:site-network-access"] = ( + site_network_access_list + ) conn_info_d = {} conn_info_d["site"] = connection_point_wan_info["service_mapping_info"][ "site-id" @@ -383,7 +387,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 = {} @@ -415,9 +419,9 @@ class WimconnectorIETFL2VPN(SdnConnectorBase): site_network_accesses = {} site_network_access_list = [] site_network_access_list.append(site_network_access) - site_network_accesses[ - "ietf-l2vpn-svc:site-network-access" - ] = site_network_access_list + site_network_accesses["ietf-l2vpn-svc:site-network-access"] = ( + site_network_access_list + ) try: endpoint_site_network_access_edit = (