diff --git a/octavia_lib/api/drivers/data_models.py b/octavia_lib/api/drivers/data_models.py index 6a1bc7e..434f003 100644 --- a/octavia_lib/api/drivers/data_models.py +++ b/octavia_lib/api/drivers/data_models.py @@ -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 diff --git a/octavia_lib/common/constants.py b/octavia_lib/common/constants.py index df0abfa..fb0f0de 100644 --- a/octavia_lib/common/constants.py +++ b/octavia_lib/common/constants.py @@ -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' diff --git a/octavia_lib/tests/unit/api/drivers/test_data_models.py b/octavia_lib/tests/unit/api/drivers/test_data_models.py index 8a84cea..5f02f8e 100644 --- a/octavia_lib/tests/unit/api/drivers/test_data_models.py +++ b/octavia_lib/tests/unit/api/drivers/test_data_models.py @@ -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)) diff --git a/releasenotes/notes/add-vip_sg_ids-6b1cfe9b558f3442.yaml b/releasenotes/notes/add-vip_sg_ids-6b1cfe9b558f3442.yaml new file mode 100644 index 0000000..4b96674 --- /dev/null +++ b/releasenotes/notes/add-vip_sg_ids-6b1cfe9b558f3442.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Added 'vip_sg_ids' field to the LoadBalancer and VIP data models.