1 From 1ae904a4912494b3d0ac87f22aaf958129744548 Mon Sep 17 00:00:00 2001
2 From: Carlos Goncalves <carlos.goncalves@neclab.eu>
3 Date: Wed, 18 Jan 2017 11:16:39 +0000
4 Subject: [PATCH] Add 'data_plane_status' option to Port classes
6 Adds 'data_plane_status' option to SetPort and UnsetPort classes.
9 Change-Id: I26e23b551afb8c37e6babdea1655efb7c5c6873b
11 openstackclient/network/v2/port.py | 18 ++++++++++++++++++
12 1 file changed, 18 insertions(+)
14 diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
15 index 42291bf2..1409a194 100644
16 --- a/openstackclient/network/v2/port.py
17 +++ b/openstackclient/network/v2/port.py
19 "(Specify both --allowed-address and --no-allowed-address"
20 "to overwrite the current allowed-address pairs)")
22 + parser.add_argument(
23 + '--data-plane-status',
25 + choices=['ACTIVE', 'DOWN'],
26 + help=_("Set data plane status of this port (ACTIVE | DOWN). "
27 + "Unset it to None with the 'port unset' command "
28 + "(requires data plane status extension)")
32 def take_action(self, parsed_args):
34 elif parsed_args.no_allowed_address_pair:
35 attrs['allowed_address_pairs'] = []
37 + if parsed_args.data_plane_status:
38 + attrs['data_plane_status'] = parsed_args.data_plane_status
40 client.update_port(obj, **attrs)
44 "[,mac-address=<mac-address>] (repeat option to set "
45 "multiple allowed-address pairs)")
47 + parser.add_argument(
48 + '--data-plane-status',
49 + action='store_true',
50 + help=_("Clear existing information of data plane status")
56 msg = _("Port does not contain allowed-address-pair %s") % addr
57 raise exceptions.CommandError(msg)
58 attrs['allowed_address_pairs'] = tmp_addr_pairs
59 + if parsed_args.data_plane_status:
60 + attrs['data_plane_status'] = None
63 client.update_port(obj, **attrs)