summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test
diff options
context:
space:
mode:
Diffstat (limited to 'test/scenario_test')
-rw-r--r--test/scenario_test/flow_spec_test.py40
-rw-r--r--test/scenario_test/global_policy_test.py13
-rw-r--r--test/scenario_test/route_server_as2_test.py17
-rw-r--r--test/scenario_test/route_server_test2.py9
4 files changed, 37 insertions, 42 deletions
diff --git a/test/scenario_test/flow_spec_test.py b/test/scenario_test/flow_spec_test.py
index d4b401a7..0a94962f 100644
--- a/test/scenario_test/flow_spec_test.py
+++ b/test/scenario_test/flow_spec_test.py
@@ -65,26 +65,6 @@ class FlowSpecTest(unittest.TestCase):
initial_wait_time = max(ctn.run() for ctn in ctns)
time.sleep(initial_wait_time)
- # Add FlowSpec routes into ExaBGP.
- # Note: Currently, ExaBGPContainer only supports to add routes by
- # reloading configuration, so we add routes here.
- cls.e1.add_route(
- route='ipv4/dst/src',
- rf='ipv4-flowspec',
- matchs=[
- 'destination 12.1.0.0/24',
- 'source 12.2.0.0/24',
- ],
- thens=['discard'])
- cls.e1.add_route(
- route='ipv6/dst/src',
- rf='ipv6-flowspec',
- matchs=[
- 'destination 2002:1::/64/10',
- 'source 2002:2::/64/15',
- ],
- thens=['discard'])
-
# Add FlowSpec routes into GoBGP.
cls.g1.add_route(
route='ipv4/all',
@@ -122,9 +102,25 @@ class FlowSpecTest(unittest.TestCase):
cls.g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=cls.e1)
cls.g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=cls.y1)
+ # Add FlowSpec routes into ExaBGP.
+ cls.e1.add_route(
+ route='ipv4/dst/src',
+ rf='ipv4-flowspec',
+ matchs=[
+ 'destination 12.1.0.0/24',
+ 'source 12.2.0.0/24',
+ ],
+ thens=['discard'])
+ cls.e1.add_route(
+ route='ipv6/dst/src',
+ rf='ipv6-flowspec',
+ matchs=[
+ 'destination 2002:1::/64/10',
+ 'source 2002:2::/64/15',
+ ],
+ thens=['discard'])
+
# Add FlowSpec routes into YABGP.
- # Note: Currently, YABGPContainer only supports to add routes via
- # REST API after connection established, so we add routes here.
cls.y1.add_route(
route='ipv4/all',
rf='ipv4-flowspec',
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():
diff --git a/test/scenario_test/route_server_as2_test.py b/test/scenario_test/route_server_as2_test.py
index bcff8f74..d60b4b21 100644
--- a/test/scenario_test/route_server_as2_test.py
+++ b/test/scenario_test/route_server_as2_test.py
@@ -53,16 +53,7 @@ class GoBGPTestBase(unittest.TestCase):
for i in range(4)]
ctns = [g1] + rs_clients
- # advertise a route from route-server-clients
- for idx, rs_client in enumerate(rs_clients):
- route = '10.0.{0}.0/24'.format(idx + 1)
- rs_client.add_route(route)
- if idx < 2:
- route = '10.0.10.0/24'
- rs_client.add_route(route)
-
initial_wait_time = max(ctn.run() for ctn in ctns)
-
time.sleep(initial_wait_time)
for i, rs_client in enumerate(rs_clients):
@@ -72,6 +63,14 @@ class GoBGPTestBase(unittest.TestCase):
as2 = True
rs_client.add_peer(g1, as2=as2)
+ # advertise a route from route-server-clients
+ for idx, rs_client in enumerate(rs_clients):
+ route = '10.0.{0}.0/24'.format(idx + 1)
+ rs_client.add_route(route)
+ if idx < 2:
+ route = '10.0.10.0/24'
+ rs_client.add_route(route)
+
cls.gobgp = g1
cls.quaggas = {x.name: x for x in rs_clients}
diff --git a/test/scenario_test/route_server_test2.py b/test/scenario_test/route_server_test2.py
index e60e264e..61c546b8 100644
--- a/test/scenario_test/route_server_test2.py
+++ b/test/scenario_test/route_server_test2.py
@@ -43,7 +43,6 @@ class GoBGPTestBase(unittest.TestCase):
g1 = GoBGPContainer(name='g1', asn=65000, router_id='192.168.0.1',
ctn_image_name=gobgp_ctn_image_name,
log_level=parser_option.gobgp_log_level)
-
g2 = GoBGPContainer(name='g2', asn=65001, router_id='192.168.0.2',
ctn_image_name=gobgp_ctn_image_name)
e1 = ExaBGPContainer(name='e1', asn=65002, router_id='192.168.0.3')
@@ -55,8 +54,10 @@ class GoBGPTestBase(unittest.TestCase):
time.sleep(initial_wait_time)
for cli in cls.clients.values():
- g1.add_peer(cli, is_rs_client=True, passwd='passwd', passive=True, prefix_limit=10)
- cli.add_peer(g1, passwd='passwd')
+ # Omit "passwd" to avoid a issue on ExaBGP version 4.0.5:
+ # https://github.com/Exa-Networks/exabgp/issues/766
+ g1.add_peer(cli, is_rs_client=True, passive=True, prefix_limit=10)
+ cli.add_peer(g1)
# advertise a route from route-server-clients
g2.add_route('10.0.0.0/24')
@@ -66,7 +67,7 @@ class GoBGPTestBase(unittest.TestCase):
# test each neighbor state is turned establish
def test_01_neighbor_established(self):
- for cli in self.clients.itervalues():
+ for cli in self.clients.values():
self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=cli)
def test_02_add_neighbor(self):