{"id":13609915,"url":"https://github.com/network-evolution/Python_for_Network_Engineers","last_synced_at":"2025-04-12T22:32:09.482Z","repository":{"id":51942632,"uuid":"354918226","full_name":"network-evolution/Python_for_Network_Engineers","owner":"network-evolution","description":"This repo contains Scripts which are explained in the youtube Channel https://www.youtube.com/c/NetworkEvolution/videos?sub_confirmation=1","archived":false,"fork":false,"pushed_at":"2024-04-15T10:42:20.000Z","size":203,"stargazers_count":100,"open_issues_count":1,"forks_count":48,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-07T16:41:23.378Z","etag":null,"topics":["ansible-playbook","cicd-pipeline","cisco-ios","napalm-ansible","netbox-api","netconf","netmiko","network-automation","network-engineers","network-programming","network-security","nornir-netmiko","nxos-device","paramiko","paramiko-tutorial","pyats","python","regex-pattern","restconf","ssh-automation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/network-evolution.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2021-04-05T17:38:36.000Z","updated_at":"2024-10-22T16:20:05.000Z","dependencies_parsed_at":"2024-08-01T19:43:42.048Z","dependency_job_id":"25861c83-d843-4677-91ab-242771ffa8f6","html_url":"https://github.com/network-evolution/Python_for_Network_Engineers","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/network-evolution%2FPython_for_Network_Engineers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/network-evolution%2FPython_for_Network_Engineers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/network-evolution%2FPython_for_Network_Engineers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/network-evolution%2FPython_for_Network_Engineers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/network-evolution","download_url":"https://codeload.github.com/network-evolution/Python_for_Network_Engineers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248640882,"owners_count":21138107,"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":["ansible-playbook","cicd-pipeline","cisco-ios","napalm-ansible","netbox-api","netconf","netmiko","network-automation","network-engineers","network-programming","network-security","nornir-netmiko","nxos-device","paramiko","paramiko-tutorial","pyats","python","regex-pattern","restconf","ssh-automation"],"created_at":"2024-08-01T19:01:39.231Z","updated_at":"2025-04-12T22:32:09.168Z","avatar_url":"https://github.com/network-evolution.png","language":"Python","readme":"﻿# Python for Network Engineers\nThis repo contains Scripts which are explained in the YouTube Channel [NetworkEvolution](https://www.youtube.com/c/NetworkEvolution?sub_confirmation=1)\n\n## List of Directories in this Repository:\n- [**00_Python_Scripts_from_Youtube_Playlist** ](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/00_Python_Scripts_from_Youtube_Playlist)\n- [**01_Paramiko_Sample_Scripts** ](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/01_Paramiko_Sample_Scripts)\n- [**02_Configure_Device_Using_CSV** ](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/02_Configure_Device_Using_CSV)\n- [**03_Cisco_Config_Parser_Regex** ](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/03_Cisco_Config_Parser_Regex)\n\n# Summary of each Directory\n***\n## Directory : [00_Python_Scripts_from_Youtube_Playlist](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/00_Python_Scripts_from_Youtube_Playlist)\nThis directory contains all the Scripts explained in the below YouTube playlist which has more than 70 Videos.\n\n\nTraining starts from a very beginner level like:\nHow to initiate SSH Connection to the Device using Paramiko\nTo Intermediate level of Using NETCONF/YANG, RESTCONF etc\n\u003e List of all the Scripts\n\n[Click here for Complete Videos Playlist In YouTube :Python Learning for Network Engineers](https://www.youtube.com/watch?v=sG_RiytUA38\u0026list=PLOocymQm7YWakdZkBfCRIC06fv7xQE85N)\n\n```\nFor the Complete Scripts and Video maps please access the folder \"`00_Python_Scripts_from_Youtube_Playlist`\" in this Repository\n```\n\nThese Python scripts Contains Tutorials on:\n  - Paramiko\n  - Netmiko\n  - Nornir\n  - NAPALM\n  - Ansible\n  - NETCONF/YANG\n  - RESTCONF\n  - Regex For Parsing\n  - CSV for Bulk Configuration\n  - How to use text file for Configuration\n\n***\n## Directory : [01_Paramiko_Sample_Scripts](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/01_Paramiko_Sample_Scripts)\nThis directory contains Scripts which explains how to use Paramiko Library for communicating with Cisco Devices.\n\n* Demonstrates the use of SSH Hostkey policy. Different ways to use hostkey policies :\n```\nsession.set_missing_host_key_policy(paramiko.AutoAddPolicy())\nsession.load_host_keys('/home/evolve/.ssh/known_hosts')\nsession.set_missing_host_key_policy(paramiko.WarningPolicy())\n```\n\n* SSH Keybased Authentication Using Paramiko:\n* Paramiko SSH exec_command Example\n* Paramiko invoke_shell example\n* SSH Password Based Authentication\n\n### List of Scripts in the Directory\n```\n01_ssh_host_key_policy.py\n02.1_ssh_key_cisco_exec_command.py\n02.2_ssh_key_cisco_invoke_shell.py\n02.3_ssh_key_cisco_invoke_shell_fn.py\n```\n\n[Click here for Complete Paramiko Scripts Tutorial Playlist In YouTube :01_Paramiko_Sample_Scripts](https://www.youtube.com/watch?v=A075aWJMAeM\u0026list=PLOocymQm7YWYc73phqzbZ1S3ANrVVpUFN)\n\n```\nFor the Complete Scripts and Video maps please access the folder \"`01_Paramiko_Sample_Scripts`\" in this Repository\n```\n***\n## Directory : [02_Configure_Device_Using_CSV](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/02_Configure_Device_Using_CSV)\nThis directory contains Scripts which explains how to read Device IP Address and configuration lines from CSV file and configure respective devices using Python.\n\n* Sample CSV FIle Used for Configuring the Device :\n\n![CSV1](https://user-images.githubusercontent.com/70020386/114660759-7d79b600-9d13-11eb-8e53-6cd2807341c8.png)\n\n\n* The above CSV file will create a Dictionary in below format \n```\nconf_dict={'192.168.0.50': ['terminal len 0',\n                  'config t',\n                  'int gi1',\n                  'no shut',\n                  'exit',\n                  'exit',\n                  'show ip int brie',\n                  'show run int gi1'],\n '192.168.0.51': ['terminal len 0',\n                  'config t',\n                  'int lo0',\n                  'ip add 10.0.0.1 255.255.255.0',\n                  'int lo1',\n                  'ip add 11.0.0.1 255.255.255.0',\n                  'do show run int loopback0',\n                  'do show run int loopback1'],\n '192.168.0.53': ['terminal len 0', 'config t', 'int gi3', 'no shut'],\n 'csr1.test.lab': ['terminal len 0',\n                   'config t',\n                   'int gi2',\n                   'no shut',\n                   'ip address 2.2.2.2 255.255.255.0',\n                   'exit',\n                   'exit',\n                   'show ip int brie',\n                   'show run int gi2']}\n```\n\n* \n\n### List of Scripts in the Directory\n- **01_config_in_row.csv** : How to read Content from CSV file in row format : [Script Demonstration Videos](https://www.youtube.com/watch?v=3XoVPJkHMFU\u0026list=PLOocymQm7YWYpP_Qkju89vN8BykhvWO5U)\n- **01_csv_reader_row.py** : How to read Content from CSV file Using Reader format : [Script Demonstration Videos](https://www.youtube.com/watch?v=3XoVPJkHMFU\u0026list=PLOocymQm7YWYpP_Qkju89vN8BykhvWO5U)\n- **02_config_in_column.csv** : How to read Content from CSV file in Column format :[Script Demonstration Videos](https://www.youtube.com/watch?v=3XoVPJkHMFU\u0026list=PLOocymQm7YWYpP_Qkju89vN8BykhvWO5U)\n- **02_csv_reader_column.py** : How to read Content from CSV file in Column format using Reader : [Script Demonstration Videos](https://www.youtube.com/watch?v=3XoVPJkHMFU\u0026list=PLOocymQm7YWYpP_Qkju89vN8BykhvWO5U)\n- **03_csv_DictReader_column.py** : How to read Content from CSV file in Column format using DictReader :[Script Demonstration Videos](https://www.youtube.com/watch?v=3XoVPJkHMFU\u0026list=PLOocymQm7YWYpP_Qkju89vN8BykhvWO5U)\n\n[Click here for Complete CSV Videos Playlist In YouTube :02_Configure_Device_Using_CSV](https://www.youtube.com/watch?v=3XoVPJkHMFU\u0026list=PLOocymQm7YWYpP_Qkju89vN8BykhvWO5U)\n\n```\nFor the Complete Scripts and Video maps please access the folder \"`02_Configure_Device_Using_CSV`\" in this Repository\n```\n\n***\n## Directory : [03_Cisco_Config_Parser_Regex](https://github.com/network-evolution/Python_for_Network_Engineers/tree/main/03_Cisco_Config_Parser_Regex)\nThis directory contains Scripts which explains how to parse configuration lines from Cisco Devices Using Regex in Python\n\n### Sample Parsed Output :\n\n*Show Version Parser \n\n![Show_Version](https://user-images.githubusercontent.com/70020386/114664645-9dac7380-9d19-11eb-9e8f-864eae0bc6b0.png)\n\n*Show Running Config Parser Output:\n\n![Show_run_parsing](https://user-images.githubusercontent.com/70020386/114667044-9f2b6b00-9d1c-11eb-8fe4-9f2d38bf8b2d.png)\n\n* Regex Patterns Used for Show Version Parser:\n```\nversion_pattern = re.compile(r'Cisco .+ Software, Version (\\S+)')\nmodel_pattern = re.compile(r'cisco (\\S+).+bytes of memory\\.')\nserial_no_pattern = re.compile(r'Processor board ID (\\S+)')\nuptime_pattern = re.compile(r'(.+) uptime is (.*)')\n\n```\n* Regex Patterns Used for Show running Parser:\n```\nhostname_pattern = re.compile(r'hostname (\\S+)')\ndomainname_pattern = re.compile(r'ip domain name (.+)')\npid_pattern = re.compile(r'license udi pid (\\w+) sn (\\S+)')\nnetconf_pattern = re.compile(r\"netconf-yang\\r\\n\")\nusername_pattern = re.compile(r'username (\\S+) privilege (\\d{2})')\ninterface_pattern = re.compile(r'interface (\\S+[.]?\\d*)\\r\\n.+?\\r?\\n?\\s?ip address ([\\d\\.]+) ([\\d\\.]+)')\ninterface_prop_pattern = re.compile(r'interface (?P\u003cname\u003e\\S+[.]?\\d*)\\r\\n\\s?.+?\\r?\\n?\\s?ip address (?P\u003cip_aadress\u003e[\\d\\.]+) (?P\u003cmask\u003e[\\d\\.]+)')\ndefault_route_pattern = re.compile(r'ip route 0.0.0.0 0.0.0.0.+?([\\d.]+)\\r\\n')\nstatic_route_pattern = re.compile(r'ip route (?P\u003cdst_subnet\u003e[^0][\\d\\.]+) (?P\u003cmask\u003e[^0][\\d\\.]+) (?P\u003cnext_hop\u003e[\\d\\.]+)')\n\n```\n\n* \n\n### List of Scripts in the Directory\n- **01_parse_Show_ver_SSH.py** : Parse Show Version Output over SSH : [Script Demonstration Videos](https://www.youtube.com/watch?v=PbP9tyV0Zao\u0026list=PLOocymQm7YWY8Eksax8mjRSWbUijb7W93)\n- **01_parse_show_ver_from_file.py** : Parse Show Version Output from Text file : [Script Demonstration Videos](https://www.youtube.com/watch?v=PbP9tyV0Zao\u0026list=PLOocymQm7YWY8Eksax8mjRSWbUijb7W93)\n- **02_parse_show_run_from_file.py** : Parse Show Run Output from Text file :[Script Demonstration Videos](https://www.youtube.com/watch?v=PbP9tyV0Zao\u0026list=PLOocymQm7YWY8Eksax8mjRSWbUijb7W93)\n- **02_parse_show_run_from_SSH.py** : HParse Show Run Output from SSH : [Script Demonstration Videos](https://www.youtube.com/watch?v=PbP9tyV0Zao\u0026list=PLOocymQm7YWY8Eksax8mjRSWbUijb7W93)\n- **command_output_to_txt.py** : Save Multiple Show Commands to text file :[Script Demonstration Videos](https://www.youtube.com/watch?v=PbP9tyV0Zao\u0026list=PLOocymQm7YWY8Eksax8mjRSWbUijb7W93)\n\n[Click here for Complete Cisco Configuration Parsing Videos Playlist In YouTube](https://www.youtube.com/watch?v=PbP9tyV0Zao\u0026list=PLOocymQm7YWY8Eksax8mjRSWbUijb7W93)\n\n```\nFor the Complete Scripts and Video maps please access the folder \"03_Cisco_Config_Parser_Regex\" in this Repository\n```\n\n\n","funding_links":[],"categories":["python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetwork-evolution%2FPython_for_Network_Engineers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetwork-evolution%2FPython_for_Network_Engineers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetwork-evolution%2FPython_for_Network_Engineers/lists"}