From 27447283f1a86710ff8e9cd3e93c30dbe2e066ee Mon Sep 17 00:00:00 2001 From: Shannon Byrnes Date: Sun, 17 Mar 2024 18:52:23 -0700 Subject: [PATCH] wip --- lab-2/4_netmiko_seek_helper_addrs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lab-2/4_netmiko_seek_helper_addrs.py b/lab-2/4_netmiko_seek_helper_addrs.py index 3d8663c..7820a4b 100644 --- a/lab-2/4_netmiko_seek_helper_addrs.py +++ b/lab-2/4_netmiko_seek_helper_addrs.py @@ -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. @@ -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 @@ -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!")