# salt.states.net_napalm_yang

## NAPALM YANG state

Manage the configuration of network devices according to the YANG models (OpenConfig/IETF).

New in version 2017.7.0.

### Dependencies

- napalm-yang

- pyangbing > 0.5.11

To be able to load configuration on network devices, it requires NAPALM library to be installed: `pip install napalm`. Please check Installation for complete details.

salt.states.net_napalm_yang.configured(name, data, **kwargs)

  Configure the network device, given the input data strucuted according to the YANG models.

  Note

  The main difference between this function and `managed` is that the later generates and loads the configuration only when there are differences between the existing configuration on the device and the expected configuration. Depending on the platform and hardware capabilities, one could be more optimal than the other. Additionally, the output of the `managed` is different, in such a way that the `pchange` field in the output contains structured data, rather than text.

  data

    YANG structured data.

  models

    A list of models to be used when generating the config.

  profiles: `None`

    Use certain profiles to generate the config. If not specified, will use the platform default profile(s).

  test: `False`

    Dry run? If set as `True`, will apply the config, discard and return the changes. Default: `False` and will commit the changes on the device.

  commit: `True`

    Commit? Default: `True`.

  debug: `False`

    Debug mode. Will insert a new key under the output dictionary, as `loaded_config` containing the raw configuration loaded on the device.

  replace: `False`

    Should replace the config with the new generate one?

  State SLS example:

      {%- set expected_config =  pillar.get('openconfig_interfaces_cfg') -%}
      interfaces_config:
        napalm_yang.configured:
          - data: {{ expected_config | json }}
          - models:
            - models.openconfig_interfaces
          - debug: true

  Pillar example:

      openconfig_interfaces_cfg:
        _kwargs:
          filter: true
        interfaces:
          interface:
            Et1:
              config:
                mtu: 9000
            Et2:
              config:
                description: "description example"

salt.states.net_napalm_yang.managed(name, data, **kwargs)

  Manage the device configuration given the input data structured according to the YANG models.

  data

    YANG structured data.

  models

    A list of models to be used when generating the config.

  profiles: `None`

    Use certain profiles to generate the config. If not specified, will use the platform default profile(s).

  compliance_report: `False`

    Return the compliance report in the comment.

    New in version 2017.7.3.

  test: `False`

    Dry run? If set as `True`, will apply the config, discard and return the changes. Default: `False` and will commit the changes on the device.

  commit: `True`

    Commit? Default: `True`.

  debug: `False`

    Debug mode. Will insert a new key under the output dictionary, as `loaded_config` containing the raw configuration loaded on the device.

  replace: `False`

    Should replace the config with the new generate one?

  State SLS example:

      {%- set expected_config =  pillar.get('openconfig_interfaces_cfg') -%}
      interfaces_config:
        napalm_yang.managed:
          - data: {{ expected_config | json }}
          - models:
            - models.openconfig_interfaces
          - debug: true

  Pillar example:

      openconfig_interfaces_cfg:
        _kwargs:
          filter: true
        interfaces:
          interface:
            Et1:
              config:
                mtu: 9000
            Et2:
              config:
                description: "description example"