02-26-2014 01:53 PM
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.
02-26-2014 05:37 PM
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 ****
02-27-2014 06:34 AM
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
.
02-27-2014 06:55 AM
Hi Mario,
This is actully a BUG
Config push fails when the device name is long
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 ****
05-01-2014 06:44 AM
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.
07-11-2014 06:53 AM
Were you ever able to find a solution for this? I'm having the same experience at the moment.
07-11-2014 06:59 AM
Did you try the solution I suggested? This method worked for me.
07-11-2014 07:06 AM
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.
07-11-2014 09:11 AM
Can you submit the exact syntax you are trying to use?
07-11-2014 11:23 AM
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>
07-21-2014 07:52 AM
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>
07-11-2014 10:42 AM
Unfortunately I haven't had any success yet.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide