summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-07-22 05:02:17 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-08-03 12:09:07 +0900
commitb5e49f1319c37b4da3a010e09fc370d9285bb828 (patch)
tree104ca8f3d3220993560317d7227cde4a21c88ed1 /test/scenario_test
parent87bd4c1648e4aa6982add12d84ddf299aca1f4d7 (diff)
server: fix advertising multiple local withdrawals with same prefix
a bug introduced by 332766189685028c4f9852e4285fb1a9025223cc Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test')
-rw-r--r--test/scenario_test/bgp_router_test.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/scenario_test/bgp_router_test.py b/test/scenario_test/bgp_router_test.py
index a528c36d..4f7e981d 100644
--- a/test/scenario_test/bgp_router_test.py
+++ b/test/scenario_test/bgp_router_test.py
@@ -25,6 +25,9 @@ import time
import nose
from noseplugin import OptionParser, parser_option
from itertools import chain
+import ryu.lib.pcaplib as pcap
+from ryu.lib.packet.packet import Packet
+from ryu.lib.packet.bgp import BGPMessage
class GoBGPTestBase(unittest.TestCase):
@@ -354,6 +357,37 @@ class GoBGPTestBase(unittest.TestCase):
g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=e1)
+ def test_20_check_withdrawal_2(self):
+ g1 = self.gobgp
+ g2 = self.quaggas['g2']
+
+ dumpfile = g2.start_tcpdump()
+
+ g1.add_route('10.40.0.0/24')
+
+ time.sleep(1)
+
+ paths = g2.get_global_rib('10.40.0.0/24')
+ self.assertTrue(len(paths) == 1)
+
+ g1.local('gobgp global rib del 10.40.0.0/24')
+
+ time.sleep(1)
+
+ paths = g2.get_global_rib('10.40.0.0/24')
+ self.assertTrue(len(paths) == 0)
+
+ g2.stop_tcpdump()
+ 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]
+ cnt += len(pkt.withdrawn_routes)
+
+ self.assertTrue(cnt == 1)
if __name__ == '__main__':