3.19.4.4.1.4 UpdateDhcpScopeDelegate
The UpdateDhcpScopeDelegate processing is done when the IpamOperationWithProgressParameter.OperationId is AdminOperationId.EditDhcpScope. The IpamOperationWithProgressParameter instance MUST be of type UpdateDhcpScopeParameters.
This operation updates an existing DHCP scope. In the following steps, any time a fault is generated, SetOverallStatus is called with the fault details:
If IpamOperationWithProgressParameter is NULL or not of type UpdateDhcpScopeParameters, generate an appropriate SOAP fault (as specified in section 2.2.2.1). Project IpamOperationWithProgressParameter in a local variable as UpdateDhcpScopeParameters.
If UpdateDhcpScopeParameters.scope is NULL, generate an appropriate SOAP fault.
Store UpdateDhcpScopeParameters.scope as a scopeToStore variable.
If scopeToStore is an instance of DhcpScopeV4, the addressfamily is assigned InterNetwork. Otherwise the addressfamily is assigned InterNetworkV6.
If scopeToStore.ParentDhcpServerRecordId has been specified, fetch the DhcpServer instance by calling the procedure GetDHCPServerFromTable and passing scopeToStore.ParentDhcpServerRecordId as Param_Id parameter and addressfamily as Param_addressfamily.
If Result_server is NULL, generate an appropriate SOAP fault. Otherwise assign Result_server to dhcpServer variable.
Check whether the scope already exists. Store the result in scopeExists flag. This is done based on the following conditions:
If scopeToStore.RecordId is specified, look up the row in ADM_DHCPScopesTable for the row in which RecordId is equal to scopeToStore.RecordId.
If scopeToStore.RecordId is not specified but ScopeId is specified, look up the row in ADM_DHCPScopesTable wherein ScopeDetails.ScopeId is equal to scopeToStore.ScopeId.
If scopeExists is FALSE, an appropriate SOAP fault MUST be generated.
Validate the scopeToStore data by invoking ValidateDhcpScope with scopeToStore as Param_scope parameter. If the validation fails, an appropriate SOAP fault MUST be generated.
Update the existing scope row in ADM_DHCPScopesTable with RecordId being scopeToStore.RecordId for the following values:
ScopeId
ScopeName
Status
SubnetDelay
LeaseDurationType
LeaseDuration
ServingClientsType
Get the address range corresponding to the scope and store it in scopeRange.
Lookup the ADM_IPRangeTable for the row whose ScopeRecordId is equal to scopeToStore.RecordId.
Call the procedure GetIPRangeFromTable, passing the RecordId of the row found as Param_id and addressfamily as Param_addressfamily. Store the result into scopeRange.
Update the scopeRange with the following values and update the same to the ADM_IPRangeTable:
StartIPAddress
EndIPAddress
PrefixLength
SubnetId
ScopeId
Description
Set or update scopeRange.CustomFieldValues to include built-in custom fields--BuiltinCustomField.ManagedBy and BuiltinCustomField.ManagedByEntity--and assign them to MSDHCP and the dhcpServer.ServerName, respectively.
Add or update the scopeRange that was created/modified into the ADM_IPRangeTable.
If UpdateDhcpScopeParameters.Scope.ModifiedProperties contains any DiscardDnsRecordOnLeaseDeletionStatus, DnsNameProtectionStatus, DnsUpdateType, DnsNotRequestingClientsUpdateType, or DnsDisableDynamicPtrUpdates properties, the DNS settings for the scopes have to be updated as follows:
For DhcpScopeV4, the following properties are updated:
DnsNameProtectionStatus
DiscardDnsRecordOnLeaseDeletionStatus
DnsUpdateType
DnsNotRequestingClientsUpdateType
DnsDisableDynamicPtrUpdates
For DhcpScopeV6, the following properties are updated:
DnsNameProtectionStatus
DiscardDnsRecordOnLeaseDeletionStatus
DnsUpdateType
For each key value pair in scopeToStore.Options.OperationTracker, perform the following operations:
If the Key is CollectionOperations.Add or CollectionOperations.Set, add or update the DhcpOption in Value portion of key value pair into ADM_DhcpOptionsTable as follows:
Delete the row from the ADM_DhcpOptionsTable that meets the following criteria (if it already exists):
ServerRecordId is assigned dhcpServer.RecordId.
ScopeRecordId is assigned scopeToStore.RecordId.
OptionDefinitionRecordId is assigned DhcpOption.OptionDefinition.RecordID.
UserClassRecordId is assigned DhcpOption.UserClass.RecordId.
Insert a new row into ADM_DhcpOptionstable with the following values:
ServerRecordId is assigned dhcpServer.RecordId.
ScopeRecordId is assigned nullscopeToStore.RecordId.
OptionDefinitionRecordId is assigned DhcpOption.OptionDefinition.RecordId.
UserClassRecordId is assigned the value of DhcpOption.UserClass.RecordId.
Values is assigned the value of DhcpOption.Values.
OptionOwnerType is assigned the value of DhcpOption.OptionOwnerType.
If the Key is CollectionOperations.Delete, delete the DhcpOption form ADM_DhcpOptionsTable by looking up based on the following values:
ServerRecordId is assigned dhcpServer.RecordId.
ScopeRecordId is assigned scopeToStore.RecordId.
OptionDefinitionRecordId is assigned DhcpOption.OptionDefinition.RecordID.
UserClassRecordId is assigned DhcpOption.UserClass.RecordId.
For each key value pair in scopeToStore.ExclusionRanges, perform the following operations:
If Key is CollectionOperations.Add, add the DhcpExclusionRange specified in Value to scopeToStore.ScopeDetails.ExclusionRanges.
If Key is CollectionOperations.Delete, delete the DhcpExclusionRange specified in Value to scopeToStore.ScopeDetails.ExclusionRanges.
If the scopeToStore.ExclusionRanges is modified, the scopeRange's IsOverlapping and address mapping will need to be updated as well. For this, perform the following steps:
The IsOverlapping field and the IP address mapping to the range will need to be reset. This is done by invoking the ResetCurrentIPRangeMapping procedure of the ADM_IPRangeTable with the Param_range parameter is assigned scopeRange.
The IsOverlapping field has to be recalculated for the address ranges based on the updated address range. Also, the addresses in ADM_IPAddressTable have to be recalculated based on the new range. This is done by performing the steps listed under SetIPRangeMapping by passing the scopeRange as the currentRange parameter.
Call SetOverallStatus with Success and 100 percent completion.