How to Filter Floating IPs with Neutron Python API?

asked 2015-10-14 18:44:17 -0500

mattr gravatar image

I'm utilizing the Neutron Python API to attempt to filter for a specific Floating IP using the (neutron.list_floatingips()) method. In essence, I'm attempting to mimic this behavior:

$ neutron floatingip-list --tenant-id xxx | grep
| 4ec7639a-47ca-40a8-8cd9-7bc5272f666f | | | 64994354-4921-48ce-b819-d34d194c631c |

The issue is when performing the call to the API as such:

>>> neutron.list_floatingips()

It will return a dictionary object with ALL of the Floating IPs under the tenant, when only a specific IP needs to be returned. I've attempted (in a few different ways) to filter the results, similar to below:

>>> neutron.list_floatingips(filter_value={'floating_ip_address': ''})

It still returns the same results as when not including an argument. So my question is, what is the argument to be expected in order to filter for this specific value?

I'm aware I could potentially filter through the resulting dictionary values; however, I'm trying to avoid having the API return more results than necessary.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-11-04 15:55:41 -0500

mattr gravatar image

The solution is as follows:

{'floatingips': [{u'router_id': None, u'status': u'ACTIVE', u'tenant_id': u'8537ba5eb1d74d42ac22dcf840c4081a', u'floating_network_id': u'd06e2261-e3c7-4753-afaa-de3efe371f1f', u'fixed_ip_address': None, u'floating_ip_address': u'', u'port_id': None, u'id': u'ca22da1f-cce0-4d73-98d2-21522313b15f'}]}
edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-10-14 18:42:00 -0500

Seen: 718 times

Last updated: Nov 04 '15