def test_malformed_packet(): pwd = os.getcwd() pattern = check_pattern() if fab.test_user_check() is False: print "you are not root" sys.exit(1) if fab.docker_pkg_check() is False: print "not install docker package." sys.exit(1) if len(pattern) <= 0: print "read test pattern is faild." print "pattern element is " + str(len(pattern)) sys.exit(1) use_local = parser_option.use_local log_debug = True if parser_option.gobgp_log_level == 'debug' else False go_path = parser_option.go_path exabgp_path = parser_option.exabgp_path fab.init_malformed_test_env_executor(use_local, go_path, exabgp_path, log_debug) for pkey in pattern: conf_file = pwd + "/exabgp_test_conf/" + pkey if os.path.isfile(conf_file) is True: fab.start_exabgp(pkey) yield check_func, pkey, pattern[pkey] fab.stop_exabgp() else: print "config file not exists." print conf_file sys.exit(1)
def test_malformed_packet(): pwd = os.getcwd() pattern = check_pattern() if fab.test_user_check() is False: print "you are not root" sys.exit(1) if fab.docker_pkg_check() is False: print "not install docker package." sys.exit(1) if len(pattern) <= 0: print "read test pattern is faild." print "pattern element is " + str(len(pattern)) sys.exit(1) use_local = parser_option.use_local log_debug = parser_option.gobgp_log_debug go_path = parser_option.go_path exabgp_path = parser_option.exabgp_path fab.init_malformed_test_env_executor(use_local, go_path, exabgp_path, log_debug) for pkey in pattern: conf_file = pwd + "/exabgp_test_conf/" + pkey if os.path.isfile(conf_file) is True: fab.start_exabgp(pkey) yield check_func, pkey, pattern[pkey] fab.stop_exabgp() else: print "config file not exists." print conf_file sys.exit(1)
def test_malformed_packet(): pwd = os.getcwd() pattern = check_pattern() if fab.test_user_check() is False: print "you are not root" sys.exit(1) if fab.docker_pkg_check() is False: print "not install docker package." sys.exit(1) if len(pattern) <= 0: print "read test pattern is faild." print "pattern element is " + str(len(pattern)) sys.exit(1) use_local = parser_option.use_local log_debug = parser_option.gobgp_log_debug go_path = parser_option.go_path exabgp_path = parser_option.exabgp_path for pkey in pattern: conf_file = pwd + "/exabgp_test_conf/" + pkey if os.path.isfile(conf_file) is True: fab.init_malformed_test_env_executor(pkey, use_local, go_path, exabgp_path, log_debug) print "please wait (" + str(initial_wait_time) + " second)" time.sleep(initial_wait_time) yield check_func, pkey, pattern[pkey] else: print "config file not exists." print conf_file sys.exit(1)
# soft reset print "soft_reset" self.soft_reset(peer2, IPv4) # check local-rib self.assertTrue(path_exists_in_localrib(peer3,prefix1)) self.assertTrue(path_exists_in_localrib(peer3,prefix2)) self.assertTrue(path_exists_in_localrib(peer3,prefix3)) # check local-adj-out-rib self.assertTrue(path_exists_in_adj_rib_out(peer3, prefix1)) self.assertFalse(path_exists_in_adj_rib_out(peer3, prefix2,r=3)) self.assertTrue(path_exists_in_adj_rib_out(peer3, prefix3)) # check show ip bgp on peer3(quagga3) self.assertTrue(path_exists_in_routing_table(peer3, prefix1)) self.assertFalse(path_exists_in_routing_table(peer3, prefix2,r=3)) self.assertTrue(path_exists_in_routing_table(peer3, prefix3)) if __name__ == '__main__': if fab.test_user_check() is False: print "you are not root." sys.exit(1) if fab.docker_pkg_check() is False: print "not install docker package." sys.exit(1) nose.main(argv=sys.argv, addplugins=[OptionParser()], defaultTest=sys.argv[0])
retry_count = 0 check_result = False while retry_count < self.dest_check_limit: check_result = check_func() if check_result: print "compare OK" break else: retry_count += 1 print "compare NG -> retry ( %d / %d )" % ( retry_count, self.dest_check_limit) time.sleep(self.wait_per_retry) self.assertEqual(check_result, True) if __name__ == '__main__': if fab.test_user_check() is False: print "you are not root." sys.exit(1) if fab.docker_pkg_check() is False: print "not install docker package." sys.exit(1) nose.main(argv=sys.argv, addplugins=[OptionParser()], defaultTest=sys.argv[0])