Using PI 3.1.5
Having trouble deploying a template. Have written which uses a DB variable to perform a show command (enable mode). . Here's an example template content:
#if ($interfaceNames !="")
#MODE_ENABLE
#foreach ($intf in $interfaceNames)
#if ($intf.toString().contains("Te"))
show idprom interface $intf | inc Name
#end
#end
#MODE_END_ENABLE
#end
This is basically designed to show the vendor of any SFP in a 10Gb interface. The interfaceNames variable is a DB lookup using "UpIntfName" as the default value.
This works fine through the GUI and could see the vendor name my next step was going to be to deploy through the API and use some string manipulation to extract the vendor name. However when deploying through the API I get a result something like this:
#MODE_ENABLE
#MODE_END_ENABLE
response:
<cliChunks><cliChunk><cli>terminal width 0
config t
exit
config t
</cli><response><![CDATA[terminal width 0
***#config t
Enter configuration commands, one per line. End with CNTL/Z.
***(config)#exit
***#config t
Enter configuration commands, one per line. End with CNTL/Z.
***(config)#]]></response></cliChunk></cliChunks>
Which seems to suggest that no commands were generated (either the foreach didn't work or the if statement didn't match).
Then tried something really simple thus:
#MODE_ENABLE
show $DeviceName
#MODE_END_ENABLE
$DeviceName is a DB variable using the built-in DeviceName value
This isn't a valid CLI command but what's interesting is the output. Through the GUI it correctly tried to execute 'show XXXXX' where XXXX is the device name. However through the API the output is:
0/3 template configurations successfully applied.
Error occured while executing the command show $DeviceName.Command Output : show $DeviceName
show $DeviceName
^
% Invalid input detected at '^' marker.
Error occured while executing the command show $DeviceName.Command Output : show $DeviceName
show $DeviceName
^
% Invalid input detected at '^' marker.
Error occured while executing the command show $DeviceName.Command Output : show $DeviceName
show $DeviceName
^
% Invalid input detected at '^' marker.
This suggest that the DB variables aren't getting evaluated when deploying a template through the API.
Has anyone successfully deployed templates using DB variables.
Two more related questions:
1) When deploying a job through API you cannot see the results of that job through the GUI, the jobs go into the CliTemplateDeployIOSDevices section but if you click the 'job detail view' link it returns 'Could not find the Job Results.'
2) When deploying through the GUI you get options for 'continue' or 'stop' if errors are encountered, is there any equivalent option when using cliTemplateConfiguration/deployTemplateThroughJob.
Regarding DB variables not having their values populated, this is a known issue which we are fixing in 3.1.6 (https://bst.cloudapps.cisco.com/bugsearch/bug/CSCvc98615).
Seeing results in the job dashboard will be supported in 3.2. To get detailed job results in versions prior to 3.2, we recommend using the GET op/jobService/runhistory resource (https://developer.cisco.com/media/prime-infrastructure-api-reference-v3-1/192.168.115.187/webacs/api/v1/op/jobService/runhistory-GETcc3b.html?_docs).
No, there is no such option via the API. If one device fails deployment then the next device, if there is one, will be configured.
Comments
0 comments
Please sign in to leave a comment.