def setup_module(mod): """ Sets up the pytest environment * `mod`: module name """ global topo testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) logger.info("Running setup_module to create topology") # This function initiates the topology build with Topogen... tgen = Topogen(CreateTopo, mod.__name__) # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, topo) # Starting topology, create tmp files which are loaded to routers # to start deamons and then start routers start_topology(tgen, daemons) # Creating configuration from JSON build_config_from_json(tgen, topo) # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) logger.info("Running setup_module() done")
def setup_module(mod): """ Sets up the pytest environment * `mod`: module name """ testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: %s", testsuite_run_time) logger.info("=" * 40) topology = """ _______r2_____ | | iperf | | iperf r0-----r1-------------r3-----r5 | | |_____________| r4 """ logger.info("Master Topology: \n %s", topology) logger.info("Running setup_module to create topology") # This function initiates the topology build with Topogen... json_file = "{}/multicast_pim_static_rp.json".format(CWD) tgen = Topogen(json_file, mod.__name__) global TOPO TOPO = tgen.json_topo # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, TOPO) # Starting topology, create tmp files which are loaded to routers # to start daemons and then start routers start_topology(tgen, daemons) # Don"t run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) # Creating configuration from JSON build_config_from_json(tgen, TOPO) # Verify PIM neighbors result = verify_pim_neighbors(tgen, TOPO) assert result is True, "setup_module :Failed \n Error:" " {}".format( result) # XXX Replace this using "with McastTesterHelper()... " in each test if possible. global app_helper app_helper = McastTesterHelper(tgen) logger.info("Running setup_module() done")
def setup_module(mod): """ Sets up the pytest environment * `mod`: module name """ # Required linux kernel version for this suite to run. result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) logger.info("Master Topology: \n {}".format(TOPOLOGY)) logger.info("Running setup_module to create topology") # This function initiates the topology build with Topogen... json_file = "{}/mcast_pim_bsmp_02.json".format(CWD) tgen = Topogen(json_file, mod.__name__) global topo topo = tgen.json_topo # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, topo) # Starting topology, create tmp files which are loaded to routers # to start daemons and then start routers start_topology(tgen, daemons) # Don"t run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) # Creating configuration from JSON build_config_from_json(tgen, topo) # Verify PIM neighbors result = verify_pim_neighbors(tgen, topo) assert result is True, " Verify PIM neighbor: Failed Error: {}".format( result) # XXX Replace this using "with McastTesterHelper()... " in each test if possible. global app_helper app_helper = McastTesterHelper(tgen) logger.info("Running setup_module() done")
def setup_module_from_json(testfile, json_file=None): """Do the standard module setup for JSON based test. * `testfile` : The path to the testfile. The name is used to derive the json config file name as well (removing `test_` prefix and replacing `.py` suffix with `.json` """ # Create topology object tgen = create_tgen_from_json(testfile, json_file) # Start routers (and their daemons) start_topology(tgen, topo_daemons(tgen)) # Configure routers build_config_from_json(tgen) assert not tgen.routers_have_failure() return tgen
def setup_module(mod): """ Sets up the pytest environment * `mod`: module name """ # Required linux kernel version for this suite to run. result = required_linux_kernel_version("4.19") if result is not True: pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) logger.info("Master Topology: \n {}".format(TOPOLOGY)) logger.info("Running setup_module to create topology") testdir = os.path.dirname(os.path.realpath(__file__)) json_file = "{}/pim_dr_nondr_with_transit_router_topo3.json".format(testdir) tgen = Topogen(json_file, mod.__name__) global topo topo = tgen.json_topo # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, tgen.json_topo) # Starting topology, create tmp files which are loaded to routers # to start deamons and then start routers start_topology(tgen, daemons) # Don"t run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) # Creating configuration from JSON build_config_from_json(tgen, tgen.json_topo) # XXX Replace this using "with McastTesterHelper()... " in each test if possible. global app_helper app_helper = McastTesterHelper(tgen) logger.info("Running setup_module() done")
def setup_module(mod): return pytest.skip("OSPF GR helper mode is currently broken") """ Sets up the pytest environment * `mod`: module name """ global topo, intf, intf1, sw_name, pkt testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) logger.info("Running setup_module to create topology") # This function initiates the topology build with Topogen... json_file = "{}/ospf_gr_helper.json".format(CWD) tgen = Topogen(json_file, mod.__name__) global topo topo = tgen.json_topo # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, topo) # Starting topology, create tmp files which are loaded to routers # to start deamons and then start routers start_topology(tgen, daemons) # Creating configuration from JSON build_config_from_json(tgen, topo) # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) ospf_covergence = verify_ospf_neighbor(tgen, topo, lan=True) assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence) sw_name = "s1" intf = topo["routers"]["r0"]["links"][sw_name]["interface"] intf1 = topo["routers"]["r1"]["links"][sw_name]["interface"] pkt = topo["routers"]["r1"]["opq_lsa_hex"] logger.info("Running setup_module() done")
def setup_module(mod): """ Sets up the pytest environment * `mod`: module name """ global topo, switch_name testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) logger.info("Running setup_module to create topology") # This function initiates the topology build with Topogen... json_file = "{}/ospfv3_ecmp_lan.json".format(CWD) tgen = Topogen(json_file, mod.__name__) global topo topo = tgen.json_topo # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, topo) # Starting topology, create tmp files which are loaded to routers # to start daemons and then start routers start_topology(tgen, daemons) # Creating configuration from JSON build_config_from_json(tgen, topo) # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) # Api call verify whether OSPF is converged ospf_covergence = verify_ospf6_neighbor(tgen, topo, lan=True) assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence) switch_name = [k for k in topo["switches"].keys()][0] logger.info("Running setup_module() done")
def setup_module(mod): """Sets up the pytest environment.""" global topo testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) logger.info("Running setup_module to create topology") # This function initiates the topology build with Topogen... tgen = Topogen(CreateTopo, mod.__name__) # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, topo) # Starting topology, create tmp files which are loaded to routers # to start daemons and then start routers start_topology(tgen, daemons) # Creating configuration from JSON build_config_from_json(tgen, topo) # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) # Api call verify whether OSPF converged ospf_covergence_ipv4 = verify_ospf_neighbor(tgen, topo) assert ospf_covergence_ipv4 is True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence_ipv4 ) # Api call verify whether OSPF6 converged ospf_covergence_ipv6 = verify_ospf6_neighbor(tgen, topo) assert ospf_covergence_ipv6 is True, "setup_module :Failed \n Error:" " {}".format( ospf_covergence_ipv6 ) logger.info("Running setup_module() done")
def setup_module(mod): """ Sets up the pytest environment * `mod`: module name """ # Required linux kernel version for this suite to run. result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) logger.info("Master Topology: \n {}".format(TOPOLOGY)) logger.info("Running setup_module to create topology") # This function initiates the topology build with Topogen... tgen = Topogen(CreateTopo, mod.__name__) # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. daemons = topo_daemons(tgen, topo) # Starting topology, create tmp files which are loaded to routers # to start deamons and then start routers start_topology(tgen, daemons) # Don"t run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) # Creating configuration from JSON build_config_from_json(tgen, topo) logger.info("Running setup_module() done")