diff options
author | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-05-28 15:00:21 +0900 |
---|---|---|
committer | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-06-10 16:50:29 +0900 |
commit | f60ec00e0b3cc5dcfcf78e1a3dfd1b85be31e678 (patch) | |
tree | 343d7bd09fbff6892ad379e477a4137418301a00 | |
parent | 42234c30bc98af1339752477539938d462c9969d (diff) |
scenario_test: fix malformed test
-rw-r--r-- | test/scenario_test/docker_control.py | 15 | ||||
-rw-r--r-- | test/scenario_test/route_server_malformed_test.py | 15 |
2 files changed, 20 insertions, 10 deletions
diff --git a/test/scenario_test/docker_control.py b/test/scenario_test/docker_control.py index 29b382b3..83918d41 100644 --- a/test/scenario_test/docker_control.py +++ b/test/scenario_test/docker_control.py @@ -307,6 +307,18 @@ def start_exabgp(conf_file): local(cmd, capture=True) +def stop_exabgp(): + cmd = "docker exec exabgp pkill -9 python" + local(cmd, capture=True) + log_path = CONFIG_DIRR + EXABGP_LOG_FILE + clean_log(log_path) + + +def clean_log(file_path): + cmd = ": > " + file_path + local(cmd, capture=True) + + def get_notification_from_exabgp_log(): log_path = CONFIG_DIRR + EXABGP_LOG_FILE cmd = "grep notification " + log_path + " | head -1" @@ -564,7 +576,7 @@ def init_ipv6_test_env_executor(quagga_num, use_local, go_path, log_debug=False) print "complete initialization of test environment." -def init_malformed_test_env_executor(conf_file, use_local, go_path, exabgp_path, log_debug=False): +def init_malformed_test_env_executor(use_local, go_path, exabgp_path, log_debug=False): print "start initialization of exabgp test environment." if docker_container_check() or bridge_setting_check(): @@ -617,7 +629,6 @@ def init_malformed_test_env_executor(conf_file, use_local, go_path, exabgp_path # run quagga docker container docker_container_run_quagga(1, BRIDGE_0) - start_exabgp(conf_file) def docker_container_quagga_append_executor(quagga_num, go_path, is_route_server=True): diff --git a/test/scenario_test/route_server_malformed_test.py b/test/scenario_test/route_server_malformed_test.py index ab1f12bd..1a76f6aa 100644 --- a/test/scenario_test/route_server_malformed_test.py +++ b/test/scenario_test/route_server_malformed_test.py @@ -28,9 +28,8 @@ from noseplugin import OptionParser from noseplugin import parser_option from constant import CONFIG_DIR, CLI_CMD -initial_wait_time = 10 -wait_per_retry = 5 -retry_limit = (60 - initial_wait_time) / wait_per_retry +wait_per_retry = 2 +retry_limit = 60 / wait_per_retry gobgp_ip = "10.0.255.1" gobgp_port = "8080" @@ -79,14 +78,14 @@ def test_malformed_packet(): 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.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) + fab.start_exabgp(pkey) yield check_func, pkey, pattern[pkey] - + fab.stop_exabgp() else: print "config file not exists." print conf_file @@ -127,9 +126,9 @@ def check_func(exabgp_conf, result): remote_ip = neighbor['conf']['remote_ip'] if remote_ip == "10.0.0.1": q_state = neighbor['info']['bgp_state'] - q_transitions = neighbor['info']['fsm_established_transitions'] q_address = remote_ip if q_state == "BGP_FSM_ESTABLISHED": + q_transitions = neighbor['info']['fsm_established_transitions'] in_prepare_quagga = False else: e_address = remote_ip |