From 426abbdc681d3f36f186fd685a3f1c0b6058f626 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Thu, 13 Feb 2025 12:48:56 +0000 Subject: [PATCH] [Neutron] Support ``uplink-status-propagation-updatable`` extension Added ``--enable-uplink-status-propagation`` option and ``--disable-uplink-status-propagation`` option to ``port update`` command. Now the Neutron extension "uplink-status-propagation-updatable" allows to update the related value in a port. That was implemented in the following patches (during 2025.1 Epoxy release): * https://review.opendev.org/c/openstack/neutron-lib/+/927820 * https://review.opendev.org/c/openstack/neutron-lib/+/936234 * https://review.opendev.org/c/openstack/neutron/+/931641 Related-Bug: #1722720 Change-Id: I99cdcf21438d6d85092c995b50cb10b26ae7c059 --- openstackclient/network/v2/port.py | 12 ++++++++ .../tests/unit/network/v2/test_port.py | 29 +++++++++++++++++++ ...ropagation_updatable-d1e155c19247b666.yaml | 5 ++++ 3 files changed, 46 insertions(+) create mode 100644 releasenotes/notes/port_uplink_status_propagation_updatable-d1e155c19247b666.yaml diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index 7803b657d2..dd202e4589 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -1102,6 +1102,18 @@ class SetPort(common.NeutronCommandWithExtraArgs): "(requires data plane status extension)" ), ) + uplink_status_group = parser.add_mutually_exclusive_group() + uplink_status_group.add_argument( + '--enable-uplink-status-propagation', + action='store_true', + help=_('Enable uplink status propagation'), + ) + uplink_status_group.add_argument( + '--disable-uplink-status-propagation', + action='store_true', + help=_('Disable uplink status propagation'), + ) + _tag.add_tag_option_to_parser_for_set(parser, _('port')) return parser diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py index 77561f78c2..634f291cb1 100644 --- a/openstackclient/tests/unit/network/v2/test_port.py +++ b/openstackclient/tests/unit/network/v2/test_port.py @@ -2633,6 +2633,35 @@ class TestSetPort(TestPort): def test_set_trusted_false(self): self._test_set_trusted_field(False) + def _test_set_uplink_status_propagation(self, uspropagation): + arglist = [self._port.id] + if uspropagation: + arglist += ['--enable-uplink-status-propagation'] + else: + arglist += ['--disable-uplink-status-propagation'] + + verifylist = [ + ('port', self._port.id), + ] + if uspropagation: + verifylist.append(('enable_uplink_status_propagation', True)) + else: + verifylist.append(('enable_uplink_status_propagation', False)) + + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + result = self.cmd.take_action(parsed_args) + self.network_client.update_port.assert_called_once_with( + self._port, **{'propagate_uplink_status': uspropagation} + ) + self.assertIsNone(result) + + def test_set_uplink_status_propagation_true(self): + self._test_set_uplink_status_propagation(True) + + def test_set_uplink_status_propagation_false(self): + self._test_set_uplink_status_propagation(False) + class TestShowPort(TestPort): # The port to show. diff --git a/releasenotes/notes/port_uplink_status_propagation_updatable-d1e155c19247b666.yaml b/releasenotes/notes/port_uplink_status_propagation_updatable-d1e155c19247b666.yaml new file mode 100644 index 0000000000..0e7b776207 --- /dev/null +++ b/releasenotes/notes/port_uplink_status_propagation_updatable-d1e155c19247b666.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add ``--enable-uplink-status-propagation`` option and + ``--disable-uplink-status-propagation`` option to ``port update`` command.