Commit 5e4cdc8e authored by Pablo Armingol's avatar Pablo Armingol
Browse files

L2VPN bugs fixed

parent dda9a413
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -57,7 +57,7 @@ export CRDB_DATABASE="tfs"
export CRDB_DEPLOY_MODE="single"
export CRDB_DEPLOY_MODE="single"


# Disable flag for dropping database, if it exists.
# Disable flag for dropping database, if it exists.
export CRDB_DROP_DATABASE_IF_EXISTS=""
export CRDB_DROP_DATABASE_IF_EXISTS="YES"


# Disable flag for re-deploying CockroachDB from scratch.
# Disable flag for re-deploying CockroachDB from scratch.
export CRDB_REDEPLOY=""
export CRDB_REDEPLOY=""
@@ -90,7 +90,7 @@ export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis"
export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups"
export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups"


# Disable flag for dropping tables if they exist.
# Disable flag for dropping tables if they exist.
export QDB_DROP_TABLES_IF_EXIST=""
export QDB_DROP_TABLES_IF_EXIST="YES"


# Disable flag for re-deploying QuestDB from scratch.
# Disable flag for re-deploying QuestDB from scratch.
export QDB_REDEPLOY=""
export QDB_REDEPLOY=""
+4 −3
Original line number Original line Diff line number Diff line
@@ -201,7 +201,7 @@ def edit_config(
    for i,resource in enumerate(resources):
    for i,resource in enumerate(resources):
        str_resource_name = 'resources[#{:d}]'.format(i)
        str_resource_name = 'resources[#{:d}]'.format(i)
        try:
        try:
            #logger.debug('[{:s}] resource = {:s}'.format(str_method, str(resource)))
            logger.debug('[{:s}] resource = {:s}'.format(str_method, str(resource)))
            chk_type(str_resource_name, resource, (list, tuple))
            chk_type(str_resource_name, resource, (list, tuple))
            chk_length(str_resource_name, resource, min_length=2, max_length=2)
            chk_length(str_resource_name, resource, min_length=2, max_length=2)
            resource_key,resource_value = resource
            resource_key,resource_value = resource
@@ -209,8 +209,8 @@ def edit_config(
            str_config_message = compose_config(
            str_config_message = compose_config(
                resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor)
                resource_key, resource_value, delete=delete, vendor=netconf_handler.vendor)
            if str_config_message is None: raise UnsupportedResourceKeyException(resource_key)
            if str_config_message is None: raise UnsupportedResourceKeyException(resource_key)
            #logger.debug('[{:s}] str_config_message[{:d}] = {:s}'.format(
            logger.debug('[{:s}] str_config_message[{:d}] = {:s}'.format(
            #    str_method, len(str_config_message), str(str_config_message)))
                str_method, len(str_config_message), str(str_config_message)))
            netconf_handler.edit_config(
            netconf_handler.edit_config(
                config=str_config_message, target=target, default_operation=default_operation,
                config=str_config_message, target=target, default_operation=default_operation,
                test_option=test_option, error_option=error_option, format=format)
                test_option=test_option, error_option=error_option, format=format)
@@ -228,6 +228,7 @@ def edit_config(
            netconf_handler.commit()
            netconf_handler.commit()
        except Exception as e: # pylint: disable=broad-except
        except Exception as e: # pylint: disable=broad-except
            msg = '[{:s}] Exception committing: {:s}'
            msg = '[{:s}] Exception committing: {:s}'
            str_operation = 'preparing' if target == 'candidate' else ('deleting' if delete else 'setting')
            logger.exception(msg.format(str_method, str_operation, str(resources)))
            logger.exception(msg.format(str_method, str_operation, str(resources)))
            results = [e for _ in resources] # if commit fails, set exception in each resource
            results = [e for _ in resources] # if commit fails, set exception in each resource
    return results
    return results
+3 −1
Original line number Original line Diff line number Diff line
<interfaces xmlns="http://openconfig.net/yang/interfaces" 
<interfaces xmlns="http://openconfig.net/yang/interfaces" 
            xmlns:oc-ip="http://openconfig.net/yang/interfaces/ip" >
            xmlns:oc-ip="http://openconfig.net/yang/interfaces/ip" >
    <interface>
    <interface{% if operation is defined %} xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="{{operation}}"{% endif %}>
        <name>{{name}}</name>
        <name>{{name}}</name>
        {% if operation is defined and operation != 'delete' %}
        <config>
        <config>
            <name>{{name}}</name>
            <name>{{name}}</name>
            <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:{{type}}</type>
            <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:{{type}}</type>
@@ -44,5 +45,6 @@
                {% endif %}
                {% endif %}
            </subinterface>
            </subinterface>
        </subinterfaces>
        </subinterfaces>
        {% endif %}
    </interface>
    </interface>
</interfaces>
</interfaces>
+6 −2
Original line number Original line Diff line number Diff line
@@ -37,11 +37,15 @@ LOGGER = logging.getLogger(__name__)
ROUTER_ID = {
ROUTER_ID = {
    'R149': '5.5.5.5',
    'R149': '5.5.5.5',
    'R155': '5.5.5.1',
    'R155': '5.5.5.1',
    'R199': '5.5.5.6',

}
}


VIRTUAL_CIRCUIT = {
VIRTUAL_CIRCUIT = {
    'R149': '5.5.5.5',
    'R149': '5.5.5.5',
    'R155': '5.5.5.1',
    'R155': '5.5.5.1',
    'R199': '5.5.5.6',

}
}


class RequestGenerator:
class RequestGenerator:
@@ -333,7 +337,7 @@ class RequestGenerator:
                    '/device[{:s}]/endpoint[{:s}]/settings'.format(src_device_name, src_endpoint_name), {
                    '/device[{:s}]/endpoint[{:s}]/settings'.format(src_device_name, src_endpoint_name), {
                        'router_id'          : src_router_id,
                        'router_id'          : src_router_id,
                        'route_distinguisher': route_distinguisher,
                        'route_distinguisher': route_distinguisher,
                        'sub_interface_index': vlan_id,
                        'sub_interface_index': 0,
                        'vlan_id'            : vlan_id,
                        'vlan_id'            : vlan_id,
                        'address_ip'         : src_address_ip,
                        'address_ip'         : src_address_ip,
                        'address_prefix'     : 16,
                        'address_prefix'     : 16,
@@ -344,7 +348,7 @@ class RequestGenerator:
                    '/device[{:s}]/endpoint[{:s}]/settings'.format(dst_device_name, dst_endpoint_name), {
                    '/device[{:s}]/endpoint[{:s}]/settings'.format(dst_device_name, dst_endpoint_name), {
                        'router_id'          : dst_router_id,
                        'router_id'          : dst_router_id,
                        'route_distinguisher': route_distinguisher,
                        'route_distinguisher': route_distinguisher,
                        'sub_interface_index': vlan_id,
                        'sub_interface_index': 0,
                        'vlan_id'            : vlan_id,
                        'vlan_id'            : vlan_id,
                        'address_ip'         : dst_address_ip,
                        'address_ip'         : dst_address_ip,
                        'address_prefix'     : 16,
                        'address_prefix'     : 16,
+3 −5
Original line number Original line Diff line number Diff line
@@ -105,19 +105,17 @@ def teardown_config_rules(


    if_cirid_name         = '{:s}.{:s}'.format(endpoint_name, str(circuit_id))
    if_cirid_name         = '{:s}.{:s}'.format(endpoint_name, str(circuit_id))
    network_instance_name = 'ELAN-AC:{:s}'.format(str(circuit_id))
    network_instance_name = 'ELAN-AC:{:s}'.format(str(circuit_id))
    connection_point_id   = 'VC-1'
    #connection_point_id   = 'VC-1'


    json_config_rules = [
    json_config_rules = [
        


        json_config_rule_delete(
        json_config_rule_delete(
            '/network_instance[{:s}]'.format(network_instance_name),
            '/network_instance[{:s}]'.format(network_instance_name),
            {'name': network_instance_name}),
            {'name': network_instance_name}),
        
        
        json_config_rule_delete(
        json_config_rule_delete(
            '/interface[{:s}]'.format(if_cirid_name), {
            '/interface[{:s}]/subinterface[0]'.format(if_cirid_name),{
            'name': if_cirid_name,
            'name': if_cirid_name,
        }),
        }),
        
    ]
    ]
    return json_config_rules
    return json_config_rules