diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2016-09-27 14:07:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-10-03 16:31:51 -0700 |
commit | a021647b0a59d38a19579254b9c061a1632b6d98 (patch) | |
tree | 7353f4d1856b85e78e986288e46b09f2d70a9009 /test/scenario_test/bgp_router_test.py | |
parent | c6f5b5d13d6395f7fd020d2cb2527a6e0cafa19d (diff) |
test: Adopt to the updated Ryu BGP Packet lib API
From Ryu v4.6, the Packet library can parse the entire BGP packet
via packet.Packet() API.
This patch fixes to adopt bgp_router_test.py to the updated API,
and reverts the Ryu version in pip-requires.txt to the latest.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'test/scenario_test/bgp_router_test.py')
-rw-r--r-- | test/scenario_test/bgp_router_test.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/scenario_test/bgp_router_test.py b/test/scenario_test/bgp_router_test.py index 3154df21..5f85c23a 100644 --- a/test/scenario_test/bgp_router_test.py +++ b/test/scenario_test/bgp_router_test.py @@ -353,7 +353,7 @@ class GoBGPTestBase(unittest.TestCase): e1.add_peer(g1) n = e1.peers[g1]['local_addr'].split('/')[0] g1.local('gobgp n add {0} as 65000'.format(n)) - g1.add_peer(e1, reload_config=False) + g1.add_peer(e1, reload_config=False) g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=e1) @@ -381,18 +381,17 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(1) cnt = 0 - for pkt in pcap.Reader(open(dumpfile)): - last = Packet(pkt[1]).protocols[-1] - if type(last) == str: - pkt = BGPMessage.parser(last)[0] - if type(pkt) == BGPUpdate: - cnt += len(pkt.withdrawn_routes) + for _, buf in pcap.Reader(open(dumpfile)): + pkt = Packet(buf).get_protocol(BGPMessage) + if isinstance(pkt, BGPUpdate): + cnt += len(pkt.withdrawn_routes) 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): |