Template Variables.

I’d like to add some things I’ve found out while trying out template variables where the documentation is not 100% clear. When building a JSON template config file, like those from PMP 450, the ${…} notation needs to be completely inside double quotes (") if the value the config expects is a string, and without any quotes if the value it expects is a number or boolean. Examples below.

An IP address is a string, so you would write it like this:
“networkBridgeIPAddr”: “${IP_ADDRESS=10.1.2.3}”

Or, without a default value, like this:
“networkBridgeIPAddr”: “${IP_ADDRESS}”

If the value is a boolean or a number, there will be no double quotes.
“bridgeTableSize”: ${TABLE_SIZE}

Or, with a default value, like so:
“bridgeTableSize”: ${TABLE_SIZE=4}

Notice that this last notation, the one where the ${…} notation is not between double quotes, makes it so the config file template is not in valid JSON format. Knowing this, and following this format, has made it so every config file template with variables that I have made have been accepted by the devices. I had issues where the device would not accept the config file before I found this out, even if cnMaestro accepted the template and understood it.

Hope this helps someone.

3 Likes