Commit 69b96fbc authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device - IETF ACTN Driver:

- Added test script
- Improved unitary test
- Minor code fixings
- Removed unneeded files
- Added related objects factory methods
parent f1d61a8c
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


PROJECTDIR=`pwd`

cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc

# Run unitary tests and analyze coverage of code at same time
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    device/tests/test_unitary_ietf_actn.py
+12 −0
Original line number Diff line number Diff line
@@ -46,6 +46,10 @@ DEVICE_P4_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_P4]
DEVICE_TFS_TYPE    = DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value
DEVICE_TFS_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_IETF_L2VPN]

DEVICE_IETF_ACTN_TYPE    = DeviceTypeEnum.OPEN_LINE_SYSTEM.value
DEVICE_IETF_ACTN_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_IETF_ACTN]


def json_device_id(device_uuid : str):
    return {'device_uuid': {'uuid': device_uuid}}

@@ -136,6 +140,14 @@ def json_device_tfs_disabled(
        device_uuid, DEVICE_TFS_TYPE, DEVICE_DISABLED, name=name, endpoints=endpoints, config_rules=config_rules,
        drivers=drivers)

def json_device_ietf_actn_disabled(
        device_uuid : str, name : Optional[str] = None, endpoints : List[Dict] = [], config_rules : List[Dict] = [],
        drivers : List[Dict] = DEVICE_IETF_ACTN_DRIVERS
    ):
    return json_device(
        device_uuid, DEVICE_IETF_ACTN_TYPE, DEVICE_DISABLED, name=name, endpoints=endpoints, config_rules=config_rules,
        drivers=drivers)

def json_device_connect_rules(address : str, port : int, settings : Dict = {}) -> List[Dict]:
    return [
        json_config_rule_set('_connect/address',  address),
+9 −0
Original line number Diff line number Diff line
@@ -84,6 +84,15 @@ DRIVERS.append(
        }
    ]))

from .ietf_actn.IetfActnDriver import IetfActnDriver # pylint: disable=wrong-import-position
DRIVERS.append(
    (IetfActnDriver, [
        {
            FilterFieldEnum.DEVICE_TYPE: DeviceTypeEnum.OPEN_LINE_SYSTEM,
            FilterFieldEnum.DRIVER: DeviceDriverEnum.DEVICEDRIVER_IETF_ACTN,
        }
    ]))

if LOAD_ALL_DEVICE_DRIVERS:
    from .openconfig.OpenConfigDriver import OpenConfigDriver # pylint: disable=wrong-import-position
    DRIVERS.append(
+0 −14
Original line number Diff line number Diff line

osu_tunnel_1:
    delay = 20
    te_odu_number = 40
    src_ttp_channel_name = 'och:1-odu2:1-oduflex:1-osuflex:2'
    dst_ttp_channel_name = 'och:1-odu2:1-oduflex:3-osuflex:1'

etht_service_1:
    etht_svc_type = 'op-mp2mp-svc'
    src_endpoint_static_route_list:
        dst='128.32.10.5', mask=24 => next_hop='128.32.33.5'
        dst='128.32.20.5', mask=24 => next_hop='128.32.33.5'
    dst_endpoint_static_route_list:
        dst='172.1.101.22', mask=24 => next_hop='172.10.33.5'
+2 −2
Original line number Diff line number Diff line
@@ -176,10 +176,10 @@ class EthtServiceHandler:

                'dst_node_id'      : dst_endpoint['node-id'],
                'dst_tp_id'        : dst_endpoint['tp-id'],
                'dst_vlan_tag'     : src_endpoint['outer-tag']['vlan-value'],
                'dst_vlan_tag'     : dst_endpoint['outer-tag']['vlan-value'],
                'dst_static_routes': [
                    (static_route['destination'], static_route['destination-mask'], static_route['next-hop'])
                    for static_route in src_endpoint.get('static-route-list', list())
                    for static_route in dst_endpoint.get('static-route-list', list())
                ],
            }
            etht_services.append(etht_service)
Loading