Commit 71966646 authored by Roberto Rubino's avatar Roberto Rubino
Browse files

new development of microwave device - implemented the Api to get...

new development of microwave device - implemented the Api to get configurations, create and delete services
parent 8cfa12d1
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
#!/bin/bash
# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
#
# 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

# Useful flags for pytest:
#-o log_cli=true -o log_file=device.log -o log_file_level=DEBUG

coverage run --rcfile=$RCFILE --append -m pytest -s --log-level=INFO --verbose \
    device/tests/test_unitary_microwave.py
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ from enum import Enum
class DeviceTypeEnum(Enum):
    EMULATED_OPTICAL_LINE_SYSTEM = 'emu-optical-line-system'
    EMULATED_PACKET_ROUTER       = 'emu-packet-router'
    MICROVAWE_RADIO_SYSTEM       = 'microwave-radio-system'
    OPTICAL_ROADM                = 'optical-roadm'
    OPTICAL_TRANDPONDER          = 'optical-trandponder'
    OPTICAL_LINE_SYSTEM          = 'optical-line-system'
+11 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ DEVICE_PR_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG]
DEVICE_TAPI_TYPE    = DeviceTypeEnum.OPTICAL_LINE_SYSTEM.value
DEVICE_TAPI_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_TRANSPORT_API]

# check which enum type and value assign to microwave device
DEVICE_MICROWAVE_TYPE    = DeviceTypeEnum.MICROVAWE_RADIO_SYSTEM.value
DEVICE_MICROWAVE_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_IETF_NETWORK_TOPOLOGY]

DEVICE_P4_TYPE      = DeviceTypeEnum.P4_SWITCH.value
DEVICE_P4_DRIVERS   = [DeviceDriverEnum.DEVICEDRIVER_P4]

@@ -81,6 +85,13 @@ def json_device_tapi_disabled(
    return json_device(
        device_uuid, DEVICE_TAPI_TYPE, DEVICE_DISABLED, endpoints=endpoints, config_rules=config_rules, drivers=drivers)

def json_device_microwave_disabled(
        device_uuid : str, endpoints : List[Dict] = [], config_rules : List[Dict] = [],
        drivers : List[Dict] = DEVICE_MICROWAVE_DRIVERS
    ):
    return json_device(
        device_uuid, DEVICE_MICROWAVE_TYPE, DEVICE_DISABLED, endpoints=endpoints, config_rules=config_rules, drivers=drivers)

def json_device_p4_disabled(
        device_uuid : str, endpoints : List[Dict] = [], config_rules : List[Dict] = [],
        drivers : List[Dict] = DEVICE_P4_DRIVERS
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ APScheduler==3.8.1
fastcache==1.1.0
grpcio==1.43.0
grpcio-health-checking==1.43.0
grpcio-tools==1.43.0
Jinja2==3.0.3
netconf-client==2.0.0 #1.7.3
p4runtime==1.3.0
+7 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ from .emulated.EmulatedDriver import EmulatedDriver
from .openconfig.OpenConfigDriver import OpenConfigDriver
from .transport_api.TransportApiDriver import TransportApiDriver
from .p4.p4_driver import P4Driver
from .microwave.IETFApiDriver import IETFApiDriver

DRIVERS = [
    (EmulatedDriver, [
@@ -51,4 +52,10 @@ DRIVERS = [
            FilterFieldEnum.DRIVER     : ORM_DeviceDriverEnum.P4,
        }
    ]),
    (IETFApiDriver, [
        {
            FilterFieldEnum.DEVICE_TYPE: DeviceTypeEnum.MICROVAWE_RADIO_SYSTEM,
            FilterFieldEnum.DRIVER     : ORM_DeviceDriverEnum.IETF_NETWORK_TOPOLOGY,
        }
    ]),
]
Loading