{"id":21636106,"url":"https://github.com/bigevilbeard/wos","last_synced_at":"2025-03-18T23:50:11.416Z","repository":{"id":128722128,"uuid":"116836331","full_name":"bigevilbeard/WOS","owner":"bigevilbeard","description":"Napalm demo","archived":false,"fork":false,"pushed_at":"2018-01-19T16:42:07.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T00:41:38.447Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigevilbeard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-01-09T15:48:38.000Z","updated_at":"2018-01-09T15:54:15.000Z","dependencies_parsed_at":"2023-06-05T02:00:24.058Z","dependency_job_id":null,"html_url":"https://github.com/bigevilbeard/WOS","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%2FWOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigevilbeard%2FWOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigevilbeard%2FWOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigevilbeard%2FWOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigevilbeard","download_url":"https://codeload.github.com/bigevilbeard/WOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244326199,"owners_count":20435122,"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:53.983Z","updated_at":"2025-03-18T23:50:11.397Z","avatar_url":"https://github.com/bigevilbeard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intro\nNapalm demo showing how to automate changes to Cisco IOS-XR using the merging configuration.\nNAPALM tries to provide a common interface and mechanisms to push configuration and retrieve state data from network devices.\n\n### NAPALM\n\nNAPALM (Network Automation and Programmability Abstraction Layer with Multivendor support) is a Python library that implements a set of functions to interact with different router vendor devices using a unified API.\n\nNAPALM supports several methods to connect to the devices, to manipulate configurations or to retrieve data.\n\n\n### GitHub Repo's\n\n1. [Napalm](https://github.com/napalm-automation/napalm)\n\n## Install Napalm\n\nStart first by installing the napalm module in python using PIP\n\n```\npip install napalm\n```\n\n## Create the JSON file\n\nThe json file acts like a backend php/sql db would, this holds the device \n\n- IP address\n- driver (in this case XR)\n- username\n- password\n- rr (reflector or client)\n\n```\n{\n  \"router:1\": {\n    \"IP\": \"10.94.241.179\",\n    \"type\": \"iosxr\",\n    \"user\": \"cisco\",\n    \"password\": \"cisco\",\n    \"rr\": \"reflector\"\n  },\n  \"router:2\": {\n    \"IP\": \"10.94.241.171\",\n    \"type\": \"iosxr\",\n    \"user\": \"cisco\",\n    \"password\": \"cisco\",\n    \"rr\": \"client\"\n  },\n  \"router:3\": {\n    \"IP\": \"10.94.241.172\",\n    \"type\": \"iosxr\",\n    \"user\": \"cisco\",\n    \"password\": \"cisco\",\n    \"rr\": \"client\"\n }\n}\n```\n## Create a cfg file for the route reflector  \nThis serves as the temaplate use for the changes we want to make for our route reflector. \nConfigurations can be replaced entirely or merged (in this case we wil use the merge feature) into the existing device config. \nYou can load configuration either from a string or from a file, here we will use the cfg file.\n\n```\nrouter bgp 123\n bgp cluster-id 1\n address-family ipv4 unicast\n !\n neighbor-group rrclients\n  remote-as 123\n  update-source Loopback0\n  address-family ipv4 unicast\n   route-reflector-client\n  !\n !\n neighbor 192.168.255.1\n  use neighbor-group rrclients\n !\n neighbor 192.168.255.2\n  use neighbor-group rrclients\n```\n## Create a cfg file for the route reflector clients\nThis serves as the temaplate use for the changes we want to make for our route reflector clients\n```\nrouter bgp 123\n bgp cluster-id 1\n address-family ipv4 unicast\n !\n neighbor 192.168.255.9\n  remote-as 123\n  update-source Loopback0\n  address-family ipv4 unicast\n```\n\n\n## Running the code\n\n```\npython napalm_many_nodes.py\n```\nYou will see you are shown a diff (or if the configurtion is in place already a note saying this is already applied) and \nthen the option to eyeball the change, discard or push/commit the change to the devices.\n\n## Rolling back\n```\npython napalm_many_nodes_rollback.py \n``` \n This will undo the changes and print a diff showing the changeing being rolled back to each router. Followed by the option to commit\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigevilbeard%2Fwos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigevilbeard%2Fwos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigevilbeard%2Fwos/lists"}