09-26-2023 12:43 AM
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.
Solved! Go to Solution.
11-28-2023 06:22 AM
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.
11-24-2023 12:40 AM
Guys Any inputs ?
11-27-2023 12:15 PM
There is not much to add to the error message itself, the deviation module indeed introduces circular module dependencies. Your options include:
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
.
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.
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.
Combine 2. and 3. - deselect the deviation module and modify the deviated module so that the result corresponds to what the device expects.
11-27-2023 10:28 PM
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.
11-28-2023 06:22 AM
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.
01-17-2024 10:45 PM - edited 01-17-2024 10:47 PM
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 ?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide