Add vnic_type to the member object

The member object now has an optional vnic_type that specifies if the
member network port should use an SR-IOV VF or not.

Change-Id: Ia2a3d396de2b09c5e9e55e6cec826423dce5aff8
This commit is contained in:
Michael Johnson 2024-03-29 22:17:09 +00:00
parent 36e1ec56f2
commit f89f4cd3af
4 changed files with 18 additions and 5 deletions

View File

@ -233,7 +233,8 @@ class Member(BaseDataModel):
def __init__(self, address=Unset, admin_state_up=Unset, member_id=Unset, def __init__(self, address=Unset, admin_state_up=Unset, member_id=Unset,
monitor_address=Unset, monitor_port=Unset, name=Unset, monitor_address=Unset, monitor_port=Unset, name=Unset,
pool_id=Unset, protocol_port=Unset, subnet_id=Unset, pool_id=Unset, protocol_port=Unset, subnet_id=Unset,
weight=Unset, backup=Unset, project_id=Unset): weight=Unset, backup=Unset, project_id=Unset,
vnic_type=Unset):
self.address = address self.address = address
self.admin_state_up = admin_state_up self.admin_state_up = admin_state_up
@ -247,12 +248,14 @@ class Member(BaseDataModel):
self.weight = weight self.weight = weight
self.backup = backup self.backup = backup
self.project_id = project_id self.project_id = project_id
self.vnic_type = vnic_type
def __str__(self): def __str__(self):
return (f"Member(address={self.address!r}, " return (f"Member(address={self.address!r}, "
f"member_id={self.member_id!r}, name={self.name!r}, " f"member_id={self.member_id!r}, name={self.name!r}, "
f"pool_id={self.pool_id!r}, project_id={self.project_id!r}, " f"pool_id={self.pool_id!r}, project_id={self.project_id!r}, "
f"subnet_id={self.subnet_id!r}, weight={self.weight!r})") f"subnet_id={self.subnet_id!r}, weight={self.weight!r}, "
f"vnic_type={self.vnic_type!r})")
class HealthMonitor(BaseDataModel): class HealthMonitor(BaseDataModel):

View File

@ -298,4 +298,7 @@ VIP_NETWORK_ID = 'vip_network_id'
VIP_PORT_ID = 'vip_port_id' VIP_PORT_ID = 'vip_port_id'
VIP_SUBNET_ID = 'vip_subnet_id' VIP_SUBNET_ID = 'vip_subnet_id'
VIP_QOS_POLICY_ID = 'vip_qos_policy_id' VIP_QOS_POLICY_ID = 'vip_qos_policy_id'
VNIC_TYPE = 'vnic_type'
VNIC_TYPE_DIRECT = 'direct'
VNIC_TYPE_NORMAL = 'normal'
WEIGHT = 'weight' WEIGHT = 'weight'

View File

@ -150,7 +150,8 @@ class TestProviderDataModels(base.TestCase):
protocol_port=80, protocol_port=80,
subnet_id=self.mem_subnet_id, subnet_id=self.mem_subnet_id,
weight=1, weight=1,
backup=False) backup=False,
vnic_type=constants.VNIC_TYPE_NORMAL)
self.ref_healthmonitor = data_models.HealthMonitor( self.ref_healthmonitor = data_models.HealthMonitor(
admin_state_up=False, admin_state_up=False,
@ -307,7 +308,8 @@ class TestProviderDataModels(base.TestCase):
'protocol_port': 80, 'protocol_port': 80,
'subnet_id': self.mem_subnet_id, 'subnet_id': self.mem_subnet_id,
'weight': 1, 'weight': 1,
'backup': False} 'backup': False,
'vnic_type': constants.VNIC_TYPE_NORMAL}
self.ref_healthmonitor_dict = { self.ref_healthmonitor_dict = {
'admin_state_up': False, 'admin_state_up': False,
@ -518,7 +520,8 @@ class TestProviderDataModels(base.TestCase):
f"Member(address='192.0.2.10', member_id={self.member_id!r}, " f"Member(address='192.0.2.10', member_id={self.member_id!r}, "
f"name='member', pool_id={self.pool_id!r}, " f"name='member', pool_id={self.pool_id!r}, "
f"project_id={self.project_id!r}, " f"project_id={self.project_id!r}, "
f"subnet_id={self.ref_member.subnet_id!r}, weight=1)", f"subnet_id={self.ref_member.subnet_id!r}, weight=1, "
f"vnic_type='{constants.VNIC_TYPE_NORMAL}')",
str(self.ref_member)) str(self.ref_member))
self.assertEqual( self.assertEqual(
f"Pool(loadbalancer_id={self.loadbalancer_id!r}, " f"Pool(loadbalancer_id={self.loadbalancer_id!r}, "

View File

@ -0,0 +1,4 @@
---
features:
- |
Added the "vnic_type" field to the member object.