{"id":21636115,"url":"https://github.com/bigevilbeard/napalm_click","last_synced_at":"2025-04-11T15:50:24.513Z","repository":{"id":128721748,"uuid":"186374267","full_name":"bigevilbeard/napalm_click","owner":"bigevilbeard","description":"Network automation with napalm and click","archived":false,"fork":false,"pushed_at":"2020-03-12T15:16:43.000Z","size":40,"stargazers_count":16,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T11:52:25.335Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigevilbeard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-13T08:08:11.000Z","updated_at":"2024-06-28T11:05:53.000Z","dependencies_parsed_at":"2023-03-13T11:28:42.029Z","dependency_job_id":null,"html_url":"https://github.com/bigevilbeard/napalm_click","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigevilbeard%2Fnapalm_click","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigevilbeard%2Fnapalm_click/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigevilbeard%2Fnapalm_click/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigevilbeard%2Fnapalm_click/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigevilbeard","download_url":"https://codeload.github.com/bigevilbeard/napalm_click/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248434418,"owners_count":21102831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T03:29:56.592Z","updated_at":"2025-04-11T15:50:24.502Z","avatar_url":"https://github.com/bigevilbeard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Network Automation with Napalm and Click Python libraries\n\nNetwork automation and devices management has many paths and options... With so many APIs being available your network can quickly be as complex to manage with automation as it was with manual configurations. Evaluating the offerings of API vendors often goes past the technology itself. But, [NAPALM](https://napalm.readthedocs.io/en/latest/index.html) (Network Automation and Programmability Abstraction Layer with Multivendor support) is helping to change that, a unified API makes it possible to share code between network devices and vendors.\n\nNAPALM is a Python library that implements a set of functions to interact with different network device Operating Systems using a unified API.\n\n[Click](https://click.palletsprojects.com/en/7.x/) is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary.\n\n## DevNet Sandbox\nAll code has been written/tested on the [Cisco DevNet IOS XR always on Sandbox](https://t.co/V6rXj3plwF).\nPlease see the sandbox pages for credentials and reservations.\n\n## Code\n\nAll of the code you need is located in this repo. Clone the repo and access it with the following commands:\n\n```\ngit clone https://github.com/bigevilbeard/napalm_click\ncd napalm_click\n```\n\n## Python Environment Setup\nIt is recommended that this code be used with Python 3.6. It is highly recommended to leverage Python Virtual Environments (venv).\n\nFollow these steps to create and activate a venv.\n```\n# OS X or Linux\nvirtualenv venv --python=python3.6\nsource venv/bin/activate\n```\n## Install the code requirements\n```\npip install -r requirements.txt\n```\n\n\n## Running the code examples\n\nNAPALM supports several methods to connect to the devices, to manipulate configurations or to retrieve data. Configurations can be replaced entirely or merged into the existing device config. You can load configuration either from a string or from a file. If for some reason you committed the changes and you want to rollback, this can also be done (please check NAPALM documentation for support of merge, replace and rollback as some platforms differ)\n\n\nThis code uses Object-Oriented Programming (OOP). This is a programming paradigm where different components of a computer program are modeled after real-world objects. An object is anything that has some characteristics and can perform a function. All args used in the running of the code are handled using [Click](https://click.palletsprojects.com/en/7.x/).\n\n```\ncli.add_command(facts)\ncli.add_command(interfaces)\ncli.add_command(interfaces_ip)\ncli.add_command(merge)\ncli.add_command(replace)\ncli.add_command(rollback)\n\n```\n**Note:** Before using the code, update the IP address/hostname and port information.\n\n```\n(venv) STUACLAR-M-R6EU:napalm_click stuaclar$ python iosxenapalmapi.click.py --help\nUsage: iosxenapalmapi.click.py [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  facts\n  interfaces\n  interfaces_ip\n  merge\n  replace\n  rollback\n  validation\n```\n\nWith this code, we show the router version and interface information (shown in `json` format).\n\n\n\n## Example Use Commands\n\n```\n(venv) STUACLAR-M-R6EU:napalm_click stuaclar$ python iosxenapalmapi.click.py interfaces\nRetrieving Information\n{\n    \"Loopback100\": {\n        \"description\": \"\",\n        \"is_enabled\": true,\n        \"is_up\": true,\n        \"last_flapped\": -1.0,\n        \"mac_address\": \"\",\n        \"speed\": 0\n    },\n    \"Loopback200\": {\n        \"description\": \"\",\n        \"is_enabled\": true,\n        \"is_up\": true,\n        \"last_flapped\": -1.0,\n        \"mac_address\": \"\",\n        \"speed\": 0\n    },\n    \"MgmtEth0/RP0/CPU0/0\": {\n        \"description\": \"\",\n        \"is_enabled\": true,\n        \"is_up\": true,\n        \"last_flapped\": -1.0,\n        \"mac_address\": \"08:00:27:82:91:AB\",\n        \"speed\": 1000\n    },\n    \"Null0\": {\n        \"description\": \"\",\n        \"is_enabled\": true,\n        \"is_up\": true,\n        \"last_flapped\": -1.0,\n        \"mac_address\": \"\",\n        \"speed\": 0\n    }\n}\n```\n```\n(venv) STUACLAR-M-R6EU:napalm_click stuaclar$ python iosxenapalmapi.click.py merge\nMerge Loopback Interfaces\n\nDiff:\n---\n+++\n@@ -10,6 +10,12 @@\n+!\n+interface Loopback100\n+ ipv4 address 1.1.1.100 255.255.255.255\n+!\n+interface Loopback200\n+ ipv4 address 1.1.1.200 255.255.255.255\n !\n interface MgmtEth0/RP0/CPU0/0\n  ipv4 address dhcp\n\nWould you like to commit these changes? [yN]: y\nCommitting ...\n```\n\n## About me\n\nNetwork Automation Developer Advocate for Cisco DevNet.\nI'm like Hugh Hefner... minus the mansion, the exotic cars, the girls, the magazine and the money. So basically, I have a robe.\n\nFind me here: [LinkedIn](https://www.linkedin.com/in/stuarteclark/) / [Twitter](https://twitter.com/bigevilbeard)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigevilbeard%2Fnapalm_click","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigevilbeard%2Fnapalm_click","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigevilbeard%2Fnapalm_click/lists"}