cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1204
Views
2
Helpful
4
Replies

Problem with id-allocator package (1.4.0)

previousqna
Level 5
Level 5

Hi,

 

 

Has anyone used the id-allocator package that is found on stash ? v1.4.0 ?

 

 

I am trying to create a simple pool and and it fails:

 

 

admin@ncs(config)# resource-pools id-pool test range start 9 end 10

 

admin@ncs(config-id-pool-test)# top

 

admin@ncs(config)# commit

 

Commit complete.

 

admin@ncs(config)#

 

admin@ncs# show running-config resource-pools

 

resource-pools id-pool test

 

range start 9

 

range end 10

 

!

 

admin@ncs#

 

 

Everything seems to be fine but the ncs-java-vm.log throws an error:

 

 

<ERROR> 25-Feb-2017::01:38:04.545 RangeSet (id-allocator:Reactive fastmap id allocation)-Run-0: - Failed to setup RangeSet

 

  1. com.tailf.cdb.CdbException: already exists

              at com.tailf.cdb.CdbException.mk(CdbException.java:64)              at com.tailf.cdb.CdbSession.create(CdbSession.java:1100)              at com.tailf.pkg.idallocator.RangeSet.<init>(RangeSet.java:45)              at com.tailf.pkg.idallocator.IdAllocator.createPool(IdAllocator.java:1118)              at com.tailf.pkg.idallocator.IdAllocator.run(IdAllocator.java:295)              at com.tailf.ncs.ctrl.ApplicationLifeCycle$1.run(ApplicationLifeCycle.java:72)              at java.lang.Thread.run(Thread.java:745)  <ERROR> 25-Feb-2017::01:38:04.550 RangeSet (resource-manager:Reactive fastmap id allocation)-Run-2: - Could not add range {"start":9,"end":10} 

  1. com.tailf.cdb.CdbException: already exists

 

            at com.tailf.cdb.CdbException.mk(CdbException.java:64)

 

            at com.tailf.cdb.CdbSession.create(CdbSession.java:1100)

 

            at com.tailf.cdb.CdbSession.create(CdbSession.java:1120)

 

            at com.tailf.pkg.idallocator.RangeSet.add(RangeSet.java:83)

 

            at com.tailf.pkg.idallocator.RangeSet.add(RangeSet.java:19)

 

            at com.tailf.pkg.idpool.IDPool.recalculateRanges(IDPool.java:221)

 

            at com.tailf.pkg.idpool.IDPool.setRange(IDPool.java:174)

 

            at com.tailf.pkg.idallocator.IdAllocator.createPool(IdAllocator.java:1136)

 

            at com.tailf.pkg.idallocator.IdAllocator.run(IdAllocator.java:295)

 

            at com.tailf.ncs.ctrl.ApplicationLifeCycle$1.run(ApplicationLifeCycle.java:72)

 

            at java.lang.Thread.run(Thread.java:745)

 

 

All packages (nso-util, resource-manager and id-allocator) are the latest version from stash (cloned):

 

 

git clone https://stash.tail-f.com/scm/pkg/resource-manager.git

 

git clone https://stash.tail-f.com/scm/pkg/nso-util.git

 

git clone https://stash.tail-f.com/scm/pkg/id-allocator.git

 

 

The installation is fresh 4.3.1 installation.

 

 

Any ideas ? Should I not be using those ? the package posted on developer.cisco.com is not the latest and is from July 2016.

1 Accepted Solution

Accepted Solutions

Great feedback! I’m adding a review of the README.md in our issue tracker, could you find the information you needed in the documentation?

 

 

You do need to have resource manager as a required package. I think it’s part of the python package documentation.

View solution in original post

4 Replies 4

previousqna
Level 5
Level 5

Please use the resource-manager package instead. Version 2.1.1 was released this Friday.

I figured out yesterday that the resource-manager package now includes the id-allocator.py and ipaddress_allocator.py.

 

 

I think documentation in the README.md should include this details, explaining how to use it and everything, I would gladly write something and submit a Pull Request but I was not able to figure out how to get an account on Atlassian Bitbucket.

 

 

There is also a typo () in the example that can be found in both id_allocator.py and ipaddress_allocator.py:

 

 

(default-py2) [lurueda resource_manager:develop±]$ diff ipaddress_allocator.py.bak ipaddress_allocator.py

 

21c21

 

<     import reource_manager.ipaddress_allocator as ip_allocator

 

---

 

>     import resource_manager.ipaddress_allocator as ip_allocator

 

(default-py2) [lurueda resource_manager:develop±]$ diff id_allocator.py.bak id_allocator.py

 

14c14

 

<     import reource_manager.id_allocator as id_allocator

 

---

 

>     import resource_manager.id_allocator as id_allocator

 

 

And there is something else, which I do not know if should also be part of the instructions. I had to add the resource-manager package as a pre-requisite in the package-meta-data.xml for the package I am using which is importing the resource_manager.id_allocator package

 

 

(default-py2) [lurueda l2vpn:master]$ grep -C1 resource-manager package-meta-data.xml

 

  <required-package>

 

    <name>resource-manager</name>

 

  </required-package>

 

 

Can you confirm this is required, I could not get it to work without it. I kept getting the following error:

 

2017-02-25 22:31:23 - l2vpn :: Traceback (most recent call last):

 

  File "/opt/cisco/nso/4.3.1/src/ncs/pyapi/ncs_pyvm/startup.py", line 227, in start_components

 

2017-02-25 22:31:23 - l2vpn ::     pname=pname, cname=cname, main_q=self.msg_sink)

 

  File "/opt/cisco/nso/4.3.1/src/ncs/pyapi/ncs_pyvm/ncsthreads.py", line 152, in __init__

 

2017-02-25 22:31:23 - l2vpn ::     mod = __import__(modname)

 

  File "/private/tmp/nso-python-examples/state/packages-in-use/1/l2vpn/python/l2vpn/main.py", line 6, in <module>

 

2017-02-25 22:31:23 - l2vpn ::     import resource_manager.id_allocator as id_allocator

 

ImportError: No module named resource_manager.id_allocator

Great feedback! I’m adding a review of the README.md in our issue tracker, could you find the information you needed in the documentation?

 

 

You do need to have resource manager as a required package. I think it’s part of the python package documentation.

The README.md is kind of misleading because it does mention that is not a standalone package when in reality I think that this version is quite the opposite. It is a standalone package now in this version.

 

 

Resource manager is NOT a standalone package. You will need an 'implementation' package, e.g. id-allocator or ipaddress-allocator.

 

The easiest way is to download and use the 'Resource Manager Bundle' which you should find in the same place where you found this package.

 

The id-allocator and ipaddress-allocator should also be available at the same place.

 

 

The other thing is that we should have in the README.md an example of how to use resource allocation on a package the reader wants to build (examples for both Java and Python).