Manage the configuration of network devices according to the YANG models (OpenConfig/IETF).
New in version 2017.7.0.
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.netyang.
configured
(name, data, models, **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.
None
False
True
, will apply the config, discard
and return the changes. Default: False
and will commit
the changes on the device.True
True
.False
loaded_config
containing the raw configuration loaded on the device.False
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.netyang.
managed
(name, data, models, **kwargs)¶Manage the device configuration given the input data structured according to the YANG models.
None
False
Return the compliance report in the comment.
The compliance report structured object can be found however
in the pchanges
field of the output (not displayed on the CLI).
New in version 2017.7.3.
False
True
, will apply the config, discard
and return the changes. Default: False
and will commit
the changes on the device.True
True
.False
loaded_config
containing the raw configuration loaded on the device.False
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"