How many floating ip's are available globally

Registered by Heiko Krämer

It should be possible for an admin user to see how many floating IP's on each/global
'router:external:True'
network are free/used.

Example:
neutron floatingip-list --free --all-tenants

+--------------------------------------+-------------------------+----------+---------+
| id | network_name | Free | Max
+--------------------------------------+-------------------------+----------+---------+
|2aa6c2xxxxx | test_pub | 34 | 250 |
+--------------------------------------+-------------------------+----------+---------+

To prevent have enough floating IP's in the pool of a growing stack. The configured stack should have enough IP's for customers.

Cheers
Heiko

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Heiko Krämer
Direction:
Needs approval
Assignee:
None
Definition:
Superseded
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Armando Migliaccio

Related branches

Sprints

Whiteboard

I'd rather add this informations on the $neutron subnet-list command, where we see 'start' and 'end' for every allocation pool (not only those 'external:True', the same problem applies to internal networks):

$ neutron subnet-list
+--------------------------------------+----------------+-----------------+----------------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+----------------+-----------------+----------------------------------------------------+
| c391f529-e87f-4de9-ab30-934475a20915 | public-subnet | 192.168.99.0/27 | {"start": "192.168.99.10", "end": "192.168.99.20"} |
| 95439d1e-0c14-4f4b-916d-782a773e5782 | private-subnet | 10.0.0.0/24 | {"start": "10.0.0.2", "end": "10.0.0.254"} |
+--------------------------------------+----------------+-----------------+----------------------------------------------------+

The code might affect the DB model: neutron/db/db_base_plugin_v2.py

Here is one of the affected tables:
MariaDB [neutron_ml2]> select * from ipavailabilityranges;
+--------------------------------------+---------------+---------------+
| allocation_pool_id | first_ip | last_ip |
+--------------------------------------+---------------+---------------+
| 7d81d92f-53bd-493b-8447-18b147991013 | 192.168.99.14 | 192.168.99.20 |
| cdcc918f-bb8c-4c77-8168-22781c7c759a | 10.0.0.2 | 10.0.0.254 |
+--------------------------------------+---------------+---------------+

Either they add a DB field with the size of the range, or they dynamically calculate it as part of the checks done in the method _validate_allocation_pools in db_base_plugin_v2.py

Anyhow, the API should report back the total capacity of the ip pool (the 'MAX' column in the blueprint proposal), plus display somewhere the current used capacity or the current available capacity (the 'FREE' column). This might relate to this BP https://blueprints.launchpad.net/neutron/+spec/neutron-network-statistics , but personally I prefer the approach of this BP. It's up to open discussion if a 'free/used' number makes sense, given it's variability compared to the static nature of an IP range configuration (that never changes). For some, the 'free/used' belongs in a /stats interface.

Here is an example of the extended API (example modified from http://docs.openstack.org/api/openstack-network/2.0/content/GET_os-subnets-v2_showSubnet__v2.0_subnets__subnet_id__subnets.html)

Note the added two fields 'free' and 'max' under 'allocation_pools'

GET /v2.0/subnets/{subnet_id}
{
    "subnet": {
        "name": "my_subnet",
        "enable_dhcp": true,
        "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
        "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
        "dns_nameservers": [],
        "allocation_pools": [
            {
                "start": "192.168.0.2",
                "end": "192.168.168.254",
                "free": "236",
                "max": "252",
            }
        ],
        "host_routes": [],
        "ip_version": 4,
        "gateway_ip": "192.0.0.1",
        "cidr": "192.0.0.0/8",
        "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"
    }
}

Malini-k-bhandaru: Are we not interested in any bandwidth capacity that is unsed?

(?)

Work Items