4 Authors: Baohua Yang@IBM, Denghui Huang@IBM
7 Usage: Before running the test tool, should
8 1. Start 2-layer tree topology network. e.g., in Mininet, run
9 'sudo mn --controller=remote,ip=127.0.0.1 --mac --topo tree,2'.
10 2. Configure gateway in the controller web GUI, name = 'gateway', subnet = '10.0.0.254/24'.
11 3. In Mininet, run 'h1 ping h2' to make sure the network is connected.
15 from restlib import * # noqa
18 def test_module(module_name):
20 Run single test on given module.
22 print "#Test case: " + module_name.replace('_', ' ')
23 cmd = 'python -m doctest ' + module_name + '.py'
27 def run(modules=None):
29 Run test cases according to the given modules.
30 If no parameter is given, then will scan the case directory,
31 and try to run all cases.
33 backup_dir = os.getcwd()
35 modules = [e[:-3] for e in os.listdir(MODULES_DIR) if e.endswith('.py')]
36 os.chdir(backup_dir + '/' + MODULES_DIR)
42 if __name__ == '__main__':
44 test_modules = ['switch_manager', 'topology_manager', 'forwarding_rule_manager', 'statistics_manager',
45 'host_tracker', 'arp_handler', 'forwarding_manager', 'container_manager']
46 # test_modules = ['topology_manager']