diff options
-rw-r--r-- | test/lib/base.py | 3 | ||||
-rw-r--r-- | test/lib/gobgp.py | 8 | ||||
-rw-r--r-- | test/scenario_test/graceful_restart_test.py | 3 | ||||
-rw-r--r-- | test/scenario_test/long_lived_graceful_restart_test.py | 3 |
4 files changed, 12 insertions, 5 deletions
diff --git a/test/lib/base.py b/test/lib/base.py index 657c9623..99a9e97c 100644 --- a/test/lib/base.py +++ b/test/lib/base.py @@ -48,6 +48,9 @@ BGP_ATTR_TYPE_CLUSTER_LIST = 10 BGP_ATTR_TYPE_MP_REACH_NLRI = 14 BGP_ATTR_TYPE_EXTENDED_COMMUNITIES = 16 +GRACEFUL_RESTART_TIME = 30 +LONG_LIVED_GRACEFUL_RESTART_TIME = 30 + FLOWSPEC_NAME_TO_TYPE = { "destination": 1, "source": 2, diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index 3c33056b..bc1f96e9 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -30,6 +30,7 @@ import toml import yaml from lib.base import ( + community_str, wait_for_completion, BGPContainer, CmdBuffer, @@ -39,7 +40,8 @@ from lib.base import ( BGP_ATTR_TYPE_LOCAL_PREF, BGP_ATTR_TYPE_COMMUNITIES, BGP_ATTR_TYPE_MP_REACH_NLRI, - community_str, + GRACEFUL_RESTART_TIME, + LONG_LIVED_GRACEFUL_RESTART_TIME, ) @@ -445,7 +447,7 @@ class GoBGPContainer(BGPContainer): v['prefix-limit'] = {'config': {'max-prefixes': info['prefix_limit'], 'shutdown-threshold-pct': 80}} if info['graceful_restart'] is not None: - n['graceful-restart'] = {'config': {'enabled': True, 'restart-time': 20}} + n['graceful-restart'] = {'config': {'enabled': True, 'restart-time': GRACEFUL_RESTART_TIME}} for afi_safi in afi_safi_list: afi_safi['mp-graceful-restart'] = {'config': {'enabled': True}} @@ -453,7 +455,7 @@ class GoBGPContainer(BGPContainer): n['graceful-restart']['config']['restart-time'] = 1 n['graceful-restart']['config']['long-lived-enabled'] = True for afi_safi in afi_safi_list: - afi_safi['long-lived-graceful-restart'] = {'config': {'enabled': True, 'restart-time': 30}} + afi_safi['long-lived-graceful-restart'] = {'config': {'enabled': True, 'restart-time': LONG_LIVED_GRACEFUL_RESTART_TIME}} if info['is_rr_client']: cluster_id = self.router_id diff --git a/test/scenario_test/graceful_restart_test.py b/test/scenario_test/graceful_restart_test.py index 5d2c2b9d..537cf96c 100644 --- a/test/scenario_test/graceful_restart_test.py +++ b/test/scenario_test/graceful_restart_test.py @@ -29,6 +29,7 @@ from lib.base import ( BGP_FSM_IDLE, BGP_FSM_ACTIVE, BGP_FSM_ESTABLISHED, + GRACEFUL_RESTART_TIME, ) from lib.gobgp import GoBGPContainer @@ -124,7 +125,7 @@ class GoBGPTestBase(unittest.TestCase): self.assertTrue(len(g3.get_global_rib('10.10.30.0/24')) == 1) def test_06_test_restart_timer_expire(self): - time.sleep(25) + time.sleep(GRACEFUL_RESTART_TIME + 5) g2 = self.bgpds['g2'] self.assertTrue(len(g2.get_global_rib()) == 0) diff --git a/test/scenario_test/long_lived_graceful_restart_test.py b/test/scenario_test/long_lived_graceful_restart_test.py index 0a42afab..44f4a45b 100644 --- a/test/scenario_test/long_lived_graceful_restart_test.py +++ b/test/scenario_test/long_lived_graceful_restart_test.py @@ -29,6 +29,7 @@ from lib import base from lib.base import ( BGP_FSM_ACTIVE, BGP_FSM_ESTABLISHED, + LONG_LIVED_GRACEFUL_RESTART_TIME, ) from lib.gobgp import GoBGPContainer @@ -156,7 +157,7 @@ class GoBGPTestBase(unittest.TestCase): self.assertTrue(g2.asn in rib[0]['paths'][0]['aspath']) def test_05_llgr_restart_timer_expire(self): - time.sleep(35) + time.sleep(LONG_LIVED_GRACEFUL_RESTART_TIME + 5) g3 = self.bgpds['g3'] rib = g3.get_global_rib('10.10.0.0/24') self.assertTrue(len(rib) == 0) |