napalm_parse_yang

Parse configuration/state from a file or device and returns a dict that

Parameters

Parameter Required Default Choices Description
dev_os False N/A N/A OS of the device
file_path False N/A N/A Path to a file to load native config/state from. Note: Either file_path or data to connect to a device must be provided. Note: file_path takes precedence over a live device
hostname False N/A N/A IP or FQDN of the device you want to connect to
mode True N/A N/A Whether to parse config/state or both. Note: `both` is not supported in combination with `file_path`.
models True N/A N/A A list that should match the SUPPORTED_MODELS in napalm-yang
optional_args False N/A N/A Dictionary of additional arguments passed to underlying driver
password False N/A N/A Password
profiles False N/A N/A A list profiles
provider False N/A N/A Dictionary which acts as a collection of arguments used to define the characteristics of how to connect to the device. Note - hostname, username, password and dev_os must be defined in either provider or local param if we want to parse from a device Note - local param takes precedence, e.g. hostname is preferred to provider['hostname']
timeout False N/A N/A Time in seconds to wait for the device to respond
username False N/A N/A Username

Examples

- name: Parse from device

  napalm_parse_yang:

    hostname: '{{ inventory_hostname }}'

    username: '{{ user }}'

    dev_os: '{{ os }}'

    password: '{{ passwd }}'

    mode: "config"

    profiles: ["eos"]

    models:

        - models.openconfig_interfaces

  register: running



- name: Parse from file

  napalm_parse_yang:

    file_path: "eos.config"

    mode: "config"

    profiles: ["eos"]

    models:

        - models.openconfig_interfaces

  register: config

Return

Name Description Returned Type Sample
changed Dict the representes a valid YANG object always dict {'interfaces': {'interface':'Et1': {...}, ... }}