From 57c3e520db68f1157d5ea6c8057f70badd99c07c Mon Sep 17 00:00:00 2001 From: Shannon Byrnes Date: Sun, 17 Mar 2024 19:00:21 -0700 Subject: [PATCH] wip --- ...3_netmiko_textfsm_update_description_to_lldp_neighbors.py} | 3 ++- ...drs.py => 4_netmiko_ciscoconfparse_update_helper_addrs.py} | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename lab-2/{3_netmiko_update_description_to_lldp_neighbors.py => 3_netmiko_textfsm_update_description_to_lldp_neighbors.py} (93%) rename lab-2/{4_netmiko_seek_helper_addrs.py => 4_netmiko_ciscoconfparse_update_helper_addrs.py} (94%) diff --git a/lab-2/3_netmiko_update_description_to_lldp_neighbors.py b/lab-2/3_netmiko_textfsm_update_description_to_lldp_neighbors.py similarity index 93% rename from lab-2/3_netmiko_update_description_to_lldp_neighbors.py rename to lab-2/3_netmiko_textfsm_update_description_to_lldp_neighbors.py index 65637a5..8310b02 100644 --- a/lab-2/3_netmiko_update_description_to_lldp_neighbors.py +++ b/lab-2/3_netmiko_textfsm_update_description_to_lldp_neighbors.py @@ -60,5 +60,6 @@ f"description -> {neighbor_name}, {neighbor_interface}" ] + print(f"Before:{connection.send_command(f'show run int {my_interface}')}") connection.send_config_set(configuration) - print(connection.send_command(f"show run int {my_interface}")) + print(f"After:{connection.send_command(f'show run int {my_interface}')}") diff --git a/lab-2/4_netmiko_seek_helper_addrs.py b/lab-2/4_netmiko_ciscoconfparse_update_helper_addrs.py similarity index 94% rename from lab-2/4_netmiko_seek_helper_addrs.py rename to lab-2/4_netmiko_ciscoconfparse_update_helper_addrs.py index 7820a4b..43824db 100644 --- a/lab-2/4_netmiko_seek_helper_addrs.py +++ b/lab-2/4_netmiko_ciscoconfparse_update_helper_addrs.py @@ -18,8 +18,8 @@ # Get the output for "show run". This will be raw and unformatted. raw_config = connection.send_command("show run") - # Turn this giant singular string of output into a list of lines. - parser = CiscoConfParse(config=raw_config) + # Turn this giant singular string of output into a list of lines and give it to CiscoConfParse. + parser = CiscoConfParse(config=raw_config.split("\n"), ignore_blank_lines=False) for intf in parser.find_objects("^interface .*"): # Get the interface name.