mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
530 stars 343 forks source link

xml output is empty #796

Open VahidTa opened 2 years ago

VahidTa commented 2 years ago

Hi, I tired to convert "Cisco-IOS-XR-aaa-protocol-radius-cfg.yang" model to xml with smaple-xml-skeleton feature, but it returns empty skeleton. I tested with tree option and it worked.

Regards, Vahid

llhotka commented 2 years ago

This module contains only augments, an XML skeleton can be generated only if it is processed together with module(s) that are augmented by it – they provide the top-level part of the XML tree.

VahidTa commented 2 years ago

Thank you. But it is configuration part of the platform. So, is there any hint to provide XML configs with pyang for this type of YANG models?

llhotka commented 2 years ago

No, the sample-xml-skeleton can only work with a complete tree.

rkkilari commented 2 years ago

Is there any feature roadmap to support above usecase? Or is it a deadend using pyang for such usecase?

wlupton commented 2 years ago

You could try including the modules that define the augmented nodes?

pyang Cisco-IOS-XR-aaa-locald-cfg.yang Cisco-IOS-XR-aaa-lib-cfg.yang  Cisco-IOS-XR-aaa-protocol-radius-cfg.yang -f sample-xml-skeleton
VahidTa commented 2 years ago

Thank you @wlupton. Yes it worked! I think it is good idea to add this example into the documentation if there isn't any.

wlupton commented 2 years ago

I suppose that the XML skeleton could include dummy entries for nodes in any augmented paths, and then could include the augments. This would be a bit more consistent with 'tree' behavior. @mbj4668 and @llhotka, do you think this would make sense? (Perhaps there'd have to be a new option to enable this behaviour in order to preserve backwards-compatibility.)