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

ECOC'22 test:

- Renamed OldBigNet scenario to BigNet
- Updated JSON descriptor builder scripts
- Generated descriptor files for scenario
- Updated definition of functional tests
parent db37ba7e
Loading
Loading
Loading
Loading
+1299 −0

File added.

Preview size limit exceeded, changes collapsed.

+1005 −0

File added.

Preview size limit exceeded, changes collapsed.

+985 −0

File added.

Preview size limit exceeded, changes collapsed.

+42 −6
Original line number Diff line number Diff line
@@ -12,14 +12,50 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import copy, json, sys
from .Objects_OldBigNet import CONTEXTS, DEVICES, LINKS, TOPOLOGIES
# Execution:
# $ cd src
# $ python -m tests.ecoc22.tests.BuildDescriptors dc-csgw-tn
# $ python -m tests.ecoc22.tests.BuildDescriptors dc-csgw-tn-ols
# $ python -m tests.ecoc22.tests.BuildDescriptors bignet

import copy, json, os, sys
from enum import Enum
from typing import Dict, Tuple

class Scenario(Enum):
    BIGNET         = 'bignet'
    DC_CSGW_TN     = 'dc-csgw-tn'
    DC_CSGW_TN_OLS = 'dc-csgw-tn-ols'

scenario = None if len(sys.argv) < 2 else sys.argv[1].lower()

if scenario == Scenario.BIGNET.value:
    from .Objects_BigNet import CONTEXTS, DEVICES, LINKS, TOPOLOGIES
    FILENAME = 'tests/ecoc22/descriptors_emulated-BigNet.json'
elif scenario == Scenario.DC_CSGW_TN.value:
    os.environ['ADD_CONNECT_RULES_TO_DEVICES'] = 'TRUE'
    from .Objects_DC_CSGW_TN import CONTEXTS, DEVICES, LINKS, TOPOLOGIES
    FILENAME = 'tests/ecoc22/descriptors_emulated-DC_CSGW_TN.json'
elif scenario == Scenario.DC_CSGW_TN_OLS.value:
    os.environ['ADD_CONNECT_RULES_TO_DEVICES'] = 'TRUE'
    from .Objects_DC_CSGW_TN_OLS import CONTEXTS, DEVICES, LINKS, TOPOLOGIES
    FILENAME = 'tests/ecoc22/descriptors_emulated-DC_CSGW_TN_OLS.json'
else:
    scenarios = str([s.value for s in Scenario])
    raise Exception('Unsupported Scenario({:s}), choices are: {:s}'.format(scenario, scenarios))

def main():
    with open('tests/ecoc22/descriptors_emulated.json', 'w', encoding='UTF-8') as f:
    with open(FILENAME, 'w', encoding='UTF-8') as f:
        devices = []
        for device,connect_rules in DEVICES:
        for item in DEVICES:
            if isinstance(item, Dict):
                device = item
            elif isinstance(item, Tuple) and len(item) == 2:
                device,connect_rules = item
            else:
                raise Exception('Wrongly formatted item: {:s}'.format(str(item)))
            device = copy.deepcopy(device)
            if len(item) == 2:
                device['device_config']['config_rules'].extend(connect_rules)
            devices.append(device)

@@ -28,7 +64,7 @@ def main():
            'topologies': TOPOLOGIES,
            'devices': devices,
            'links': LINKS
        }))
        }, sort_keys=True, indent=4))
    return 0

if __name__ == '__main__':
+2 −0
Original line number Diff line number Diff line
@@ -3,7 +3,9 @@ from common.Settings import get_setting
from compute.tests.mock_osm.MockOSM import MockOSM
from context.client.ContextClient import ContextClient
from device.client.DeviceClient import DeviceClient
#from .Objects_BigNet import WIM_MAPPING, WIM_PASSWORD, WIM_USERNAME
from .Objects_DC_CSGW_TN import WIM_MAPPING, WIM_PASSWORD, WIM_USERNAME
#from .Objects_DC_CSGW_TN_OLS import WIM_MAPPING, WIM_PASSWORD, WIM_USERNAME

@pytest.fixture(scope='session')
def context_client():
Loading