summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorHongbin Lu <hongbin034@gmail.com>2018-01-09 21:24:08 +0000
committerHongbin Lu <hongbin.lu@huawei.com>2018-06-29 20:15:28 +0000
commit4a9cb8eea8e47950cb30ecaa7572a23d80d5bfcd (patch)
tree3e4798ac2949e1237534331cd6e6bb797f14c383 /openstackclient/network
parente4b8c31cd399f469b3378069187614763c24451d (diff)
downloadpython-openstackclient-4a9cb8eea8e47950cb30ecaa7572a23d80d5bfcd.tar.gz
Support filtering port with IP address substring
Change-Id: I9559f1c0a6db943705bd32aefb60d7ea7054dd1b Related-Bug: #1718605
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/port.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
index f13ee7b9..af6efa9d 100644
--- a/openstackclient/network/v2/port.py
+++ b/openstackclient/network/v2/port.py
@@ -215,6 +215,9 @@ def _prepare_filter_fixed_ips(client_manager, parsed_args):
if 'ip-address' in ip_spec:
ips.append('ip_address=%s' % ip_spec['ip-address'])
+
+ if 'ip-substring' in ip_spec:
+ ips.append('ip_address_substr=%s' % ip_spec['ip-substring'])
return ips
@@ -531,11 +534,13 @@ class ListPort(command.Lister):
identity_common.add_project_domain_option_to_parser(parser)
parser.add_argument(
'--fixed-ip',
- metavar='subnet=<subnet>,ip-address=<ip-address>',
+ metavar=('subnet=<subnet>,ip-address=<ip-address>,'
+ 'ip-substring=<ip-substring>'),
action=parseractions.MultiKeyValueAction,
- optional_keys=['subnet', 'ip-address'],
+ optional_keys=['subnet', 'ip-address', 'ip-substring'],
help=_("Desired IP and/or subnet for filtering ports "
- "(name or ID): subnet=<subnet>,ip-address=<ip-address> "
+ "(name or ID): subnet=<subnet>,ip-address=<ip-address>,"
+ "ip-substring=<ip-substring> "
"(repeat option to set multiple fixed IP addresses)"),
)
_tag.add_tag_filtering_option_to_parser(parser, _('ports'))