def get_add_vswitch_port_group_spec(client_factory, vswitch_name, port_group_name, vlan_id):
 vswitch_port_group_spec = client_factory.create('ns0:HostPortGroupSpec')
 vswitch_port_group_spec.name = port_group_name
 vswitch_port_group_spec.vswitchName = vswitch_name
 vswitch_port_group_spec.vlanId = int(vlan_id)
 policy = client_factory.create('ns0:HostNetworkPolicy')
 nicteaming = client_factory.create('ns0:HostNicTeamingPolicy')
 nicteaming.notifySwitches = True
 policy.nicTeaming = nicteaming
 vswitch_port_group_spec.policy = policy
 return vswitch_port_group_spec

def get_add_vswitch_port_group_spec ( client_factory , vswitch_name , port_group_name , vlan_id ) : vswitch_port_group_spec = client_factory . create ( 'ns0:HostPortGroupSpec' ) vswitch_port_group_spec . name = port_group_name vswitch_port_group_spec . vswitchName = vswitch_name vswitch_port_group_spec . vlanId = int ( vlan_id ) policy = client_factory . create ( 'ns0:HostNetworkPolicy' ) nicteaming = client_factory . create ( 'ns0:HostNicTeamingPolicy' ) nicteaming . notifySwitches = True policy . nicTeaming = nicteaming vswitch_port_group_spec . policy = policy return vswitch_port_group_spec
builds the virtual switch port group add spec .