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

Prime Infrastructure 3.1 CLI template hash table arrays

Dave Lewis
Level 1
Level 1

Does anyone know if its possible to use hash table arrays in CLI templates for PI 3.1? I can't see any way of doing it as the 'data types' for the variables are standard integer, string, DB etcetera. What I'm looking for is a way of creating a table of values, for example if I want to create multiple vlans I'd want a variable called 'vlan_list', something like this in the form view of the template:

VLAN_ID      VLAN_NAME
100 TEST
101 TEST2
...etc...

And then my cli template would have something like this:

#foreach ($vlan in $vlan_list)
vlan $vlan.VLAN_ID
name $vlan.VLAN_NAME
#end

This is possible in DCNM but I can't see any way of doing it in PI CLI templates? I have seen other templates such as 'NAM -> System' within the features and technologies section (see picture) that implement this but I can't find a way of doing it myself

Any help appreciated.

Dave

1 Reply 1

mario.jost
Level 3
Level 3

I know it is way too late, but i stumbled accross a similar problem today and thought i'd post the fix for this so someone else might profit from it. In your environment, something like this should do the trick:

#set($counter = 0)
#set($split_arrVLAN_ID = $arrVLAN_ID.split(";", -1))
#set($split_arrVLAN_NAME = $arrVLAN_NAME.split(";", -1))

#foreach($vlanID in $split_arrVLAN_ID)
        vlan $vlanID
        name split_arrVLAN_NAME.get($counter)"
        exit
    #set($counter = $counter + 1)
#end

You'd have to provide the two variables in an array. So if you wanna get this configuration:

vlan 2
   name Test
   exit
vlan 3
   name Fish
   exit
vlan 25
   name dontharmus
   exit

You'd have to fill out the variables via Prime GUI or API like this:

$arrVLAN_ID
2;3;25 $arrVLAN_NAME
Test;Fish;dontharmus

 

Review Cisco Networking for a $25 gift card