summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2
diff options
context:
space:
mode:
authorTang Chen <chen.tang@easystack.cn>2016-02-16 14:33:31 +0800
committerTang Chen <chen.tang@easystack.cn>2016-02-19 11:10:53 +0800
commitca34aa1587212ce5ac456a988fd6b442e646ed16 (patch)
treeb6983dc5c5ef55a57a998b0478437d307f56d593 /openstackclient/network/v2
parent444fc6149db58361e5329e3f05eb8f056fb7479a (diff)
downloadpython-openstackclient-ca34aa1587212ce5ac456a988fd6b442e646ed16.tar.gz
Floating IP: Fix "ip floating list" in neutron network
The implementation of "ip floating list" in the commit below is incorrect: Change-Id: I253f66f6bc64470e1a18ffea506048eb53f67d5c This is because the FloatingIP objects returned from Nova and Neutron network are different. They need different handling. This patch fixes this problem. The output for Neutron network would be: +--------------------------------------+---------------------+------------------+------+ | ID | Floating IP Address | Fixed IP Address | Port | +--------------------------------------+---------------------+------------------+------+ | 1976df86-e66a-4f96-81bd-c6ffee6407f1 | 172.24.4.3 | None | None | +--------------------------------------+---------------------+------------------+------+ The output for Neutron network would be: +----+---------------------+------------------+-----------+--------+ | ID | Floating IP Address | Fixed IP Address | Server ID | Pool | +----+---------------------+------------------+-----------+--------+ | 1 | 172.24.4.1 | None | None | public | +----+---------------------+------------------+-----------+--------+ Change-Id: I1295e922df695414511d9a07ca4a8e2428040064 Partial-Bug: 1519502 Related-to: blueprint neutron-client
Diffstat (limited to 'openstackclient/network/v2')
-rw-r--r--openstackclient/network/v2/floating_ip.py39
1 files changed, 32 insertions, 7 deletions
diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py
index 48895048..23b83201 100644
--- a/openstackclient/network/v2/floating_ip.py
+++ b/openstackclient/network/v2/floating_ip.py
@@ -43,24 +43,49 @@ class DeleteFloatingIP(common.NetworkAndComputeCommand):
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):
+ columns = (
+ 'id',
+ 'floating_ip_address',
+ 'fixed_ip_address',
+ 'port_id',
+ )
+ headers = (
+ 'ID',
+ 'Floating IP Address',
+ 'Fixed IP Address',
+ 'Port',
+ )
+
query = {}
data = client.ips(**query)
- return (self.column_headers,
+ return (headers,
(utils.get_item_properties(
- s, self.columns,
+ s, columns,
formatters={},
) for s in data))
def take_action_compute(self, client, parsed_args):
+ columns = (
+ 'ID',
+ 'IP',
+ 'Fixed IP',
+ 'Instance ID',
+ 'Pool',
+ )
+ headers = (
+ 'ID',
+ 'Floating IP Address',
+ 'Fixed IP Address',
+ 'Server',
+ 'Pool',
+ )
+
data = client.floating_ips.list()
- return (self.column_headers,
+ return (headers,
(utils.get_item_properties(
- s, self.columns,
+ s, columns,
formatters={},
) for s in data))