Commit c2ff7c09 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'feat/90-cttc-implement-sbi-driver-actn' into 'develop'

Resolve "(CTTC) Implement SBI Driver ACTN"

Closes #90

See merge request !188
parents ddf485fe 36758538
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -202,6 +202,7 @@ enum DeviceDriverEnum {
  DEVICEDRIVER_IETF_L2VPN = 7;
  DEVICEDRIVER_IETF_L2VPN = 7;
  DEVICEDRIVER_GNMI_OPENCONFIG = 8;
  DEVICEDRIVER_GNMI_OPENCONFIG = 8;
  DEVICEDRIVER_FLEXSCALE = 9;
  DEVICEDRIVER_FLEXSCALE = 9;
  DEVICEDRIVER_IETF_ACTN = 10;
}
}


enum DeviceOperationalStatusEnum {
enum DeviceOperationalStatusEnum {
+25 −0
Original line number Original line 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
# helpful pytest flags: --log-level=INFO -o log_cli=true --verbose --maxfail=1 --durations=0
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
    device/tests/test_unitary_ietf_actn.py
+12 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,10 @@ DEVICE_P4_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_P4]
DEVICE_TFS_TYPE    = DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value
DEVICE_TFS_TYPE    = DeviceTypeEnum.TERAFLOWSDN_CONTROLLER.value
DEVICE_TFS_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_IETF_L2VPN]
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):
def json_device_id(device_uuid : str):
    return {'device_uuid': {'uuid': device_uuid}}
    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,
        device_uuid, DEVICE_TFS_TYPE, DEVICE_DISABLED, name=name, endpoints=endpoints, config_rules=config_rules,
        drivers=drivers)
        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]:
def json_device_connect_rules(address : str, port : int, settings : Dict = {}) -> List[Dict]:
    return [
    return [
        json_config_rule_set('_connect/address',  address),
        json_config_rule_set('_connect/address',  address),
+1 −0
Original line number Original line Diff line number Diff line
@@ -47,6 +47,7 @@ def validate_device_driver_enum(message):
        'DEVICEDRIVER_IETF_L2VPN',
        'DEVICEDRIVER_IETF_L2VPN',
        'DEVICEDRIVER_GNMI_OPENCONFIG',
        'DEVICEDRIVER_GNMI_OPENCONFIG',
        'DEVICEDRIVER_FLEXSCALE',
        'DEVICEDRIVER_FLEXSCALE',
        'DEVICEDRIVER_IETF_ACTN',
    ]
    ]


def validate_device_operational_status_enum(message):
def validate_device_operational_status_enum(message):
+1 −0
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ class ORM_DeviceDriverEnum(enum.Enum):
    IETF_L2VPN            = DeviceDriverEnum.DEVICEDRIVER_IETF_L2VPN
    IETF_L2VPN            = DeviceDriverEnum.DEVICEDRIVER_IETF_L2VPN
    GNMI_OPENCONFIG       = DeviceDriverEnum.DEVICEDRIVER_GNMI_OPENCONFIG
    GNMI_OPENCONFIG       = DeviceDriverEnum.DEVICEDRIVER_GNMI_OPENCONFIG
    FLEXSCALE             = DeviceDriverEnum.DEVICEDRIVER_FLEXSCALE
    FLEXSCALE             = DeviceDriverEnum.DEVICEDRIVER_FLEXSCALE
    IETF_ACTN             = DeviceDriverEnum.DEVICEDRIVER_IETF_ACTN


grpc_to_enum__device_driver = functools.partial(
grpc_to_enum__device_driver = functools.partial(
    grpc_to_enum, DeviceDriverEnum, ORM_DeviceDriverEnum)
    grpc_to_enum, DeviceDriverEnum, ORM_DeviceDriverEnum)
Loading