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