Allow setting init_state=None in the segment port update
Change-Id: Ifb195cdc2e37319d89a305eb82255c0219604300
This commit is contained in:
parent
895188ad7f
commit
b49988f87a
@ -5764,6 +5764,26 @@ class TestPolicySegmentPort(NsxPolicyLibTestCase):
|
|||||||
lp_update.assert_called_once_with(
|
lp_update.assert_called_once_with(
|
||||||
mock.ANY, False, admin_state=True)
|
mock.ANY, False, admin_state=True)
|
||||||
|
|
||||||
|
def test_update(self):
|
||||||
|
segment_id = '111'
|
||||||
|
port_id = '222'
|
||||||
|
name = 'new name'
|
||||||
|
# admin_state = False
|
||||||
|
with self.mock_get(segment_id, port_id), \
|
||||||
|
self.mock_create_update() as update_call:
|
||||||
|
|
||||||
|
self.resourceApi.update(segment_id,
|
||||||
|
port_id,
|
||||||
|
name=name,
|
||||||
|
init_state=None)
|
||||||
|
expected_def = core_defs.SegmentPortDef(
|
||||||
|
nsx_version=nsxlib_testcase.LATEST_VERSION,
|
||||||
|
segment_id=segment_id,
|
||||||
|
port_id=port_id,
|
||||||
|
name=name,
|
||||||
|
init_state=None)
|
||||||
|
self.assert_called_with_def(update_call, expected_def)
|
||||||
|
|
||||||
|
|
||||||
class TestPolicySegmentProfileBase(NsxPolicyLibTestCase):
|
class TestPolicySegmentProfileBase(NsxPolicyLibTestCase):
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ ALLOCATE_ADDRESS_NONE = "None"
|
|||||||
# SegmentPort init_state types
|
# SegmentPort init_state types
|
||||||
INIT_STATE_UNBLOCKED_VLAN = 'UNBLOCKED_VLAN'
|
INIT_STATE_UNBLOCKED_VLAN = 'UNBLOCKED_VLAN'
|
||||||
INIT_STATE_RESTORE_VIF = 'RESTORE_VIF'
|
INIT_STATE_RESTORE_VIF = 'RESTORE_VIF'
|
||||||
|
INIT_STATE_NONE = None
|
||||||
|
|
||||||
# NSXv3 L2 Gateway constants
|
# NSXv3 L2 Gateway constants
|
||||||
BRIDGE_ENDPOINT = "BRIDGEENDPOINT"
|
BRIDGE_ENDPOINT = "BRIDGEENDPOINT"
|
||||||
|
@ -1356,7 +1356,8 @@ class SegmentPortDef(ResourceDef):
|
|||||||
if (self.has_attr('init_state') and
|
if (self.has_attr('init_state') and
|
||||||
self._version_dependant_attr_supported('init_state')):
|
self._version_dependant_attr_supported('init_state')):
|
||||||
valid_list = [nsx_constants.INIT_STATE_UNBLOCKED_VLAN,
|
valid_list = [nsx_constants.INIT_STATE_UNBLOCKED_VLAN,
|
||||||
nsx_constants.INIT_STATE_RESTORE_VIF]
|
nsx_constants.INIT_STATE_RESTORE_VIF,
|
||||||
|
nsx_constants.INIT_STATE_NONE]
|
||||||
init_state = self.get_attr('init_state')
|
init_state = self.get_attr('init_state')
|
||||||
if init_state not in valid_list:
|
if init_state not in valid_list:
|
||||||
raise exceptions.InvalidInput(
|
raise exceptions.InvalidInput(
|
||||||
|
@ -2606,6 +2606,7 @@ class NsxPolicySegmentPortApi(NsxPolicyResourceBase):
|
|||||||
address_bindings=IGNORE,
|
address_bindings=IGNORE,
|
||||||
hyperbus_mode=IGNORE,
|
hyperbus_mode=IGNORE,
|
||||||
admin_state=IGNORE,
|
admin_state=IGNORE,
|
||||||
|
init_state=IGNORE,
|
||||||
extra_configs=IGNORE,
|
extra_configs=IGNORE,
|
||||||
tags=IGNORE,
|
tags=IGNORE,
|
||||||
tenant=constants.POLICY_INFRA_TENANT):
|
tenant=constants.POLICY_INFRA_TENANT):
|
||||||
@ -2617,6 +2618,7 @@ class NsxPolicySegmentPortApi(NsxPolicyResourceBase):
|
|||||||
address_bindings=address_bindings,
|
address_bindings=address_bindings,
|
||||||
hyperbus_mode=hyperbus_mode,
|
hyperbus_mode=hyperbus_mode,
|
||||||
admin_state=admin_state,
|
admin_state=admin_state,
|
||||||
|
init_state=init_state,
|
||||||
extra_configs=extra_configs,
|
extra_configs=extra_configs,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
tenant=tenant)
|
tenant=tenant)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user