From c834356f10cb8bc04c8b0a9eb2a438b2e9c50632 Mon Sep 17 00:00:00 2001 From: Gilles Thouenon Date: Tue, 13 Apr 2021 09:12:17 +0200 Subject: [PATCH] Change way to start simulators - change way to import modules from common and remove symbolic folder links - create a single flat simulators file containing all simulators configurations in order to be able to launch topology configurations composed of node devices of different versions - adapt python test files accordingly - create specific log directory for simulators in common JIRA: TRNSPRTPCE-434 Signed-off-by: Gilles Thouenon Change-Id: I094d2dd844b0591b0012fd10395576cca147b54a --- tests/transportpce_tests/1.2.1/__init__.py | 0 tests/transportpce_tests/1.2.1/common | 1 - tests/transportpce_tests/1.2.1/simulators.py | 27 -------------- .../transportpce_tests/1.2.1/test_end2end.py | 19 ++++++---- tests/transportpce_tests/1.2.1/test_gnpy.py | 3 +- tests/transportpce_tests/1.2.1/test_olm.py | 18 ++++++--- tests/transportpce_tests/1.2.1/test_pce.py | 3 +- .../1.2.1/test_portmapping.py | 27 ++++---------- .../test_renderer_service_path_nominal.py | 12 +++--- .../1.2.1/test_topo_portmapping.py | 11 ++++-- .../transportpce_tests/1.2.1/test_topology.py | 16 +++++--- tests/transportpce_tests/2.2.1/__init__.py | 0 tests/transportpce_tests/2.2.1/common | 1 - tests/transportpce_tests/2.2.1/simulators.py | 29 --------------- .../transportpce_tests/2.2.1/test_end2end.py | 18 ++++++--- .../2.2.1/test_flex_grid.py | 9 +++-- .../2.2.1/test_nbinotifications.py | 17 ++++++--- tests/transportpce_tests/2.2.1/test_olm.py | 18 ++++++--- .../2.2.1/test_otn_end2end.py | 19 ++++++---- .../2.2.1/test_otn_renderer.py | 9 +++-- .../2.2.1/test_otn_sh_renderer.py | 12 ++++-- .../2.2.1/test_otn_topology.py | 9 +++-- .../2.2.1/test_portmapping.py | 11 ++++-- .../test_renderer_service_path_nominal.py | 11 ++++-- tests/transportpce_tests/2.2.1/test_tapi.py | 28 ++++++++------ .../2.2.1/test_topo_portmapping.py | 11 ++++-- .../transportpce_tests/2.2.1/test_topology.py | 16 +++++--- tests/transportpce_tests/7.1/__init__.py | 0 tests/transportpce_tests/7.1/common | 1 - tests/transportpce_tests/7.1/simulators.py | 20 ---------- tests/transportpce_tests/7.1/test_pce_400G.py | 3 +- tests/transportpce_tests/common/log/.gitkeep | 0 tests/transportpce_tests/common/simulators.py | 37 ++++++++++++++++++- tests/transportpce_tests/common/test_utils.py | 28 +++++++------- 34 files changed, 232 insertions(+), 212 deletions(-) create mode 100644 tests/transportpce_tests/1.2.1/__init__.py delete mode 120000 tests/transportpce_tests/1.2.1/common delete mode 100644 tests/transportpce_tests/1.2.1/simulators.py create mode 100644 tests/transportpce_tests/2.2.1/__init__.py delete mode 120000 tests/transportpce_tests/2.2.1/common delete mode 100644 tests/transportpce_tests/2.2.1/simulators.py create mode 100644 tests/transportpce_tests/7.1/__init__.py delete mode 120000 tests/transportpce_tests/7.1/common delete mode 100644 tests/transportpce_tests/7.1/simulators.py create mode 100644 tests/transportpce_tests/common/log/.gitkeep mode change 120000 => 100644 tests/transportpce_tests/common/simulators.py diff --git a/tests/transportpce_tests/1.2.1/__init__.py b/tests/transportpce_tests/1.2.1/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/transportpce_tests/1.2.1/common b/tests/transportpce_tests/1.2.1/common deleted file mode 120000 index 83323993b..000000000 --- a/tests/transportpce_tests/1.2.1/common +++ /dev/null @@ -1 +0,0 @@ -../common/ \ No newline at end of file diff --git a/tests/transportpce_tests/1.2.1/simulators.py b/tests/transportpce_tests/1.2.1/simulators.py deleted file mode 100644 index 79bbcd8f6..000000000 --- a/tests/transportpce_tests/1.2.1/simulators.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# Copyright (c) 2020 Orange, Inc. and others. All rights reserved. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## -import os - -SIMS = { - 'xpdra': {'port': '17830', 'configfile': 'oper-XPDRA.xml', 'logfile': 'oper-XPDRA.log'}, - 'roadma': {'port': '17831', 'configfile': 'oper-ROADMA.xml', 'logfile': 'oper-ROADMA.log'}, - 'roadmb': {'port': '17832', 'configfile': 'oper-ROADMB.xml', 'logfile': 'oper-ROADMB.log'}, - 'roadmc': {'port': '17833', 'configfile': 'oper-ROADMC.xml', 'logfile': 'oper-ROADMC.log'}, - 'xpdrc': {'port': '17834', 'configfile': 'oper-XPDRC.xml', 'logfile': 'oper-XPDRC.log'}, - 'roadma-full': {'port': '17821', 'configfile': 'oper-ROADMA-full.xml', 'logfile': 'oper-ROADMA.log'}, - 'roadmc-full': {'port': '17823', 'configfile': 'oper-ROADMC-full.xml', 'logfile': 'oper-ROADMC.log'} -} - -HONEYNODE_EXECUTABLE = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "..", "..", "honeynode", "1.2.1", "honeynode-simulator", "honeycomb-tpce") -SAMPLES_DIRECTORY = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "..", "..", "sample_configs", "openroadm", "1.2.1") diff --git a/tests/transportpce_tests/1.2.1/test_end2end.py b/tests/transportpce_tests/1.2.1/test_end2end.py index 77f2eeac5..3f7ca3b52 100644 --- a/tests/transportpce_tests/1.2.1/test_end2end.py +++ b/tests/transportpce_tests/1.2.1/test_end2end.py @@ -14,9 +14,10 @@ import base64 import time import unittest - import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEFulltesting(unittest.TestCase): cr_serv_sample_data = {"input": { @@ -118,11 +119,15 @@ class TransportPCEFulltesting(unittest.TestCase): } processes = None WAITING = 20 + NODE_VERSION = '1.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma-full', 'roadmc-full', 'xpdrc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), + ('roadma-full', cls.NODE_VERSION), + ('roadmc-full', cls.NODE_VERSION), + ('xpdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -136,19 +141,19 @@ class TransportPCEFulltesting(unittest.TestCase): # connect netconf devices def test_01_connect_xpdrA(self): - response = test_utils.mount_device("XPDRA01", 'xpdra') + response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_connect_xpdrC(self): - response = test_utils.mount_device("XPDRC01", 'xpdrc') + response = test_utils.mount_device("XPDRC01", ('xpdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_connect_rdmA(self): - response = test_utils.mount_device("ROADMA01", 'roadma-full') + response = test_utils.mount_device("ROADMA01", ('roadma-full', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_04_connect_rdmC(self): - response = test_utils.mount_device("ROADMC01", 'roadmc-full') + response = test_utils.mount_device("ROADMC01", ('roadmc-full', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_05_connect_xprdA_N1_to_roadmA_PP1(self): diff --git a/tests/transportpce_tests/1.2.1/test_gnpy.py b/tests/transportpce_tests/1.2.1/test_gnpy.py index c0752cb7f..57d8935bd 100644 --- a/tests/transportpce_tests/1.2.1/test_gnpy.py +++ b/tests/transportpce_tests/1.2.1/test_gnpy.py @@ -17,7 +17,8 @@ import os import sys import time import requests -from common import test_utils +sys.path.append('transportpce_tests/common/') +import test_utils class TransportGNPYtesting(unittest.TestCase): diff --git a/tests/transportpce_tests/1.2.1/test_olm.py b/tests/transportpce_tests/1.2.1/test_olm.py index b42c488f3..96778f5ac 100644 --- a/tests/transportpce_tests/1.2.1/test_olm.py +++ b/tests/transportpce_tests/1.2.1/test_olm.py @@ -15,17 +15,23 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportOlmTesting(unittest.TestCase): processes = None + NODE_VERSION = '1.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma-full', 'roadmc-full', 'xpdrc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), + ('roadma-full', cls.NODE_VERSION), + ('roadmc-full', cls.NODE_VERSION), + ('xpdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -39,19 +45,19 @@ class TransportOlmTesting(unittest.TestCase): time.sleep(1) def test_01_xpdrA_device_connected(self): - response = test_utils.mount_device("XPDRA01", 'xpdra') + response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_xpdrC_device_connected(self): - response = test_utils.mount_device("XPDRC01", 'xpdrc') + response = test_utils.mount_device("XPDRC01", ('xpdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_rdmA_device_connected(self): - response = test_utils.mount_device("ROADMA01", 'roadma-full') + response = test_utils.mount_device("ROADMA01", ('roadma-full', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_04_rdmC_device_connected(self): - response = test_utils.mount_device("ROADMC01", 'roadmc-full') + response = test_utils.mount_device("ROADMC01", ('roadmc-full', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_05_connect_xprdA_to_roadmA(self): diff --git a/tests/transportpce_tests/1.2.1/test_pce.py b/tests/transportpce_tests/1.2.1/test_pce.py index d8447847b..bbed914aa 100644 --- a/tests/transportpce_tests/1.2.1/test_pce.py +++ b/tests/transportpce_tests/1.2.1/test_pce.py @@ -16,7 +16,8 @@ import os import sys import time import requests -from common import test_utils +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): diff --git a/tests/transportpce_tests/1.2.1/test_portmapping.py b/tests/transportpce_tests/1.2.1/test_portmapping.py index 5cc4c14dd..6a9f9fc47 100644 --- a/tests/transportpce_tests/1.2.1/test_portmapping.py +++ b/tests/transportpce_tests/1.2.1/test_portmapping.py @@ -15,17 +15,20 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEPortMappingTesting(unittest.TestCase): processes = None + NODE_VERSION = '1.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -38,24 +41,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase): print("execution of {}".format(self.id().split(".")[-1])) time.sleep(10) -# def test_01_restconfAPI(self): -# response = test_utils.get_netconf_oper_request("controller-config") -# self.assertEqual(response.status_code, requests.codes.ok) -# res = response.json() -# self.assertEqual(res['node'] [0] ['netconf-node-topology:connection-status'], -# 'connected') - -# def test_02_restconfAPI(self): -# response = test_utils.portmapping_request("controller-config") -# self.assertEqual(response.status_code, requests.codes.not_found) -# res = response.json() -# self.assertIn( -# {"error-type":"application", "error-tag":"data-missing", -# "error-message":"Request could not be completed because the relevant data model content does not exist "}, -# res['errors']['error']) - def test_01_rdm_device_connection(self): - response = test_utils.mount_device("ROADMA01", 'roadma') + response = test_utils.mount_device("ROADMA01", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_rdm_device_connected(self): @@ -111,7 +98,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): res['mapping']) def test_07_xpdr_device_connection(self): - response = test_utils.mount_device("XPDRA01", 'xpdra') + response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_08_xpdr_device_connected(self): diff --git a/tests/transportpce_tests/1.2.1/test_renderer_service_path_nominal.py b/tests/transportpce_tests/1.2.1/test_renderer_service_path_nominal.py index 9787e4071..305c2ec89 100644 --- a/tests/transportpce_tests/1.2.1/test_renderer_service_path_nominal.py +++ b/tests/transportpce_tests/1.2.1/test_renderer_service_path_nominal.py @@ -15,17 +15,19 @@ import unittest import time import requests -from common import test_utils - +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCERendererTesting(unittest.TestCase): processes = None + NODE_VERSION = '1.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -39,11 +41,11 @@ class TransportPCERendererTesting(unittest.TestCase): time.sleep(10) def test_01_rdm_device_connected(self): - response = test_utils.mount_device("ROADMA01", 'roadma') + response = test_utils.mount_device("ROADMA01", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_xpdr_device_connected(self): - response = test_utils.mount_device("XPDRA01", 'xpdra') + response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_rdm_portmapping(self): diff --git a/tests/transportpce_tests/1.2.1/test_topo_portmapping.py b/tests/transportpce_tests/1.2.1/test_topo_portmapping.py index 683b04a48..9390c26a6 100644 --- a/tests/transportpce_tests/1.2.1/test_topo_portmapping.py +++ b/tests/transportpce_tests/1.2.1/test_topo_portmapping.py @@ -17,17 +17,20 @@ import time import unittest import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): processes = None + NODE_VERSION = '1.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -41,7 +44,7 @@ class TransportPCEtesting(unittest.TestCase): # Connect the ROADMA def test_01_connect_rdm(self): - response = test_utils.mount_device("ROADMA01", 'roadma') + response = test_utils.mount_device("ROADMA01", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) # Verify the termination points of the ROADMA @@ -66,7 +69,7 @@ class TransportPCEtesting(unittest.TestCase): # #Connect the XPDRA def test_04_connect_xpdr(self): - response = test_utils.mount_device("XPDRA01", 'xpdra') + response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) # #Verify the termination points related to XPDR diff --git a/tests/transportpce_tests/1.2.1/test_topology.py b/tests/transportpce_tests/1.2.1/test_topology.py index 83045d50c..6140f0eca 100644 --- a/tests/transportpce_tests/1.2.1/test_topology.py +++ b/tests/transportpce_tests/1.2.1/test_topology.py @@ -16,12 +16,15 @@ import time import unittest import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCETopologyTesting(unittest.TestCase): processes = None + NODE_VERSION = '1.2.1' CHECK_DICT1 = { 'ROADMA01-SRG1': { 'node_type': 'SRG', @@ -93,7 +96,8 @@ class TransportPCETopologyTesting(unittest.TestCase): @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma', 'roadmb', 'roadmc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION), + ('roadmb', cls.NODE_VERSION), ('roadmc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -106,7 +110,7 @@ class TransportPCETopologyTesting(unittest.TestCase): time.sleep(5) def test_01_connect_ROADMA(self): - response = test_utils.mount_device("ROADMA01", 'roadma') + response = test_utils.mount_device("ROADMA01", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_getClliNetwork(self): @@ -188,7 +192,7 @@ class TransportPCETopologyTesting(unittest.TestCase): self.assertEqual(len(listNode), 0) def test_06_connect_XPDRA(self): - response = test_utils.mount_device("XPDRA01", 'xpdra') + response = test_utils.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_07_getClliNetwork(self): @@ -320,7 +324,7 @@ class TransportPCETopologyTesting(unittest.TestCase): self.assertEqual(len(check_list[link_type]), 0) def test_13_connect_ROADMC(self): - response = test_utils.mount_device("ROADMC01", 'roadmc') + response = test_utils.mount_device("ROADMC01", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_14_omsAttributes_ROADMA_ROADMC(self): @@ -523,7 +527,7 @@ class TransportPCETopologyTesting(unittest.TestCase): self.assertEqual(len(listNode), 0) def test_21_connect_ROADMB(self): - response = test_utils.mount_device("ROADMB01", 'roadmb') + response = test_utils.mount_device("ROADMB01", ('roadmb', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_22_omsAttributes_ROADMA_ROADMB(self): diff --git a/tests/transportpce_tests/2.2.1/__init__.py b/tests/transportpce_tests/2.2.1/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/transportpce_tests/2.2.1/common b/tests/transportpce_tests/2.2.1/common deleted file mode 120000 index 83323993b..000000000 --- a/tests/transportpce_tests/2.2.1/common +++ /dev/null @@ -1 +0,0 @@ -../common/ \ No newline at end of file diff --git a/tests/transportpce_tests/2.2.1/simulators.py b/tests/transportpce_tests/2.2.1/simulators.py deleted file mode 100644 index dd1ac0ca5..000000000 --- a/tests/transportpce_tests/2.2.1/simulators.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# Copyright (c) 2020 Orange, Inc. and others. All rights reserved. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import os - -SIMS = { - 'xpdra': {'port': '17840', 'configfile': 'oper-XPDRA.xml', 'logfile': 'oper-XPDRA.log'}, - 'roadma': {'port': '17841', 'configfile': 'oper-ROADMA.xml', 'logfile': 'oper-ROADMA.log'}, - 'roadmb': {'port': '17842', 'configfile': 'oper-ROADMB.xml', 'logfile': 'oper-ROADMB.log'}, - 'roadmc': {'port': '17843', 'configfile': 'oper-ROADMC.xml', 'logfile': 'oper-ROADMC.log'}, - 'roadmd': {'port': '17847', 'configfile': 'oper-ROADMD.xml', 'logfile': 'oper-ROADMD.log'}, - 'xpdrc': {'port': '17844', 'configfile': 'oper-XPDRC.xml', 'logfile': 'oper-XPDRC.log'}, - 'spdra': {'port': '17845', 'configfile': 'oper-SPDRA.xml', 'logfile': 'oper-SPDRA.log'}, - 'spdrc': {'port': '17846', 'configfile': 'oper-SPDRC.xml', 'logfile': 'oper-SPDRC.log'} -} - -HONEYNODE_EXECUTABLE = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "..", "..", "honeynode", "2.2.1", "honeynode-simulator", "honeycomb-tpce") -SAMPLES_DIRECTORY = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "..", "..", "sample_configs", "openroadm", "2.2.1") diff --git a/tests/transportpce_tests/2.2.1/test_end2end.py b/tests/transportpce_tests/2.2.1/test_end2end.py index 66a75089b..e68f79847 100644 --- a/tests/transportpce_tests/2.2.1/test_end2end.py +++ b/tests/transportpce_tests/2.2.1/test_end2end.py @@ -14,7 +14,9 @@ import base64 import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEFulltesting(unittest.TestCase): @@ -110,11 +112,15 @@ class TransportPCEFulltesting(unittest.TestCase): } WAITING = 20 # nominal value is 300 + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma', 'roadmc', 'xpdrc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), + ('roadma', cls.NODE_VERSION), + ('roadmc', cls.NODE_VERSION), + ('xpdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -127,19 +133,19 @@ class TransportPCEFulltesting(unittest.TestCase): print("execution of {}".format(self.id().split(".")[-1])) def test_01_connect_xpdrA(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_connect_xpdrC(self): - response = test_utils.mount_device("XPDR-C1", 'xpdrc') + response = test_utils.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_connect_rdmA(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_04_connect_rdmC(self): - response = test_utils.mount_device("ROADM-C1", 'roadmc') + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_05_connect_xprdA_N1_to_roadmA_PP1(self): diff --git a/tests/transportpce_tests/2.2.1/test_flex_grid.py b/tests/transportpce_tests/2.2.1/test_flex_grid.py index 21aa9989d..b48c9aacc 100644 --- a/tests/transportpce_tests/2.2.1/test_flex_grid.py +++ b/tests/transportpce_tests/2.2.1/test_flex_grid.py @@ -12,17 +12,20 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEPortMappingTesting(unittest.TestCase): processes = None + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['roadmd']) + cls.processes = test_utils.start_sims([('roadmd', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -35,7 +38,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): time.sleep(10) def test_01_rdm_device_connection(self): - response = test_utils.mount_device("ROADM-D1", 'roadmd') + response = test_utils.mount_device("ROADM-D1", ('roadmd', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) diff --git a/tests/transportpce_tests/2.2.1/test_nbinotifications.py b/tests/transportpce_tests/2.2.1/test_nbinotifications.py index b772b3667..628fa8f10 100644 --- a/tests/transportpce_tests/2.2.1/test_nbinotifications.py +++ b/tests/transportpce_tests/2.2.1/test_nbinotifications.py @@ -16,7 +16,8 @@ import sys import unittest import time import requests -from common import test_utils +sys.path.append('transportpce_tests/common/') +import test_utils class TransportNbiNotificationstesting(unittest.TestCase): @@ -111,6 +112,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): } WAITING = 20 # nominal value is 300 + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): @@ -132,7 +134,10 @@ class TransportNbiNotificationstesting(unittest.TestCase): print("NBI notification installation feature failed...") test_utils.shutdown_process(cls.processes[0]) sys.exit(2) - cls.processes = test_utils.start_sims(['xpdra', 'roadma', 'roadmc', 'xpdrc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), + ('roadma', cls.NODE_VERSION), + ('roadmc', cls.NODE_VERSION), + ('xpdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -145,19 +150,19 @@ class TransportNbiNotificationstesting(unittest.TestCase): print("execution of {}".format(self.id().split(".")[-1])) def test_01_connect_xpdrA(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_connect_xpdrC(self): - response = test_utils.mount_device("XPDR-C1", 'xpdrc') + response = test_utils.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_connect_rdmA(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_04_connect_rdmC(self): - response = test_utils.mount_device("ROADM-C1", 'roadmc') + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_05_connect_xprdA_N1_to_roadmA_PP1(self): diff --git a/tests/transportpce_tests/2.2.1/test_olm.py b/tests/transportpce_tests/2.2.1/test_olm.py index 53823dd75..67e609fa7 100644 --- a/tests/transportpce_tests/2.2.1/test_olm.py +++ b/tests/transportpce_tests/2.2.1/test_olm.py @@ -15,17 +15,23 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportOlmTesting(unittest.TestCase): processes = None + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma', 'roadmc', 'xpdrc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), + ('roadma', cls.NODE_VERSION), + ('roadmc', cls.NODE_VERSION), + ('xpdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -39,19 +45,19 @@ class TransportOlmTesting(unittest.TestCase): time.sleep(1) def test_01_xpdrA_device_connected(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_xpdrC_device_connected(self): - response = test_utils.mount_device("XPDR-C1", 'xpdrc') + response = test_utils.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_rdmA_device_connected(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_04_rdmC_device_connected(self): - response = test_utils.mount_device("ROADM-C1", 'roadmc') + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_05_connect_xprdA_to_roadmA(self): diff --git a/tests/transportpce_tests/2.2.1/test_otn_end2end.py b/tests/transportpce_tests/2.2.1/test_otn_end2end.py index 1803908f9..6e04ca93e 100644 --- a/tests/transportpce_tests/2.2.1/test_otn_end2end.py +++ b/tests/transportpce_tests/2.2.1/test_otn_end2end.py @@ -16,13 +16,16 @@ import base64 import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): processes = None WAITING = 20 # nominal value is 300 + NODE_VERSION = '2.2.1' cr_serv_sample_data = {"input": { "sdnc-request-header": { @@ -129,8 +132,10 @@ class TransportPCEtesting(unittest.TestCase): @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims( - ['spdra', 'roadma', 'roadmc', 'spdrc']) + cls.processes = test_utils.start_sims([('spdra', cls.NODE_VERSION), + ('roadma', cls.NODE_VERSION), + ('roadmc', cls.NODE_VERSION), + ('spdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -143,22 +148,22 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) def test_01_connect_spdrA(self): - response = test_utils.mount_device("SPDR-SA1", 'spdra') + response = test_utils.mount_device("SPDR-SA1", ('spdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_connect_spdrC(self): - response = test_utils.mount_device("SPDR-SC1", 'spdrc') + response = test_utils.mount_device("SPDR-SC1", ('spdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_connect_rdmA(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_04_connect_rdmC(self): - response = test_utils.mount_device("ROADM-C1", 'roadmc') + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) diff --git a/tests/transportpce_tests/2.2.1/test_otn_renderer.py b/tests/transportpce_tests/2.2.1/test_otn_renderer.py index a275c2ab4..65869f7ff 100644 --- a/tests/transportpce_tests/2.2.1/test_otn_renderer.py +++ b/tests/transportpce_tests/2.2.1/test_otn_renderer.py @@ -15,7 +15,9 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): @@ -33,11 +35,12 @@ class TransportPCEtesting(unittest.TestCase): 'lcp-hash-val': 'Swfw02qXGyI=', 'port-admin-state': 'InService', 'port-oper-state': 'InService'} + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['spdra']) + cls.processes = test_utils.start_sims([('spdra', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -50,7 +53,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) def test_01_connect_SPDR_SA1(self): - response = test_utils.mount_device("SPDR-SA1", 'spdra') + response = test_utils.mount_device("SPDR-SA1", ('spdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) diff --git a/tests/transportpce_tests/2.2.1/test_otn_sh_renderer.py b/tests/transportpce_tests/2.2.1/test_otn_sh_renderer.py index 4b047e2da..4d583c8c5 100644 --- a/tests/transportpce_tests/2.2.1/test_otn_sh_renderer.py +++ b/tests/transportpce_tests/2.2.1/test_otn_sh_renderer.py @@ -15,17 +15,21 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): processes = None + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['spdra', 'spdrc']) + cls.processes = test_utils.start_sims([('spdra', cls.NODE_VERSION), + ('spdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -38,7 +42,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) def test_01_connect_SPDR_SA1(self): - response = test_utils.mount_device("SPDR-SA1", 'spdra') + response = test_utils.mount_device("SPDR-SA1", ('spdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) @@ -51,7 +55,7 @@ class TransportPCEtesting(unittest.TestCase): 'connected') def test_02_connect_SPDR_SC1(self): - response = test_utils.mount_device("SPDR-SC1", 'spdrc') + response = test_utils.mount_device("SPDR-SC1", ('spdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) diff --git a/tests/transportpce_tests/2.2.1/test_otn_topology.py b/tests/transportpce_tests/2.2.1/test_otn_topology.py index fd80a5c75..84e3652c7 100644 --- a/tests/transportpce_tests/2.2.1/test_otn_topology.py +++ b/tests/transportpce_tests/2.2.1/test_otn_topology.py @@ -16,17 +16,20 @@ import unittest import time import logging import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): processes = None + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['spdra']) + cls.processes = test_utils.start_sims([('spdra', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -39,7 +42,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) def test_01_connect_SPDR_SA1(self): - response = test_utils.mount_device("SPDR-SA1", 'spdra') + response = test_utils.mount_device("SPDR-SA1", ('spdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) diff --git a/tests/transportpce_tests/2.2.1/test_portmapping.py b/tests/transportpce_tests/2.2.1/test_portmapping.py index 831cf0d99..9316b20b6 100644 --- a/tests/transportpce_tests/2.2.1/test_portmapping.py +++ b/tests/transportpce_tests/2.2.1/test_portmapping.py @@ -15,17 +15,20 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEPortMappingTesting(unittest.TestCase): processes = None + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -39,7 +42,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): time.sleep(10) def test_01_rdm_device_connection(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_rdm_device_connected(self): @@ -107,7 +110,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): res['mapping']) def test_08_xpdr_device_connection(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_09_xpdr_device_connected(self): diff --git a/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py b/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py index 432ae1294..0c2ab278a 100644 --- a/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py +++ b/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py @@ -15,17 +15,20 @@ import unittest #from unittest.result import failfast import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCERendererTesting(unittest.TestCase): processes = None + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -35,11 +38,11 @@ class TransportPCERendererTesting(unittest.TestCase): print("all processes killed") def test_01_rdm_device_connected(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_xpdr_device_connected(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_rdm_portmapping(self): diff --git a/tests/transportpce_tests/2.2.1/test_tapi.py b/tests/transportpce_tests/2.2.1/test_tapi.py index 7d0d0bd9e..150a4c1af 100644 --- a/tests/transportpce_tests/2.2.1/test_tapi.py +++ b/tests/transportpce_tests/2.2.1/test_tapi.py @@ -18,10 +18,9 @@ import os import sys import time import unittest - import requests - -from common import test_utils +sys.path.append('transportpce_tests/common/') +import test_utils CREATED_SUCCESSFULLY = 'Result message should contain Xponder Roadm Link created successfully' @@ -30,6 +29,7 @@ class TransportTapitesting(unittest.TestCase): processes = None WAITING = 20 + NODE_VERSION = '2.2.1' cr_serv_sample_data = {"input": { "sdnc-request-header": { "request-id": "request-1", @@ -154,7 +154,13 @@ class TransportTapitesting(unittest.TestCase): print("tapi installation feature failed...") test_utils.shutdown_process(cls.processes[0]) sys.exit(2) - cls.processes = test_utils.start_sims(['xpdra', 'roadma', 'roadmb', 'roadmc', 'xpdrc', 'spdra', 'spdrc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), + ('roadma', cls.NODE_VERSION), + ('roadmb', cls.NODE_VERSION), + ('roadmc', cls.NODE_VERSION), + ('xpdrc', cls.NODE_VERSION), + ('spdra', cls.NODE_VERSION), + ('spdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -203,7 +209,7 @@ class TransportTapitesting(unittest.TestCase): self.assertNotIn("link", res["output"]["topology"], 'Topology should contain no link') def test_03_connect_rdmb(self): - response = test_utils.mount_device("ROADM-B1", 'roadmb') + response = test_utils.mount_device("ROADM-B1", ('roadmb', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) @@ -238,7 +244,7 @@ class TransportTapitesting(unittest.TestCase): time.sleep(5) def test_06_connect_xpdra(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) @@ -246,12 +252,12 @@ class TransportTapitesting(unittest.TestCase): self.test_04_check_tapi_topos() def test_08_connect_rdma(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) def test_09_connect_rdmc(self): - response = test_utils.mount_device("ROADM-C1", 'roadmc') + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) @@ -334,7 +340,7 @@ class TransportTapitesting(unittest.TestCase): 'Topology should contain 1 oms link') def test_15_connect_xpdrc(self): - response = test_utils.mount_device("XPDR-C1", 'xpdrc') + response = test_utils.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) @@ -399,13 +405,13 @@ class TransportTapitesting(unittest.TestCase): 'Topology should contain 2 oms links') def test_20_connect_spdr_sa1(self): - response = test_utils.mount_device("SPDR-SA1", 'spdra') + response = test_utils.mount_device("SPDR-SA1", ('spdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) # TODO replace connect and disconnect timers with test_utils.wait_until_log_contains def test_21_connect_spdr_sc1(self): - response = test_utils.mount_device("SPDR-SC1", 'spdrc') + response = test_utils.mount_device("SPDR-SC1", ('spdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) time.sleep(10) # TODO replace connect and disconnect timers with test_utils.wait_until_log_contains diff --git a/tests/transportpce_tests/2.2.1/test_topo_portmapping.py b/tests/transportpce_tests/2.2.1/test_topo_portmapping.py index 66c0c23d3..d749323b9 100644 --- a/tests/transportpce_tests/2.2.1/test_topo_portmapping.py +++ b/tests/transportpce_tests/2.2.1/test_topo_portmapping.py @@ -15,17 +15,20 @@ import unittest import time import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): processes = None + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -39,7 +42,7 @@ class TransportPCEtesting(unittest.TestCase): # Connect the ROADMA def test_01_connect_rdm(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) # Verify the termination points of the ROADMA @@ -78,7 +81,7 @@ class TransportPCEtesting(unittest.TestCase): # #Connect the XPDRA def test_04_connect_xpdr(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) # #Verify the termination points related to XPDR diff --git a/tests/transportpce_tests/2.2.1/test_topology.py b/tests/transportpce_tests/2.2.1/test_topology.py index 60df28b48..8ab6386e8 100644 --- a/tests/transportpce_tests/2.2.1/test_topology.py +++ b/tests/transportpce_tests/2.2.1/test_topology.py @@ -17,7 +17,9 @@ import unittest import time import logging import requests -from common import test_utils +import sys +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCEtesting(unittest.TestCase): @@ -90,11 +92,13 @@ class TransportPCEtesting(unittest.TestCase): 'org-openroadm-common-network:operational-state': 'inService'})] } } + NODE_VERSION = '2.2.1' @classmethod def setUpClass(cls): cls.processes = test_utils.start_tpce() - cls.processes = test_utils.start_sims(['xpdra', 'roadma', 'roadmb', 'roadmc']) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION), + ('roadmb', cls.NODE_VERSION), ('roadmc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): @@ -107,7 +111,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) def test_01_connect_ROADM_A1(self): - response = test_utils.mount_device("ROADM-A1", 'roadma') + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_getClliNetwork(self): @@ -189,7 +193,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(len(listNode), 0) def test_06_connect_XPDRA(self): - response = test_utils.mount_device("XPDR-A1", 'xpdra') + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_07_getClliNetwork(self): @@ -320,7 +324,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(len(check_list[link_type]), 0) def test_13_connect_ROADMC(self): - response = test_utils.mount_device("ROADM-C1", 'roadmc') + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_14_omsAttributes_ROADMA_ROADMC(self): @@ -521,7 +525,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(len(listNode), 0) def test_21_connect_ROADMB(self): - response = test_utils.mount_device("ROADM-B1", 'roadmb') + response = test_utils.mount_device("ROADM-B1", ('roadmb', self.NODE_VERSION)) self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_22_omsAttributes_ROADMA_ROADMB(self): diff --git a/tests/transportpce_tests/7.1/__init__.py b/tests/transportpce_tests/7.1/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/transportpce_tests/7.1/common b/tests/transportpce_tests/7.1/common deleted file mode 120000 index 83323993b..000000000 --- a/tests/transportpce_tests/7.1/common +++ /dev/null @@ -1 +0,0 @@ -../common/ \ No newline at end of file diff --git a/tests/transportpce_tests/7.1/simulators.py b/tests/transportpce_tests/7.1/simulators.py deleted file mode 100644 index 5bdbbb579..000000000 --- a/tests/transportpce_tests/7.1/simulators.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# Copyright (c) 2020 Orange, Inc. and others. All rights reserved. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import os - -SIMS = {} - -HONEYNODE_EXECUTABLE = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "..", "..", "honeynode", "7.1", "honeynode-simulator", "honeycomb-tpce") -SAMPLES_DIRECTORY = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "..", "..", "sample_configs", "openroadm", "7.1") diff --git a/tests/transportpce_tests/7.1/test_pce_400G.py b/tests/transportpce_tests/7.1/test_pce_400G.py index 3b19c7c15..189e9245b 100644 --- a/tests/transportpce_tests/7.1/test_pce_400G.py +++ b/tests/transportpce_tests/7.1/test_pce_400G.py @@ -16,7 +16,8 @@ import os import sys import time import requests -from common import test_utils +sys.path.append('transportpce_tests/common/') +import test_utils class TransportPCE400Gtesting(unittest.TestCase): diff --git a/tests/transportpce_tests/common/log/.gitkeep b/tests/transportpce_tests/common/log/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/transportpce_tests/common/simulators.py b/tests/transportpce_tests/common/simulators.py deleted file mode 120000 index 18d5fb86a..000000000 --- a/tests/transportpce_tests/common/simulators.py +++ /dev/null @@ -1 +0,0 @@ -../simulators.py \ No newline at end of file diff --git a/tests/transportpce_tests/common/simulators.py b/tests/transportpce_tests/common/simulators.py new file mode 100644 index 000000000..95fe8d9da --- /dev/null +++ b/tests/transportpce_tests/common/simulators.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +############################################################################## +# Copyright (c) 2020 Orange, Inc. and others. All rights reserved. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import os + +SIMS = { + ('xpdra', '1.2.1'): {'port': '17830', 'configfile': 'oper-XPDRA.xml', 'logfile': 'xpdra-121.log'}, + ('roadma', '1.2.1'): {'port': '17831', 'configfile': 'oper-ROADMA.xml', 'logfile': 'roadma-121.log'}, + ('roadmb', '1.2.1'): {'port': '17832', 'configfile': 'oper-ROADMB.xml', 'logfile': 'roadmb-121.log'}, + ('roadmc', '1.2.1'): {'port': '17833', 'configfile': 'oper-ROADMC.xml', 'logfile': 'roadmc-121.log'}, + ('xpdrc', '1.2.1'): {'port': '17834', 'configfile': 'oper-XPDRC.xml', 'logfile': 'xpdrc-121.log'}, + ('roadma-full', '1.2.1'): {'port': '17821', 'configfile': 'oper-ROADMA-full.xml', 'logfile': 'roadma-121.log'}, + ('roadmc-full', '1.2.1'): {'port': '17823', 'configfile': 'oper-ROADMC-full.xml', 'logfile': 'roadmc-121.log'}, + ('xpdra', '2.2.1'): {'port': '17840', 'configfile': 'oper-XPDRA.xml', 'logfile': 'xpdra-221.log'}, + ('roadma', '2.2.1'): {'port': '17841', 'configfile': 'oper-ROADMA.xml', 'logfile': 'roadma-221.log'}, + ('roadmb', '2.2.1'): {'port': '17842', 'configfile': 'oper-ROADMB.xml', 'logfile': 'roadmb-221.log'}, + ('roadmc', '2.2.1'): {'port': '17843', 'configfile': 'oper-ROADMC.xml', 'logfile': 'roadmc-221.log'}, + ('roadmd', '2.2.1'): {'port': '17847', 'configfile': 'oper-ROADMD.xml', 'logfile': 'roadmd-221.log'}, + ('xpdrc', '2.2.1'): {'port': '17844', 'configfile': 'oper-XPDRC.xml', 'logfile': 'xpdrc-221.log'}, + ('spdra', '2.2.1'): {'port': '17845', 'configfile': 'oper-SPDRA.xml', 'logfile': 'spdra-221.log'}, + ('spdrc', '2.2.1'): {'port': '17846', 'configfile': 'oper-SPDRC.xml', 'logfile': 'spdrc-221.log'}, + ('xpdra', '7.1'): {'port': '17850', 'configfile': 'oper-XPDRA.xml', 'logfile': 'xpdra-71.log'}, + ('roadma', '7.1'): {'port': '17851', 'configfile': 'oper-ROADMA.xml', 'logfile': 'roadma-71.log'}, + ('roadmb', '7.1'): {'port': '17852', 'configfile': 'oper-ROADMB.xml', 'logfile': 'roadmb-71.log'}, + ('roadmc', '7.1'): {'port': '17853', 'configfile': 'oper-ROADMC.xml', 'logfile': 'roadmc-71.log'}, + ('xpdrc', '7.1'): {'port': '17854', 'configfile': 'oper-XPDRC.xml', 'logfile': 'xpdrc-71.log'}, + ('xpdra2', '7.1'): {'port': '17857', 'configfile': 'oper-XPDRA2.xml', 'logfile': 'xpdra2-71.log'}, + ('xpdrc2', '7.1'): {'port': '17858', 'configfile': 'oper-XPDRC2.xml', 'logfile': 'xpdrc2-71.log'} +} \ No newline at end of file diff --git a/tests/transportpce_tests/common/test_utils.py b/tests/transportpce_tests/common/test_utils.py index 7ca0d6660..dfbd32f72 100644 --- a/tests/transportpce_tests/common/test_utils.py +++ b/tests/transportpce_tests/common/test_utils.py @@ -25,8 +25,6 @@ import requests import simulators SIMS = simulators.SIMS -HONEYNODE_EXECUTABLE = simulators.HONEYNODE_EXECUTABLE -SAMPLES_DIRECTORY = simulators.SAMPLES_DIRECTORY HONEYNODE_OK_START_MSG = "Netconf SSH endpoint started successfully at 0.0.0.0" KARAF_OK_START_MSG = re.escape( @@ -60,8 +58,7 @@ TYPE_APPLICATION_XML = {'Content-Type': 'application/xml', 'Accept': 'applicatio CODE_SHOULD_BE_200 = 'Http status code should be 200' CODE_SHOULD_BE_201 = 'Http status code should be 201' -LOG_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) - +SIM_LOG_DIRECTORY = os.path.join(os.path.dirname(os.path.realpath(__file__)), "log") KARAF_LOG = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "..", "..", "karaf", "target", "assembly", "data", "log", "karaf.log") @@ -76,13 +73,13 @@ else: def start_sims(sims_list): for sim in sims_list: - print("starting simulator for " + sim + "...") - log_file = os.path.join(LOG_DIRECTORY, SIMS[sim]['logfile']) - process = start_honeynode(log_file, SIMS[sim]['port'], SIMS[sim]['configfile']) - if wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 200): - print("simulator for " + sim + " started") + print("starting simulator " + sim[0] + " in OpenROADM device version " + sim[1] + "...") + log_file = os.path.join(SIM_LOG_DIRECTORY, SIMS[sim]['logfile']) + process = start_honeynode(log_file, sim) + if wait_until_log_contains(log_file, HONEYNODE_OK_START_MSG, 100): + print("simulator for " + sim[0] + " started") else: - print("simulator for " + sim + " failed to start") + print("simulator for " + sim[0] + " failed to start") shutdown_process(process) for pid in process_list: shutdown_process(pid) @@ -434,11 +431,15 @@ def shutdown_process(process): process.send_signal(signal.SIGINT) -def start_honeynode(log_file: str, node_port: str, node_config_file_name: str): - if os.path.isfile(HONEYNODE_EXECUTABLE): +def start_honeynode(log_file: str, sim): + executable = os.path.join(os.path.dirname(os.path.realpath(__file__)), + "..", "..", "honeynode", sim[1], "honeynode-simulator", "honeycomb-tpce") + sample_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), + "..", "..", "sample_configs", "openroadm", sim[1]) + if os.path.isfile(executable): with open(log_file, 'w') as outfile: return subprocess.Popen( - [HONEYNODE_EXECUTABLE, node_port, os.path.join(SAMPLES_DIRECTORY, node_config_file_name)], + [executable, SIMS[sim]['port'], os.path.join(sample_directory, SIMS[sim]['configfile'])], stdout=outfile, stderr=outfile) return None @@ -492,4 +493,3 @@ class TimeOut: def __exit__(self, type, value, traceback): # pylint: disable=W0622 signal.alarm(0) - -- 2.36.6