How can I (dynamically) create resource pools that assign resources on a per-device basis? Basically, I'd like to generate a pool for every device that assigns an index to some of the device's interfaces.
The following will re-use the same indexes for all devices, which is not what I want:
for interface in service.interface: self.log.info('Working on interface ', interface.ifname) id_allocator.id_request(service, "/sdwan-underlay[device='%s']" % (service.device), tctx.username, 'ifids', interface.ifname, False)
if not ifid: # must start at 1, 0 will drop into this self.log.info("IFID not ready") return self.log.info('IFID = %s' % (ifid)) interface.intfid = ifid
I could of course manually create a pool for every device before I actually add the device, but I'm looking for a way how to handle that in Python. How can I create such a pool when (before) a new device is added? And how could it be deleted when the device disappears again?
pool_name = service.device idpool = root.ralloc__resource_pools.idalloc__id_pool #Check if pool exists, if not, create new one if not pool_name in idpool: idpool.create(pool_name) self.log.info('Generating a new idpool for ', pool_name) idpool[pool_name].range.start = 1 idpool[pool_name].range.end = 128
for interface in service.interface: self.log.info('Working on interface ', interface.ifname) id_allocator.id_request(service, "/sdwan-underlay[device='%s']" % (service.device), tctx.username, pool_name, interface.ifname, False)
One comment, you probably want to skip that if-statement checking if the pool already exists or not. If you have multiple services on the same device you want them all to create the pool. NSO is reference counting which means that if they all have a reference to the pool it won’t be deleted until the last service is deleted.
SW upgrade or migration is something you never can escape from so it's better to make it part of your process. The remaining challenge is to determine when to give up what has been working to secure your future needs. Martin and the NSO team will guide y...
There is not a single golden tool that fits all purposes simply because development processes and needs are different. Instead, pick the tooling you need from the Smörgåsbord and build your environment to suit your needs. Shashidhar will guide you throug...
How Verizon Streamlined NSO Development with Continuous Integration
This is a customer success story of how Verizon ITNUC builds a CI chain to streamline the NSO development process. The containerized NSO makes testing several NSO packages in para...
It is best practice to avoid storing your secrets (e.g., passwords and shared keys) in plain text, either on NSO or on the device. In NSO, we support multiple encrypted data types that are encrypted using a local key. Similarly, many devices such as Cisco...