cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
205
Views
3
Helpful
6
Replies
Cisco Employee

resource manager

 

All,

 

 

I’m trying to figure out how the resource manager package works together with id-allocator and ipaddress-allocator.

 

I have a simple service just for testing in my lab setup that will create a csr VM.

 

I’m trying to figure out how to automatically assign an ip address for the management interface initially.

 

 

If anyone has staged this in a sample I can look at or can reply back with some high level steps , I would appreciate the jumpstart.

 

 

-Scott

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Cisco Employee

Re: resource manager

 

Hi Scott,

 

 

What version are you using? The latest version is 1.5.0:  https://software.cisco.com/download/release.html?mdfid=286312205&flowid=81492&softwareid=286283941&release=4.3.0.1&relind=AVAILABLE&rellifecycle=&reltype=latest

 

 

If the version isn’t very old, you should have two example packages id-loop and ip-loop and a pdf in the resource-manager package.

 

 

The ip-loop looks like this:

 

------------------

 

import ncs

 

from ncs.application import Service

 

import resource_manager.ipaddress_allocator as ip_allocator

 

 

 

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/ip-vl:ip-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))

 

 

 

class Loop(ncs.application.Application):

 

    def setup(self):

 

        self.log.info('Loop RUNNING')

 

self.register_service('ip-loopspnt-python', LoopService)

 

 

    def teardown(self):

 

        self.log.info('Loop FINISHED')

 

 

---------------------

 

 

In the cli we set the service:

 

 

set services ip-loop-python sId pool management cidr-length 32

 

 

Note that the example packages also contains java examples, requesting an id:

 

 

  1. IdAllocator.idRequest(service, poolName, username, serviceName, false);

 

 

BR,

 

Johan

 

View solution in original post

6 REPLIES 6
Highlighted
Cisco Employee

Re: resource manager

 

Hi Scott,

 

 

What version are you using? The latest version is 1.5.0:  https://software.cisco.com/download/release.html?mdfid=286312205&flowid=81492&softwareid=286283941&release=4.3.0.1&relind=AVAILABLE&rellifecycle=&reltype=latest

 

 

If the version isn’t very old, you should have two example packages id-loop and ip-loop and a pdf in the resource-manager package.

 

 

The ip-loop looks like this:

 

------------------

 

import ncs

 

from ncs.application import Service

 

import resource_manager.ipaddress_allocator as ip_allocator

 

 

 

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/ip-vl:ip-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))

 

 

 

class Loop(ncs.application.Application):

 

    def setup(self):

 

        self.log.info('Loop RUNNING')

 

self.register_service('ip-loopspnt-python', LoopService)

 

 

    def teardown(self):

 

        self.log.info('Loop FINISHED')

 

 

---------------------

 

 

In the cli we set the service:

 

 

set services ip-loop-python sId pool management cidr-length 32

 

 

Note that the example packages also contains java examples, requesting an id:

 

 

  1. IdAllocator.idRequest(service, poolName, username, serviceName, false);

 

 

BR,

 

Johan

 

View solution in original post

Highlighted
Cisco Employee

Re: resource manager

 

Johan,

 

 

Thank you for taking the time to reply and get me headed in the right direction.

 

I’m installing 4.3 in my lab setup now.

 

 

I really appreciate the help!

 

-Scott

 

Highlighted
Cisco Employee

Re: resource manager

 

Johan , Team ,

 

 

Are there any python libraries within NSO that provide for ip address iteration over an allocated pool ?

 

I also have a requirement to convert mask format to/from (255.255.255.0 <-> /24).

 

 

Just figured I’d ask before reinventing the wheel.

 

 

-Scott

 

Highlighted
Cisco Employee

Re: resource manager

Highlighted
Cisco Employee

Re: resource manager

 

Johan, Team,

 

 

I have several packages working that leverage resource manager on my laptop install of NSO 4.3.

 

I’m trying to change the underlying NSO version from 4.3 to 4.2 to match the current version of NSO in the customer lab.

 

