'openstack ip availability list/show' in Python API

406 views Asked by At

I would like to use this openstack command using the Python API. Going through the Neutron documentation, I found this page.

I tried executing 'network_ip_availability.ListIpAvailability(neutron.list_networks())' but it I get a 'TypeError: __init__() takes at least 3 arguments (2 given)'.

I cannot figure out what else does it need aside from a list of networks to display its IPs.

Any help in understanding on how to use these commands in Python API will be appreciated. Thank you.

1

There are 1 answers

0
dvnguyen On

I wouldn't use that internal API, but use the public one here. You'll need:

  1. Install the openstacksdk using pip pip install openstacksdk
  2. Get a Openstack connection object with your credentials. See more at connect guide
  3. Use the connection object above to access Openstack resource. For instance, here the guide to access network resource API.
  4. And finally, use the network API to get available floating IPs