summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test
diff options
context:
space:
mode:
Diffstat (limited to 'test/scenario_test')
-rw-r--r--test/scenario_test/docker_control.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/test/scenario_test/docker_control.py b/test/scenario_test/docker_control.py
index 13118ea8..3da6e5da 100644
--- a/test/scenario_test/docker_control.py
+++ b/test/scenario_test/docker_control.py
@@ -189,19 +189,31 @@ def make_install_file(use_local=False):
def docker_container_stop_quagga(quagga):
- cmd = "docker rm -f " + quagga
+ if docker_check_running(quagga):
+ cmd = "docker stop " + quagga
+ local(cmd, capture=True)
+
+ cmd = "docker rm " + quagga
local(cmd, capture=True)
cmd = "rm -rf " + CONFIG_DIRR + quagga
local(cmd, capture=True)
def docker_container_stop_gobgp():
- cmd = "docker rm -f " + GOBGP_CONTAINER_NAME
+ if docker_check_running(GOBGP_CONTAINER_NAME):
+ cmd = "docker stop " + GOBGP_CONTAINER_NAME
+ local(cmd, capture=True)
+
+ cmd = "docker rm " + GOBGP_CONTAINER_NAME
local(cmd, capture=True)
def docker_container_stop_exabgp():
- cmd = "docker rm -f " + EXABGP_CONTAINER_NAME
+ if docker_check_running(EXABGP_CONTAINER_NAME):
+ cmd = "docker stop " + EXABGP_CONTAINER_NAME
+ local(cmd, capture=True)
+
+ cmd = "docker rm " + EXABGP_CONTAINER_NAME
local(cmd, capture=True)
@@ -219,6 +231,14 @@ def docker_containers_destroy():
local(cmd, capture=True)
+def docker_check_running(cname):
+ cmd = "docker ps | awk '{print $NF}'"
+ outbuf = local(cmd, capture=True)
+ docker_ps = outbuf.split('\n')
+ if cname in docker_ps:
+ return True
+
+
def docker_container_quagga_append(quagga_num, bridge):
print "start append docker container."
docker_container_run_quagga(quagga_num, bridge)
@@ -342,11 +362,6 @@ def make_config_append(quagga_num, go_path, bridge, peer_opts="", policy_pattern
local(cmd, capture=True)
-def change_exabgp_version():
- cmd = "docker exec exabgp git -C /root/exabgp pull origin master"
- local(cmd, capture=True)
-
-
def reload_config():
cmd = "docker exec gobgp /usr/bin/pkill gobgpd -SIGHUP"
local(cmd, capture=True)
@@ -562,8 +577,6 @@ def init_malformed_test_env_executor(conf_file, use_local, go_path, exabgp_path
local(cmd, capture=True)
cmd = "docker exec exabgp cp -rf " + SHARE_VOLUME + "/exabgp /root/"
local(cmd, capture=True)
- else:
- change_exabgp_version()
start_gobgp()