3.3.4.133 SaveSubnet
The SaveSubnet operation is used to create a new range object in the IPAM data store.
-
<wsdl:operation name="SaveSubnet"> <wsdl:input wsaw:Action="http://Microsoft.Windows.Ipam/IIpamServer/SaveSubnet" message="ipam:IIpamServer_SaveSubnet_InputMessage" /> <wsdl:output wsaw:Action="http://Microsoft.Windows.Ipam/IIpamServer/SaveSubnetResponse" message="ipam:IIpamServer_SaveSubnet_OutputMessage" /> </wsdl:operation>
Upon receiving the IIpamServer_SaveRange_InputMessage request message, the server performs the following processing steps. Upon successful completion of these steps, the server MUST respond with the IIpamServer_SaveRange_OutputMessage message. In the event of a failure, an appropriate SOAP fault MUST be sent to the client as specified in section 2.2.2.1:
Validate the SaveSubnet.subnet by calling ValidateSubnet passing SaveSubnet.subnet as Param_IPSubnet.
If any of the rules in the previous validation fails, an appropriate SOAP fault MUST be raised.
Assign SaveSubnet.subnet to subnetToBeSaved.
Check if a subnet already exists with the same startIP and EndIP in the same address space as subnetToBeSaved. Raise an appropriate SOAP fault if such a subnet already exists in the IPAM data store. Follow these steps for this:
Call the procedure GetAllSubnetsForAddressCategory of ADM_SubnetTable with the following parameters for the call:
Assign subnetToBeSaved.AddressCategory to Param_AddressCategory.
Assign the Result_Subnets to a temporary data store possibleConflictingSubnets.
For each of the currentSubnet subnets in possibleConflictingSubnets, check if currentSubnet.startIPAddress is equal to subnetToBeSaved.startIPAddress and currentSubnet.EndIPAddress is equal to subnetToBeSaved.EndIPAddress and currentSubnet.AddressSpaceId is equal to subnetToBeSaved.AddressSpaceId. Raise a fault if the subnet already exists in the IPAM data store.
Calculate the IsOverlapping and UseForUtilization properties of the subnetToBeSaved by using the following steps:
Get all the subnets that overlap with subnetToBeSaved by calling the procedure GetOverlappingSubnets for ADM_SubnetTable with the following params:
Assign subnetToBeSaved.startIPAddress to Param_StartIPAddress.
Assign subnetToBeSaved.EndIPAddress to Param_EndIPAddress.
Assign subnetToBeSaved.PrefixLength to Param_PrefixLength.
Assign subnetToBeSaved.AddressSpaceId to Param_AddressSpaceId.
Assign subnetToBeSaved.RecordId to Param_RecordIdToExclude.
For each of the subnets in Result_OverlappingBlocks, check if the UseForUtilization property is set. If none of these subnets have the UseForUtilization set to TRUE or if the Result_OverlappingBlocks is empty, set UseForUtilization property subnetToBeSaved to TRUE.
If Result_OverlappingBlocks is empty, set isOverlapping property for subnetToBeSaved to FALSE. Otherwise, set the isOverlapping property of subnetToBeSaved to TRUE.
If the subnetToBeSaved.addressSpaceRecordId points to the default address space, do the following to compute the parent IP block to which it maps. Only subnets that belong to the default address space map to a block. Call CalculateParentForIPBlock for ADM_IPBlocksTable with the following parameters:
Assign subnetToBeSaved.startIPAddress to Param_StartIPAddress.
Assign subnetToBeSaved.EndIPAddress to Param_EndIPAddress.
Assign subnetToBeSaved.PrefixLength to Param_ PrefixLength.
Assign subnetToBeSaved.RecordId to Param_RecordIdToExclude.
Assign subnetToBeSaved.AddressCategory to Param_AddressCategory.
Set the ParentIPBlockRecordID of subnetToBeSaved to RecordId returned in the previous result.
Add a new row into the ADM_IPBlocksTable by using the values from subnetToBeSaved.
Add a new row into the ADM_SubnetTable by using the values from subnetToBeSaved. Assign the RecordId of the new row added to subnetToBeSaved.
Add a new row into the ADM_IPBlockMultivaluedPropertiesTable by using the values from subnetToBeSaved. Values applicable are listed in ADM_IPBlockMultivaluedPropertiesTable.
Update the isOverlapping property of all the subnets that overlap with subnetToBeSaved. For all the rows of ADM_SubnetTable corresponding to Result_OverlappingBlocks calculated in step 6b, set IsOverlapping to TRUE.
Validate the subnetToBeSaved.CustomFieldValues by performing the processing rules listed in ValidateCustomFieldValues. If the custom field values are valid, store the custom field values by calling the SetCustomFieldValues procedure of ADM_CustomFieldValuesAssociationTable with the following parameters:
Param_ObjectType is set to EnumeratedObjectType.Subnet.
Param_ObjectRecordId is set to subnetToBeSaved.RecordId.
Param_addressFamily is set to InterNetwork if the subnetToBeSaved is IPv4Range. If subnetToBeSaved is IPv6Range, Param_addressFamily is set to InterNetworkV6.
Param_CustomFieldValuesCollection is assigned subnetToBeSaved.CustomFieldValues.
Call CreateAssociationEntry procedure of ADM_AccessScopeAssociationTable with the following parameters:
Assign subnetToBeSaved.RecordId to Param_objectId.
Assign subnetToBeSaved.ObjectType to Param_objectType.