Skip to content

Commit d22b773

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "[Neutron] Support uplink-status-propagation-updatable extension"
2 parents 12e264a + 426abbd commit d22b773

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

openstackclient/network/v2/port.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,18 @@ def get_parser(self, prog_name):
11031103
"(requires data plane status extension)"
11041104
),
11051105
)
1106+
uplink_status_group = parser.add_mutually_exclusive_group()
1107+
uplink_status_group.add_argument(
1108+
'--enable-uplink-status-propagation',
1109+
action='store_true',
1110+
help=_('Enable uplink status propagation'),
1111+
)
1112+
uplink_status_group.add_argument(
1113+
'--disable-uplink-status-propagation',
1114+
action='store_true',
1115+
help=_('Disable uplink status propagation'),
1116+
)
1117+
11061118
_tag.add_tag_option_to_parser_for_set(parser, _('port'))
11071119

11081120
return parser

openstackclient/tests/unit/network/v2/test_port.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,6 +2633,35 @@ def test_set_trusted_true(self):
26332633
def test_set_trusted_false(self):
26342634
self._test_set_trusted_field(False)
26352635

2636+
def _test_set_uplink_status_propagation(self, uspropagation):
2637+
arglist = [self._port.id]
2638+
if uspropagation:
2639+
arglist += ['--enable-uplink-status-propagation']
2640+
else:
2641+
arglist += ['--disable-uplink-status-propagation']
2642+
2643+
verifylist = [
2644+
('port', self._port.id),
2645+
]
2646+
if uspropagation:
2647+
verifylist.append(('enable_uplink_status_propagation', True))
2648+
else:
2649+
verifylist.append(('enable_uplink_status_propagation', False))
2650+
2651+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
2652+
2653+
result = self.cmd.take_action(parsed_args)
2654+
self.network_client.update_port.assert_called_once_with(
2655+
self._port, **{'propagate_uplink_status': uspropagation}
2656+
)
2657+
self.assertIsNone(result)
2658+
2659+
def test_set_uplink_status_propagation_true(self):
2660+
self._test_set_uplink_status_propagation(True)
2661+
2662+
def test_set_uplink_status_propagation_false(self):
2663+
self._test_set_uplink_status_propagation(False)
2664+
26362665

26372666
class TestShowPort(TestPort):
26382667
# The port to show.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
features:
3+
- |
4+
Add ``--enable-uplink-status-propagation`` option and
5+
``--disable-uplink-status-propagation`` option to ``port update`` command.

0 commit comments

Comments
 (0)