VMware Cloud Community
dwchan
Enthusiast
Enthusiast

How to create multiple Teamings definition in NSX-T

I am still learning my way around NSX-T and how its API schema layout.  I did manage to figure out how create an Uplink profile with various type of policies.

$NSXT_UplinkProfile_Name = 'Uplink Profile'
$NSXT_UplinkProfile_Description = 'Uplink Description'
$NSXT_UplinkProfile_Policy = 'FAILOVER_ORDER' # LOADBALANCE_SRCID FAILOVER_ORDER
$NSXT_UplinkProfile_ActiveLinks = 'uplink1'
$NSXT_UplinkProfile_StandbyLinks = 'uplink2'
$NSXT_UplinkProfile_VLAN = 31
$NSXT_UplinkProfile_MTU = 1600

if ($NSXT_UplinkProfile_Name -match '') {
$NSXT_Host_UplinkProfile_Name = $NSXT_UplinkProfile_Name
}

$hostSwitchProfileService = Get-NsxtService -Name "com.vmware.nsx.host_switch_profiles"
$ESXiUplinkProfileSpec = $hostSwitchProfileService.help.create.base_host_switch_profile.uplink_host_switch_profile.Create()
$activeUplinkSpec = $hostSwitchProfileService.help.create.base_host_switch_profile.uplink_host_switch_profile.teaming.active_list.Element.Create()
$activeUplinkSpec.uplink_name = $NSXT_UplinkProfile_ActiveLinks
$activeUplinkSpec.uplink_type = 'PNIC'

if ($NSXT_UplinkProfile_Policy -eq 'LOADBALANCE_SRCID') {
$standbyUplinkSpec = $hostSwitchProfileService.help.create.base_host_switch_profile.uplink_host_switch_profile.teaming.active_list.Element.Create()
$standbyUplinkSpec.uplink_name = $NSXT_UplinkProfile_StandbyLinks
$standbyUplinkSpec.uplink_type = 'PNIC'
} else {
$standbyUplinkSpec = $hostSwitchProfileService.help.create.base_host_switch_profile.uplink_host_switch_profile.teaming.standby_list.Element.Create()
$standbyUplinkSpec.uplink_name = $NSXT_UplinkProfile_StandbyLinks
$standbyUplinkSpec.uplink_type = 'PNIC'
}
#$ESXiUplinkProfileSpec.named_teamings = "test"

$ESXiUplinkProfileSpec.display_name = $NSXT_UplinkProfile_Name
$ESXiUplinkProfileSpec.description = $NSXT_UplinkProfile_Description
$ESXiUplinkProfileSpec.transport_vlan = $NSXT_UplinkProfile_VLAN
$ESXiUplinkProfileSpec.mtu = $NSXT_UplinkProfile_MTU
$addActiveUplink = $ESXiUplinkProfileSpec.teaming.active_list.Add($activeUplinkSpec)
if ($NSXT_UplinkProfile_Policy -eq 'LOADBALANCE_SRCID') {
if ( -not [string]::IsNullOrEmpty($NSXT_UplinkProfile_StandbyLinks)) {
$addActiveUplink = $ESXiUplinkProfileSpec.teaming.active_list.Add($standbyUplinkSpec)
}
} else {
if ( -not [string]::IsNullOrEmpty($NSXT_UplinkProfile_StandbyLinks)) {
$addStandbyUplink = $ESXiUplinkProfileSpec.teaming.standby_list.Add($standbyUplinkSpec)
}
}
$ESXiUplinkProfileSpec.teaming.policy = $NSXT_UplinkProfile_Policy
My-Logger "Creating NSX-T Uplink Profiles ..."
$ESXiUplinkProfile = $hostSwitchProfileService.create($ESXiUplinkProfileSpec)

However, I am stuck, or perhaps just need some syntax guidance on how to add more than one Teamings definition into the profile like this

dwchan_1-1615617172962.png

Unlike some of the configuration where you just have to figure out which method or object to add a simple value, or add something to a fix JSON file, I have no idea on how to add additional or initiate multiple 'Named_Teaming' object while adding its to my current $ESXiUplinkProfileSpec to create the object.  Any comment or guidance would be appreicated as always

 

 

Reply
0 Kudos
0 Replies