You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've sent a ton of time trying to get a simple script to work but nothing I try is working. I got most of the pieces to work but I'm having issues with the meat of this script where the command is actually run on my target devices. I want to run request platform software package clean then based on output from the command either delete the output or just print the output if there is nothing to be cleaned. This is what I have for this bit:
output=net_connect.send_command("request platform software package clean", expect_string="Do you want to proceed? [y/n]")
#sends a yes when prompted
output += net_connect.send_command("y",read_timeout=200)
Ive tried send_command_timing, and I tried just setting the read time out but both did not yield the expected results.
Heres what the terminal output looks like on a switch there are two scenarios:
1.
switch#request platform software package clean
This operation may take several minutes...
Running command on switch 1
Cleaning up unnecessary package files
No path specified, will use booted path flash:packages.conf
Cleaning flash:
Scanning boot directory for packages ... done.
Preparing packages list to delete ...
cat3k_caa-guestshell.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpbase.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpcore.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-srdriver.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-universalk9.16.12.08.CSCvy45135.SPA.smu.bin
File is in use, will not delete.
cat3k_caa-webui.16.12.08.SPA.pkg
File is in use, will not delete.
packages.conf
File is in use, will not delete.
done.
SUCCESS: No extra package or provisioning files found on media. Nothing to clean.
switch#request platform software package clean
This operation may take several minutes...
Running command on switch 1
Cleaning up unnecessary package files
No path specified, will use booted path flash:packages.conf
Cleaning flash:
Scanning boot directory for packages ... done.
Preparing packages list to delete ...
cat3k_caa-guestshell.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpbase.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpcore.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-srdriver.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-universalk9.16.12.08.CSCvy45135.SPA.smu.bin
File is in use, will not delete.
cat3k_caa-webui.16.12.08.SPA.pkg
File is in use, will not delete.
packages.conf
File is in use, will not delete.
done.
The following files will be deleted:
[switch 1]:
/flash/cat3k_caa-guestshell.16.09.06.SPA.pkg
/flash/cat3k_caa-rpbase.16.09.06.SPA.pkg
/flash/cat3k_caa-rpcore.16.09.06.SPA.pkg
/flash/cat3k_caa-srdriver.16.09.06.SPA.pkg
/flash/cat3k_caa-universalk9.SPA.03.06.06.E.152-2.E6.conf
/flash/cat3k_caa-universalk9.SPA.03.06.06.E.152-2.E6.conf.00-
/flash/cat3k_caa-webui.16.09.06.SPA.pkg
Do you want to proceed? [y/n]
I tired get the output then use that to match parts of the string with an if else statement but I did not have any look with this approach as well. Any input would be greatly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello all,
I've sent a ton of time trying to get a simple script to work but nothing I try is working. I got most of the pieces to work but I'm having issues with the meat of this script where the command is actually run on my target devices. I want to run request platform software package clean then based on output from the command either delete the output or just print the output if there is nothing to be cleaned. This is what I have for this bit:
output=net_connect.send_command("request platform software package clean", expect_string="Do you want to proceed? [y/n]")
#sends a yes when prompted
output += net_connect.send_command("y",read_timeout=200)
print(ip + "######################################################")
print(output)
net_connect.disconnect()
when I run this I get a time out exemption
Ive tried send_command_timing, and I tried just setting the read time out but both did not yield the expected results.
Heres what the terminal output looks like on a switch there are two scenarios:
1.
switch#request platform software package clean
This operation may take several minutes...
Running command on switch 1
Cleaning up unnecessary package files
No path specified, will use booted path flash:packages.conf
Cleaning flash:
Scanning boot directory for packages ... done.
Preparing packages list to delete ...
cat3k_caa-guestshell.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpbase.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpcore.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-srdriver.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-universalk9.16.12.08.CSCvy45135.SPA.smu.bin
File is in use, will not delete.
cat3k_caa-webui.16.12.08.SPA.pkg
File is in use, will not delete.
packages.conf
File is in use, will not delete.
done.
SUCCESS: No extra package or provisioning files found on media. Nothing to clean.
switch#request platform software package clean
This operation may take several minutes...
Running command on switch 1
Cleaning up unnecessary package files
No path specified, will use booted path flash:packages.conf
Cleaning flash:
Scanning boot directory for packages ... done.
Preparing packages list to delete ...
cat3k_caa-guestshell.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpbase.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-rpcore.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-srdriver.16.12.08.SPA.pkg
File is in use, will not delete.
cat3k_caa-universalk9.16.12.08.CSCvy45135.SPA.smu.bin
File is in use, will not delete.
cat3k_caa-webui.16.12.08.SPA.pkg
File is in use, will not delete.
packages.conf
File is in use, will not delete.
done.
The following files will be deleted:
[switch 1]:
/flash/cat3k_caa-guestshell.16.09.06.SPA.pkg
/flash/cat3k_caa-rpbase.16.09.06.SPA.pkg
/flash/cat3k_caa-rpcore.16.09.06.SPA.pkg
/flash/cat3k_caa-srdriver.16.09.06.SPA.pkg
/flash/cat3k_caa-universalk9.SPA.03.06.06.E.152-2.E6.conf
/flash/cat3k_caa-universalk9.SPA.03.06.06.E.152-2.E6.conf.00-
/flash/cat3k_caa-webui.16.09.06.SPA.pkg
Do you want to proceed? [y/n]
I tired get the output then use that to match parts of the string with an if else statement but I did not have any look with this approach as well. Any input would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions