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>
(cherry picked from commit bfa1abb291)
(cherry picked from commit 9d2769df87)
This commit is contained in:
Gregory Thiemonge
2025-04-10 07:56:43 +02:00
parent ccafae0182
commit a2c29c49c0
3 changed files with 15 additions and 1 deletions

View File

@@ -40,6 +40,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):
@@ -2812,6 +2817,9 @@ class TestLoadBalancerGraph(base.BaseAPITest):
'pools': create_pools or []
}
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.