Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion connect_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ def load_router_details(yaml_file):
with open(yaml_file, 'r') as file:
return yaml.safe_load(file)


def connect_to_router(router):
"""Simulate connecting to a router and print its details."""
print(f"Connecting to {router['hostname']} at {router['ip']}...")
print(f"Using username: {router['username']}")
print(f"Enable password: {router['enable_password']}")
print(f"Example command: 'show ip interface brief'")
print(f"Connection to {router['hostname']} successful!")
print("-" * 40)

routers = load_router_details('routers.yaml')['routers']
for router in routers:
connect_to_router(router)
connect_to_router(router)
10 changes: 10 additions & 0 deletions routers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ routers:
ip: 192.168.1.2
username: admin
password: cisco123
enable_password: enable123
- hostname: router3
ip: 192.168.1.3
username: admin
password: cisco123
enable_password: enable123
- hostname: router4
ip: 192.168.1.4
username: admin
password: cisco123
enable_password: enable123
Empty file added update-script.txt
Empty file.