Ability to reference the SNMPOID variable names from within the templates?
kbarton1212 opened this issue · 2 comments
Apologies if I'm breaking rules by posting this question as it's not necessary an "issue".
From within a template, is it possible to reference the variable name that holds the SNMPOID value when querying the switch for serial number/model?
For example, I am using the following ztp set snmpoid command:
ztp set snmpoid WS-C3750_MODEL_NAME 1.3.6.1.2.1.47.1.1.1.1.13.1001
This query correctly pulls the model name for the switch I am testing with, and matches it using my ztp set array command which then matches the correct template I have using the ztp set assocation id command.
What I would like to do, is reference the WS-C3750_MODEL_NAME variable from within my template - for example, using this variable as the hostname. Is this possible?
So far I have tried using the {{ WS-C3750_MODEL_NAME }} name in my template but it failed completely, and I have also tried using the keystore with a command such as ztp set keystore 3750 hostname WS-C3750_MODEL_NAME - but it didn't reference the snmpoid variable, rather just used the actual WS-C3750_MODEL_NAME name.
Thanks, and again - sorry if this is not the correct place for questions like this.
First of all, yes this is the appropriate place for questions like this. So no problem there.
To answer your main question, I do not think it is currently possible to do what you are wanting to do. If you look in the logs (ztp show log
) after a switch requests a config, you will see a line like XXXX-XX-XX XX:XX:XX: cfact.merge_final_config: Merging with values: ...
and then a JSON dump of all the values available to your template. Currently there are no SNMP query results in those data, but I see no reason to not have it in there. I am going to consider this a bug and queue it for repair. I may be able to turn out a fix for it in the next few days.
Added to bug list. Closing