summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorRichard Theis <rtheis@us.ibm.com>2016-06-29 09:48:04 -0500
committerRichard Theis <rtheis@us.ibm.com>2016-06-29 10:13:18 -0500
commit92d0fbeafd146126897934a7ec57ebf2ccef8580 (patch)
tree43af6670b1a87e340198e601de36703ec83113ad /openstackclient/network
parent6920c9e839b3ce416ea769fce7034c426512a041 (diff)
downloadpython-openstackclient-92d0fbeafd146126897934a7ec57ebf2ccef8580.tar.gz
Add port security option to network commands
Add the "--enable-port-security" and "--disable-port-security" options to the "network create" and "network set" commands. This supports setting the default port security for ports created on a network. Change-Id: I1deb505bd77cef2e4bc3c2dbbb0c450665136f47 Implements: blueprint neutron-client
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/network.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 31dfc798..ccc02fd8 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -58,6 +58,10 @@ def _get_attrs(client_manager, parsed_args):
attrs['shared'] = True
if parsed_args.no_share:
attrs['shared'] = False
+ if parsed_args.enable_port_security:
+ attrs['port_security_enabled'] = True
+ if parsed_args.disable_port_security:
+ attrs['port_security_enabled'] = False
# "network set" command doesn't support setting project.
if 'project' in parsed_args and parsed_args.project is not None:
@@ -197,6 +201,19 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
"(Network Availability Zone extension required, "
"repeat option to set multiple availability zones)")
)
+ port_security_group = parser.add_mutually_exclusive_group()
+ port_security_group.add_argument(
+ '--enable-port-security',
+ action='store_true',
+ help=_("Enable port security by default for ports created on "
+ "this network (default)")
+ )
+ port_security_group.add_argument(
+ '--disable-port-security',
+ action='store_true',
+ help=_("Disable port security by default for ports created on "
+ "this network")
+ )
external_router_grp = parser.add_mutually_exclusive_group()
external_router_grp.add_argument(
'--external',
@@ -403,6 +420,19 @@ class SetNetwork(command.Command):
action='store_true',
help=_("Do not share the network between projects")
)
+ port_security_group = parser.add_mutually_exclusive_group()
+ port_security_group.add_argument(
+ '--enable-port-security',
+ action='store_true',
+ help=_("Enable port security by default for ports created on "
+ "this network")
+ )
+ port_security_group.add_argument(
+ '--disable-port-security',
+ action='store_true',
+ help=_("Disable port security by default for ports created on "
+ "this network")
+ )
external_router_grp = parser.add_mutually_exclusive_group()
external_router_grp.add_argument(
'--external',