Add vip_sg_ids to the data model

It represents an optinal list of Neutron Securit Group IDs that can be
applied on the VIP port of a Load Balancer.

Related-Bug: #2065767
Change-Id: I1c3554d31b9066c5abdc958985de58f6f5a35d32
This commit is contained in:
Gregory Thiemonge 2024-05-15 13:19:12 +02:00
parent 5cbf950343
commit 0c86807d00
4 changed files with 24 additions and 6 deletions

View File

@ -104,8 +104,8 @@ class LoadBalancer(BaseDataModel):
listeners=Unset, loadbalancer_id=Unset, name=Unset,
pools=Unset, project_id=Unset, vip_address=Unset,
vip_network_id=Unset, vip_port_id=Unset, vip_subnet_id=Unset,
vip_qos_policy_id=Unset, additional_vips=Unset,
availability_zone=Unset):
vip_qos_policy_id=Unset, vip_sg_ids=Unset,
additional_vips=Unset, availability_zone=Unset):
self.admin_state_up = admin_state_up
self.description = description
@ -120,6 +120,7 @@ class LoadBalancer(BaseDataModel):
self.vip_port_id = vip_port_id
self.vip_subnet_id = vip_subnet_id
self.vip_qos_policy_id = vip_qos_policy_id
self.vip_sg_ids = vip_sg_ids
self.additional_vips = additional_vips
self.availability_zone = availability_zone
@ -337,10 +338,11 @@ class L7Rule(BaseDataModel):
class VIP(BaseDataModel):
def __init__(self, vip_address=Unset, vip_network_id=Unset,
vip_port_id=Unset, vip_subnet_id=Unset,
vip_qos_policy_id=Unset):
vip_qos_policy_id=Unset, vip_sg_ids=Unset):
self.vip_address = vip_address
self.vip_network_id = vip_network_id
self.vip_port_id = vip_port_id
self.vip_subnet_id = vip_subnet_id
self.vip_qos_policy_id = vip_qos_policy_id
self.vip_sg_ids = vip_sg_ids

View File

@ -296,6 +296,7 @@ VALUE = 'value'
VIP_ADDRESS = 'vip_address'
VIP_NETWORK_ID = 'vip_network_id'
VIP_PORT_ID = 'vip_port_id'
VIP_SG_IDS = 'vip_sg_ids'
VIP_SUBNET_ID = 'vip_subnet_id'
VIP_QOS_POLICY_ID = 'vip_qos_policy_id'
VNIC_TYPE = 'vnic_type'

View File

@ -46,6 +46,8 @@ class TestProviderDataModels(base.TestCase):
self.l7policy_id = uuidutils.generate_uuid()
self.l7rule_id = uuidutils.generate_uuid()
self.availability_zone = uuidutils.generate_uuid()
self.vip_sg1_id = uuidutils.generate_uuid()
self.vip_sg2_id = uuidutils.generate_uuid()
self.ref_l7rule = data_models.L7Rule(
admin_state_up=True,
@ -129,14 +131,18 @@ class TestProviderDataModels(base.TestCase):
vip_port_id=self.vip_port_id,
vip_subnet_id=self.vip_subnet_id,
vip_qos_policy_id=self.vip_qos_policy_id,
availability_zone=self.availability_zone)
availability_zone=self.availability_zone,
vip_sg_ids=[self.vip_sg1_id,
self.vip_sg2_id])
self.ref_vip = data_models.VIP(
vip_address=self.vip_address,
vip_network_id=self.vip_network_id,
vip_port_id=self.vip_port_id,
vip_subnet_id=self.vip_subnet_id,
vip_qos_policy_id=self.vip_qos_policy_id)
vip_qos_policy_id=self.vip_qos_policy_id,
vip_sg_ids=[self.vip_sg1_id,
self.vip_sg2_id])
self.ref_member = data_models.Member(
address='192.0.2.10',
@ -287,6 +293,8 @@ class TestProviderDataModels(base.TestCase):
'vip_subnet_id': self.vip_subnet_id,
'vip_qos_policy_id': self.vip_qos_policy_id,
'availability_zone': self.availability_zone,
'vip_sg_ids': [self.vip_sg1_id,
self.vip_sg2_id],
}
self.ref_vip_dict = {
@ -433,6 +441,7 @@ class TestProviderDataModels(base.TestCase):
new_ref_lib_dict['pools'] = None
new_ref_lib_dict['listeners'] = None
new_ref_lib_dict['additional_vips'] = None
new_ref_lib_dict['vip_sg_ids'] = None
self.assertEqual(new_ref_lib_dict, ref_lb_converted_to_dict)
@ -476,7 +485,8 @@ class TestProviderDataModels(base.TestCase):
vip_port_id=self.vip_port_id,
vip_subnet_id=self.vip_subnet_id,
vip_qos_policy_id=self.vip_qos_policy_id,
availability_zone=self.availability_zone)
availability_zone=self.availability_zone,
vip_sg_ids=[self.vip_sg1_id, self.vip_sg2_id])
ref_lb_dict_with_listener = deepcopy(self.ref_lb_dict_with_listener)
ref_lb_dict_with_listener['pools'] = None
@ -533,5 +543,6 @@ class TestProviderDataModels(base.TestCase):
f"vip_network_id={self.vip_network_id!r}, "
f"vip_port_id={self.vip_port_id!r}, vip_qos_policy_id="
f"{self.vip_qos_policy_id!r}, "
f"vip_sg_ids=[{self.vip_sg1_id!r}, {self.vip_sg2_id!r}], "
f"vip_subnet_id={self.vip_subnet_id!r})",
str(self.ref_vip))

View File

@ -0,0 +1,4 @@
---
features:
- |
Added 'vip_sg_ids' field to the LoadBalancer and VIP data models.