Commit 71e7ebce authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component:

- L2NM/L3NM Emulated Service Handler: ignored configurations when there are no rules to configure
- IETF L2VPN Service Handler: corrected configuration rule for Device component
parent 1f7e5163
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -75,10 +75,12 @@ class L2NMEmulatedServiceHandler(_ServiceHandler):
                    service_uuid, connection_uuid, device_uuid, endpoint_uuid, endpoint_name,
                    settings, endpoint_settings)

                if len(json_config_rules) > 0:
                    del device_obj.device_config.config_rules[:]
                    for json_config_rule in json_config_rules:
                        device_obj.device_config.config_rules.append(ConfigRule(**json_config_rule))
                    self.__task_executor.configure_device(device_obj)

                results.append(True)
            except Exception as e: # pylint: disable=broad-except
                LOGGER.exception('Unable to SetEndpoint({:s})'.format(str(endpoint)))
@@ -110,10 +112,12 @@ class L2NMEmulatedServiceHandler(_ServiceHandler):
                    service_uuid, connection_uuid, device_uuid, endpoint_uuid, endpoint_name,
                    settings, endpoint_settings)

                if len(json_config_rules) > 0:
                    del device_obj.device_config.config_rules[:]
                    for json_config_rule in json_config_rules:
                        device_obj.device_config.config_rules.append(ConfigRule(**json_config_rule))
                    self.__task_executor.configure_device(device_obj)

                results.append(True)
            except Exception as e: # pylint: disable=broad-except
                LOGGER.exception('Unable to DeleteEndpoint({:s})'.format(str(endpoint)))
+4 −8
Original line number Diff line number Diff line
@@ -68,16 +68,12 @@ class L2NM_IETFL2VPN_ServiceHandler(_ServiceHandler):

            json_config_rule = json_config_rule_set('/services/service[{:s}]'.format(service_uuid), {
                'uuid'              : service_uuid,
                'src_device_name'   : src_device.name,
                'src_endpoint_name' : src_endpoint.name,
                'dst_device_name'   : dst_device.name,
                'dst_endpoint_name' : dst_endpoint.name,
                'encapsulation_type': encap_type,
                'vlan_id'           : vlan_id,
                'src': {
                    'device'  : {'uuid': src_device_uuid,   'name': src_device.name  },
                    'endpoint': {'uuid': src_endpoint_uuid, 'name': src_endpoint.name},
                },
                'dst': {
                    'device'  : {'uuid': dst_device_uuid,   'name': dst_device.name  },
                    'endpoint': {'uuid': dst_endpoint_uuid, 'name': dst_endpoint.name},
                },
            })
            del manager.device_config.config_rules[:]
            manager.device_config.config_rules.append(ConfigRule(**json_config_rule))
+12 −8
Original line number Diff line number Diff line
@@ -75,10 +75,12 @@ class L3NMEmulatedServiceHandler(_ServiceHandler):
                    service_uuid, connection_uuid, device_uuid, endpoint_uuid, endpoint_name,
                    settings, endpoint_settings)

                if len(json_config_rules) > 0:
                    del device_obj.device_config.config_rules[:]
                    for json_config_rule in json_config_rules:
                        device_obj.device_config.config_rules.append(ConfigRule(**json_config_rule))
                    self.__task_executor.configure_device(device_obj)

                results.append(True)
            except Exception as e: # pylint: disable=broad-except
                LOGGER.exception('Unable to SetEndpoint({:s})'.format(str(endpoint)))
@@ -110,10 +112,12 @@ class L3NMEmulatedServiceHandler(_ServiceHandler):
                    service_uuid, connection_uuid, device_uuid, endpoint_uuid, endpoint_name,
                    settings, endpoint_settings)

                if len(json_config_rules) > 0:
                    del device_obj.device_config.config_rules[:]
                    for json_config_rule in json_config_rules:
                        device_obj.device_config.config_rules.append(ConfigRule(**json_config_rule))
                    self.__task_executor.configure_device(device_obj)

                results.append(True)
            except Exception as e: # pylint: disable=broad-except
                LOGGER.exception('Unable to DeleteEndpoint({:s})'.format(str(endpoint)))