Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST GoBGP backend #1382

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -44,7 +44,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 @@ -62,8 +62,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 @@ -82,3 +82,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')
84 changes: 49 additions & 35 deletions tests/st/bgp/test_global_peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,67 @@

class TestGlobalPeers(TestBase):

@attr('slow')
def test_global_peers(self):
def _test_global_peers(self, backend='bird'):
"""
Test global BGP peer configuration.

Test by turning off the mesh and configuring the mesh as
a set of global peers.
"""
with DockerHost('host1',
# with DockerHost('host1',
# additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS,
# start_calico=False) as host1, \
# DockerHost('host2',
# additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS,
# start_calico=False) as host2:
host1 = DockerHost('host1',
additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS,
start_calico=False) as host1, \
DockerHost('host2',
start_calico=False)
host2 = DockerHost('host2',
additional_docker_options=CLUSTER_STORE_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)
start_calico=False)

# Start both hosts using specific AS numbers.
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)
workload_host1 = host1.create_workload("workload1", network=network1, ip=DEFAULT_IPV4_ADDR_1)
workload_host2 = host2.create_workload("workload2", network=network1, ip=DEFAULT_IPV4_ADDR_2)

# Create a network and a couple of workloads on each host.
network1 = host1.create_network("subnet1", subnet=DEFAULT_IPV4_POOL_CIDR)
workload_host1 = host1.create_workload("workload1", network=network1, ip=DEFAULT_IPV4_ADDR_1)
workload_host2 = host2.create_workload("workload2", network=network1, ip=DEFAULT_IPV4_ADDR_2)
# Allow network to converge
self.assert_true(workload_host1.check_can_ping(DEFAULT_IPV4_ADDR_2, retries=10))

# Allow network to converge
self.assert_true(workload_host1.check_can_ping(DEFAULT_IPV4_ADDR_2, retries=10))
# Turn the node-to-node mesh off and wait for connectivity to drop.
host1.calicoctl("config set nodeToNodeMesh off")
self.assert_true(workload_host1.check_cant_ping(DEFAULT_IPV4_ADDR_2, retries=10))

# Turn the node-to-node mesh off and wait for connectivity to drop.
host1.calicoctl("config set nodeToNodeMesh off")
self.assert_true(workload_host1.check_cant_ping(DEFAULT_IPV4_ADDR_2, retries=10))
# Configure global peers to explicitly set up a mesh. This means
# each node will try to peer with itself which will fail.
create_bgp_peer(host1, 'global', host2.ip, LARGE_AS_NUM)
create_bgp_peer(host2, 'global', host1.ip, LARGE_AS_NUM)

# Configure global peers to explicitly set up a mesh. This means
# each node will try to peer with itself which will fail.
create_bgp_peer(host1, 'global', host2.ip, LARGE_AS_NUM)
create_bgp_peer(host2, 'global', host1.ip, LARGE_AS_NUM)
# Allow network to converge
self.assert_true(workload_host1.check_can_ping(DEFAULT_IPV4_ADDR_2, retries=10))

# Allow network to converge
self.assert_true(workload_host1.check_can_ping(DEFAULT_IPV4_ADDR_2, retries=10))
# Check connectivity in both directions
self.assert_ip_connectivity(workload_list=[workload_host1,
workload_host2],
ip_pass_list=[DEFAULT_IPV4_ADDR_1,
DEFAULT_IPV4_ADDR_2])

# Check connectivity in both directions
self.assert_ip_connectivity(workload_list=[workload_host1,
workload_host2],
ip_pass_list=[DEFAULT_IPV4_ADDR_1,
DEFAULT_IPV4_ADDR_2])
# 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", "Active"]),
("global", host2.ip, "Established")])
check_bird_status(host2, [("global", host1.ip, "Established"),
("global", host2.ip, ["Idle", "Active"])])

# 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"),
("global", host2.ip, "Established")])
check_bird_status(host2, [("global", host1.ip, "Established"),
("global", host2.ip, "Idle")])
# @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=CLUSTER_STORE_DOCKER_OPTIONS) as host1, \
additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS,
start_calico=False) as host1, \
DockerHost('host2',
additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS) as host2, \
additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS,
start_calico=False) as host2, \
DockerHost('host3',
additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS) as host3, \
additional_docker_options=CLUSTER_STORE_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=CLUSTER_STORE_DOCKER_OPTIONS) as host1, \
additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS,
start_calico=False) as host1, \
DockerHost('host2',
additional_docker_options=CLUSTER_STORE_DOCKER_OPTIONS) as host2, \
additional_docker_options=CLUSTER_STORE_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_single_route_reflector(self):
self._test_single_route_reflector(backend='bird')

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