IP Address Allocator

Manage IP address allocation in NSO.

The NSO Resource Manager IP Address Allocator allocates IP prefixes or individual addresses. It supports IPv4 and IPv6 resources.

Pool Definition

Each IP address pool is a named configuration item under /resource-pools/ip-address-pool and contains a list of subnets used for resource allocation.

admin@ncs(config)# resource-pools ip-address-pool some-pool subnet 192.0.2.0 24
admin@ncs(config)# resource-pools ip-address-pool some-pool subnet 2001:db8:: 32
admin@ncs(config)# commit

Additionally, non-overlapping exclusion ranges may be defined for a pool. The values from the exclusion ranges are not available for allocation.

admin@ncs(config)# resource-pools ip-address-pool some-pool exclude 192.0.2.4 30
admin@ncs(config)# commit
resource-pools ip-address-pool some-pool
 subnet 192.0.2.0 24
 subnet 2001:db8:: 32
 exclude 192.0.2.4 30
!

Allocate Action

Manual allocation or pre-allocation is possible with the use of the /resource-pools/find-ip action. If allocate parameter is specified, the allocation is persisted right away. Otherwise, a free resource is returned if found, however, it is not allocated.

The request must specify either a specific resource or requested prefix length:

See Allocation Options for more options.

Allocate by API

For service use, Resource Manager exposes the resource_manager.service.Allocator class.

First, import and create an instance of the Allocator, supplying the service object as provided by the service callback (e.g. cb_create):

Then, create a new IP address allocator request by calling Allocator.ip() and configuring a requested prefix length:

If you wish to allocate a specific value (if it is still available), you need to call the ip() function with the request_ip parameter instead:

You must also select a resource pool to assign the value from:

Finally, allocate an actual value by calling allocate() with the allocation name:

Last updated

Was this helpful?