Although the installation of NAPALM is very easy, some underlying Python libraries have certain dependencies on various operating systems. This SaltStack formula provides the necessary state to install the required packages.
Note
See the full Salt Formulas installation and usage instructions.
Install the NAPALM and additional community drivers, together with their system requirements.
Note
Beginning with release 2.0.0, NAPALM has been reunified into a single monolithic package, and therefore the structure used by this formula has been therefore changed. The previous structure can be still found under the 1.0.0 tag, however this is not recommended usage as the individual drivers are no longer maintained.
Fields:
version
: The NAPALM version to install.upgrade
: Boolean value, defaults toFalse
-- whether should upgrade NAPALM (and the additional drivers, unless a specific version is requested).additional_drivers
: A list of NAPALM community drivers to install in addition to the core library. Check out https://github.com/napalm-automation-community/ for the list of available community drivers. Do note however that the community drivers are not maintained by the NAPALM core developers, and they may not be available on the public Python Package Index (PyPI). See https://napalm.readthedocs.io/en/latest/contributing/drivers.html for more details.For each of the listed drivers, you can pin to a specific desired version to install. See an example below.
napalm:
version: 2.4.0
additional_drivers:
- napalm-ros
- napalm-panos==0.5.1
See pillar.example.
Note
As NAPALM is mostly used when working with Proxy Minions, it is good to keep in mind this distinction: Proxy Minions manage the network gear, while regular minion(s) manage the server(s) where the Proxy minions run. Hence, this formula is designed to be executed on the regular Minion, in order to prepare the environment for the Proxies.
Hint
While the above is generally true, beginning with Salt release 2019.2.0,
once you have NAPALM installed on a regular Minion, you can execute the
regular NAPALM functions using salt-call
against one device at a time,
e.g.,
$ salt-call net.lldp driver=junos host=cr1.thn.lon username=test password=test1234
To avoid passing the above for every command, you can specific these
details in the Minion configuration file (typically /etc/salt/minion
),
e.g.,
napalm:
driver: junos
username: test
password: test1234
optional_args:
key_file: /path/to/ssh/key
ssh_config_file: /path/to/ssh/config
To install, execute:
$ sudo salt-call state.sls napalm_install
From the master, targeting the server(s) where we need to install NAPALM:
$ sudo salt 'server-for-napalm' state.sls napalm_install
$ sudo salt-call state.apply napalm_install
local:
----------
ID: Install system packges
Function: pkg.installed
Result: True
Comment: 3 targeted packages were installed/updated.
The following packages were already installed: python-pip, libssl-dev, python-dev
Started: 08:45:58.781798
Duration: 13944.873 ms
Changes:
----------
libffi-dev:
----------
new:
3.2.1-8
old:
libxslt1-dev:
----------
new:
1.1.29-5ubuntu0.1
old:
python-cffi:
----------
new:
1.11.5-1
old:
python-ply:
----------
new:
3.11-1
old:
python-pycparser:
----------
new:
2.18-2
old:
----------
ID: Install NAPALM
Function: pip.installed
Name: napalm==2.4.0
Result: True
Comment: All packages were successfully installed
Started: 08:46:13.764355
Duration: 23864.833 ms
Changes:
----------
napalm==2.4.0:
Installed
----------
ID: Install additional drivers
Function: pip.installed
Result: True
Comment: All packages were successfully installed
Started: 08:46:37.629497
Duration: 15499.615 ms
Changes:
----------
napalm-panos==0.5.1:
Installed
napalm-ros==0.4.1:
Installed
Summary for local
------------
Succeeded: 3 (changed=3)
Failed: 0
------------
Total states run: 3
Total run time: 53.309 s