vCO Workflow Script to Create a Distributed Virtual Switch – Part 3

The following is a multi-part series of vCO Workflow Scripts to Create a Distributed Virtual Switch – Part 3

 

 

System.log("====================================================================================================");

System.log("===== Retrieving an Array of dvSwitch Port Groups");

var arrVcDistributedVirtualPortgroup;
	arrVcDistributedVirtualPortgroup = objVcVMwareDistributedVirtualSwitch.portgroup;

System.log("===== Looping Through an Array of dvSwitch Port Groups");

for ( var i = 0; i < arrVcDistributedVirtualPortgroup.length; i++ )
{
	var objVcDistributedVirtualPortgroup;
		objVcDistributedVirtualPortgroup = arrVcDistributedVirtualPortgroup[i];

	var strVcDistributedVirtualPortgroupName;
		strVcDistributedVirtualPortgroupName = objVcDistributedVirtualPortgroup.name;

	System.log("===== Port Group Name = " + strVcDistributedVirtualPortgroupName);
	
	System.log("===== Re-Naming dvSwitch Uplink Port Group");

	if ( strVcDistributedVirtualPortgroupName.search("dvSwitch-vSphere-DVUplinks-") > -1 )
	{
		System.log("===== Executing the dvSwitch Port Group Creation Task");

		var objVcTask;
			objVcTask = objVcDistributedVirtualPortgroup.rename_Task("dvSwitch-vSphere-Services-Uplinks")
		
		var objResult;
			objResult = objModule.WaitForVcTask(objVcTask);
	}
}

System.log("====================================================================================================");

Leave a Reply