ipaddr: Update docs (#54587)

Added docs for

* next_nth_usable
* next_usable
* range_usable
* last_usable

Fixes: #50546

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2019-04-06 00:50:27 +05:30 committed by Alicia Cozine
parent dd09a9a9fd
commit 098e0afbd5

View file

@ -405,6 +405,34 @@ be automatically converted to a router address (with a ``::1/48`` host address):
.. _6to4: https://en.wikipedia.org/wiki/6to4
Finding IP addresses within a range
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To find usable IP addresses within an IP range, try these ``ipaddr`` filters:
To find the next usable IP address in a range, use ``next_usable`` ::
# {{ '192.168.122.1/24' | ipaddr('next_usable') }}
192.168.122.2
To find the last usable IP address from a range, use ``last_usable``::
# {{ '192.168.122.1/24' | ipaddr('last_usable') }}
192.168.122.254
To find the available range of IP addresses from the given network address, use ``range_usable``::
# {{ '192.168.122.1/24' | ipaddr('range_usable') }}
192.168.122.1-192.168.122.254
To find the next nth usable IP address within a range, use ``next_nth_usable``::
# {{ '192.168.122.1/24' | next_nth_usable(2) }}
192.168.122.3
In this example, ``next_nth_usable`` returns the second usable IP address for the given IP range.
IP Math
^^^^^^^