def handle_ip_range_update(target_dict, start_list, step_list,
                           repeat_list, recycle_list,
                           target_step_list, reset,
                           obj_name, prop_name):
    plLogger = PLLogger.GetLogger("methodology")
    plLogger.LogDebug(" process ip...")
    plLogger.LogDebug("  object: " + obj_name + "   property: " + prop_name)

    is_collection = dm_utils.is_property_collection(obj_name, prop_name)
    plLogger.LogDebug("  is_collection: " + str(is_collection))

    pattern_iter = 0
    target_count = 0

    # Make a distinct COPY of start_list into curr_start_list so that
    # the curr_start_list doesn't change each time start_list does.
    # curr_start_list is used to keep track of the starting values
    # for a particular target object given reset and target_step_list.
    curr_start_list = list(start_list)

    for target_key in sorted(target_dict):
        curr_mod_obj_list = target_dict[target_key]
        if reset:
            # Reset the pattern generator
            pattern_iter = 0

        # Update start_list with target_step_list
        start_iter = 0
        for start, target_step in zip(curr_start_list, target_step_list):
            start_list[start_iter] = if_utils.expand_ip_pattern(
                target_count, 1, str(start), str(target_step), 0, 0)[0]
            start_iter = start_iter + 1
        plLogger.LogDebug("curr_start_list: " + str(curr_start_list))
        plLogger.LogDebug("start_list: " + str(start_list))
        plLogger.LogDebug("target_count: " + str(target_count))
        plLogger.LogDebug("target_step_list: " + str(target_step_list))

        # Iterate over the objects to be modified (per target object)
        for mod_obj in curr_mod_obj_list:
            list_pos = 0
            val_list = []

            # Iterate over the elements in the start_list (list_pos)
            for start in start_list:
                ip_list = if_utils.expand_ip_pattern(
                    pattern_iter, 1,
                    start_list[list_pos],
                    step_list[list_pos],
                    int(repeat_list[list_pos]),
                    int(recycle_list[list_pos]))
                plLogger.LogDebug(" setting next ip to: " + str(ip_list[0]))
                val_list.append(ip_list[0])
                list_pos = list_pos + 1
            if is_collection is True:
                mod_obj.SetCollection(prop_name, val_list)
            else:
                mod_obj.Set(prop_name, val_list[0])
            pattern_iter = pattern_iter + 1
        target_count = target_count + 1
def handle_uint_range_update(target_dict, start_list, step_list,
                             repeat_list, recycle_list,
                             target_step_list, reset,
                             obj_name, prop_name):
    plLogger = PLLogger.GetLogger("methodology")
    plLogger.LogDebug(" process unsigned integer...")
    plLogger.LogDebug("  object: " + obj_name + "   property: " + prop_name)

    # Hack due to CMeta.GetPropertyRange("EmulatedDevice", "DeviceCount")
    # failing due to an invalid cast from hex (boost::lexical_cast<int>
    # is failing due to hex input).
    try:
        prop_range = CMeta.GetPropertyRange(obj_name, prop_name)
    except:
        prop_range = None
    is_collection = dm_utils.is_property_collection(obj_name, prop_name)
    plLogger.LogDebug("  prop_range: " + str(prop_range))
    plLogger.LogDebug("  is_collection: " + str(is_collection))

    pattern_iter = 0
    target_count = 0

    # Make a distinct COPY of start_list into curr_start_list so that
    # the curr_start_list doesn't change each time start_list does.
    # curr_start_list is used to keep track of the starting values
    # for a particular target object given reset and target_step_list.
    curr_start_list = list(start_list)

    for target_key in sorted(target_dict):
        curr_mod_obj_list = target_dict[target_key]
        if reset:
            # Reset the pattern generator
            pattern_iter = 0

        # Update start_list with target_step_list
        start_iter = 0
        for start, target_step in zip(curr_start_list, target_step_list):
            start_list[start_iter] = str(int(start) +
                                         int(target_step) * target_count)
            start_iter = start_iter + 1
        plLogger.LogDebug("curr_start_list: " + str(curr_start_list))
        plLogger.LogDebug("start_list: " + str(start_list))
        plLogger.LogDebug("target_count: " + str(target_count))
        plLogger.LogDebug("target_step_list: " + str(target_step_list))

        # Iterate over the objects to be modified (per target object)
        for mod_obj in curr_mod_obj_list:
            list_pos = 0
            val_list = []

            # Iterate over the elements in the start_list (list_pos)
            for start in start_list:
                int_list = if_utils.expand_int_pattern(
                    pattern_iter, 1,
                    int(start_list[list_pos]),
                    int(step_list[list_pos]),
                    int(repeat_list[list_pos]),
                    int(recycle_list[list_pos]))
                plLogger.LogDebug(" setting next int to: " + str(int_list[0]))
                num = int_list[0]
                if prop_range is not None:
                    min_val, max_val = prop_range[0], prop_range[1]
                    if num < min_val or num > max_val:
                        num = min_val + \
                            (num - min_val) % (max_val - min_val + 1)
                val_list.append(num)
                list_pos = list_pos + 1
            if is_collection is True:
                mod_obj.SetCollection(prop_name, val_list)
            else:
                mod_obj.Set(prop_name, val_list[0])
            pattern_iter = pattern_iter + 1
        target_count = target_count + 1