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:
Gregory Thiemonge
2025-04-10 07:56:43 +02:00
parent cd4fa250d1
commit bfa1abb291
3 changed files with 15 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ class AdditionalVipsType(types.BaseType):
"""Type for additional vips"""
subnet_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)
ip_address = wtypes.wsattr(types.IPAddressType())
port_id = wtypes.wsattr(wtypes.UuidType())
class LoadBalancerResponse(BaseLoadBalancerType):

View File

@@ -672,9 +672,14 @@ class TestLoadBalancer(base.BaseAPITest):
self.assertEqual(subnet1.id, api_lb.get('vip_subnet_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(
# 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']))
def test_create_neutron_failure(self):
@@ -2840,6 +2845,9 @@ class TestLoadBalancerGraph(base.BaseAPITest):
if vip_sg_ids:
create_lb['vip_sg_ids'] = vip_sg_ids
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})
expected_lb = {
'description': '',

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Fixed missing `port_id` element when getting the `additional_vips`
parameter of a load balancer.