Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sbyrnes committed Mar 18, 2024
1 parent eac963f commit 2744728
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lab-2/4_netmiko_seek_helper_addrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
raw_config = connection.send_command("show run")

# Turn this giant singular string of output into a list of lines.
parser = CiscoConfParse(raw_config.split("\n"))
parser = CiscoConfParse(config=raw_config)

for intf in parser.find_objects("^interface .*"):
# Get the interface name.
Expand All @@ -35,7 +35,7 @@
# Only configure our new IP helper on the interface if the old one existed.
continue
else:
print(f"Found old IP helper!:\n{intf}")
print(f"Found old IP helper!: {intf.text}")

# Variable `helper_address_line` is a list of all matching lines.
# We know Cisco won't have duplicate lines, so we can always assume it is the first
Expand All @@ -52,8 +52,8 @@
"commit"
]
# Let's observe:
print(f"Before:\n{connection.send_command(f'show run {intf_name}')}\n")
print(f"Before:{connection.send_command(f'show run {intf_name}')}\n")
connection.send_config_set(commands)
print(f"After:\n{connection.send_command(f'show run {intf_name}')}")
print(f"After:{connection.send_command(f'show run {intf_name}')}")

print("Done!")

0 comments on commit 2744728

Please sign in to comment.