From 1adfa485d578af59b653c9b2d141b12a97e89fb7 Mon Sep 17 00:00:00 2001 From: Naoto Hanaue Date: Wed, 1 Jul 2015 16:06:24 +0900 Subject: scenario_test: add the test of med actioin --- test/scenario_test/gobgp_test.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/scenario_test/gobgp_test.py') diff --git a/test/scenario_test/gobgp_test.py b/test/scenario_test/gobgp_test.py index 452b7f7a..1333afad 100644 --- a/test/scenario_test/gobgp_test.py +++ b/test/scenario_test/gobgp_test.py @@ -321,6 +321,32 @@ class GoBGPTestBase(unittest.TestCase): return False + # get route information on quagga + def check_med(self, neighbor_address, target_addr, med, retry=3, interval=-1, af=IPv4): + if interval < 0: + interval = self.wait_per_retry + print "check route %s on quagga : %s" % (target_addr, neighbor_address) + retry_count = 0 + + while True: + tn = qaccess.login(neighbor_address) + result = qaccess.check_med(tn, target_addr, med, af) + qaccess.logout(tn) + + if result: + return True + else: + print "target path %s with med %s is none" % (target_addr, med) + + retry_count += 1 + if retry_count > retry: + break + else: + print "wait (" + str(interval) + " seconds)" + time.sleep(interval) + + return False + def compare_rib_with_quagga_configs(self, rib_owner_addr, local_rib): for quagga_config in self.quagga_configs: -- cgit v1.2.3