def setUpClass(cls):
     # pylint: disable=unsubscriptable-object
     # TODO: for lighty manage the activation of NBI notification feature
     cls.init_failed = False
     cls.processes = test_utils.start_tpce()
     # NBI notification feature is not installed by default in Karaf
     if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True':
         print("installing NBI notification feature...")
         result = test_utils.install_karaf_feature(
             "odl-transportpce-nbinotifications")
         if result.returncode != 0:
             cls.init_failed = True
         print("Restarting OpenDaylight...")
         test_utils.shutdown_process(cls.processes[0])
         cls.processes[0] = test_utils.start_karaf()
         test_utils.process_list[0] = cls.processes[0]
         cls.init_failed = not test_utils.wait_until_log_contains(
             test_utils.KARAF_LOG,
             test_utils.KARAF_OK_START_MSG,
             time_to_wait=60)
     if cls.init_failed:
         print("NBI notification installation feature failed...")
         test_utils.shutdown_process(cls.processes[0])
         sys.exit(2)
     cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION),
                                            ('roadma', cls.NODE_VERSION),
                                            ('roadmc', cls.NODE_VERSION),
                                            ('xpdrc', cls.NODE_VERSION)])
Example #2
0
    def setUpClass(cls):
        cls.init_failed = False

        print("starting opendaylight...")
        cls.odl_process = test_utils.start_tpce()
        if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True':
            karaf_log = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..", "..",
                "karaf", "target", "assembly", "data", "log", "karaf.log")
            searched_expr = re.escape("Blueprint container for bundle "
                                      "org.opendaylight.netconf.restconf"
                                      ) + ".* was successfully created"
            found = test_utils.wait_until_log_contains(karaf_log,
                                                       searched_expr,
                                                       time_to_wait=60)
            cls.init_failed = not found
            if not cls.init_failed:
                print("opendaylight started")
                print("installing tapi feature...")
                result = test_utils.install_karaf_feature(
                    "odl-transportpce-tapi")
                if result.returncode != 0:
                    cls.init_failed = True
                print("Restarting opendaylight...")
                test_utils.shutdown_process(cls.odl_process)
                cls.odl_process = test_utils.start_tpce()
                found = test_utils.wait_until_log_contains(karaf_log,
                                                           searched_expr,
                                                           time_to_wait=60)
                cls.init_failed = not found
        if not cls.init_failed:
            print("starting XPDRA...")
            cls.honeynode_process1 = test_utils.start_xpdra_honeynode()

            print("starting ROADMA...")
            cls.honeynode_process2 = test_utils.start_roadma_honeynode()

            print("starting ROADMC...")
            cls.honeynode_process3 = test_utils.start_roadmc_honeynode()

            print("starting XPDRC...")
            cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()

            print("starting SPDRA...")
            cls.honeynode_process5 = test_utils.start_spdra_honeynode()
            print("all honeynodes started")
    def setUpClass(cls):
        # pylint: disable=bare-except
        sample_files_parsed = False
        try:
            TOPO_CLLINET_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "clliNetwork.json")
            with open(TOPO_CLLINET_FILE, 'r',
                      encoding='utf-8') as topo_cllinet:
                cls.topo_cllinet_data = topo_cllinet.read()

            TOPO_ORDNET_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "openroadmNetwork.json")
            with open(TOPO_ORDNET_FILE, 'r', encoding='utf-8') as topo_ordnet:
                cls.topo_ordnet_data = topo_ordnet.read()

            TOPO_ORDTOPO_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "openroadmTopology.json")
            with open(TOPO_ORDTOPO_FILE, 'r',
                      encoding='utf-8') as topo_ordtopo:
                cls.topo_ordtopo_data = topo_ordtopo.read()
            PORT_MAPPING_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "gnpy_portmapping_121.json")
            with open(PORT_MAPPING_FILE, 'r',
                      encoding='utf-8') as port_mapping:
                cls.port_mapping_data = port_mapping.read()
            sample_files_parsed = True
        except PermissionError as err:
            print("Permission Error when trying to read sample files\n", err)
            sys.exit(2)
        except FileNotFoundError as err:
            print("File Not found Error when trying to read sample files\n",
                  err)
            sys.exit(2)
        except:
            print("Unexpected error when trying to read sample files\n",
                  sys.exc_info()[0])
            sys.exit(2)
        finally:
            if sample_files_parsed:
                print("sample files content loaded")

        with open('gnpy.log', 'w', encoding='utf-8') as outfile:
            print('starting GNPy REST server...')
            # pylint: disable=consider-using-with
            test_utils.process_list.append(
                subprocess.Popen(['gnpy-rest'],
                                 stdout=outfile,
                                 stderr=outfile,
                                 stdin=None))
        cls.processes = test_utils.start_tpce()
    def setUpClass(cls):
        # pylint: disable=bare-except
        sample_files_parsed = False
        try:
            TOPO_BI_DIR_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "honeynode-topo400G.json")
            with open(TOPO_BI_DIR_FILE, 'r', encoding='utf-8') as topo_bi_dir:
                cls.topo_bi_dir_data = topo_bi_dir.read()

            OTN_TOPO_BI_DIR_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "honeynode-otntopo400G.json")
            with open(OTN_TOPO_BI_DIR_FILE, 'r',
                      encoding='utf-8') as otn_topo_bi_dir:
                cls.otn_topo_bi_dir_data = otn_topo_bi_dir.read()

            OTUC4_OTN_TOPO_BI_DIR_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "honeynode-otntopo400GwithOTUC4.json")
            with open(OTUC4_OTN_TOPO_BI_DIR_FILE, 'r',
                      encoding='utf-8') as otuc4_otn_topo_bi_dir:
                cls.otuc4_otn_topo_bi_dir_data = otuc4_otn_topo_bi_dir.read()

            ODUC4_OTN_TOPO_BI_DIR_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "honeynode-otntopo400GwithODUC4.json")
            with open(ODUC4_OTN_TOPO_BI_DIR_FILE, 'r',
                      encoding='utf-8') as oduc4_otn_topo_bi_dir:
                cls.oduc4_otn_topo_bi_dir_data = oduc4_otn_topo_bi_dir.read()

            PORT_MAPPING_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "pce_portmapping_71.json")
            with open(PORT_MAPPING_FILE, 'r',
                      encoding='utf-8') as port_mapping:
                cls.port_mapping_data = port_mapping.read()
            sample_files_parsed = True
        except PermissionError as err:
            print("Permission Error when trying to read sample files\n", err)
            sys.exit(2)
        except FileNotFoundError as err:
            print("File Not found Error when trying to read sample files\n",
                  err)
            sys.exit(2)
        except:
            print("Unexpected error when trying to read sample files\n",
                  sys.exc_info()[0])
            sys.exit(2)
        finally:
            if sample_files_parsed:
                print("sample files content loaded")
        cls.processes = test_utils.start_tpce()
