{"id":9135,"library":"napalm","title":"NAPALM: Network Automation and Programmability Abstraction Layer with Multivendor Support","description":"NAPALM (Network Automation and Programmability Abstraction Layer with Multivendor support) is a Python library that provides a unified API to interact with various network devices from different vendors (e.g., Cisco IOS/XR/NX-OS, Arista EOS, Juniper Junos). It abstracts away vendor-specific complexities, offering a consistent way to retrieve operational data and manage configurations. The current version is 5.1.0, with regular releases, typically major updates every 6-12 months and minor/patch releases in between.","status":"active","version":"5.1.0","language":"en","source_language":"en","source_url":"https://github.com/napalm-automation/napalm","tags":["network automation","networking","multi-vendor","configuration management","operational data"],"install":[{"cmd":"pip install napalm","lang":"bash","label":"Install core library"},{"cmd":"pip install napalm[full]","lang":"bash","label":"Install with all optional dependencies for drivers"}],"dependencies":[{"reason":"Underlying SSH/Telnet library for many drivers","package":"netmiko","optional":false},{"reason":"Arista EOS driver","package":"pyeapi","optional":true},{"reason":"Juniper Junos driver","package":"junos-eznc","optional":true},{"reason":"NETCONF protocol support for various drivers","package":"ncclient","optional":true}],"imports":[{"symbol":"get_network_driver","correct":"from napalm import get_network_driver"},{"note":"Exceptions are located under `napalm.base.exceptions` since v3.x.","wrong":"from napalm.exceptions import NapalmBaseException","symbol":"NapalmBaseException","correct":"from napalm.base.exceptions import NapalmBaseException"}],"quickstart":{"code":"from napalm import get_network_driver\n\ndef connect_and_get_facts(hostname, username, password):\n    try:\n        driver = get_network_driver(\"ios\") # Replace 'ios' with your device type (e.g., 'eos', 'junos', 'nxos')\n        device = driver(\n            hostname,\n            username,\n            password,\n            optional_args={\n                \"port\": 22, # Or 830 for NETCONF, 443 for API\n                \"secret\": \"\", # If using privilege escalation\n                \"config_file\": None # Path to an external config file\n            }\n        )\n        print(f\"Connecting to {hostname}...\")\n        device.open()\n        print(f\"Successfully connected to {hostname}.\")\n        \n        facts = device.get_facts()\n        print(\"Device Facts:\")\n        for k, v in facts.items():\n            print(f\"  {k}: {v}\")\n            \n        # Example: Get interface details\n        # interfaces = device.get_interfaces()\n        # print(\"Interfaces:\", interfaces)\n            \n    except Exception as e:\n        print(f\"Error connecting or retrieving data: {e}\")\n    finally:\n        if 'device' in locals() and device.is_open:\n            device.close()\n            print(f\"Disconnected from {hostname}.\")\n\nif __name__ == \"__main__\":\n    # Replace with your actual device details\n    DEVICE_HOSTNAME = os.environ.get('NAPALM_TEST_HOSTNAME', '192.168.1.1')\n    DEVICE_USERNAME = os.environ.get('NAPALM_TEST_USERNAME', 'admin')\n    DEVICE_PASSWORD = os.environ.get('NAPALM_TEST_PASSWORD', 'password')\n    \n    # Make sure to set these environment variables or change the default values\n    connect_and_get_facts(DEVICE_HOSTNAME, DEVICE_USERNAME, DEVICE_PASSWORD)","lang":"python","description":"This quickstart demonstrates how to connect to a network device using NAPALM, retrieve basic device facts, and properly close the connection. Remember to replace the placeholder credentials and device type with your actual network environment details. For production, use environment variables or a secure credential management system."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin NAPALM to `<5.1.0`.","message":"Python 3.8 support was dropped in NAPALM v5.1.0. NAPALM now requires Python 3.9+ (including 3.13 support).","severity":"breaking","affected_versions":">=5.1.0"},{"fix":"Ensure your Arista EOS devices are running version 4.23 or newer. Remove the `eos_fn0039_config` argument from your driver initialization if previously used.","message":"Arista EOS versions older than 4.23 are no longer supported starting with NAPALM v5.0.0. Additionally, the `eos_fn0039_config` optional argument for EOS was removed.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"No specific fix required, but be aware of the changed metadata for type-aware tooling.","message":"NAPALM v4.0.0 introduced extensive type hinting. While not a breaking change in terms of runtime behavior, it impacts static analysis and how developers might perceive function signatures. If relying on introspection or type checks, be aware of these additions.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"It is recommended to use NAPALM v3.1.0 or newer for more consistent `force_no_enable` behavior in custom drivers.","message":"The behavior of `force_no_enable` for Netmiko-based drivers (like IOS and NX-OS) was fixed in v3.1.0. If you maintain a third-party driver that uses Netmiko but does not utilize `enable` features, older NAPALM versions might have exhibited unexpected behavior.","severity":"gotcha","affected_versions":"<3.1.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify network reachability (ping), check SSH/API port (default 22 for SSH, 443/830 for API/NETCONF), ensure correct username/password, and confirm device is configured for programmatic access (SSH, API enabled, correct user privileges).","cause":"Network connectivity issues, incorrect hostname/IP, wrong port, firewall blocking, or invalid device credentials/access method.","error":"napalm.base.exceptions.ConnectionException: Cannot connect to device 192.168.1.1"},{"fix":"Double-check the driver name against NAPALM's documentation (e.g., 'ios', 'eos', 'junos', 'nxos'). If it's a valid driver, ensure all necessary optional dependencies (e.g., `pip install napalm[full]` or specific driver extras) are installed.","cause":"The specified network driver name is incorrect, unsupported, or a required underlying dependency for the driver is not installed.","error":"TypeError: 'NoneType' object is not callable (e.g., when calling `get_network_driver('nonexistent_driver')`)"},{"fix":"Review the configuration changes being pushed. Test the configuration snippet manually on the device CLI to ensure it's valid. Inspect the device's error messages for specific syntax issues.","cause":"The configuration payload provided to `load_merge_candidate` or `load_replace_candidate` contains syntax errors or conflicts with the device's current configuration.","error":"napalm.base.exceptions.MergeConfigException: Configuration validation failed: ... (followed by device error messages)"},{"fix":"Wait for the other process/user to release the lock, or manually clear the lock on the device if no active changes are being performed. In some cases, increasing the `lock_config_timeout` optional argument might help if the device is slow to respond.","cause":"Another process or user has an exclusive lock on the device's configuration, preventing NAPALM from making changes.","error":"napalm.base.exceptions.LockError: Unable to lock device's configuration"}]}