cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
244
Views
0
Helpful
0
Replies

Looking for a tool or API to process service template files

ygorelik
Cisco Employee
Cisco Employee

I am looking for a tool to process service template files in terms of addressing all conditional statements.

Let's say I have a template that defines a user statement for the snmp v3 configuration on IOS device (part is shown, the full template can be found here

<user>
<name>{$USER}</name>
<group>nso-sync-monitor</group>
<v3/>
<?if {$AUTH = "auth"}?>
<auth>{$AUTH_ALGORITHM}</auth>
<auth-password>{$AUTH_PASSWORD}</auth-password>
<?elif {$AUTH = "priv"}?>
<auth>{$AUTH_ALGORITHM}</auth>
<auth-password>{$AUTH_PASSWORD}</auth-password>
<priv>{$PRIV_ALGORITHM}</priv>
<?if {$PRIV_ALGORITHM = "aes"}?>
<bits>128</bits>
<?end?>
<priv-password>{$PRIV_PASSWORD}</priv-password>
<?end?>
</user>

 Given set of variables that control the conditional statement:

temp_vars = {AUTH: 'noauth'}

I should get the resulting XML:

<user>
<name>{$USER}</name>
<group>nso-sync-monitor</group>
<v3/>
</user>

Needless to add that the conditional statements are not limited to if-else statement, but should cover the syntax, which is used in NSO template development. Ideally would be to have an NSO API, which processes the templates.

Thank you.

0 Replies 0