I’ve installed 4.2 in a separate directory, ran ncs-setup and attempted to copy over packages/* from NSO 4.3.

 

 

I’ve recompiled all packages via make but resource manager is giving me some problems.

 

I  can’t find any documentation mentioning tailf-doc.

 

 

The following message shows:

 

 

(venv)SCODONNE-M-N01F:src scodonne$ make all clean

 

cd java && DEPS=../../.. ant -q all

 

 

BUILD SUCCESSFUL

 

Total time: 0 seconds

 

/Library/Developer/CommandLineTools/usr/bin/make -C ../doc clean

 

Makefile:10: *** "You need to have tailf-doc in PATH, see doc/README".  Stop.

 

make: *** [clean] Error 2

 

 

 

(venv)SCODONNE-M-N01F:src scodonne$ java -version

 

java version "1.8.0_111"

 

Java(TM) SE Runtime Environment (build 1.8.0_111-b14)

 

Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

 

 

 

Additionally, the following shows when attempting to start ncs:

 

 

(venv)SCODONNE-M-N01F:mlv-ncs-run scodonne$ ncs -v --foreground

 

<INFO> 20-Jan-2017::14:03:09.296 SCODONNE-M-N01F ncs[10879]: - Enabling error log

 

<INFO> 20-Jan-2017::14:03:09.301 SCODONNE-M-N01F ncs[10879]: - Writing error log to ./logs/ncserr.log

 

<INFO> 20-Jan-2017::14:03:09.329 SCODONNE-M-N01F ncs[10879]: - Writing daemon log to /Volumes/SSDCard/nso42/mlv-ncs-run/logs/ncs.log

 

<INFO> 20-Jan-2017::14:03:09.329 SCODONNE-M-N01F ncs[10879]: - Writing NETCONF log to /Volumes/SSDCard/nso42/mlv-ncs-run/logs/netconf.log

 

<INFO> 20-Jan-2017::14:03:09.329 SCODONNE-M-N01F ncs[10879]: - Writing SNMP log to /Volumes/SSDCard/nso42/mlv-ncs-run/logs/snmp.log

 

<INFO> 20-Jan-2017::14:03:09.329 SCODONNE-M-N01F ncs[10879]: - Writing audit log to /Volumes/SSDCard/nso42/mlv-ncs-run/logs/audit.log

 

<INFO> 20-Jan-2017::14:03:09.329 SCODONNE-M-N01F ncs[10879]: - Writing developer log to /Volumes/SSDCard/nso42/mlv-ncs-run/logs/devel.log

 

<INFO> 20-Jan-2017::14:03:09.330 SCODONNE-M-N01F ncs[10879]: - Writing XPath trace log to /Volumes/SSDCard/nso42/mlv-ncs-run/logs/xpath.trace

 

<INFO> 20-Jan-2017::14:03:09.330 SCODONNE-M-N01F ncs[10879]: - Daemon logging started

 

<INFO> 20-Jan-2017::14:03:09.412 SCODONNE-M-N01F ncs[10879]: ncs embedded apps in early_phase0: []

 

<DEBUG> 20-Jan-2017::14:03:09.489 SCODONNE-M-N01F ncs[10879]: - Loading file ./state/packages-in-use/1/resource-manager/load-dir/id-allocator-oper.fxs

 

<CRIT> 20-Jan-2017::14:03:09.490 SCODONNE-M-N01F ncs[10879]: - Failed to load file ./state/packages-in-use/1/resource-manager/load-dir/id-allocator-oper.fxs: ./state/packages-in-use/1/resource-manager/load-dir/id-allocator-oper.fxs: Must be recompiled!

 

"Failed to load file ./state/packages-in-use/1/resource-manager/load-dir/id-allocator-oper.fxs: ./state/packages-in-use/1/resource-manager/load-dir/id-allocator-oper.fxs: Must be recompiled!\n"

 

 

Highlighted
Cisco Employee

Re: resource manager

 

Scott,

 

 

In the make command line order does matter.

 

 

I think you want to do:

 

$ make clean all 

 

 

Instead of:

 

$ make all clean

 

 

If you invoke the ‘clean’ target after the ‘all’, the fxs file that is created by the ‘all’ will get deleted by the ‘clean’…

 

 

-Larry

 

Content for Community-Ad
FusionCharts will render here