def remove_ip_address(ns, setting, address):
    address, version = util.address_check(address)

    protocol = ns.LMI_IPAssignmentSettingData.ProtocolIFTypeValues.values_dict()["IPv%s" % version]
    found = False
    for settingData in setting.associators(AssocClass="LMI_OrderedIPAssignmentComponent"):
        if (settingData.ProtocolIFType is not None and
                int(settingData.ProtocolIFType) == protocol and
                hasattr(settingData, "IPAddresses")):

            i = 0
            # lmishell doesn't handle in-place editing of array parameters properly,
            # we need to create new arrays and then copy them back
            addresses = []
            masks = []
            gateways = []
            while i < len(settingData.IPAddresses):
                if not util.compare_address(settingData.IPAddresses[i], address):
                    addresses.append(settingData.IPAddresses[i])
                    if version == 4:
                        masks.append(settingData.SubnetMasks[i])
                    else:
                        masks.append(settingData.IPv6SubnetPrefixLengths[i])
                    gateways.append(settingData.GatewayAddresses[i])
                else:
                    found = True
                i += 1
            settingData.IPAddresses = addresses
            if version == 4:
                settingData.SubnetMasks = masks
            else:
                settingData.IPv6SubnetPrefixLengths = masks
            settingData.GatewayAddresses = gateways
            settingData.push()
    if not found:
        raise LmiInvalidOptions("Can't remove IP address from setting: invalid setting type or address doesn't exist.")
    LOG().info("IP address %s removed from setting %s", address, setting.Caption)
    return 0
Remove the IP address from given static setting.
dataset/ETHPy150Open openlmi/openlmi-scripts/commands/networking/lmi/scripts/networking/__init__.py/remove_ip_address