You call the HostNetworkSystem.AddVirtualSwitch method to add one or more virtual switches. Pass in the name of the virtual switch and a HostVirtualSwitchSpec data object as parameters.
Inside HostVirtualSwitchSpec you can specify the MTU, number of ports, network policy, and bridge specification. The bridge specifies how the virtual switch connects to the physical adapter. The currently supported bond bridge provides network adapter (NIC) teaming capabilities through the use of a list of physical devices and, optionally, a beacon probe to test connectivity with physical adapters.
After you have created the virtual switch, you can connect it to a pnic for connection to the outside, and to a VMkernel port or a port group.
To add a virtual switch, use the following steps.
Procedure
Example: Adding a Virtual Switch
vswitchId = vSwitch42; ... ManagedObjectReference nwSystem = configMgr.getNetworkSystem(); HostVirtualSwitchSpec spec = new HostVirtualSwitchSpec(); spec.setNumPorts(8); service.addVirtualSwitch(nwSystem, vswitchId, spec); System.out.println( " : Successful creating : " + vswitchId);