From 246f60ab13b57df0cdff2190ebaca316a946f3e7 Mon Sep 17 00:00:00 2001 From: Sindhu Devale Date: Wed, 9 Nov 2016 16:30:55 -0600 Subject: Add `--enable/disable-port-security` option to `port set` and `port create` This patch adds the currently missing options `--enable-port-security` and `--disable-port-security` in the `os port set` and `os port create` commands. Partially-Implements: blueprint network-commands-options Change-Id: I4dc11cdf32bf482a5937f5464fe8a3b418644ec3 --- openstackclient/network/v2/port.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'openstackclient/network') diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index 86174d53..784adf19 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -146,6 +146,12 @@ def _get_attrs(client_manager, parsed_args): ).id attrs['tenant_id'] = project_id + if parsed_args.disable_port_security: + attrs['port_security_enabled'] = False + + if parsed_args.enable_port_security: + attrs['port_security_enabled'] = True + return attrs @@ -297,6 +303,17 @@ class CreatePort(command.ShowOne): action='store_true', help=_("Associate no security groups with this port") ) + port_security = parser.add_mutually_exclusive_group() + port_security.add_argument( + '--enable-port-security', + action='store_true', + help=_("Enable port security for this port (Default)") + ) + port_security.add_argument( + '--disable-port-security', + action='store_true', + help=_("Disable port security for this port") + ) return parser @@ -512,6 +529,17 @@ class SetPort(command.Command): action='store_true', help=_("Clear existing security groups associated with this port") ) + port_security = parser.add_mutually_exclusive_group() + port_security.add_argument( + '--enable-port-security', + action='store_true', + help=_("Enable port security for this port") + ) + port_security.add_argument( + '--disable-port-security', + action='store_true', + help=_("Disable port security for this port") + ) return parser -- cgit v1.2.1