summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorSindhu Devale <sindhu.devale@intel.com>2016-11-09 16:30:55 -0600
committerSindhu Devale <sindhu.devale@intel.com>2016-11-28 16:33:34 -0600
commit246f60ab13b57df0cdff2190ebaca316a946f3e7 (patch)
tree2c1952b0a2c2d011bfa421f1afcc1658896d13a1 /openstackclient/network
parente07b0e0919784b48dc47ae9cd8836342b8c13480 (diff)
downloadpython-openstackclient-246f60ab13b57df0cdff2190ebaca316a946f3e7.tar.gz
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
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/port.py28
1 files changed, 28 insertions, 0 deletions
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