summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test
diff options
context:
space:
mode:
Diffstat (limited to 'test/scenario_test')
-rw-r--r--test/scenario_test/bgp_router_test.py20
-rw-r--r--test/scenario_test/ibgp_router_test.py25
-rw-r--r--test/scenario_test/route_reflector_test.py11
-rw-r--r--test/scenario_test/route_server_ipv4_v6_test.py17
-rw-r--r--test/scenario_test/route_server_test.py23
5 files changed, 44 insertions, 52 deletions
diff --git a/test/scenario_test/bgp_router_test.py b/test/scenario_test/bgp_router_test.py
index 1a92a1b3..7d93ba53 100644
--- a/test/scenario_test/bgp_router_test.py
+++ b/test/scenario_test/bgp_router_test.py
@@ -59,21 +59,17 @@ 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)
for q in qs:
- g1.add_peer(q, reload_config=False, passwd='passwd')
+ g1.add_peer(q, passwd='passwd')
q.add_peer(g1, passwd='passwd', passive=True)
- g1.create_config()
- g1.reload_config()
+ # 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}
@@ -145,14 +141,14 @@ class GoBGPTestBase(unittest.TestCase):
def test_05_add_quagga(self):
q4 = QuaggaBGPContainer(name='q4', asn=65004, router_id='192.168.0.5')
self.quaggas['q4'] = q4
-
- q4.add_route('10.0.4.0/24')
-
initial_wait_time = q4.run()
time.sleep(initial_wait_time)
+
self.gobgp.add_peer(q4)
q4.add_peer(self.gobgp)
+ q4.add_route('10.0.4.0/24')
+
self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=q4)
def test_06_check_global_rib(self):
diff --git a/test/scenario_test/ibgp_router_test.py b/test/scenario_test/ibgp_router_test.py
index ed476122..59815e6e 100644
--- a/test/scenario_test/ibgp_router_test.py
+++ b/test/scenario_test/ibgp_router_test.py
@@ -51,13 +51,7 @@ class GoBGPTestBase(unittest.TestCase):
qs = [q1, q2]
ctns = [g1, q1, q2]
- # advertise a route from q1, q2
- for idx, c in enumerate(qs):
- route = '10.0.{0}.0/24'.format(idx + 1)
- c.add_route(route)
-
initial_wait_time = max(ctn.run() for ctn in ctns)
-
time.sleep(initial_wait_time)
# ibgp peer. loop topology
@@ -65,6 +59,11 @@ class GoBGPTestBase(unittest.TestCase):
a.add_peer(b)
b.add_peer(a)
+ # advertise a route from q1, q2
+ for idx, c in enumerate(qs):
+ route = '10.0.{0}.0/24'.format(idx + 1)
+ c.add_route(route)
+
cls.gobgp = g1
cls.quaggas = {'q1': q1, 'q2': q2}
@@ -163,14 +162,14 @@ class GoBGPTestBase(unittest.TestCase):
def test_07_add_ebgp_peer(self):
q3 = QuaggaBGPContainer(name='q3', asn=65001, router_id='192.168.0.4')
self.quaggas['q3'] = q3
-
- q3.add_route('10.0.3.0/24')
-
initial_wait_time = q3.run()
time.sleep(initial_wait_time)
+
self.gobgp.add_peer(q3)
q3.add_peer(self.gobgp)
+ q3.add_route('10.0.3.0/24')
+
self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=q3)
def test_08_check_global_rib(self):
@@ -246,15 +245,15 @@ class GoBGPTestBase(unittest.TestCase):
def test_15_add_ebgp_peer(self):
q4 = QuaggaBGPContainer(name='q4', asn=65001, router_id='192.168.0.5')
self.quaggas['q4'] = q4
-
- prefix = '10.0.4.0/24'
- q4.add_route(prefix)
-
initial_wait_time = q4.run()
time.sleep(initial_wait_time)
+
self.gobgp.add_peer(q4)
q4.add_peer(self.gobgp)
+ prefix = '10.0.4.0/24'
+ q4.add_route(prefix)
+
self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=q4)
q1 = self.quaggas['q1']
diff --git a/test/scenario_test/route_reflector_test.py b/test/scenario_test/route_reflector_test.py
index a5516dec..29846d53 100644
--- a/test/scenario_test/route_reflector_test.py
+++ b/test/scenario_test/route_reflector_test.py
@@ -61,13 +61,7 @@ class GoBGPTestBase(unittest.TestCase):
qs = [q1, q2, q3, q4]
ctns = [g1, q1, q2, q3, q4]
- # advertise a route from q1, q2
- for idx, c in enumerate(qs):
- route = '10.0.{0}.0/24'.format(idx + 1)
- c.add_route(route)
-
initial_wait_time = max(ctn.run() for ctn in ctns)
-
time.sleep(initial_wait_time)
# g1 as a route reflector
@@ -80,6 +74,11 @@ class GoBGPTestBase(unittest.TestCase):
g1.add_peer(q4)
q4.add_peer(g1)
+ # advertise a route from q1, q2
+ for idx, c in enumerate(qs):
+ route = '10.0.{0}.0/24'.format(idx + 1)
+ c.add_route(route)
+
cls.gobgp = g1
cls.quaggas = {'q1': q1, 'q2': q2, 'q3': q3, 'q4': q4}
diff --git a/test/scenario_test/route_server_ipv4_v6_test.py b/test/scenario_test/route_server_ipv4_v6_test.py
index 9d7e15a7..07f77e4a 100644
--- a/test/scenario_test/route_server_ipv4_v6_test.py
+++ b/test/scenario_test/route_server_ipv4_v6_test.py
@@ -52,16 +52,7 @@ class GoBGPIPv6Test(unittest.TestCase):
v4 = [q1, q2]
v6 = [q3, q4]
- for idx, q in enumerate(v4):
- route = '10.0.{0}.0/24'.format(idx + 1)
- q.add_route(route)
-
- for idx, q in enumerate(v6):
- route = '2001:{0}::/96'.format(idx + 1)
- q.add_route(route, rf='ipv6')
-
initial_wait_time = max(ctn.run() for ctn in ctns)
-
time.sleep(initial_wait_time)
for ctn in v4:
@@ -72,6 +63,14 @@ class GoBGPIPv6Test(unittest.TestCase):
g1.add_peer(ctn, is_rs_client=True, v6=True)
ctn.add_peer(g1, v6=True)
+ for idx, q in enumerate(v4):
+ route = '10.0.{0}.0/24'.format(idx + 1)
+ q.add_route(route)
+
+ for idx, q in enumerate(v6):
+ route = '2001:{0}::/96'.format(idx + 1)
+ q.add_route(route, rf='ipv6')
+
cls.gobgp = g1
cls.quaggas = {'q1': q1, 'q2': q2, 'q3': q3, 'q4': q4}
cls.ipv4s = {'q1': q1, 'q2': q2}
diff --git a/test/scenario_test/route_server_test.py b/test/scenario_test/route_server_test.py
index a99f1f8b..149adfd2 100644
--- a/test/scenario_test/route_server_test.py
+++ b/test/scenario_test/route_server_test.py
@@ -56,21 +56,20 @@ class GoBGPTestBase(unittest.TestCase):
q2 = rs_clients[1]
q3 = rs_clients[2]
- # advertise a route from route-server-clients
- routes = []
- for idx, rs_client in enumerate(rs_clients):
- route = '10.0.{0}.0/24'.format(idx + 1)
- rs_client.add_route(route)
- routes.append(route)
-
initial_wait_time = max(ctn.run() for ctn in ctns)
-
time.sleep(initial_wait_time)
for rs_client in rs_clients:
g1.add_peer(rs_client, is_rs_client=True, passwd='passwd', passive=True, prefix_limit=10)
rs_client.add_peer(g1, passwd='passwd')
+ # advertise a route from route-server-clients
+ routes = []
+ for idx, rs_client in enumerate(rs_clients):
+ route = '10.0.{0}.0/24'.format(idx + 1)
+ rs_client.add_route(route)
+ routes.append(route)
+
cls.gobgp = g1
cls.quaggas = {'q1': q1, 'q2': q2, 'q3': q3}
@@ -148,15 +147,15 @@ class GoBGPTestBase(unittest.TestCase):
def test_05_add_rs_client(self):
q4 = QuaggaBGPContainer(name='q4', asn=65004, router_id='192.168.0.5')
self.quaggas['q4'] = q4
-
- route = '10.0.4.0/24'
- q4.add_route(route)
-
initial_wait_time = q4.run()
time.sleep(initial_wait_time)
+
self.gobgp.add_peer(q4, is_rs_client=True)
q4.add_peer(self.gobgp)
+ route = '10.0.4.0/24'
+ q4.add_route(route)
+
self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=q4)
# check advertised routes are stored in gobgp's local-rib