cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2202
Views
5
Helpful
11
Replies

Prime Infrastructure - CLI Template - SmartPort Macro

MARIO POIER
Enthusiast
Enthusiast

I'm hoping that someone can provide an example of a CLI Template for deploying a SmartPort Macro in Prime Infrastructure 2.0. I've tried multiple formats and can't seem to get it to work.

Macro to be configured:

macro auto execute TEST_MACRO {

     blah

     blah

     blahdeeblah

}

Example 1 Template:

#INTERACTIVE

macro auto execute TEST_MACRO {

<IQ><R>

<IQ><R>blah

<IQ><R>blah

<IQ><R>blahdeeblah

<IQ><R>}

#ENDS_INTERACTIVE

The above example runs successfully, however it does not actually produce a result.

Example 2 Template:

<MLTCMD>macro auto execute TEST_MACRO {

blah

blah

blahdeeblah

}</MLTCMD>

The above example fails with the following result:

Error : Exception while sending interactive commands to device, Expect timeout: Failed to match expected device output due to Expect timeout current timeout 60000. Current output : > >blah >blah >blahdeeblah >} mc-t307-acc06(config)# Current expects : blah blah blahdeeblah \}

I'm sure that all my troubles stem from '>' result that is sent to the CLI after each line of the function is entered, however I can't seem to work around the problem.

I've tried many more combinations without success... Any help would be appreciated.

11 Replies 11

AFROJ AHMAD
Cisco Employee
Cisco Employee

Hi Mario,

what kind of device is this , I mean the model no ?

Can you try to run the Template again after Shortening the HOSTNAME of the device  and see how it work.

**********Hostname Character 10 or less *************

Thanks-
Afroz
[Do rate the useful post]
****Ratings Encourages Contributors ****

Thanks- Afroz [Do rate the useful post] ****Ratings Encourages Contributors ****

The switch that I'm attempting to deploy to is a 2960 Series (2960-48TT-L) running 12.2(55)SE1.

I'm not exactly sure that I understand what you mean by running the template with a shorter hostname. The current hostname is: mc-t307-acc06. Upon deployment I really only have the option to select the device from a list which is the FQDN of the device.

Regards,

Mario

.

Hi Mario,

This is actully a BUG

Config push fails when the device name is long

CSCub57283

Workaround:Modify the device name to a small name. Deploy the template again to the device

Thanks-
Afroz
[Do rate the useful post]
****Ratings Encourages Contributors ****

Thanks- Afroz [Do rate the useful post] ****Ratings Encourages Contributors ****

Justin bollinger
Beginner
Beginner

Instead of 

#INTERACTIVE

macro auto execute TEST_MACRO {

<IQ><R>

<IQ><R>blah

<IQ><R>blah

<IQ><R>blahdeeblah

<IQ><R>}

#ENDS_INTERACTIVE

Try 

<MLTCMD>
macro auto execute TEST_MACRO {
blah
blah
blahdeeblah
}
</MLTCMD>

 

 

This works for me.  

Torrance Zeiler
Beginner
Beginner

Were you ever able to find a solution for this? I'm having the same experience at the moment.

Did you try the solution I suggested?  This method worked for me.

Yes, it looked promising since I was not receiving the error that Mario reported. The job reported successful but the function is not being created on the switch. The only command I am sticking in the macro is 'conf t' so I'm not pushing anything complicated. It works fine when I manually create it.. very strange.

Can you submit the exact syntax you are trying to use?

Sure! I went back and made it real simple but I started getting the failure errors that Mario was getting above.

<MLTCMD>macro auto execute TEST_EVENT {
conf t
}</MLTCMD>

Now, here's the weird part. I tried the syntax below and was able to get it pushed to the switch. Thinking I solved the issue, I then added some more commands to my macro, pushed it again, and it failed. I then went back and tried the code below again without the extra commands but that time it failed.

#INTERACTIVE
macro auto execute TEST_EVENT {
<IQ><R><MLTCMD>conf t
}</MLTCMD>
 

It looks like you hit the nail on the head, Justin. I revisited this today and was able to get it to write the macro to the switch using your syntax, albeit the job still failing in PI.

Even though you say it works for you, are your jobs in PI finishing successfully or are they failing like mine? Failing job or not, it's still writing to the switch so I may just need to run with it.

My syntax is as follows-

<MLTCMD>macro auto execute TEST_EVENT {
if [[ $LINKUP == YES ]];
  then configure terminal
  interface $INTERFACE
    macro description $TRIGGER
  exit
fi
}</MLTCMD>

Unfortunately I haven't had any success yet.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers