cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1041
Views
1
Helpful
5
Replies

Circular dependency errors while building Ned.

sjohri
Level 1
Level 1

Hello,

I am trying to build Ned after fetching the modules from the Netconf. But i am facing error of circular dependency while building Ned.

Steps followed:-

1)admin@ncs(config)# netconf-ned-builder project xyz 1.0 fetch-module-list
2)admin@ncs(config)# netconf-ned-builder project xyx module * * select
3)admin@ncs(config)# netconf-ned-builder project xyz 1.0 build-ned overwrite

Error:-

 error: deviation causes circular dependency between augmented/xyz-tempa@2021-08-09.yang and augmented/xyz-tempb@2021-09-09.yang

I tried running pyang with lint but there was no circular dependency detected

sjohri@mypc$ pyang --lint -f tree xyz-tempa.yang xyz-tempb.yang xyz-temp-deviation.yang
module: xyz-tempa
+--rw x
+--rw keyx? xyz-tb:testing
+--rw abc* string
+--rw xyz-tb:y? string

 

Error scenario:-

1) Yang A (xyx-tempa) 
2) Yang B (xyz-tempb) imports yang A and defines a new enum and an augmented leaf to Yang A
3) Deviation Yang (xyz-temp-deviation.yang) deviates/replaces a type of the leaf defined in YangA with a type defined in YangB.

I am attaching a sample yang for the reference.

Can you please provide some inputs.

1 Accepted Solution

Accepted Solutions

mvolf
Cisco Employee
Cisco Employee

I am probably missing your point. Circular module dependencies are not allowed, and for a reason. Your deviation module makes xyz-tempa dependent on xyz-tempb, since a leaf defined in the former is now typed by a type from the latter; and xyz-tempb depends on xyz-tempa by its definition. Operationally, it does not matter if a circular dependency was there from the day one or was introduced via a deviation, even though the latter may not be explicitly forbidden by the RFC. The fact that the tools you mention ignore or are somehow able to cope with circular dependencies is hardly really relevant.

View solution in original post

5 Replies 5

sjohri
Level 1
Level 1

Guys Any inputs ?

mvolf
Cisco Employee
Cisco Employee

There is not much to add to the error message itself, the deviation module indeed introduces circular module dependencies. Your options include:

  1. If you have control over the date model, fix the problem, e.g. by moving the typedef to another module that does not depend on tempa.

  2. Modify and fix the downloaded YANG modules before running the building the NED. The modules should be somewhere in your NSO instance’s state directory.

  3. Just deselect the deviation module. If it’s only deviation consists of narrowing the data type from string to enumeration, you may keep string - NSO would then allow you to use other values than strings base-0 and base-1, and if you do so, subsequent commit would probably fail. But other than that, everything else should work.

  4. Combine 2. and 3. - deselect the deviation module and modify the deviated module so that the result corresponds to what the device expects.

sjohri
Level 1
Level 1

Thanks @mvolf  for your responses.

As per yang RFC i could not find any reference that says this will cause circular dependency.
Any reference would be helpful.

Only thing i could find out was 

   There MUST NOT be any circular chains of imports.  For example, if
   module "a" imports module "b", "b" cannot import "a".

Other observations are:-


1) Even pyang with strict checking using --lint is not reporting any circular dependency
2) Netconf server is able to load the same.
3) MG-SOft and other Netconf client they are also not reporting it. 

mvolf
Cisco Employee
Cisco Employee

I am probably missing your point. Circular module dependencies are not allowed, and for a reason. Your deviation module makes xyz-tempa dependent on xyz-tempb, since a leaf defined in the former is now typed by a type from the latter; and xyz-tempb depends on xyz-tempa by its definition. Operationally, it does not matter if a circular dependency was there from the day one or was introduced via a deviation, even though the latter may not be explicitly forbidden by the RFC. The fact that the tools you mention ignore or are somehow able to cope with circular dependencies is hardly really relevant.

sjohri
Level 1
Level 1

Thanks @mvolf  for your valuable inputs.  I was wondering if there a way to make sure we catch the issue right at the time of writing the yang. As you mentioned that RFC does not explicitly forbids it and other open source tools like pyang etc are also not detecting it and developers may make such mistakes.

One way i could think of educating people around this, but such problems are tricky and could be missed.
Any other options if you could suggest ?