- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Different actions depending on switch prompt (perl, netmri easy)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2021 10:43 PM
Running these versions :
NetMRI Version : 7.4.2.97106
API Version : 3.4
NetMRI_Easy : 0.6
Script languange : Perl
Im looking for a way to check the prompt a cisco device is returning after a sent command and take appropriate actions. Prompt does change depending of outcome of command, sometimes its "]" and sometimes its "#".
If prompt = "]" then send command "yes"
If prompt = "#" then send command "copy run start"
Is this possible? If, then how?
Br
Magnus
Re: Different actions depending on switch prompt (perl, netmri easy)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2021 06:15 AM
Can you past the examples of what commands you are sending and what it returns and is it all the same OS type like IOS/NX-OS or a mixed bag that you are running it on?
Twitter: https://twitter.com/sifbaksh
https://sifbaksh.com
Re: Different actions depending on switch prompt (perl, netmri easy)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2021 07:20 AM
Also here is an example in CCS not sure about PERL or Python but let me do some research
Output-Triggers: router context Enterasys Trigger: router context Enterasys Trigger-Filter: $Vendor eq "Enterasys" Trigger-Context: true ## ## Command to enter a new context - this could involve a change in the prompt structure ## Trigger-Context-Enter: enable ## ## Regular expression that defines the prompt structure for this context ## Trigger-Context-Prompt: .*# ## ## Command to leave the context - the regular expression prompt structure will be reverted to what it was before. ## NOTE: This is the last thing in the trigger that is processed (i.e. after all Output-Triggers have finished). ## Trigger-Context-Exit: exit ## ## Run some commands within this context ## Trigger-Commands: configure ip route $Network $SubnetMask $Router $Metric exit ## ## Process the output of the above commands ##
Twitter: https://twitter.com/sifbaksh
https://sifbaksh.com
Re: Different actions depending on switch prompt (perl, netmri easy)
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 05:07 AM - edited 02-04-2021 05:08 AM
switch#install remove inactive
If there are files eligable for deletion it will ask this question :
Do you want to remove the above files? [y/n]
Otherwise it just ends back in the regular prompt :
switch#
if prompt "]" then "y"
else do nothing.
Br
Magnus
(edited incorrect spelling)
Re: Different actions depending on switch prompt (perl, netmri easy)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 07:32 AM
You can use the following
install remove inactive \ry
or is it
install remove inactive y\r
Will do it for you
Twitter: https://twitter.com/sifbaksh
https://sifbaksh.com