summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/quagga_access.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/scenario_test/quagga_access.py')
-rw-r--r--test/scenario_test/quagga_access.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/scenario_test/quagga_access.py b/test/scenario_test/quagga_access.py
index 634dc439..a04ccd59 100644
--- a/test/scenario_test/quagga_access.py
+++ b/test/scenario_test/quagga_access.py
@@ -144,6 +144,7 @@ def lookup_prefix(tn, prefix, af):
return paths
+
def check_community(tn, addr, community, af=IPv4):
if af == IPv4:
tn.write("show ip bgp community " + community + "\n")
@@ -157,4 +158,21 @@ def check_community(tn, addr, community, af=IPv4):
if addr in line:
return True
- return False \ No newline at end of file
+ return False
+
+
+def check_med(tn, addr, med, af=IPv4):
+ if af == IPv4:
+ tn.write("show ip bgp " + addr[0] + "\n")
+ elif af == IPv6:
+ tn.write("show bgp ipv6 " + addr[0] + "\n")
+ else:
+ print "invalid af: ", af
+ return
+ result = tn.read_until("bgpd#")
+ for line in result.split("\n"):
+ if "metric" in line:
+ if str(med) in line.split()[3]:
+ return True
+
+ return False