DevNet Associate (DEVASC) v1.0Infrastructure and AutomationHard
A network engineer is using the 'pyang' tool to validate a custom YANG module for a new network service. After running the validation, the engineer wants to generate a tree-like representation of the module's data model to easily visualize its hierarchical structure and identify potential issues. Which 'pyang' format option should be used?
- A-f json
- B-f tree
- C-f yin
- D-f dsdl
Show answer & explanationAnswer & explanation
Correct answer: B. -f tree
The 'pyang -f tree' command generates a text-based, tree-like representation of the YANG module's data model. This output clearly shows the hierarchical structure of containers, lists, leaves, and their properties, which is invaluable for visualization and debugging during module development.
Why the other options are wrong
- A. -f json outputs the YANG module in a JSON-encoded format, not a hierarchical tree visualization.
- C. -f yin outputs the YANG module in YIN (YANG Independent Notation) format, which is an XML-based representation of YANG, not a tree visualization.
- D. -f dsdl outputs the YANG module as an XML Schema (DSDL), which is for validation of XML documents, not for visualizing the YANG module's structure directly.
pyang -f tree
The 'pyang -f tree' command is used with the 'pyang' YANG validator and converter tool to generate a clear, hierarchical, ASCII-art tree representation of a YANG module's data model. This output aids in understanding and debugging the module's structure.
- Outputs a tree-like text visualization
- Shows hierarchical structure of YANG nodes
- Useful for module development and debugging
- Part of the 'pyang' tool
- Displays containers, lists, leaves, and types
Memory trick: Pyang's tree format helps you see the YANG forest.