05-30-2017 07:39 AM - edited 03-01-2019 03:51 AM
We need to manage IP resource pools for a DHCP service using NSO. Please can anyone with experience using NSO to manage an IP resource pool, please share codes used for this ?
Python codes will be great, but we can also look codes written in other language.
Thanks
Solved! Go to Solution.
05-30-2017 09:14 AM
I'm assuming you're using the ipaddress-allocator and resource-manager packages.
If so, you can allocate networks (or addresses) like this:
class LoopService(Service):
@Service.create
def cb_create(self, tctx, root, service, proplist):
self.log.info('Service create(service=', service._path, ')')
pool_name = service.pool
alloc_name = service.name
self.log.info('CIDR length = ', service.cidr_length)
ip_allocator.net_request(service,
"/services/vl:loop-python[name='%s']" % (service.name),
tctx.username,
pool_name,
alloc_name,
service.cidr_length)
net = ip_allocator.net_read(tctx.username, root,
pool_name, alloc_name)
if not net:
self.log.info("Alloc not ready")
return
self.log.info('net = %s' % (net))
05-30-2017 09:14 AM
I'm assuming you're using the ipaddress-allocator and resource-manager packages.
If so, you can allocate networks (or addresses) like this:
class LoopService(Service):
@Service.create
def cb_create(self, tctx, root, service, proplist):
self.log.info('Service create(service=', service._path, ')')
pool_name = service.pool
alloc_name = service.name
self.log.info('CIDR length = ', service.cidr_length)
ip_allocator.net_request(service,
"/services/vl:loop-python[name='%s']" % (service.name),
tctx.username,
pool_name,
alloc_name,
service.cidr_length)
net = ip_allocator.net_read(tctx.username, root,
pool_name, alloc_name)
if not net:
self.log.info("Alloc not ready")
return
self.log.info('net = %s' % (net))
06-02-2017 12:26 AM
Thanks Fedrick for sharing this. Very helpful
We are have NSO 4.4.1 installed but looking at the tailf download site we dont seem to have ipaddress-allocator and resource-manager packages for 4.4.1 release, with the last version release
being 4.2.1.2/
Does anyone know if the ipaddress-allocator , resource-manager, packages and nso-util for 4.2.1.2 is compatible with NSO 4.4.1 ?
Is there plans to have these ncs packages updated?
06-02-2017 12:41 AM
That should be fine, download the latest version from NSO Software, here on the Hub, please let me know if you don't have access.
Recompile it for your NSO (e.g make clean all -C packages/resource-manager/src).
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide