diff options
| author | Tang Chen <chen.tang@easystack.cn> | 2016-02-09 14:23:28 +0800 |
|---|---|---|
| committer | Steve Martinelli <stevemar@ca.ibm.com> | 2016-02-14 04:21:08 +0000 |
| commit | d8abec33ada8b2b028d52eb8bfad2640812b9af8 (patch) | |
| tree | 2fa0f1ac02ce9bb4b7a17cdbb5a521e05f7899bd /openstackclient/network/v2 | |
| parent | 6109dfcf63a666330e7323d957a37a251dd2b520 (diff) | |
| download | python-openstackclient-d8abec33ada8b2b028d52eb8bfad2640812b9af8.tar.gz | |
Floating IP: Neutron support for "ip floating list" command
Change-Id: I253f66f6bc64470e1a18ffea506048eb53f67d5c
partial-Bug: 1519502
Related-to: blueprint neutron-client
Diffstat (limited to 'openstackclient/network/v2')
| -rw-r--r-- | openstackclient/network/v2/floating_ip.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py index 91a93380..48895048 100644 --- a/openstackclient/network/v2/floating_ip.py +++ b/openstackclient/network/v2/floating_ip.py @@ -38,3 +38,29 @@ class DeleteFloatingIP(common.NetworkAndComputeCommand): parsed_args.floating_ip, ) client.floating_ips.delete(obj.id) + + +class ListFloatingIP(common.NetworkAndComputeLister): + """List floating IP(s)""" + + columns = ('ID', 'IP', 'Fixed IP', 'Instance ID', 'Pool') + column_headers = ('ID', 'Floating IP', 'Fixed IP', 'Server ID', 'Pool') + + def take_action_network(self, client, parsed_args): + query = {} + data = client.ips(**query) + + return (self.column_headers, + (utils.get_item_properties( + s, self.columns, + formatters={}, + ) for s in data)) + + def take_action_compute(self, client, parsed_args): + data = client.floating_ips.list() + + return (self.column_headers, + (utils.get_item_properties( + s, self.columns, + formatters={}, + ) for s in data)) |
