diff options
author | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-06-09 17:44:49 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-06-09 23:07:36 +0900 |
commit | a97129f1400f2be76942124f535fb9831063aa5a (patch) | |
tree | f9bfd33aafe2c6709f62393794ef14b5bf9abb35 /test | |
parent | 2f82a1a6e6f4ab69d00f647c852713107cb94ec0 (diff) |
scenario_test: build gobgp only at the beginning of the policy scenario test
Diffstat (limited to 'test')
-rw-r--r-- | test/scenario_test/docker_control.py | 119 | ||||
-rw-r--r-- | test/scenario_test/route_server_policy_test.py | 121 |
2 files changed, 122 insertions, 118 deletions
diff --git a/test/scenario_test/docker_control.py b/test/scenario_test/docker_control.py index 3da6e5da..29b382b3 100644 --- a/test/scenario_test/docker_control.py +++ b/test/scenario_test/docker_control.py @@ -153,6 +153,14 @@ def create_config_dir(): cmd = "mkdir " + CONFIG_DIR local(cmd, capture=True) + +def recreate_conf_dir(dirname): + cmd = "rm -rf " + dirname + local(cmd, capture=True) + cmd = "mkdir " + dirname + local(cmd, capture=True) + + def make_startup_file(log_opt=""): file_buff = '#!/bin/bash' + '\n' file_buff += "cd /go/src/github.com/osrg/gobgp/gobgpd" + '\n' @@ -199,18 +207,19 @@ def docker_container_stop_quagga(quagga): local(cmd, capture=True) -def docker_container_stop_gobgp(): +def docker_container_stop_gobgp(remove=True): if docker_check_running(GOBGP_CONTAINER_NAME): - cmd = "docker stop " + GOBGP_CONTAINER_NAME + cmd = "docker stop --time=1 " + GOBGP_CONTAINER_NAME local(cmd, capture=True) - cmd = "docker rm " + GOBGP_CONTAINER_NAME - local(cmd, capture=True) + if remove: + cmd = "docker rm " + GOBGP_CONTAINER_NAME + local(cmd, capture=True) def docker_container_stop_exabgp(): if docker_check_running(EXABGP_CONTAINER_NAME): - cmd = "docker stop " + EXABGP_CONTAINER_NAME + cmd = "docker stop --time=1 " + EXABGP_CONTAINER_NAME local(cmd, capture=True) cmd = "docker rm " + EXABGP_CONTAINER_NAME @@ -276,9 +285,16 @@ def bridge_unsetting_for_docker_connection(): local(cmd, capture=True) -def start_gobgp(): +def build_gobgp(): cmd = "docker exec gobgp " + INSTALL_FILE local(cmd, capture=True) + + +def start_gobgp(build=True): + if build: + cmd = "docker exec gobgp " + INSTALL_FILE + local(cmd, capture=True) + cmd = "docker exec -d gobgp " + STARTUP_FILE local(cmd, capture=True) @@ -368,6 +384,39 @@ def reload_config(): print "gobgp config reloaded." +def prepare_gobgp(log_debug, use_local): + + # cleanup gobgp container + docker_container_stop_gobgp(remove=True) + recreate_conf_dir(CONFIG_DIRR) + + # set log option + opt = "-l debug" if log_debug else "" + # execute local gobgp program in the docker container if the input option is local + make_startup_file(log_opt=opt) + if use_local: + print "execute gobgp program in local machine." + pwd = local("pwd", capture=True) + if A_PART_OF_CURRENT_DIR in pwd: + gobgp_path = re.sub(A_PART_OF_CURRENT_DIR, "", pwd) + cmd = "cp -r " + gobgp_path + " " + CONFIG_DIRR + local(cmd, capture=True) + make_install_file(use_local=True) + else: + print "local gobgp dosen't exist." + print "get the latest master gobgp from github." + make_install_file() + else: + print "execute gobgp program of osrg/master in github." + make_install_file() + change_owner_to_root(CONFIG_DIR) + + cmd = "docker run --privileged=true -v " + CONFIG_DIR + ":" + SHARE_VOLUME + " -d --name " \ + + GOBGP_CONTAINER_NAME + " -id osrg/gobgp" + local(cmd, capture=True) + build_gobgp() + + def init_test_env_executor(quagga_num, use_local, go_path, log_debug=False, is_route_server=True): print "start initialization of test environment." @@ -420,25 +469,33 @@ def init_policy_test_env_executor(quagga_num, use_local, go_path, log_debug=Fals print "start initialization of test environment." if docker_container_check() or bridge_setting_check(): - print "gobgp test environment already exists." - print "so that remake gobgp test environment." - docker_containers_destroy() - - print "make gobgp policy test environment." - create_config_dir() + print "gobgp test environment already exists. clean up..." + containers = docker_containers_get() + for container in containers: + if re.match(r'q[0-9][0-9]*', container) is not None: + docker_container_stop_quagga(container) + if container == GOBGP_CONTAINER_NAME: + docker_container_stop_gobgp(remove=False) + if container == EXABGP_CONTAINER_NAME: + docker_container_stop_exabgp() + bridge_unsetting_for_docker_connection() + # cmd = "rm -rf " + CONFIG_DIRR + # local(cmd, capture=True) + + # print "make gobgp policy test environment." + # create_config_dir() - if use_ipv6: - global IP_VERSION - IP_VERSION = IPv6 - else: - global IP_VERSION - IP_VERSION = IPv4 + global IP_VERSION + IP_VERSION = IPv6 if use_ipv6 else IPv4 bridge_setting_for_docker_connection(BRIDGES) make_config(quagga_num, go_path, BRIDGE_0, policy_pattern=policy) # run gobgp docker container - docker_container_run_gobgp(BRIDGE_0) + # docker_container_run_gobgp(BRIDGE_0) + cmd = "docker start %s" % GOBGP_CONTAINER_NAME + local(cmd, capture=True) + docker_container_set_ipaddress(BRIDGE_0, GOBGP_CONTAINER_NAME, GOBGP_ADDRESS_0[IP_VERSION] + BASE_MASK[IP_VERSION]) if use_exabgp: # run exabgp @@ -447,29 +504,7 @@ def init_policy_test_env_executor(quagga_num, use_local, go_path, log_debug=Fals cmd = "docker exec exabgp cp -rf " + SHARE_VOLUME + "/exabgp /root/" local(cmd, capture=True) - # set log option - opt = "-l debug" if log_debug else "" - - # execute local gobgp program in the docker container if the input option is local - make_startup_file(log_opt=opt) - if use_local: - print "execute gobgp program in local machine." - pwd = local("pwd", capture=True) - if A_PART_OF_CURRENT_DIR in pwd: - gobgp_path = re.sub(A_PART_OF_CURRENT_DIR, "", pwd) - cmd = "cp -r " + gobgp_path + " " + CONFIG_DIRR - local(cmd, capture=True) - make_install_file(use_local=True) - else: - print "local gobgp dosen't exist." - print "get the latest master gobgp from github." - make_install_file() - else: - print "execute gobgp program of osrg/master in github." - make_install_file() - - change_owner_to_root(CONFIG_DIR) - start_gobgp() + start_gobgp(build=False) # run quagga docker container for num in range(1, quagga_num + 1): diff --git a/test/scenario_test/route_server_policy_test.py b/test/scenario_test/route_server_policy_test.py index f673747d..5f358b84 100644 --- a/test/scenario_test/route_server_policy_test.py +++ b/test/scenario_test/route_server_policy_test.py @@ -40,7 +40,15 @@ class GoBGPTest(GoBGPTestBase): self.use_ipv6_gobgp = False self.use_exa_bgp = False self.retry_count_common = 2 - self.initial_wait_time = 5 + self.initial_wait_time = 1 + self.wait_per_retry = 3 + + + @classmethod + def setUpClass(cls): + 'called once, before any tests' + print 'prepare gobgp' + fab.prepare_gobgp(parser_option.gobgp_log_debug, parser_option.use_local) def initialize(self, policy_pattern=None): @@ -220,7 +228,7 @@ class GoBGPTest(GoBGPTestBase): self.assertTrue(path_exists_in_localrib(peer1,prefix3)) self.assertTrue(path_exists_in_localrib(peer3,prefix1)) - self.assertFalse(path_exists_in_localrib(peer3,prefix2,r=3)) + self.assertFalse(path_exists_in_localrib(peer3,prefix2,r=1)) self.assertFalse(path_exists_in_localrib(peer3,prefix3,r=0)) # check show ip bgp on peer1(quagga1) @@ -230,7 +238,7 @@ class GoBGPTest(GoBGPTestBase): # 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.assertFalse(path_exists_in_routing_table(peer3, prefix2,r=1)) self.assertFalse(path_exists_in_routing_table(peer3, prefix3,r=0)) # check adj-rib-out in peer2 @@ -249,12 +257,12 @@ class GoBGPTest(GoBGPTestBase): # check local-rib self.assertTrue(path_exists_in_localrib(peer3,prefix1)) - self.assertFalse(path_exists_in_localrib(peer3,prefix2,r=3)) + self.assertFalse(path_exists_in_localrib(peer3,prefix2,r=1)) self.assertTrue(path_exists_in_localrib(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=0)) + self.assertFalse(path_exists_in_routing_table(peer3, prefix2,r=1)) self.assertTrue(path_exists_in_routing_table(peer3, prefix3)) @@ -338,8 +346,8 @@ class GoBGPTest(GoBGPTestBase): # check peer3 rib-out self.assertTrue(path_exists_in_adj_rib_out(peer3,prefix1)) - self.assertFalse(path_exists_in_adj_rib_out(peer3,prefix2,r=3)) - self.assertFalse(path_exists_in_adj_rib_out(peer3,prefix3,r=3)) + self.assertFalse(path_exists_in_adj_rib_out(peer3,prefix2,r=1)) + self.assertFalse(path_exists_in_adj_rib_out(peer3,prefix3,r=1)) # check show ip bgp on peer1(quagga1) self.assertTrue(path_exists_in_routing_table(peer1, prefix1)) @@ -348,8 +356,8 @@ class GoBGPTest(GoBGPTestBase): # 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.assertFalse(path_exists_in_routing_table(peer3, prefix3,r=0)) + self.assertFalse(path_exists_in_routing_table(peer3, prefix2,r=1)) + self.assertFalse(path_exists_in_routing_table(peer3, prefix3,r=1)) # check adj-rib-out in peer2 peer2 = "10.0.0.2" @@ -373,12 +381,12 @@ class GoBGPTest(GoBGPTestBase): # 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.assertFalse(path_exists_in_adj_rib_out(peer3, prefix2,r=1)) 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.assertFalse(path_exists_in_routing_table(peer3, prefix2,r=1)) self.assertTrue(path_exists_in_routing_table(peer3, prefix3)) """ @@ -426,7 +434,7 @@ class GoBGPTest(GoBGPTestBase): self.assertIsNone(path) # check show ip bgp on peer1(quagga3) - qpath = self.get_route(peer3, r1, retry=self.retry_count_common, interval=w, af=IPv6) + qpath = self.get_route(peer3, r1, retry=1, interval=w, af=IPv6) print qpath self.assertIsNone(qpath) @@ -480,7 +488,7 @@ class GoBGPTest(GoBGPTestBase): self.assertIsNone(path) # check show ip bgp on peer1(quagga3) - qpath = self.get_route(peer3, r1, retry=self.retry_count_common, interval=w, af=IPv6) + qpath = self.get_route(peer3, r1, retry=1, interval=w, af=IPv6) # print qpath self.assertIsNone(qpath) @@ -559,8 +567,8 @@ class GoBGPTest(GoBGPTestBase): self.assertTrue(path_exists_in_localrib(peer1, r3)) self.assertTrue(path_exists_in_localrib(peer3, r1)) - self.assertFalse(path_exists_in_localrib(peer3, r2, r=3)) - self.assertFalse(path_exists_in_localrib(peer3, r3, r=0)) + self.assertFalse(path_exists_in_localrib(peer3, r2, r=1)) + self.assertFalse(path_exists_in_localrib(peer3, r3, r=1)) # check show ip bgp on peer1(quagga1) self.assertTrue(path_exists_in_routing_table(peer1, r1)) @@ -569,8 +577,8 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer3(quagga3) self.assertTrue(path_exists_in_routing_table(peer3, r1)) - self.assertFalse(path_exists_in_routing_table(peer3, r2, r=3)) - self.assertFalse(path_exists_in_routing_table(peer3, r3, r=0)) + self.assertFalse(path_exists_in_routing_table(peer3, r2, r=1)) + self.assertFalse(path_exists_in_routing_table(peer3, r3, r=1)) # check adj-rib-out in peer2 self.assertTrue(path_exists_in_adj_rib_in(peer2, r1)) @@ -588,12 +596,12 @@ class GoBGPTest(GoBGPTestBase): # check local-rib self.assertTrue(path_exists_in_localrib(peer3, r1)) - self.assertFalse(path_exists_in_localrib(peer3, r2, r=3)) + self.assertFalse(path_exists_in_localrib(peer3, r2, r=1)) self.assertTrue(path_exists_in_localrib(peer3, r3)) # check show ip bgp on peer3(quagga3) self.assertTrue(path_exists_in_routing_table(peer3, r1)) - self.assertFalse(path_exists_in_routing_table(peer3, r2, r=0)) + self.assertFalse(path_exists_in_routing_table(peer3, r2, r=1)) self.assertTrue(path_exists_in_routing_table(peer3, r3)) """ @@ -681,8 +689,8 @@ class GoBGPTest(GoBGPTestBase): # check peer3 rib-out self.assertTrue(path_exists_in_adj_rib_out(peer3, r1)) - self.assertFalse(path_exists_in_adj_rib_out(peer3, r2, r=3)) - self.assertFalse(path_exists_in_adj_rib_out(peer3, r3, r=3)) + self.assertFalse(path_exists_in_adj_rib_out(peer3, r2, r=1)) + self.assertFalse(path_exists_in_adj_rib_out(peer3, r3, r=1)) # check show ip bgp on peer1(quagga1) self.assertTrue(path_exists_in_routing_table(peer1, r1)) @@ -691,8 +699,8 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer3(quagga3) self.assertTrue(path_exists_in_routing_table(peer3, r1)) - self.assertFalse(path_exists_in_routing_table(peer3, r2, r=3)) - self.assertFalse(path_exists_in_routing_table(peer3, r3, r=0)) + self.assertFalse(path_exists_in_routing_table(peer3, r2, r=1)) + self.assertFalse(path_exists_in_routing_table(peer3, r3, r=1)) # check adj-rib-out in peer2 self.assertTrue(path_exists_in_adj_rib_in(peer2, r1)) @@ -715,13 +723,13 @@ class GoBGPTest(GoBGPTestBase): # check local-adj-out-rib self.assertTrue(path_exists_in_adj_rib_out(peer3, r1)) - self.assertFalse(path_exists_in_adj_rib_out(peer3, r2, r=3)) + self.assertFalse(path_exists_in_adj_rib_out(peer3, r2, r=1)) # Currently this test fails because of export_policy handling self.assertTrue(path_exists_in_adj_rib_out(peer3, r3)) # check show ip bgp on peer3(quagga3) self.assertTrue(path_exists_in_routing_table(peer3, r1)) - self.assertFalse(path_exists_in_routing_table(peer3, r2, r=3)) + self.assertFalse(path_exists_in_routing_table(peer3, r2, r=1)) self.assertTrue(path_exists_in_routing_table(peer3, r3)) @@ -765,12 +773,12 @@ class GoBGPTest(GoBGPTestBase): self.assertIsNotNone(qpath) # check adj-rib-out in peer2 - path = self.get_paths_in_localrib(peer2, prefix1,retry=0) + path = self.get_paths_in_localrib(peer2, prefix1, retry=0) # print path self.assertIsNone(path) # check show ip bgp on peer2(quagga2) - qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) + qpath = self.get_route(peer2,prefix1, retry=1) # print qpath self.assertIsNone(qpath) @@ -816,12 +824,12 @@ class GoBGPTest(GoBGPTestBase): self.assertIsNotNone(qpath) # check adj-rib-out in peer2 - path = self.get_paths_in_localrib(peer2, prefix1,retry=0) + path = self.get_paths_in_localrib(peer2, prefix1, retry=0) # print path self.assertIsNone(path) # check show ip bgp on peer2(quagga2) - qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) + qpath = self.get_route(peer2,prefix1, retry=1) # print qpath self.assertIsNone(qpath) @@ -863,17 +871,14 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 - path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - # print path + path = self.get_paths_in_localrib(peer2, prefix1, retry=0) self.assertIsNone(path) # check show ip bgp on peer2(quagga2) - qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - # print qpath + qpath = self.get_route(peer2,prefix1, retry=1) self.assertIsNone(qpath) """ @@ -918,12 +923,10 @@ class GoBGPTest(GoBGPTestBase): # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - # print path self.assertIsNone(path) # check show ip bgp on peer2(quagga2) - qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - # print qpath + qpath = self.get_route(peer2,prefix1, retry=1) self.assertIsNone(qpath) @@ -963,17 +966,14 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - # print path self.assertIsNone(path) # check show ip bgp on peer2(quagga2) - qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - # print qpath + qpath = self.get_route(peer2,prefix1, retry=1) self.assertIsNone(qpath) @@ -1014,17 +1014,14 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - print path self.assertIsNotNone(path) # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) @@ -1065,16 +1062,15 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 - path = self.get_paths_in_localrib(peer2, prefix1,retry=0) + path = self.get_paths_in_localrib(peer2, prefix1,retry=1) # print path self.assertIsNone(path) # check show ip bgp on peer2(quagga2) - qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) + qpath = self.get_route(peer2,prefix1, retry=1) # print qpath self.assertIsNone(qpath) @@ -1121,12 +1117,12 @@ class GoBGPTest(GoBGPTestBase): self.assertIsNotNone(qpath) # check adj-rib-out in peer2 - path = self.get_paths_in_localrib(peer2, prefix1,retry=0) + path = self.get_paths_in_localrib(peer2, prefix1, retry=1, interval=3) # print path self.assertIsNone(path) # check show ip bgp on peer2(quagga2) - qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) + qpath = self.get_route(peer2,prefix1, retry=1) # print qpath self.assertIsNone(qpath) @@ -1168,19 +1164,16 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - print path self.assertIsNotNone(path) attrs = [x for x in path[0]['attrs'] if 'communites' in x ] self.assertTrue((65100 << 16 | 20) in attrs[0]['communites']) # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) self.assertTrue(self.check_community(peer2, prefix1.split('/')[0], '65100:20')) @@ -1223,12 +1216,10 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - print path self.assertIsNotNone(path) attrs = [x for x in path[0]['attrs'] if 'communites' in x ] self.assertTrue((65100 << 16 | 20) in attrs[0]['communites']) @@ -1236,7 +1227,6 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) self.assertTrue(self.check_community(peer2, prefix1.split('/')[0], '65100:20')) self.assertTrue(self.check_community(peer2, prefix1.split('/')[0], '65100:30')) @@ -1280,12 +1270,10 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - print path self.assertIsNotNone(path) attrs = [x for x in path[0]['attrs'] if 'communites' in x ] self.assertTrue((65100 << 16 | 20) not in attrs[0]['communites']) @@ -1293,7 +1281,6 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:20', retry=1)) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:30', retry=1)) @@ -1338,21 +1325,16 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - print path self.assertIsNotNone(path) attrs = [x for x in path[0]['attrs'] if 'communites' in x ] self.assertFalse('communites' in attrs) - # self.assertTrue((65100 << 16 | 20) not in attrs[0]['communites']) - # self.assertTrue((65100 << 16 | 30) not in attrs[0]['communites']) # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:20', retry=1)) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:30', retry=1)) @@ -1396,24 +1378,20 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - print path self.assertIsNotNone(path) attrs = [x for x in path[0]['attrs'] if 'communites' in x ] self.assertFalse((65100 << 16 | 20) in attrs[0]['communites']) # check out-rib path = self.get_adj_rib_out(peer2, prefix1, retry=0) - print path attrs = [x for x in path['attrs'] if 'communites' in x ] self.assertTrue((65100 << 16 | 20) in attrs[0]['communites']) # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) self.assertTrue(self.check_community(peer2, prefix1.split('/')[0], '65100:20')) @@ -1468,7 +1446,6 @@ class GoBGPTest(GoBGPTestBase): self.assertFalse((65100 << 16 | 30) in attrs[0]['communites']) # check out-rib path = self.get_adj_rib_out(peer2, prefix1, retry=1) - print path attrs = [x for x in path['attrs'] if 'communites' in x ] self.assertTrue((65100 << 16 | 20) in attrs[0]['communites']) self.assertTrue((65100 << 16 | 30) in attrs[0]['communites']) @@ -1520,19 +1497,16 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=1) - print path self.assertIsNotNone(path) attrs = [x for x in path[0]['attrs'] if 'communites' in x ] self.assertTrue((65100 << 16 | 20) in attrs[0]['communites']) self.assertTrue((65100 << 16 | 30) in attrs[0]['communites']) # check out-rib path = self.get_adj_rib_out(peer2, prefix1, retry=1) - print path attrs = [x for x in path['attrs'] if 'communites' in x ] self.assertFalse((65100 << 16 | 20) in attrs[0]['communites']) self.assertFalse((65100 << 16 | 30) in attrs[0]['communites']) @@ -1540,7 +1514,6 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:20', retry=1)) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:30', retry=1)) @@ -1585,12 +1558,10 @@ class GoBGPTest(GoBGPTestBase): # check show ip bgp on peer1(quagga1) qpath = self.get_route(peer1,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) # check adj-rib-out in peer2 path = self.get_paths_in_localrib(peer2, prefix1,retry=0) - print path self.assertIsNotNone(path) attrs = [x for x in path[0]['attrs'] if 'communites' in x ] self.assertTrue((65100 << 16 | 10) in attrs[0]['communites']) @@ -1598,13 +1569,11 @@ class GoBGPTest(GoBGPTestBase): self.assertTrue((65100 << 16 | 30) in attrs[0]['communites']) # check out-rib path = self.get_adj_rib_out(peer2, prefix1, retry=1) - print path attrs = [x for x in path['attrs'] if 'communites' in x ] self.assertFalse('communites' in attrs) # check show ip bgp on peer2(quagga2) qpath = self.get_route(peer2,prefix1, retry=self.retry_count_common) - print qpath self.assertIsNotNone(qpath) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:20', retry=1)) self.assertFalse(self.check_community(peer2, prefix1.split('/')[0], '65100:30', retry=1)) |