Merge pull request #32 from openstack-charmers/octavia-dvr-test
octavia: Add setup and test code for DVR
This commit is contained in:
@@ -109,3 +109,64 @@ def prepare_payload_instance():
|
||||
zaza.openstack.configure.guest.launch_instance(
|
||||
glance_setup.LTS_IMAGE_NAME,
|
||||
userdata='#cloud-config\npackages:\n - apache2\n')
|
||||
|
||||
|
||||
def centralized_fip_network():
|
||||
"""Create network with centralized router for connecting lb and fips.
|
||||
|
||||
There are currently a few outstanding upstream issues with connecting a
|
||||
Octavia loadbalancer to the outside world through a Floating IP when used
|
||||
in conjunction with Neutron DVR [0][1][2][3][4][5].
|
||||
|
||||
Although there are some fixes provided in the referenced material, the
|
||||
current implementation still show issues and appearas to limit how we can
|
||||
model a DVR deployment.
|
||||
|
||||
A approach to work around this is to create a separate non-distributed
|
||||
network for hosting the load balancer VIP and connecting it to a FIP.
|
||||
|
||||
The payload- and loadbalancer- instances can stay in a distributed
|
||||
network, only the VIP must be in a non-distributed network.
|
||||
(although the actual hosting of said router can be on a compute host
|
||||
acting as a "centralized" snat router in a DVR deployment.)
|
||||
|
||||
0: https://bit.ly/30LgX4T
|
||||
1: https://bugs.launchpad.net/neutron/+bug/1583694
|
||||
2: https://bugs.launchpad.net/neutron/+bug/1667877
|
||||
3: https://review.opendev.org/#/c/437970/
|
||||
4: https://review.opendev.org/#/c/437986/
|
||||
5: https://review.opendev.org/#/c/466434/
|
||||
"""
|
||||
keystone_session = openstack.get_overcloud_keystone_session()
|
||||
neutron_client = openstack.get_neutron_session_client(
|
||||
keystone_session)
|
||||
|
||||
resp = neutron_client.create_network(
|
||||
{'network': {'name': 'private_lb_fip_network'}})
|
||||
network = resp['network']
|
||||
resp = neutron_client.create_subnet(
|
||||
{
|
||||
'subnets': [
|
||||
{
|
||||
'name': 'private_lb_fip_subnet',
|
||||
'network_id': network['id'],
|
||||
'ip_version': 4,
|
||||
'cidr': '10.42.0.0/24',
|
||||
},
|
||||
],
|
||||
})
|
||||
subnet = resp['subnets'][0]
|
||||
resp = neutron_client.create_router(
|
||||
{
|
||||
'router': {
|
||||
'name': 'lb_fip_router',
|
||||
'external_gateway_info': {
|
||||
'network_id': openstack.get_net_uuid(
|
||||
neutron_client, 'ext_net'),
|
||||
},
|
||||
'distributed': False,
|
||||
},
|
||||
})
|
||||
router = resp['router']
|
||||
neutron_client.add_interface_router(
|
||||
router['id'], {'subnet_id': subnet['id']})
|
||||
|
||||
@@ -61,6 +61,8 @@ class LBAASv2Test(test_utils.OpenStackBaseTest):
|
||||
payload_ips.append(server.networks['private'][0])
|
||||
self.assertTrue(len(payload_ips) > 0)
|
||||
|
||||
resp = neutron_client.list_networks(name='private_lb_fip_network')
|
||||
vip_subnet_id = resp['networks'][0]['subnets'][0]
|
||||
resp = neutron_client.list_networks(name='private')
|
||||
subnet_id = resp['networks'][0]['subnets'][0]
|
||||
octavia_client = openstack_utils.get_octavia_session_client(
|
||||
@@ -70,7 +72,7 @@ class LBAASv2Test(test_utils.OpenStackBaseTest):
|
||||
'loadbalancer': {
|
||||
'description': 'Created by Zaza',
|
||||
'admin_state_up': True,
|
||||
'vip_subnet_id': subnet_id,
|
||||
'vip_subnet_id': vip_subnet_id,
|
||||
'name': 'zaza-lb-0',
|
||||
}})
|
||||
lb_id = result['loadbalancer']['id']
|
||||
|
||||
Reference in New Issue
Block a user