Manage the configuration of network devices according to the YANG models (OpenConfig/IETF).
New in version 2017.7.0.
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.
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.
YANG structured data.
A list of models to be used when generating the config.
None
Use certain profiles to generate the config. If not specified, will use the platform default profile(s).
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.
True
Commit? Default: True
.
False
Debug mode. Will insert a new key under the output dictionary,
as loaded_config
containing the raw configuration loaded on the device.
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"
Manage the device configuration given the input data structured according to the YANG models.
YANG structured data.
A list of models to be used when generating the config.
None
Use certain profiles to generate the config. If not specified, will use the platform default profile(s).
False
Return the compliance report in the comment.
New in version 2017.7.3.
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.
True
Commit? Default: True
.
False
Debug mode. Will insert a new key under the output dictionary,
as loaded_config
containing the raw configuration loaded on the device.
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"