Configuring Multiple UCS VLAN's

Share on:

We are currently working on some Cisco ACI Integration and wanted to add a large VLAN Pool to a UCS Configuration.

Since currently Cisco UCS does not allow selecting multiple VLAN’s easily when adding to a VLAN Group or vNIC Template, we now have a pretty decent script that will do it for you.

The script can be found here.

 1# PowerCLI Script for adding VLAN to VLAN Group and vNIC Template
 2# @davidstamen
 3# http://davidstamen.com
 4
 5#Define Variables
 6$cred = Get-Credential
 7$ucs = "ucs01"
 8$startvlan = "100"
 9$endvlan = "150"
10$vnictemplate = "vnic-template"
11$vlangroup = "vlan-group"
12
13#Connect to UCS
14Connect-UCS $ucs -credential $cred
15
16#Assumes VLAN Name is the VLANID. Adds VLAN from start to end to vlan group
17for($i=$startvlan;$i -le $endvlan;$i++){Get-UcsFabricNetGroup -Name $vlangroup |Add-UcsFabricPooledVlan -Name "$i"}
18
19#Assumes VLAN Name is the VLANID. Adds VLAN from start to end to vnic template
20for($i=$startvlan;$i -le $endvlan;$i++){Get-UcsVnicTemplate -Name $vnictemplate | Add-UcsVnicInterface -ModifyPresent -DefaultNet false -Name "$i"}
21Disconnect-UCS

You now are done! In my case I had to add 500 VLAN’s, so this script saved me quite a bit of time.

comments powered by Disqus

See Also