summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/docker_control.py
diff options
context:
space:
mode:
authorHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-06-24 21:32:11 +0900
committerHiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp>2015-07-01 14:26:31 +0900
commitd45e2c9dfafb78001dd3b17fe42c1eb822bff3e9 (patch)
treeb1c5315fe35da5e89d876ab0d82900d3b4ab3cc2 /test/scenario_test/docker_control.py
parent8339ada8dfffd086a4fadc10e729bbe07d3e3e83 (diff)
scenario_test: add test cases for distribute policy
Diffstat (limited to 'test/scenario_test/docker_control.py')
-rw-r--r--test/scenario_test/docker_control.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/scenario_test/docker_control.py b/test/scenario_test/docker_control.py
index f3d24fdd..056d43cd 100644
--- a/test/scenario_test/docker_control.py
+++ b/test/scenario_test/docker_control.py
@@ -315,7 +315,7 @@ def get_notification_from_exabgp_log():
return err_mgs
-def make_config(quagga_num, go_path, bridge, peer_opts="", use_compiled=False):
+def make_config(quagga_num, go_path, bridge, peer_opts="", use_compiled=False, ipver=''):
if go_path != "":
print "specified go path is [ " + go_path + " ]."
if os.path.isdir(go_path):
@@ -328,12 +328,14 @@ def make_config(quagga_num, go_path, bridge, peer_opts="", use_compiled=False):
if use_compiled:
tool = pwd + "/quagga-rsconfig "
+ # I want to avoid a global variable.
+ ip_version = ipver if ipver else IP_VERSION
cmd = tool + " -n " + str(quagga_num) +\
- " -c /tmp/gobgp -v " + IP_VERSION + " -i " + bridge["BRIDGE_NAME"][-1] + " " + peer_opts
+ " -c /tmp/gobgp -v " + ip_version + " -i " + bridge["BRIDGE_NAME"][-1] + " " + peer_opts
local(cmd, capture=True)
-def update_policy_config(go_path, neighbor, policy_name, target, isReplace=False):
+def update_policy_config(go_path, neighbor, policy_name, target, isReplace=False, defaultReject=False):
if go_path != "":
print "specified go path is [ " + go_path + " ]."
if os.path.isdir(go_path):
@@ -343,12 +345,13 @@ def update_policy_config(go_path, neighbor, policy_name, target, isReplace=False
pwd = local("pwd", capture=True)
replace = ' -r' if isReplace else ''
- cmd = pwd + "/policy_generator -d /tmp/gobgp -n " + neighbor + " -t " + target + " -p " + policy_name + replace
+ reject = ' -j' if defaultReject else ''
+ cmd = pwd + "/policy_generator -d /tmp/gobgp -n " + neighbor + " -t " + target + " -p " + policy_name + replace + reject
local(cmd, capture=True)
# reload_config()
-def make_config_append(quagga_num, go_path, bridge, peer_opts=""):
+def make_config_append(quagga_num, go_path, bridge, peer_opts="", use_compiled=False, ipver=''):
if go_path != "":
print "specified go path is [ " + go_path + " ]."
if os.path.isdir(go_path):
@@ -356,9 +359,14 @@ def make_config_append(quagga_num, go_path, bridge, peer_opts=""):
else:
print "specified go path do not use."
pwd = local("pwd", capture=True)
+ ip_version = ipver if ipver else IP_VERSION
- cmd = go_path + "go run " + pwd + "/quagga-rsconfig.go -a " + str(quagga_num) +\
- " -c /tmp/gobgp -v " + IP_VERSION + " -i " + bridge["BRIDGE_NAME"][-1] + " " + peer_opts
+ tool = go_path + "go run " + pwd + "/quagga-rsconfig.go "
+ if use_compiled:
+ tool = pwd + "/quagga-rsconfig "
+
+ cmd = tool + " -a " + str(quagga_num) +\
+ " -c /tmp/gobgp -v " + ip_version + " -i " + bridge["BRIDGE_NAME"][-1] + " " + peer_opts
local(cmd, capture=True)
@@ -379,7 +387,7 @@ def build_config_tools(go_path):
pwd = local("pwd", capture=True)
cmd = go_path + "go build " + pwd + "/quagga-rsconfig.go"
local(cmd, capture=True)
- cmd = go_path + "go build " + pwd + "/policy_generator.go"
+ cmd = go_path + "go build " + pwd + "/policy/policy_generator.go"
local(cmd, capture=True)