summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorRichard Theis <rtheis@us.ibm.com>2016-06-15 08:53:00 -0500
committerRichard Theis <rtheis@us.ibm.com>2016-06-20 16:32:20 -0500
commitc7fb3b36556a6e7622dd7b2bf2ddb5209e518773 (patch)
treea998c0cee73e4f0854d21b8686a7dd859b0a6ed5 /openstackclient/network
parent40004b5d80689f9f9cd802b1487f8e78830e6d4f (diff)
downloadpython-openstackclient-c7fb3b36556a6e7622dd7b2bf2ddb5209e518773.tar.gz
Add "--device-owner" option to "port list"
Add "--device-owner" option to the "port list" command to enable listing ports based on device owner. Change-Id: I0a538ec41800b9f842e86dceb6ca4180ef239c95 Implements: blueprint neutron-client
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/port.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
index 1c5db706..71dc1083 100644
--- a/openstackclient/network/v2/port.py
+++ b/openstackclient/network/v2/port.py
@@ -169,7 +169,8 @@ def _add_updatable_args(parser):
parser.add_argument(
'--device-owner',
metavar='<device-owner>',
- help=_("Device owner of this port")
+ help=_("Device owner of this port. This is the entity that uses "
+ "the port (for example, network:dhcp).")
)
parser.add_argument(
'--vnic-type',
@@ -310,6 +311,13 @@ class ListPort(command.Lister):
def get_parser(self, prog_name):
parser = super(ListPort, self).get_parser(prog_name)
parser.add_argument(
+ '--device-owner',
+ metavar='<device-owner>',
+ help=_("List only ports with the specified device owner. "
+ "This is the entity that uses the port (for example, "
+ "network:dhcp).")
+ )
+ parser.add_argument(
'--router',
metavar='<router>',
dest='router',
@@ -334,10 +342,12 @@ class ListPort(command.Lister):
)
filters = {}
+ if parsed_args.device_owner is not None:
+ filters['device_owner'] = parsed_args.device_owner
if parsed_args.router:
_router = client.find_router(parsed_args.router,
ignore_missing=False)
- filters = {'device_id': _router.id}
+ filters['device_id'] = _router.id
data = client.ports(**filters)