Requirements
napalm-ros 1.6.0 and newer require NAPALM 5.x. NAPALM 5 added a format argument to get_config, and a driver cannot match both the NAPALM 4 and NAPALM 5 method signatures at once, so NAPALM 4 is no longer supported. Stay on napalm-ros 1.5.0 if you need NAPALM 4.
Caveats
As napalm-ros uses API, several caveats exist.
- API is not versioned so things may break when routeros is upgraded.
- RouterOS has no native, non-reboot commit/rollback and safe mode is not exposed via the API. Rollback is emulated with a device-side scheduler that restores a backup, so a rollback (or an expired commit-confirm) reverts by rebooting. See Configuration management.
get_configreads the running configuration over the binary API on RouterOS 7.13+ (no SSH). Below 7.13 -- RouterOS 6 and RouterOS 7.0-7.12 -- it falls back to SSH (paramiko), because reading a large export back over the API needs the chunked/file/readadded in 7.13. On that SSH path, paramiko offers keys from a running SSH agent by default; if the agent offers a key the device rejects, RouterOS may drop the session andget_configthen fails withNo existing session. Passoptional_args={'paramiko_allow_agent': False}to authenticate with the password only (SSH agent/key auth is otherwise left enabled);paramiko_look_for_keys(defaultFalse) similarly controls on-disk key lookup.get_configaccepts NAPALM 5'sformatargument but only supportstext, because RouterOS exports its configuration as an/exportscript and offers no other representation. Any other value raisesNotImplementedError.
Configuration management
Configuration management targets RouterOS 7.x and requires librouteros >= 4.2.2, which carries the /file/add fix commit_config relies on to apply a candidate on RouterOS older than ~7.13.
The commit/rollback machinery -- load_merge_candidate / load_replace_candidate, commit_config, confirm_commit, has_pending_commit, rollback, discard_config -- runs entirely over the binary API (no SSH). get_config and compare_config read the running configuration the version-aware way noted above: binary API on RouterOS 7.13+, SSH (paramiko) fallback below 7.13.
get_config/compare_configread the running configuration with/export.load_merge_candidatestages a.rscscript that is applied with/import.load_replace_candidatestages a full configuration.commit_configapplies the candidate. On RouterOS 7.16+ it first dry-runs the candidate (/import dry-run) so a syntax error is caught before anything is applied; below 7.16 that pre-flight is skipped (passoptional_args={'validate_before_commit': False}to disable it). Before a plain commit a backup is taken sorollbackcan restore it (by rebooting).commit_config(revert_in=<seconds>)arms a device-side scheduler that restores that backup unlessconfirm_commitis called in time (has_pending_commitreports whether one is armed). Because the timer lives on the device it survives a lost session or a lock-out.- A replace (
load_replace_candidate+commit_config) uses/system reset-configuration run-after-reset, which wipes the configuration and reboots into the candidate. It is destructive, has no automatic rollback, and the candidate must be a complete, self-consistent configuration that restores management connectivity. Commit-confirm (revert_in) is not available with a replace.
RouterOS configuration is imperative (an /export is a list of add/set actions, not declarative state) and ordering matters in some paths (e.g. /ip firewall filter) but not others (e.g. /ip address). compare_config is therefore a textual diff for review, not an executable patch.
cli
cli(commands) runs each command as a one-line script with /execute over the binary API (no SSH) and returns what it printed, keyed by command. Commands are RouterOS script syntax, not interactive-terminal shorthand (abbreviated menu names, tab completion): /ip/address/print or :put [/system/identity/get name] on RouterOS 7, /ip address print on RouterOS 6 (which does not accept the slash-separated form). A command RouterOS cannot parse comes back as output text (syntax error (line 1 column 6)), the way an IOS % Invalid input would, not as an exception. Only the text encoding is supported.
- On RouterOS 7 (verified on 7.18.2 and 7.23.5)
/execute as-stringblocks and returns the output directly. RouterOS caps an executed script at 64 KB. - RouterOS 6 rejects
as-string(verified on 6.33.3, 6.44.5, 6.49.21), so there the script runs as a background job writing to a temporary file (napalm-cli-<id>.txt), which is read back and removed. The API only exposes a file's contents inline when it is under about 4 KB and RouterOS 6 has no/file/read, so larger output raisesCommandErrorException; use SSH for that. Support is detected on the firstcli()call of a session, not from the version number.
Line endings are normalised to \n.
Implemented getters
- get_arp_table
- get_interfaces_counters
- get_environment
- get_facts
- get_interfaces
- get_interfaces_ip
- get_ntp_servers
- get_snmp_information
- get_users
- get_ipv6_neighbors_table
- is_alive
- ping
- get_lldp_neighbors
- get_lldp_neighbors_detail
- get_network_instances
- get_mac_address_table
- get_bgp_neighbors
- get_bgp_neighbors_detail
- get_config
- get_vlans
- cli
Release files for napalm-ros 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| napalm_ros-1.6.0.tar.gz | 19.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| napalm_ros-1.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.3 kB
Release files / napalm_ros-1.6.0.tar.gz
| Download URL | napalm_ros-1.6.0.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13467bef4b6410afbf656422a3f5993458d48a0c61a944e39e50bd83f23e61ae
|
|
BLAKE2b-256 checksum How to use checksums |
386cb4eeae8dd2df6d367b673e6ff6c78c24fb07ca2a84b8d6fb23120a731a65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.3 CPython/3.12.3 Linux/6.17.0-1022-azure
|
Release files / napalm_ros-1.6.0-py3-none-any.whl
| Download URL | napalm_ros-1.6.0-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d7473a23cb4b5b7a795c9a891a7c889bbc62f833010bdd1226b362007d9f594
|
|
BLAKE2b-256 checksum How to use checksums |
aa9610c5f05b40724c109484ee4a568f271cb216fa835360b0f6db496e9b2e1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.3 CPython/3.12.3 Linux/6.17.0-1022-azure
|