scenario_test: fix malformed test

This commit is contained in:
Naoto Hanaue
2015-06-10 16:50:29 +09:00
committed by Hiroshi Yokoi
parent 42234c30bc
commit f60ec00e0b
2 changed files with 20 additions and 10 deletions
+13 -2
View File
@@ -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):
@@ -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