From c99ec284db181c7f9c72ce1163ba1ea45fe369d0 Mon Sep 17 00:00:00 2001 From: Aradhana Singh Date: Thu, 6 Oct 2016 21:51:01 +0000 Subject: Add description field port create & port set This patchset 1. adds description field to openstack port create and openstack port set. 2. updates method _add_updatable_args with 4 spaces instead of existing 8 spaces Partially Implements: blueprint neutron-client-descriptions Partially Implements: blueprint network-commands-options Change-Id: I4598e555722b1de7bc47f3a9be0fd81eacfcb572 --- openstackclient/network/v2/port.py | 87 ++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 40 deletions(-) (limited to 'openstackclient/network/v2') diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index 92b286a9..bd777d71 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -109,6 +109,8 @@ def _get_attrs(client_manager, parsed_args): 'The --host-id option is deprecated, ' 'please use --host instead.' )) + if parsed_args.description is not None: + attrs['description'] = parsed_args.description if parsed_args.fixed_ip is not None: attrs['fixed_ips'] = parsed_args.fixed_ip if parsed_args.device: @@ -180,46 +182,51 @@ def _prepare_fixed_ips(client_manager, parsed_args): def _add_updatable_args(parser): - # NOTE(dtroyer): --device-id is deprecated in Mar 2016. Do not - # remove before 3.x release or Mar 2017. - device_group = parser.add_mutually_exclusive_group() - device_group.add_argument( - '--device', - metavar='', - help=_("Port device ID") - ) - device_group.add_argument( - '--device-id', - metavar='', - help=argparse.SUPPRESS, - ) - parser.add_argument( - '--device-owner', - metavar='', - help=_("Device owner of this port. This is the entity that uses " - "the port (for example, network:dhcp).") - ) - parser.add_argument( - '--vnic-type', - metavar='', - choices=['direct', 'direct-physical', 'macvtap', - 'normal', 'baremetal'], - help=_("VNIC type for this port (direct | direct-physical | " - "macvtap | normal | baremetal, default: normal)") - ) - # NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not - # remove before 3.x release or Mar 2017. - host_group = parser.add_mutually_exclusive_group() - host_group.add_argument( - '--host', - metavar='', - help=_("Allocate port on host (ID only)") - ) - host_group.add_argument( - '--host-id', - metavar='', - help=argparse.SUPPRESS, - ) + parser.add_argument( + '--description', + metavar='', + help=_("Description of this port") + ) + # NOTE(dtroyer): --device-id is deprecated in Mar 2016. Do not + # remove before 3.x release or Mar 2017. + device_group = parser.add_mutually_exclusive_group() + device_group.add_argument( + '--device', + metavar='', + help=_("Port device ID") + ) + device_group.add_argument( + '--device-id', + metavar='', + help=argparse.SUPPRESS, + ) + parser.add_argument( + '--device-owner', + metavar='', + help=_("Device owner of this port. This is the entity that uses " + "the port (for example, network:dhcp).") + ) + parser.add_argument( + '--vnic-type', + metavar='', + choices=['direct', 'direct-physical', 'macvtap', + 'normal', 'baremetal'], + help=_("VNIC type for this port (direct | direct-physical | " + "macvtap | normal | baremetal, default: normal)") + ) + # NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not + # remove before 3.x release or Mar 2017. + host_group = parser.add_mutually_exclusive_group() + host_group.add_argument( + '--host', + metavar='', + help=_("Allocate port on host (ID only)") + ) + host_group.add_argument( + '--host-id', + metavar='', + help=argparse.SUPPRESS, + ) class CreatePort(command.ShowOne): -- cgit v1.2.1