summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-08-20 12:02:36 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-08-25 15:53:14 +0900
commitb3c874da2581eb71d8c137d956e792565193ec0e (patch)
tree563169c8233d48a10fd5d45ac805e1320a89c532 /test
parenta17ee18e5b1fe90a7c80d6cb1f0778b97f00235a (diff)
server/api: fix GetRib API to return sorted destination
the feature has been broken. Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test')
-rw-r--r--test/scenario_test/bgp_router_test.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/scenario_test/bgp_router_test.py b/test/scenario_test/bgp_router_test.py
index 10821137..f6831f79 100644
--- a/test/scenario_test/bgp_router_test.py
+++ b/test/scenario_test/bgp_router_test.py
@@ -390,6 +390,30 @@ class GoBGPTestBase(unittest.TestCase):
self.assertTrue(cnt == 1)
+ def test_21_check_cli_sorted(self):
+ g1 = self.gobgp
+ cnt = 0
+ def next_prefix():
+ for i in range(100, 105):
+ for j in range(100, 105):
+ yield '{0}.{1}.0.0/24'.format(i, j)
+
+ for p in next_prefix():
+ g1.local('gobgp global rib add {0}'.format(p))
+ cnt += 1
+
+ cnt2 = 0
+ g = next_prefix()
+ n = g.next()
+ for path in g1.get_global_rib():
+ if path['prefix'] == n:
+ try:
+ cnt2 += 1
+ n = g.next()
+ except StopIteration:
+ break
+
+ self.assertTrue(cnt == cnt2)
if __name__ == '__main__':
if os.geteuid() is not 0: