200-901 · Question #583
Refer to the exhibit. A developer is creating a YANG file to design data with Python. Which code must be used for the tree of the YANG file?
The correct answer is A. pyang -f tree future-industries-tech.yang. To visualize the hierarchical structure of a YANG file as a tree, the pyang tool is used with the -f tree command-line option.
Question
Refer to the exhibit. A developer is creating a YANG file to design data with Python. Which code must be used for the tree of the YANG file?
Exhibit
Options
- Apyang -f tree future-industries-tech.yang
- Bpyang -i tree future-industries-tech.yang
- Cpyang -f leaf future-industries-tech.yang
- Dpyang tree future-industries-tech.yang
How the community answered
(20 responses)- A90% (18)
- B5% (1)
- D5% (1)
Why each option
To visualize the hierarchical structure of a YANG file as a tree, the `pyang` tool is used with the `-f tree` command-line option.
The `pyang` tool is a validator and converter for YANG data models, and the `-f` or `--format` option is used to specify the output format. The `tree` format specifically renders the YANG data model in a human-readable, hierarchical tree structure.
The `-i` option for `pyang` is used to specify import paths for YANG modules, not for defining the output format.
While `-f` is the correct option for format, `leaf` is a YANG data type and not a valid output format for `pyang` to display the model as a tree.
The `pyang` command requires the `-f` flag to specify `tree` as an output format; otherwise, `tree` would be interpreted as a module name to be processed.
Concept tested: YANG model visualization (pyang tree)
Source: https://datatracker.ietf.org/doc/html/rfc7950
Topics
Community Discussion
No community discussion yet for this question.
