Skip to content

Commit

Permalink
ST GoBGP backend
Browse files Browse the repository at this point in the history
Signed-off-by: Wataru Ishida <[email protected]>
  • Loading branch information
Wataru Ishida committed Dec 4, 2016
1 parent 0bb9a0a commit 3c07257
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 21 deletions.
14 changes: 11 additions & 3 deletions tests/st/bgp/test_global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_defaults(self):
self.assertEquals(host.calicoctl("config get nodeToNodeMesh"), "on")

@attr('slow')
def test_as_num(self):
def _test_as_num(self, backend='bird'):
"""
Test using different AS number for the node-to-node mesh.
Expand All @@ -66,8 +66,8 @@ def test_as_num(self):

# Start host1 using the inherited AS, and host2 using a specified
# AS (same as default).
host1.start_calico_node()
host2.start_calico_node("--as=%s" % LARGE_AS_NUM)
host1.start_calico_node("--backend=%s" % backend)
host2.start_calico_node("--backend=%s --as=%s" % (backend, LARGE_AS_NUM))

# Create a network and a couple of workloads on each host.
network1 = host1.create_network("subnet1", subnet=DEFAULT_IPV4_POOL_CIDR)
Expand All @@ -86,3 +86,11 @@ def test_as_num(self):
# Check the BGP status on each host.
check_bird_status(host1, [("node-to-node mesh", host2.ip, "Established")])
check_bird_status(host2, [("node-to-node mesh", host1.ip, "Established")])

@attr('slow')
def test_bird_as_num(self):
self._test_as_num(backend='bird')

@attr('slow')
def test_gobgp_as_num(self):
self._test_as_num(backend='gobgp')
19 changes: 13 additions & 6 deletions tests/st/bgp/test_global_peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

class TestGlobalPeers(TestBase):

@attr('slow')
def test_global_peers(self):
def _test_global_peers(self, backend='bird'):
"""
Test global BGP peer configuration.
Expand All @@ -40,8 +39,8 @@ def test_global_peers(self):
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS,
start_calico=False) as host2:
# Start both hosts using specific AS numbers.
host1.start_calico_node("--as=%s" % LARGE_AS_NUM)
host2.start_calico_node("--as=%s" % LARGE_AS_NUM)
host1.start_calico_node("--backend=%s --as=%s" % (backend, LARGE_AS_NUM))
host2.start_calico_node("--backend=%s --as=%s" % (backend, LARGE_AS_NUM))

# Create a network and a couple of workloads on each host.
network1 = host1.create_network("subnet1", subnet=DEFAULT_IPV4_POOL_CIDR)
Expand Down Expand Up @@ -71,7 +70,15 @@ def test_global_peers(self):

# Check the BGP status on each host. Connections from a node to
# itself will be idle since this is invalid BGP configuration.
check_bird_status(host1, [("global", host1.ip, "Idle"),
check_bird_status(host1, [("global", host1.ip, ["Idle", "Active"]),
("global", host2.ip, "Established")])
check_bird_status(host2, [("global", host1.ip, "Established"),
("global", host2.ip, "Idle")])
("global", host2.ip, ["Idle", "Active"])])

@attr('slow')
def test_bird_node_peers(self):
self._test_global_peers(backend='bird')

@attr('slow')
def test_gobgp_node_peers(self):
self._test_global_peers(backend='gobgp')
15 changes: 11 additions & 4 deletions tests/st/bgp/test_node_peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

class TestNodePeers(TestBase):

@attr('slow')
def test_node_peers(self):
def _test_node_peers(self, backend='bird'):
"""
Test per-node BGP peer configuration.
Expand All @@ -39,8 +38,8 @@ def test_node_peers(self):
start_calico=False) as host2:

# Start both hosts using specific AS numbers.
host1.start_calico_node("--as=%s" % LARGE_AS_NUM)
host2.start_calico_node("--as=%s" % LARGE_AS_NUM)
host1.start_calico_node("--backend=%s --as=%s" % (backend, LARGE_AS_NUM))
host2.start_calico_node("--backend=%s --as=%s" % (backend, LARGE_AS_NUM))

# Create a network and a couple of workloads on each host.
network1 = host1.create_network("subnet1", subnet=DEFAULT_IPV4_POOL_CIDR)
Expand Down Expand Up @@ -72,3 +71,11 @@ def test_node_peers(self):
# Check the BGP status on each host.
check_bird_status(host1, [("node specific", host2.ip, "Established")])
check_bird_status(host2, [("node specific", host1.ip, "Established")])

@attr('slow')
def test_bird_node_peers(self):
self._test_node_peers(backend='bird')

@attr('slow')
def test_gobgp_node_peers(self):
self._test_node_peers(backend='gobgp')
25 changes: 20 additions & 5 deletions tests/st/bgp/test_route_reflector_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,27 @@

class TestRouteReflectorCluster(TestBase):

@attr('slow')
def test_route_reflector_cluster(self):
def _test_route_reflector_cluster(self, backend='bird'):
"""
Run a multi-host test using a cluster of route reflectors and node
specific peerings.
"""
with DockerHost('host1',
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS) as host1, \
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS,
start_calico=False) as host1, \
DockerHost('host2',
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS) as host2, \
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS,
start_calico=False) as host2, \
DockerHost('host3',
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS) as host3, \
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS,
start_calico=False) as host3, \
RouteReflectorCluster(2, 2) as rrc:

# Start both hosts using specific backends.
host1.start_calico_node("--backend=%s" % backend)
host2.start_calico_node("--backend=%s" % backend)
host3.start_calico_node("--backend=%s" % backend)

# Set the default AS number - as this is used by the RR mesh, and
# turn off the node-to-node mesh (do this from any host).
host1.calicoctl("config set asNumber 64513")
Expand Down Expand Up @@ -69,3 +76,11 @@ def test_route_reflector_cluster(self):
ip_pass_list=[workload_host1.ip,
workload_host2.ip,
workload_host3.ip])

@attr('slow')
def test_bird_route_reflector_cluster(self):
self._test_route_reflector_cluster(backend='bird')

@attr('slow')
def test_gobgp_route_reflector_cluster(self):
self._test_route_reflector_cluster(backend='gobgp')
20 changes: 17 additions & 3 deletions tests/st/bgp/test_single_route_reflector.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,23 @@
class TestSingleRouteReflector(TestBase):

@attr('slow')
def test_single_route_reflector(self):
def _test_single_route_reflector(self, backend='bird'):
"""
Run a multi-host test using a single route reflector and global
peering.
"""
with DockerHost('host1',
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS) as host1, \
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS,
start_calico=False) as host1, \
DockerHost('host2',
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS) as host2, \
additional_docker_options=ADDITIONAL_DOCKER_OPTIONS,
start_calico=False) as host2, \
RouteReflectorCluster(1, 1) as rrc:

# Start both hosts using specific backends.
host1.start_calico_node("--backend=%s" % backend)
host2.start_calico_node("--backend=%s" % backend)

# Set the default AS number - as this is used by the RR mesh, and
# turn off the node-to-node mesh (do this from any host).
host1.calicoctl("config set asNumber 64514")
Expand Down Expand Up @@ -62,3 +68,11 @@ def test_single_route_reflector(self):
workload_host2],
ip_pass_list=[workload_host1.ip,
workload_host2.ip])

@attr('slow')
def test_bird_route_reflector_cluster(self):
self._test_single_route_reflector(backend='bird')

@attr('slow')
def test_gobgp_route_reflector_cluster(self):
self._test_single_route_reflector(backend='gobgp')

0 comments on commit 3c07257

Please sign in to comment.