DevNet Associate (DEVASC) v1.0Infrastructure and AutomationHard
A network engineer is using the 'pyang' tool to validate a custom YANG module that defines new configuration parameters for a router. After writing the YANG file, the engineer runs 'pyang -f tree my-custom-module.yang'. What is the primary purpose of using the '-f tree' option in this command?
- ATo convert the YANG module into a NETCONF XML payload.
- BTo check for syntax errors and semantic correctness without any output.
- CTo generate a graphical representation of the module's data model.
- DTo display the module's data model in a human-readable tree format.
Show answer & explanationAnswer & explanation
Correct answer: D. To display the module's data model in a human-readable tree format.
The 'pyang -f tree' command is used to output the YANG module's data model in a structured, human-readable tree format. This helps engineers visualize the hierarchical structure of the defined configuration and state data, making it easier to understand and debug the model.
Why the other options are wrong
- A. '-f tree' does not convert to NETCONF XML payload; other options (like '-f xml') are used for that.
- B. Syntax and semantic checking is a default function of pyang; '-f tree' adds a specific output format, not just validation without output.
- C. While visualization is a goal, '-f tree' produces text, not a graphical representation directly.
pyang -f tree
The 'pyang -f tree' command is a utility in the pyang tool that displays a YANG module's data model in a human-readable, hierarchical tree format. This output helps engineers visualize and understand the structure of the defined data.
- Visualizes YANG data model.
- Outputs in textual tree format.
- Aids in understanding module structure.
- Used for validation and documentation.
Memory trick: PYANG 'PICTURES' the YANG module as a TREE.