Hi All.
So I am wondering how to use Prime Templates to check a switch and apply a new QOS policy only when the switchport mode is access.
Foreach I know works, but I am unsure of how to continue from there. I had the thought that maybe it was possible to see if the running config of each interface matched a regex for a string, but I haven't been able to wrap my head around that logic yet.
I figure that most people are going to recommend using compliance templating/auditing instead, but still wanted to ask.
Thanks in advance
#MODE_ENABLE
#macro(service_policy)
service policy commands go here
#end
#foreach ($interfaceName in $interfaceNameList){
interface $interfaceName
#if ($switchportMode == "access"){
#service policy
}
#else(
#break
)
}
#MODE_END_ENABLE
where $interfaceNameList is the database variable type whose value will be retrieved from the database. $interfaceNameList has a default value of IntfName.
You need to create the interfaceNameList variable as DB data type (using the managed variable dialog box) and add set the default to IntfName.
If you have not specified a default value, you can specify it when you apply the CLI template.
Similarily $switchportmode would also need to be defined, because I’m not 100% on what predefined DB variables are available in /opt/CSCOlumos/conf/ifm/template/inventoryTagsInTemplate