From 88be7ddd388c440d3f80564c7f1f4f2aed1a8e36 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Mon, 19 Sep 2016 16:43:28 -0500 Subject: [PATCH] Add --description to Create/Set Network Added simple option for network description to create and set network. Change-Id: I90ce4db4e365a56ecddb00d59f4c5aa2ebbd49a3 Partially-Implements: blueprint network-command-options --- doc/source/command-objects/network.rst | 10 ++++++++++ openstackclient/network/v2/network.py | 14 ++++++++++++++ openstackclient/tests/unit/network/v2/fakes.py | 1 + .../tests/unit/network/v2/test_network.py | 12 ++++++++++++ 4 files changed, 37 insertions(+) diff --git a/doc/source/command-objects/network.rst b/doc/source/command-objects/network.rst index 5d9a5ca860..8075d50919 100644 --- a/doc/source/command-objects/network.rst +++ b/doc/source/command-objects/network.rst @@ -23,6 +23,7 @@ Create new network [--project [--project-domain ]] [--enable | --disable] [--share | --no-share] + [--description ] [--availability-zone-hint ] [--enable-port-security | --disable-port-security] [--external [--default | --no-default] | --internal] @@ -65,6 +66,10 @@ Create new network Do not share the network between projects +.. option:: --description + + Set network description + .. option:: --availability-zone-hint Availability Zone in which to create this network @@ -206,6 +211,7 @@ Set network properties [--name ] [--enable | --disable] [--share | --no-share] + [--description ] [--enable-port-security | --disable-port-security] [--external [--default | --no-default] | --internal] [--provider-network-type ] @@ -234,6 +240,10 @@ Set network properties Do not share the network between projects +.. option:: --description + + Set network description + .. option:: --enable-port-security Enable port security by default for ports created on diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py index ccc02fd8e6..31b173e138 100644 --- a/openstackclient/network/v2/network.py +++ b/openstackclient/network/v2/network.py @@ -78,6 +78,10 @@ def _get_attrs(client_manager, parsed_args): parsed_args.availability_zone_hints is not None: attrs['availability_zone_hints'] = parsed_args.availability_zone_hints + # set description + if parsed_args.description: + attrs['description'] = parsed_args.description + # update_external_network_options if parsed_args.internal: attrs['router:external'] = False @@ -191,6 +195,11 @@ class CreateNetwork(common.NetworkAndComputeShowOne): metavar='', help=_("Owner's project (name or ID)") ) + parser.add_argument( + '--description', + metavar='', + help=_("Set network description") + ) identity_common.add_project_domain_option_to_parser(parser) parser.add_argument( '--availability-zone-hint', @@ -420,6 +429,11 @@ class SetNetwork(command.Command): action='store_true', help=_("Do not share the network between projects") ) + parser.add_argument( + '--description', + metavar="