summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorYan Xing'an <yanxingan@cmss.chinamobile.com>2016-10-17 22:33:35 -0700
committerYan Xing'an <yanxingan@cmss.chinamobile.com>2016-10-19 02:50:47 -0700
commita1e305641430af48b72c941f87c7ffcc182b3f9a (patch)
tree18d82e1109690ea72faee64e36c8ab49fe5fc44a /openstackclient/network
parent5e3ec1b42faf7dc49722b58829b6c2cf5c15da79 (diff)
downloadpython-openstackclient-a1e305641430af48b72c941f87c7ffcc182b3f9a.tar.gz
Add option to allow filtering by mac-address on port list
Added support to allow filtering ports via --mac-address option to the port list command. Change-Id: I903e443f2f9057571d46520c4cafb88d1972c0cb Partial-bug: #1634333 Partially-Implements: blueprint network-commands-options
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/port.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
index 86174d53..8916fd73 100644
--- a/openstackclient/network/v2/port.py
+++ b/openstackclient/network/v2/port.py
@@ -385,6 +385,11 @@ class ListPort(command.Lister):
help=_("List only ports attached to this server (name or ID)"),
)
parser.add_argument(
+ '--mac-address',
+ metavar='<mac-address>',
+ help=_("List only ports with this MAC address")
+ )
+ parser.add_argument(
'--long',
action='store_true',
default=False,
@@ -429,6 +434,8 @@ class ListPort(command.Lister):
network = network_client.find_network(parsed_args.network,
ignore_missing=False)
filters['network_id'] = network.id
+ if parsed_args.mac_address:
+ filters['mac_address'] = parsed_args.mac_address
data = network_client.ports(**filters)