Showing results for 
Search instead for 
Did you mean: 

Circular dependency errors while building Ned.



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: 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.

4 Replies 4


Guys Any inputs ?

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.


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. 

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: