3.1.4.7 SetIPRangeMapping

The SetIPRangeMapping event captures the common processing rules for performing the following common activities for an address range:

  1. Recalculate the IsOverlapping and UseForUtilization setting for the specified range and the ranges that overlap with the specified range.

  2. Identify the subnet that this has to be mapped to. This would also create a parent subnet if none is found, and the parameter (defined later) createSubnetIfDoesNotExist set to the value TRUE.

  3. Map the appropriate set of rows in the ADM_IPAddressTable to the specified range.

In the following processing steps, currentRange indicates the address range for which the previous activities are to be performed, and createSubnetIfDoesNotExist indicates whether a parent subnet is to be automatically created if none is found:

  1. Get the list of overlapping address ranges with the StartIPAddress, EndIPAddress, ExclusionRanges by invoking the procedure GetOverlappingRanges of the ADM_IPRangeTable. This is done by setting the following input parameters:

    1. Param_StartIPAddress is assigned the value currentRange.range.StartIPAddress.

    2. Param_EndIPAddress is assigned the value currentRange.range.EndIPAddress.

    3. Param_ExclusionRanges is set to the currentRange.range.ExclusionRanges.

    4. Param_RecordIdToExclude is set to currentRange.RecordId.

    5. Param_AddressSpaceRecordId is set to currentRange.AddressSpaceId.

  2. For each overlappingRange in Result_OverlappingRows, perform the following:

    1. Calculate the ManagedBy value to be the custom field value whose custom field identifier is the same value as ADM_ManagedByCustomFieldId.

    2. Calculate the ManagedByEntity value to be the custom field value whose custom field identifier is the same as the ADM_ManagedByEntityCustomFieldId.

    3. If the ManagedBy and ManagedByEntity values of the row are the same as currentRange.ManagedByValue and currentRange.ManagedByEntityValue respectively, and currentRange.ManagedByValue is not same as MSDHCP, this overlap is not allowed, and an appropriate SOAP fault MUST be raised.

  3. For each range in Result_OverlappingRanges, if any of the ranges has UseForUtilization set as TRUE, set UseForUtilization for the currentRange as FALSE. Otherwise, set it to TRUE.

  4. If the array Result_OverlappingRanges is not empty, set the IsOverlapping property of the currentRange to TRUE. Otherwise, set it to FALSE.

  5. Get the parent subnet that currentRange range maps to, by calling MapIPRangeToBlock of ADM_IPRangeTable with following parameter.

    1. Param_range is assigned the value of currentRange.

  6. If currentRange.IPBlockId is set to a non-zero number, set flag ParentSubnetExists as TRUE. Otherwise, set ParentSubnetExists to FALSE.

  7. Fault if ParentSubnetExists is FALSE and createSubnetIfDoesNotExist is FALSE or not specified.

  8. If ParentSubnetExists is FALSE and createSubnetIfDoesNotExist is TRUE, create a new subnet for this range by inserting a new row in ADM_Subnet table and copying relevant properties from currentRange.

  9. Set the property ParentIPBlockRecordId of the currentRange to the RecordId of the newly created subnet.

  10. If the currentRange.RecordId is 0, add the currentRange to the ADM_IPRangeTable and set the currentRange.RecordId to the value of record identifier. Insert a row in ADM_IPRangeMultivaluedPropertiesTable with corresponding values from currentRange.

  11. If the currentRange.RecordId is not 0, update the existing row in the ADM_IPAddressTable specified with the values from the currentRange.ModifiedProperties. Update the corresponding row in ADM_IPRangeMultivaluedPropertiesTable with corresponding values from currentRange.

  12. If the Result_OverlappingRanges in step 3 is a nonempty set of rows, update the IsOverlapping flag of those rows in ADM_IPRangeTable to TRUE.

  13. Call the AdjustIPAddressRangeMapping procedure of ADM_IPAddressTable with the following values to map the addresses as applicable to the new address range added:

    1. Assign the value of currentRange.RecordId to Param_rangeId.

    2. Assign the value of currentRange.StartIPAddress to Param_StartIPAddress.

    3. Assign the value of currentRange.EndIPAddress to Param_EndIPAddress.

    4. Assign the value of ManagedByValue of the currentRange to the Param_ManagedByValue parameter.

    5. Assign the value of the ManagedByEntityValue of the currentRange to the Param_ManagedByEntityValue parameter.

    6. Assign the value of the AddressSpaceRecordId of the currentRange to the Param_AddressSpaceRecordId parameter.