From 18563b4132f794cc6612c2897795f96a31b565ae Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 15 Mar 2018 13:21:41 +0100 Subject: [PATCH] neutron: add --mtu for create/set network Support Neutron network mtu configuration with a new argument, --mtu that allows CLI users to set MTU for Neutron networks. Change-Id: I93d23581c7e8c84eaf9bb3b293360036f60f456b --- doc/source/cli/command-objects/network.rst | 12 ++++++++++++ openstackclient/network/v2/network.py | 14 ++++++++++++++ openstackclient/tests/unit/network/v2/fakes.py | 1 + .../tests/unit/network/v2/test_network.py | 9 +++++++++ .../notes/neutron_mtu-d87e53e2d76f8612.yaml | 5 +++++ 5 files changed, 41 insertions(+) create mode 100644 releasenotes/notes/neutron_mtu-d87e53e2d76f8612.yaml diff --git a/doc/source/cli/command-objects/network.rst b/doc/source/cli/command-objects/network.rst index 5f20dc3884..220fbf32b5 100644 --- a/doc/source/cli/command-objects/network.rst +++ b/doc/source/cli/command-objects/network.rst @@ -24,6 +24,7 @@ Create new network [--enable | --disable] [--share | --no-share] [--description ] + [--mtu ] [--availability-zone-hint ] [--enable-port-security | --disable-port-security] [--external [--default | --no-default] | --internal] @@ -74,6 +75,12 @@ Create new network *Network version 2 only* +.. option:: --mtu + + Set network mtu + + *Network version 2 only* + .. option:: --availability-zone-hint Availability Zone in which to create this network @@ -353,6 +360,7 @@ Set network properties [--enable | --disable] [--share | --no-share] [--description ] + [--mtu ] [--enable-port-security | --disable-port-security] [--external [--default | --no-default] | --internal] [--provider-network-type ] @@ -386,6 +394,10 @@ Set network properties Set network description +.. option:: --mtu + + Set network mtu + .. 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 4c1725c5f6..d1c7f005d3 100644 --- a/openstackclient/network/v2/network.py +++ b/openstackclient/network/v2/network.py @@ -107,6 +107,10 @@ def _get_attrs_network(client_manager, parsed_args): if parsed_args.description: attrs['description'] = parsed_args.description + # set mtu + if parsed_args.mtu: + attrs['mtu'] = parsed_args.mtu + # update_external_network_options if parsed_args.internal: attrs['router:external'] = False @@ -217,6 +221,11 @@ class CreateNetwork(common.NetworkAndComputeShowOne): metavar='', help=_("Set network description") ) + parser.add_argument( + '--mtu', + metavar='', + help=_("Set network mtu") + ) identity_common.add_project_domain_option_to_parser(parser) parser.add_argument( '--availability-zone-hint', @@ -619,6 +628,11 @@ class SetNetwork(command.Command): metavar="