diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-24 23:05:50 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-26 17:49:48 +0900 |
commit | 301b48532d4a5510c9d4ffdc44eb2754fdd1a3d1 (patch) | |
tree | 28aef2b5ef206121c745b304636d8f6abfedce8b /test | |
parent | a5763c20d4ab411a3d6375cad32c8c8255c43a64 (diff) |
support received, accepted, and advertised counters per family
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'test')
-rw-r--r-- | test/scenario_test/aspath_test.py | 34 | ||||
-rw-r--r-- | test/scenario_test/route_server_test2.py | 13 |
2 files changed, 32 insertions, 15 deletions
diff --git a/test/scenario_test/aspath_test.py b/test/scenario_test/aspath_test.py index d6349efe..e88e0de4 100644 --- a/test/scenario_test/aspath_test.py +++ b/test/scenario_test/aspath_test.py @@ -73,12 +73,18 @@ class GoBGPTestBase(unittest.TestCase): def test_02_check_reject_as_loop(self): def f(): - s = self.g2.get_neighbor(self.q1)['state'] - self.assertTrue('received' in s) - self.assertEqual(s.get('received', 0), 1) - # hacky. 'accepted' is zero so the key was deleted due to - # omitempty tag in bgp_configs.go. - self.assertFalse('accepted' in s) + r = self.g2.get_neighbor(self.q1) + self.assertTrue('afi_safis' in r) + received = 0 + for afisafi in r['afi_safis']: + self.assertTrue('state' in afisafi) + s = afisafi.get('state') + self.assertTrue('received' in s) + received += s.get('received') + # hacky. 'accepted' is zero so the key was deleted due to + # omitempty tag in bgp_configs.go. + self.assertFalse(s.get('accepted'), None) + self.assertEqual(received, 1) assert_several_times(f) @@ -89,11 +95,17 @@ class GoBGPTestBase(unittest.TestCase): def test_04_check_accept_as_loop(self): def f(): - s = self.g2.get_neighbor(self.q1)['state'] - self.assertTrue('received' in s) - self.assertEqual(s.get('received', 0), 1) - self.assertTrue('accepted' in s) - self.assertEqual(s.get('accepted', 0), 1) + r = self.g2.get_neighbor(self.q1) + self.assertTrue('afi_safis' in r) + received = 0 + accepted = 0 + for afisafi in r['afi_safis']: + self.assertTrue('state' in afisafi) + s = afisafi.get('state') + received += s.get('received') + accepted += s.get('accepted') + self.assertEqual(received, 1) + self.assertEqual(accepted, 1) assert_several_times(f) diff --git a/test/scenario_test/route_server_test2.py b/test/scenario_test/route_server_test2.py index 82c0656f..08b984ae 100644 --- a/test/scenario_test/route_server_test2.py +++ b/test/scenario_test/route_server_test2.py @@ -89,10 +89,15 @@ class GoBGPTestBase(unittest.TestCase): def test_04_withdraw_path(self): self.clients['g2'].local('gobgp global rib del 10.0.0.0/24') time.sleep(1) - s = self.gobgp.get_neighbor(self.clients['g2'])['state'] - self.assertEqual(s.get('advertised', 0), 1) - self.assertEqual(s.get('accepted'), None) # means info['accepted'] == 0 - self.assertEqual(s.get('received'), None) # means info['received'] == 0 + afisafis = self.gobgp.get_neighbor(self.clients['g2'])['afi_safis'] + advertised = 0 + for afisafi in afisafis: + s = afisafi.get('state') + advertised += s.get('advertised') + self.assertEqual(s.get('accepted'), None) # means info['accepted'] == 0 + self.assertEqual(s.get('received'), None) # means info['received'] == 0 + + self.assertEqual(advertised, 1) if __name__ == '__main__': |