ygot
ygot copied to clipboard
Duplicate node error using Cisco XR yang models
Using the Cisco Unified Models located at https://github.com/YangModels/yang/tree/main/vendor/cisco/xr/742 we are receiving a duplicate node error as follows:
$ generator -path . -output_file /tmp/xr.go Cisco-IOS-XR-um-mpls-te-cfg.yang
F0516 09:45:29.202966 20121 generator.go:382] ERROR Generating GoStruct Code: Cisco-IOS-XR-um-mpls-te-cfg.yang:5258:3: Duplicate node "logging" in "interface" from:
Cisco-IOS-XR-um-mpls-te-cfg.yang:2253:5: logging
Cisco-IOS-XR-um-interface-cfg.yang:229:5: logging
Viewing the yang models using pyang the model renders correctly.
docker run --rm -v $(pwd):/yang ghcr.io/hellt/pyang pyang -f tree Cisco-IOS-XR-um-mpls-te-cfg.yang
The Cisco-IOS-XR-um-mpls-te-cfg model augments Cisco-IOS-XR-um-interface-cfg where the logging node already exists.
I assume these two logging nodes should be merged when generating the structs
Apologies for the late reply -- If by "merge" you mean resolving any differences between the two leaves and merging their properties, then this is not something we intend to support since in general they can be two different leaves with different types. If you mean to support the existence of both leaves at the same time, then ygot does not support it.
The reason is because goyang, and in extension ygot, doesn't support YANG's namespaces, therefore if in the same hierarchy the same name exists twice, even in different namespaces (in this case the augment node exists in the namespace of the augmenting module), then it will complain that there is a conflict. There is a document brainstorming on how to support this although there is currently no plan to implement it from the maintainers.