Skip to content

Latest commit

 

History

History
188 lines (156 loc) · 6.87 KB

community.yang.json2xml_lookup.rst

File metadata and controls

188 lines (156 loc) · 6.87 KB

community.yang.json2xml

Validates json configuration against yang data model and convert it to xml.

  • This plugin lookups the input json configuration, validates it against the respective yang data model which is also given as input to this plugin and coverts it to xml format which can be used as payload within Netconf rpc.
Parameter Choices/Defaults Configuration Comments
_terms
path / required
Input json configuration file path that adheres to a particular yang model.
doctype
-
Default:
"config"
Specifies the target root node of the generated xml. The default value is config
keep_tmp_files
boolean
    Choices:
  • no ←
  • yes
This is a boolean flag to indicate if the intermediate files generated while validation json configuration should be kept or deleted. If the value is true the files will not be deleted else by default all the intermediate files will be deleted irrespective of whether task run is successful or not. The intermediate files are stored in path ~/.ansible/tmp/json2xml, this option is mainly used for debugging purpose.
search_path
-
This option is a colon : separated list of directories to search for imported yang modules in the yang file mentioned in path option. If the value is not given it will search in the current directory.
yang_file
path / required
Path to yang model file against which the json configuration is validated and converted to xml.

- name: translate json to xml
  debug: msg="{{ lookup('yang_json2xml', config_json,
                         yang_file='openconfig/public/release/models/interfaces/openconfig-interfaces.yang',
                         search_path='openconfig/public/release/models:pyang/modules/') }}"

Common return values are documented here, the following are the fields unique to this lookup:

Key Returned Description
_raw
-
The translated xml string from json



Authors

  • Ganesh Nalawade (@ganeshrn)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.