Adds support to accept IPv6 in VIP Address for LB Pool
In VIP assignment for a LB pool, it now allows users to assign a IPv6 IP address also. Change-Id: I8e7f047c410cde5c13c14a18e27ed25c6c767eb5 Closes-bug: #1403034
This commit is contained in:
parent
2faa5d2ed6
commit
dbf251e16e
|
@ -280,22 +280,46 @@ class LoadBalancerTests(test.TestCase):
|
|||
self.assertContains(res, default_provider)
|
||||
|
||||
def test_add_vip_post(self):
|
||||
self._test_add_vip_post()
|
||||
self._test_add_vip_common_post()
|
||||
|
||||
def test_add_vip_post_no_connection_limit(self):
|
||||
self._test_add_vip_post(with_conn_limit=False)
|
||||
self._test_add_vip_common_post(with_conn_limit=False)
|
||||
|
||||
def test_add_vip_post_with_diff_subnet(self):
|
||||
self._test_add_vip_post(with_diff_subnet=True)
|
||||
self._test_add_vip_common_post(with_diff_subnet=True)
|
||||
|
||||
def test_add_v6_vip_post(self):
|
||||
self._test_add_vip_common_post(vip_name='v6_vip1',
|
||||
subnet_name='v6_subnet1',
|
||||
pool_name='v6_pool1')
|
||||
|
||||
def test_add_v6_vip_post_no_connection_limit(self):
|
||||
self._test_add_vip_common_post(vip_name='v6_vip1',
|
||||
subnet_name='v6_subnet1',
|
||||
pool_name='v6_pool1',
|
||||
with_conn_limit=False)
|
||||
|
||||
def test_add_v6_vip_post_with_diff_subnet(self):
|
||||
self._test_add_vip_common_post(vip_name='v6_vip1',
|
||||
subnet_name='v6_subnet1',
|
||||
pool_name='v6_pool1',
|
||||
with_diff_subnet=True)
|
||||
|
||||
@test.create_stubs({api.lbaas: ('pool_get', 'vip_create'),
|
||||
api.neutron: (
|
||||
'network_list_for_tenant', 'subnet_get', )})
|
||||
def _test_add_vip_post(self, with_diff_subnet=False, with_conn_limit=True):
|
||||
vip = self.vips.first()
|
||||
def _test_add_vip_common_post(self, vip_name='vip1',
|
||||
subnet_name='mysubnet1',
|
||||
pool_name='pool1',
|
||||
with_diff_subnet=False,
|
||||
with_conn_limit=True):
|
||||
"""This method is common for both IPv4 and IPv6 tests. For IPv6 test
|
||||
we will pass the corresponding vip_name, subnet_name & pool_name.
|
||||
"""
|
||||
vip = self.vips.get(name=vip_name)
|
||||
|
||||
subnet = self.subnets.first()
|
||||
pool = self.pools.first()
|
||||
subnet = self.subnets.get(name=subnet_name)
|
||||
pool = self.pools.get(name=pool_name)
|
||||
networks = [{'subnets': [subnet, ]}, ]
|
||||
api.lbaas.pool_get(
|
||||
IsA(http.HttpRequest), pool.id).MultipleTimes().AndReturn(pool)
|
||||
|
|
|
@ -155,7 +155,7 @@ class AddVipAction(workflows.Action):
|
|||
initial="",
|
||||
required=False)
|
||||
address = forms.IPField(label=_("IP address"),
|
||||
version=forms.IPv4,
|
||||
version=forms.IPv4 | forms.IPv6,
|
||||
mask=False,
|
||||
required=False)
|
||||
protocol_port = forms.IntegerField(
|
||||
|
|
|
@ -210,7 +210,7 @@ class LbaasApiTests(test.APITestCase):
|
|||
self.assertEqual(ret_val.vip.id, vip_dict['vip']['id'])
|
||||
self.assertIsInstance(ret_val.subnet, api.neutron.Subnet)
|
||||
self.assertEqual(ret_val.subnet.id, subnet.id)
|
||||
self.assertEqual(2, len(ret_val.members))
|
||||
self.assertEqual(3, len(ret_val.members))
|
||||
self.assertIsInstance(ret_val.members[0], api.lbaas.Member)
|
||||
self.assertEqual(len(pool.health_monitors),
|
||||
len(ret_val.health_monitors))
|
||||
|
@ -300,7 +300,7 @@ class LbaasApiTests(test.APITestCase):
|
|||
ret_val = api.lbaas.pool_health_monitor_get(
|
||||
self.request, monitor['id'])
|
||||
self.assertIsInstance(ret_val, api.lbaas.PoolMonitor)
|
||||
self.assertEqual(2, len(ret_val.pools))
|
||||
self.assertEqual(3, len(ret_val.pools))
|
||||
self.assertIsInstance(ret_val.pools[0], api.lbaas.Pool)
|
||||
|
||||
@test.create_stubs({neutronclient: ('create_member', )})
|
||||
|
|
|
@ -668,6 +668,87 @@ def data(TEST):
|
|||
TEST.api_members.add(member_dict)
|
||||
TEST.members.add(lbaas.Member(member_dict))
|
||||
|
||||
# 1st v6 pool.
|
||||
pool_dict = {'id': 'c2983d70-8ac7-11e4-b116-123b93f75cba',
|
||||
'tenant_id': '1',
|
||||
'vip_id': 'b6598a5e-8ab4-11e4-b116-123b93f75cba',
|
||||
'name': 'v6_pool1',
|
||||
'description': 'pool description',
|
||||
'subnet_id': TEST.subnets.get(name='v6_subnet1').id,
|
||||
'protocol': 'HTTP',
|
||||
'lb_method': 'ROUND_ROBIN',
|
||||
'health_monitors': TEST.monitors.list(),
|
||||
'members': ['78a46e5e-eb1a-418a-88c7-0e3f5968b08'],
|
||||
'admin_state_up': True,
|
||||
'status': 'ACTIVE',
|
||||
'provider': 'haproxy'}
|
||||
TEST.api_pools.add(pool_dict)
|
||||
TEST.pools.add(lbaas.Pool(pool_dict))
|
||||
|
||||
# 1st v6 vip.
|
||||
vip_dict = {'id': 'b6598a5e-8ab4-11e4-b116-123b93f75cba',
|
||||
'name': 'v6_vip1',
|
||||
'address': 'ff09::03',
|
||||
'description': 'vip description',
|
||||
'subnet_id': TEST.subnets.get(name="v6_subnet1").id,
|
||||
'port_id': TEST.ports.first().id,
|
||||
'subnet': TEST.subnets.get(name="v6_subnet1").cidr,
|
||||
'protocol_port': 80,
|
||||
'protocol': pool_dict['protocol'],
|
||||
'pool_id': pool_dict['id'],
|
||||
'session_persistence': {'type': 'APP_COOKIE',
|
||||
'cookie_name': 'jssessionid'},
|
||||
'connection_limit': 10,
|
||||
'admin_state_up': True}
|
||||
TEST.api_vips.add(vip_dict)
|
||||
TEST.vips.add(lbaas.Vip(vip_dict))
|
||||
|
||||
# 2nd v6 vip.
|
||||
vip_dict = {'id': 'b6598cc0-8ab4-11e4-b116-123b93f75cba',
|
||||
'name': 'ff09::04',
|
||||
'address': '10.0.0.110',
|
||||
'description': 'vip description',
|
||||
'subnet_id': TEST.subnets.get(name="v6_subnet2").id,
|
||||
'port_id': TEST.ports.list()[0].id,
|
||||
'subnet': TEST.subnets.get(name="v6_subnet2").cidr,
|
||||
'protocol_port': 80,
|
||||
'protocol': pool_dict['protocol'],
|
||||
'pool_id': pool_dict['id'],
|
||||
'session_persistence': {'type': 'APP_COOKIE',
|
||||
'cookie_name': 'jssessionid'},
|
||||
'connection_limit': 10,
|
||||
'admin_state_up': True}
|
||||
TEST.api_vips.add(vip_dict)
|
||||
TEST.vips.add(lbaas.Vip(vip_dict))
|
||||
|
||||
# 1st v6 monitor.
|
||||
monitor_dict = {'id': '0dc936f8-8aca-11e4-b116-123b93f75cba',
|
||||
'type': 'http',
|
||||
'delay': 10,
|
||||
'timeout': 10,
|
||||
'max_retries': 10,
|
||||
'http_method': 'GET',
|
||||
'url_path': '/',
|
||||
'expected_codes': '200',
|
||||
'admin_state_up': True,
|
||||
"pools": [{"pool_id": TEST.pools.get(name='v6_pool1').id}],
|
||||
}
|
||||
TEST.api_monitors.add(monitor_dict)
|
||||
TEST.monitors.add(lbaas.PoolMonitor(monitor_dict))
|
||||
|
||||
# v6 member.
|
||||
member_dict = {'id': '6bc03d1e-8ad0-11e4-b116-123b93f75cba',
|
||||
'tenant_id': '1',
|
||||
'pool_id': TEST.pools.get(name='v6_pool1').id,
|
||||
'address': 'ff09::03',
|
||||
'protocol_port': 80,
|
||||
'weight': 10,
|
||||
'status': 'ACTIVE',
|
||||
'member_type': 'server_list',
|
||||
'admin_state_up': True}
|
||||
TEST.api_members.add(member_dict)
|
||||
TEST.members.add(lbaas.Member(member_dict))
|
||||
|
||||
# 1st monitor.
|
||||
monitor_dict = {'id': 'd4a0500f-db2b-4cc4-afcf-ec026febff96',
|
||||
'type': 'http',
|
||||
|
|
Loading…
Reference in New Issue