Skip to content
Snippets Groups Projects
Commit 1c7f6e4f authored by sasiain's avatar sasiain
Browse files

Update Dynpac WIM connector


Change-Id: I20d6c8e42abc6f88d5b5c81ed057ce2559c72a77
Signed-off-by: default avatarsasiain <jorge.sasiain@ehu.es>
parent ea6c8132
No related branches found
No related tags found
No related merge requests found
...@@ -56,7 +56,7 @@ class WimAPIActions(Enum): ...@@ -56,7 +56,7 @@ class WimAPIActions(Enum):
class DynpacConnector(WimConnector): class DynpacConnector(WimConnector):
__supported_service_types = ["ELINE (L2)"] __supported_service_types = ["ELINE (L2)", "ELINE"]
__supported_encapsulation_types = ["dot1q"] __supported_encapsulation_types = ["dot1q"]
__WIM_LOGGER = 'openmano.wimconn.dynpac' __WIM_LOGGER = 'openmano.wimconn.dynpac'
__ENCAPSULATION_TYPE_PARAM = "service_endpoint_encapsulation_type" __ENCAPSULATION_TYPE_PARAM = "service_endpoint_encapsulation_type"
...@@ -198,24 +198,25 @@ class DynpacConnector(WimConnector): ...@@ -198,24 +198,25 @@ class DynpacConnector(WimConnector):
if enc_type not in self.__supported_encapsulation_types: if enc_type not in self.__supported_encapsulation_types:
self.__exception(WimError.ENCAPSULATION_TYPE, http_code=400) self.__exception(WimError.ENCAPSULATION_TYPE, http_code=400)
bandwidth = kwargs.get(self.__BANDWIDTH_PARAM) # Commented out for as long as parameter isn't implemented
if not isinstance(bandwidth, int): # bandwidth = kwargs.get(self.__BANDWIDTH_PARAM)
self.__exception(WimError.BANDWIDTH, http_code=400) # if not isinstance(bandwidth, int):
# self.__exception(WimError.BANDWIDTH, http_code=400)
backup = kwargs.get(self.__BACKUP_PARAM) # Commented out for as long as parameter isn't implemented
if not isinstance(backup, bool): # backup = kwargs.get(self.__BACKUP_PARAM)
self.__exception(WimError.BACKUP, http_code=400) # if not isinstance(backup, bool):
# self.__exception(WimError.BACKUP, http_code=400)
def __get_body(self, service_type, connection_points, kwargs): def __get_body(self, service_type, connection_points, kwargs):
port_mapping = self.__config.get("port_mapping") port_mapping = self.__config.get("service_endpoint_mapping")
selected_ports = [] selected_ports = []
for connection_point in connection_points: for connection_point in connection_points:
endpoint_id = connection_point.get(self.__SERVICE_ENDPOINT_PARAM) endpoint_id = connection_point.get(self.__SERVICE_ENDPOINT_PARAM)
port = filter(lambda x: x.get(self.__WAN_SERVICE_ENDPOINT_PARAM) == endpoint_id, port_mapping)[0] port = filter(lambda x: x.get(self.__WAN_SERVICE_ENDPOINT_PARAM) == endpoint_id, port_mapping)[0]
wsmpi_json = port.get(self.__WAN_MAPPING_INFO_PARAM) port_info = port.get(self.__WAN_MAPPING_INFO_PARAM)
port_info = json.loads(wsmpi_json)
selected_ports.append(port_info) selected_ports.append(port_info)
if service_type == "ELINE (L2)": if service_type == "ELINE (L2)" or service_type == "ELINE":
service_type = "L2" service_type = "L2"
body = { body = {
"connection_points": [{ "connection_points": [{
...@@ -227,8 +228,8 @@ class DynpacConnector(WimConnector): ...@@ -227,8 +228,8 @@ class DynpacConnector(WimConnector):
"wan_switch_port": selected_ports[1].get(self.__SW_PORT_PARAM), "wan_switch_port": selected_ports[1].get(self.__SW_PORT_PARAM),
"wan_vlan": connection_points[1].get(self.__ENCAPSULATION_INFO_PARAM).get(self.__VLAN_PARAM) "wan_vlan": connection_points[1].get(self.__ENCAPSULATION_INFO_PARAM).get(self.__VLAN_PARAM)
}], }],
"bandwidth": kwargs.get(self.__BANDWIDTH_PARAM), "bandwidth": 100, # Hardcoded for as long as parameter isn't implemented
"service_type": service_type, "service_type": service_type,
"backup": kwargs.get(self.__BACKUP_PARAM) "backup": False # Hardcoded for as long as parameter isn't implemented
} }
return "body={}".format(json.dumps(body)) return "body={}".format(json.dumps(body))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment