summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test
diff options
context:
space:
mode:
authorSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2017-06-06 16:30:42 +0900
committerSatoshi Fujimoto <satoshi.fujimoto7@gmail.com>2017-06-08 13:44:13 +0900
commiteed50e9d048fdb388a0cc91db58eabd2376fdb7b (patch)
tree093e8f670e8d38a461cb8ffc3ba8f5fa0902c3a4 /test/scenario_test
parent6b710bae425a222a43fbd615a3f4464c3361175d (diff)
test: Test for Graceful Restart with multiple peers
Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Diffstat (limited to 'test/scenario_test')
-rw-r--r--test/scenario_test/graceful_restart_test.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/scenario_test/graceful_restart_test.py b/test/scenario_test/graceful_restart_test.py
index 4f3c1563..60e10437 100644
--- a/test/scenario_test/graceful_restart_test.py
+++ b/test/scenario_test/graceful_restart_test.py
@@ -26,6 +26,7 @@ from lib.noseplugin import OptionParser, parser_option
from lib import base
from lib.base import (
+ BGP_FSM_IDLE,
BGP_FSM_ACTIVE,
BGP_FSM_ESTABLISHED,
)
@@ -128,6 +129,47 @@ class GoBGPTestBase(unittest.TestCase):
g2 = self.bgpds['g2']
self.assertTrue(len(g2.get_global_rib()) == 0)
+ def test_07_multineighbor_established(self):
+ g1 = self.bgpds['g1']
+ g2 = self.bgpds['g2']
+ g3 = self.bgpds['g3']
+
+ g1._start_gobgp()
+
+ g1.del_peer(g2)
+ g1.del_peer(g3)
+ g2.del_peer(g1)
+ g3.del_peer(g1)
+ g1.add_peer(g2, graceful_restart=True, llgr=True)
+ g1.add_peer(g3, graceful_restart=True, llgr=True)
+ g2.add_peer(g1, graceful_restart=True, llgr=True)
+ g3.add_peer(g1, graceful_restart=True, llgr=True)
+
+ g2.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g1)
+ g3.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g1)
+
+ def test_08_multineighbor_graceful_restart(self):
+ g1 = self.bgpds['g1']
+ g2 = self.bgpds['g2']
+ g3 = self.bgpds['g3']
+
+ g1.graceful_restart()
+ g2.wait_for(expected_state=BGP_FSM_ACTIVE, peer=g1)
+ g3.wait_for(expected_state=BGP_FSM_ACTIVE, peer=g1)
+
+ g1._start_gobgp(graceful_restart=True)
+
+ count = 0
+ while ((g1.get_neighbor_state(g2) != BGP_FSM_ESTABLISHED)
+ or (g1.get_neighbor_state(g3) != BGP_FSM_ESTABLISHED)):
+ count += 1
+ # assert connections are not refused
+ self.assertTrue(g1.get_neighbor_state(g2) != BGP_FSM_IDLE)
+ self.assertTrue(g1.get_neighbor_state(g3) != BGP_FSM_IDLE)
+ if count > 120:
+ raise Exception('timeout')
+ time.sleep(1)
+
if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)