THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

Network Automation and Compliance (NetMRI)

Reply

Different actions depending on switch prompt (perl, netmri easy)

New Member
Posts: 5
4547     0

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)

Superuser
Posts: 115
4547     0

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?

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Different actions depending on switch prompt (perl, netmri easy)

Superuser
Posts: 115
4548     0

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
##
Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Different actions depending on switch prompt (perl, netmri easy)

[ Edited ]
New Member
Posts: 5
4548     0

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)

Superuser
Posts: 115
4548     0

You can use the following 

 

install remove inactive \ry

 

or is it 

install remove inactive y\r

Will do it for you

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com
Showing results for 
Search instead for 
Did you mean: 

Recommended for You