summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/global_policy_test.py
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2018-01-17 11:02:12 +0900
committerIWASE Yusuke <iwase.yusuke0@gmail.com>2018-02-10 21:47:38 +0900
commitaae35319a8421705f17e02e1a89aad9486ee713e (patch)
tree329d364d92a2901ea4140930af61692a2224e368 /test/scenario_test/global_policy_test.py
parent1fd46103728f0ed421a74a5fd6b96cb74b44bb38 (diff)
test/lib/exabgp: Use exabgpcli to add/del routes
Currently, to advertise or withdraw routes with ExaBGPContainer, we need to configure static routes via config file and restart ExaBGP daemon. In other words, we can NOT send withdrawing advertisement with ExaBGPContainer. Also, restating ExaBGP daemon frequently can make scenario test unstable, and it should be avoided. On the other hand, with ExaBGP version 4.0.5 or later(*), we can advertise or withdraw routes using "exabgpcli" without restating ExaBGP daemon (or writing application which calls ExaBGP's APIs). This patch fixes to use "exabgpcli" and reduces the number of restating ExaBGP daemon. Note: According to this change, adding routes into ExaBGP should be called after adding neighbor. (*): "exabgpcli" is introduced at version 4.0.2, but has some bugs related to Python 3 compatibility and FlowSpec rules combinations, then we need to use version 4.0.5 or later. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'test/scenario_test/global_policy_test.py')
-rw-r--r--test/scenario_test/global_policy_test.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/scenario_test/global_policy_test.py b/test/scenario_test/global_policy_test.py
index 39074f3a..ff534d8f 100644
--- a/test/scenario_test/global_policy_test.py
+++ b/test/scenario_test/global_policy_test.py
@@ -61,13 +61,7 @@ class GoBGPTestBase(unittest.TestCase):
qs = [q1, q2, q3]
ctns = [g1, q1, q2, q3]
- # advertise a route from q1, q2, q3
- for idx, q in enumerate(qs):
- route = '10.0.{0}.0/24'.format(idx + 1)
- q.add_route(route)
-
initial_wait_time = max(ctn.run() for ctn in ctns)
-
time.sleep(initial_wait_time)
g1.local('gobgp global policy export add default reject')
@@ -76,6 +70,11 @@ class GoBGPTestBase(unittest.TestCase):
g1.add_peer(q)
q.add_peer(g1)
+ # advertise a route from q1, q2, q3
+ for idx, q in enumerate(qs):
+ route = '10.0.{0}.0/24'.format(idx + 1)
+ q.add_route(route)
+
cls.gobgp = g1
cls.quaggas = {'q1': q1, 'q2': q2, 'q3': q3}
@@ -90,10 +89,10 @@ class GoBGPTestBase(unittest.TestCase):
def test_03_add_peer(self):
q = ExaBGPContainer(name='q4', asn=65004, router_id='192.168.0.5')
- q.add_route('10.10.0.0/24')
time.sleep(q.run())
self.gobgp.add_peer(q)
q.add_peer(self.gobgp)
+ q.add_route('10.10.0.0/24')
self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=q)
self.quaggas['q4'] = q
for q in self.quaggas.itervalues():