def deactivate(ns, setting, device=None):
    service = ns.LMI_IPConfigurationService.first_instance()

    if _provider_check_required_device(ns):
        # old version of provider that doesn't support activation of setting without device
        if device is None:
            if setting.classname == 'LMI_BridgingMasterSettingData':
                slave_class = 'LMI_BridgingSlaveSettingData'
            elif setting.classname == 'LMI_BondingMasterSettingData':
                slave_class = 'LMI_BondingSlaveSettingData'
            else:
                slave_class = None

            # Autodetect and deactivate slaves
            if slave_class:
                affected_settings = setting.associators(AssocClass='LMI_OrderedIPAssignmentComponent', ResultClass=slave_class)
            else:
                affected_settings = [setting]

            for slave_setting in affected_settings:
                device = slave_setting.first_associator(AssocClass="LMI_IPElementSettingData", ResultClass="LMI_IPNetworkConnection")
                result = service.SyncApplySettingToIPNetworkConnection(SettingData=slave_setting,
                        IPNetworkConnection=device,
                        Mode=service.ApplySettingToIPNetworkConnection.ModeValues.Mode32769)
                if result.errorstr:
                    raise LmiFailed("Unable to deactivate setting: %s" % result.errorstr)
                # TODO: rework using indications
                isCurrent = True
                while isCurrent:
                    for esd in slave_setting.references(ResultClass="LMI_IPElementSettingData"):
                        if esd.IsCurrent == ns.LMI_IPElementSettingData.IsCurrentValues.IsNotCurrent:
                            isCurrent = False
                            break
                    time.sleep(1)
            LOG().info("Setting %s deactivated", setting.Caption)
            return 0

    if device is not None:
        LOG().debug('Deactivating setting %s on device %s', setting.Caption, device.ElementName)
        result = service.SyncApplySettingToIPNetworkConnection(SettingData=setting,
                IPNetworkConnection=device,
                Mode=service.ApplySettingToIPNetworkConnection.ModeValues.Mode32769)
        if result.errorstr:
            raise LmiFailed("Unable to deactivate setting: %s" % result.errorstr)
    else:
        result = service.SyncApplySettingToIPNetworkConnection(SettingData=setting,
                Mode=service.ApplySettingToIPNetworkConnection.ModeValues.Mode32769)
        if result.errorstr:
            raise LmiFailed("Unable to deactivate setting: %s" % result.errorstr)
    LOG().info("Setting %s deactivated", setting.Caption)
    return 0
Deactivate network setting.
dataset/ETHPy150Open openlmi/openlmi-scripts/commands/networking/lmi/scripts/networking/__init__.py/deactivate