Fixed missing port_id in additional_vips API
the additional_vip object includes a port_id field but this field is not returned by the API. Change-Id: I920676dd4672b9bdcba8c771b8d7470fa88fe14d Signed-off-by: Gregory Thiemonge <gthiemon@redhat.com>
This commit is contained in:
@@ -42,6 +42,7 @@ class AdditionalVipsType(types.BaseType):
|
|||||||
"""Type for additional vips"""
|
"""Type for additional vips"""
|
||||||
subnet_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)
|
subnet_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)
|
||||||
ip_address = wtypes.wsattr(types.IPAddressType())
|
ip_address = wtypes.wsattr(types.IPAddressType())
|
||||||
|
port_id = wtypes.wsattr(wtypes.UuidType())
|
||||||
|
|
||||||
|
|
||||||
class LoadBalancerResponse(BaseLoadBalancerType):
|
class LoadBalancerResponse(BaseLoadBalancerType):
|
||||||
|
|||||||
@@ -672,9 +672,14 @@ class TestLoadBalancer(base.BaseAPITest):
|
|||||||
self.assertEqual(subnet1.id, api_lb.get('vip_subnet_id'))
|
self.assertEqual(subnet1.id, api_lb.get('vip_subnet_id'))
|
||||||
self.assertEqual(network.id, api_lb.get('vip_network_id'))
|
self.assertEqual(network.id, api_lb.get('vip_network_id'))
|
||||||
|
|
||||||
|
expected_add_vips = []
|
||||||
|
for add_vip in lb_json['additional_vips']:
|
||||||
|
add_vip.update(port_id=port.id)
|
||||||
|
expected_add_vips.append(add_vip)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
# Sort by ip_address so the list order will be guaranteed
|
# Sort by ip_address so the list order will be guaranteed
|
||||||
sorted(lb_json['additional_vips'], key=lambda x: x['ip_address']),
|
sorted(expected_add_vips, key=lambda x: x['ip_address']),
|
||||||
sorted(api_lb['additional_vips'], key=lambda x: x['ip_address']))
|
sorted(api_lb['additional_vips'], key=lambda x: x['ip_address']))
|
||||||
|
|
||||||
def test_create_neutron_failure(self):
|
def test_create_neutron_failure(self):
|
||||||
@@ -2840,6 +2845,9 @@ class TestLoadBalancerGraph(base.BaseAPITest):
|
|||||||
if vip_sg_ids:
|
if vip_sg_ids:
|
||||||
create_lb['vip_sg_ids'] = vip_sg_ids
|
create_lb['vip_sg_ids'] = vip_sg_ids
|
||||||
if additional_vips:
|
if additional_vips:
|
||||||
|
for add_vip in additional_vips:
|
||||||
|
if 'port_id' not in add_vip:
|
||||||
|
add_vip['port_id'] = create_lb['vip_port_id']
|
||||||
create_lb.update({'additional_vips': additional_vips})
|
create_lb.update({'additional_vips': additional_vips})
|
||||||
expected_lb = {
|
expected_lb = {
|
||||||
'description': '',
|
'description': '',
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixed missing `port_id` element when getting the `additional_vips`
|
||||||
|
parameter of a load balancer.
|
||||||
Reference in New Issue
Block a user