{"id":25931059,"url":"https://github.com/pouyabahri/network-automation","last_synced_at":"2026-05-07T20:48:02.755Z","repository":{"id":274090611,"uuid":"921872578","full_name":"pouyabahri/network-automation","owner":"pouyabahri","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-10T18:04:10.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-10T20:10:16.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/pouyabahri.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":"2025-01-24T19:23:37.000Z","updated_at":"2025-11-10T18:04:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1cf052a-2940-49d2-afae-3312c1aacacc","html_url":"https://github.com/pouyabahri/network-automation","commit_stats":null,"previous_names":["pouyabahri/network-automation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pouyabahri/network-automation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouyabahri%2Fnetwork-automation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouyabahri%2Fnetwork-automation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouyabahri%2Fnetwork-automation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouyabahri%2Fnetwork-automation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pouyabahri","download_url":"https://codeload.github.com/pouyabahri/network-automation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pouyabahri%2Fnetwork-automation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32755918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","napalm","python"],"created_at":"2025-03-03T23:57:19.197Z","updated_at":"2026-05-07T20:48:02.740Z","avatar_url":"https://github.com/pouyabahri.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Network Automation using Python and Ansible\nThis GitHub Repo focuses on using [NAPALM](https://github.com/napalm-automation/napalm) for automating network management on Cisco IOS devices.\n\nThis project aims to streamline network management tasks by utilizing NAPALM for network automation. NAPALM is a Python library that allows consistent interaction with network devices, regardless of vendor which simplifies configuration management and orchestration. It is a powerful solution for automating network operations.\n\n## Table of Contents\n- [Version History](#version-history)\n- [References](#references)\n- [Want to Contribute?](#want-to-contribute)\n\n## Version History\n\n### v1.3 (Latest)\n- New: Added specific error handling for ping failures (e.g., \"Request Timed Out\", \"Destination Host Unreachable\").\n\n```python\nif \"request timed out\" in output:\n            return False, \"Request Timed Out\"\n        elif \"destination host unreachable\" in output:\n            return False, \"Destination Host Unreachable\"\n        elif result.returncode == 0:\n            return True, \"Host is Reachable\"\n        else:\n            return False, \"Unknown Error\"\n    except subprocess.TimeoutExpired:\n        return False, \"Ping Command Timed Out\"\n    except Exception as e:\n        return False, f\"Error: {str(e)}\"\n```\nOutput:\n```\n🔎 Pinging 203.0.0.1...\n❌ 203.0.0.1 is unreachable. Reason: Request Timed Out.\n```\n\n### v1.2\n- New: Added specific error handling for SSH connection failures (e.g., authentication issues, timeouts).\n\n```python\n    except napalm.base.exceptions.ConnectionException as e:\n        print(f'❌ SSH Connection error with {hostname}: {e}')\n    except Exception as e:\n        print(f'❌ Error configuring {hostname}: {e}')\n```\nOutput:\n```\n🔎 Pinging 203.0.0.1...\n✅ 203.0.0.1 is reachable. Proceeding with configuration...\n🔌 Connecting to 203.0.0.1 via SSH...\n❌ SSH Connection error with 203.0.0.1: Authentication failed.\n```\n\n### v1.1\n- New: Added ping before establishing SSH session.\n- Improved console output.\n\n```python\nimport subprocess\n\ndef ping_host(hostname):\n    \"\"\"Ping a host to check if it is reachable.\"\"\"\n    try:\n        result = subprocess.run([\"ping\", \"-n\", \"1\", hostname], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n        return result.returncode == 0  # 0 means the host is reachable\n    except Exception:\n        return False\n\nfor host in hosts:\n        hostname = host['hostname']\n        print(f'🔎 Pinging {hostname}...')\n        if ping_host(hostname):\n            print(f'✅ {hostname} is reachable. Proceeding with configuration...')\n            push_ios_config(host['hostname'], host['username'], host['password'], config_commands)\n        else:\n            print(f'❌ {hostname} is unreachable. Skipping configuration.')\n```\n### v1.0\n- Initial release.\n\n## References\n\n- [ansible-napalm-samples](https://github.com/network-automation/ansible-napalm-samples)\n\n## Want to Contribute?\nWe love and appreciate contributions of all kinds! Whether it's fixing bugs, adding features, or improving documentation. Your help makes a difference.\n\nHave questions? Contact me at [pouya.bahri@yahoo.com].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpouyabahri%2Fnetwork-automation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpouyabahri%2Fnetwork-automation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpouyabahri%2Fnetwork-automation/lists"}