Applies the values in teaming_conf to a teaming policy object

    pg_name
        The name of the portgroup

    teaming
        The vim.VmwareUplinkPortTeamingPolicy to apply the config to

    teaming_conf
        The teaming config

def _apply_dvportgroup_teaming(pg_name, teaming, teaming_conf):
    '''
    Applies the values in teaming_conf to a teaming policy object

    pg_name
        The name of the portgroup

    teaming
        The vim.VmwareUplinkPortTeamingPolicy to apply the config to

    teaming_conf
        The teaming config
    '''
    log.trace('Building portgroup\'s \'%s\' teaming', pg_name)
    if 'notify_switches' in teaming_conf:
        teaming.notifySwitches = vim.BoolPolicy()
        teaming.notifySwitches.value = teaming_conf['notify_switches']
    if 'policy' in teaming_conf:
        teaming.policy = vim.StringPolicy()
        teaming.policy.value = teaming_conf['policy']
    if 'reverse_policy' in teaming_conf:
        teaming.reversePolicy = vim.BoolPolicy()
        teaming.reversePolicy.value = teaming_conf['reverse_policy']
    if 'rolling_order' in teaming_conf:
        teaming.rollingOrder = vim.BoolPolicy()
        teaming.rollingOrder.value = teaming_conf['rolling_order']
    if 'failure_criteria' in teaming_conf:
        if not teaming.failureCriteria:
            teaming.failureCriteria = vim.DVSFailureCriteria()
        failure_criteria_conf = teaming_conf['failure_criteria']
        if 'check_beacon' in failure_criteria_conf:
            teaming.failureCriteria.checkBeacon = vim.BoolPolicy()
            teaming.failureCriteria.checkBeacon.value = \
                    failure_criteria_conf['check_beacon']
        if 'check_duplex' in failure_criteria_conf:
            teaming.failureCriteria.checkDuplex = vim.BoolPolicy()
            teaming.failureCriteria.checkDuplex.value = \
                    failure_criteria_conf['check_duplex']
        if 'check_error_percent' in failure_criteria_conf:
            teaming.failureCriteria.checkErrorPercent = vim.BoolPolicy()
            teaming.failureCriteria.checkErrorPercent.value = \
                    failure_criteria_conf['check_error_percent']
        if 'check_speed' in failure_criteria_conf:
            teaming.failureCriteria.checkSpeed = vim.StringPolicy()
            teaming.failureCriteria.checkSpeed.value = \
                    failure_criteria_conf['check_speed']
        if 'full_duplex' in failure_criteria_conf:
            teaming.failureCriteria.fullDuplex = vim.BoolPolicy()
            teaming.failureCriteria.fullDuplex.value = \
                    failure_criteria_conf['full_duplex']
        if 'percentage' in failure_criteria_conf:
            teaming.failureCriteria.percentage = vim.IntPolicy()
            teaming.failureCriteria.percentage.value = \
                    failure_criteria_conf['percentage']
        if 'speed' in failure_criteria_conf:
            teaming.failureCriteria.speed = vim.IntPolicy()
            teaming.failureCriteria.speed.value = \
                    failure_criteria_conf['speed']
    if 'port_order' in teaming_conf:
        if not teaming.uplinkPortOrder:
            teaming.uplinkPortOrder = vim.VMwareUplinkPortOrderPolicy()
        if 'active' in teaming_conf['port_order']:
            teaming.uplinkPortOrder.activeUplinkPort = \
                    teaming_conf['port_order']['active']
        if 'standby' in teaming_conf['port_order']:
            teaming.uplinkPortOrder.standbyUplinkPort = \
                    teaming_conf['port_order']['standby']