Example #5
0
    def setUpClass(cls):
        # pylint: disable=bare-except
        try:
            sample_files_parsed = False
            TOPO_BI_DIR_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "honeynode-topo.xml")
            with open(TOPO_BI_DIR_FILE, 'r') as topo_bi_dir:
                cls.simple_topo_bi_dir_data = topo_bi_dir.read()

            TOPO_UNI_DIR_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "NW-simple-topology.xml")

            with open(TOPO_UNI_DIR_FILE, 'r') as topo_uni_dir:
                cls.simple_topo_uni_dir_data = topo_uni_dir.read()

            TOPO_UNI_DIR_COMPLEX_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "NW-for-test-5-4.xml")
            with open(TOPO_UNI_DIR_COMPLEX_FILE, 'r') as topo_uni_dir_complex:
                cls.complex_topo_uni_dir_data = topo_uni_dir_complex.read()
            PORT_MAPPING_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "pce_portmapping_121.json")
            with open(PORT_MAPPING_FILE, 'r') as port_mapping:
                cls.port_mapping_data = port_mapping.read()
            sample_files_parsed = True
        except PermissionError as err:
            print("Permission Error when trying to read sample files\n", err)
            sys.exit(2)
        except FileNotFoundError as err:
            print("File Not found Error when trying to read sample files\n",
                  err)
            sys.exit(2)
        except:
            print("Unexpected error when trying to read sample files\n",
                  sys.exc_info()[0])
            sys.exit(2)
        finally:
            if sample_files_parsed:
                print("sample files content loaded")

        cls.processes = test_utils.start_tpce()
Example #6
0
    def setUpClass(cls):
        # pylint: disable=bare-except
        try:
            sample_files_parsed = False
            TOPO_CLLINET_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "clliNetwork.json")
            with open(TOPO_CLLINET_FILE, 'r') as topo_cllinet:
                cls.topo_cllinet_data = topo_cllinet.read()

            TOPO_ORDNET_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "openroadmNetwork.json")
            with open(TOPO_ORDNET_FILE, 'r') as topo_ordnet:
                cls.topo_ordnet_data = topo_ordnet.read()

            TOPO_ORDTOPO_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "openroadmTopology.json")
            with open(TOPO_ORDTOPO_FILE, 'r') as topo_ordtopo:
                cls.topo_ordtopo_data = topo_ordtopo.read()
            PORT_MAPPING_FILE = os.path.join(
                os.path.dirname(os.path.realpath(__file__)), "..", "..",
                "sample_configs", "gnpy", "gnpy_portmapping_121.json")
            with open(PORT_MAPPING_FILE, 'r') as port_mapping:
                cls.port_mapping_data = port_mapping.read()
            sample_files_parsed = True
        except PermissionError as err:
            print("Permission Error when trying to read sample files\n", err)
            sys.exit(2)
        except FileNotFoundError as err:
            print("File Not found Error when trying to read sample files\n",
                  err)
            sys.exit(2)
        except:
            print("Unexpected error when trying to read sample files\n",
                  sys.exc_info()[0])
            sys.exit(2)
        finally:
            if sample_files_parsed:
                print("sample files content loaded")

        cls.processes = test_utils.start_tpce()
Example #7
0
    def setUpClass(cls):
        print("starting honeynode1...")
        cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
        time.sleep(20)

        print("starting honeynode2...")
        cls.honeynode_process2 = test_utils.start_roadma_full_honeynode()
        time.sleep(20)

        print("starting honeynode3...")
        cls.honeynode_process3 = test_utils.start_roadmc_full_honeynode()
        time.sleep(20)

        print("starting honeynode4...")
        cls.honeynode_process4 = test_utils.start_xpdrc_honeynode()
        time.sleep(20)
        print("all honeynodes started")

        print("starting opendaylight...")
        cls.odl_process = test_utils.start_tpce()
        time.sleep(60)
        print("opendaylight started")
Example #8
0
 def setUpClass(cls):
     print("starting opendaylight...")
     cls.odl_process = test_utils.start_tpce()
     time.sleep(30)
     print("opendaylight started")