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:

  1. 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.

  2. If UpdateDhcpScopeParameters.scope is NULL, generate an appropriate SOAP fault.

  3. Store UpdateDhcpScopeParameters.scope as a scopeToStore variable.

  4. If scopeToStore is an instance of DhcpScopeV4, the addressfamily is assigned InterNetwork. Otherwise the addressfamily is assigned InterNetworkV6.

  5. 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

  6. If Result_server is NULL, generate an appropriate SOAP fault. Otherwise assign Result_server to dhcpServer variable.

  7. Check whether the scope already exists. Store the result in scopeExists flag. This is done based on the following conditions:

  8. If scopeToStore.RecordId is specified, look up the row in ADM_DHCPScopesTable for the row in which RecordId is equal to scopeToStore.RecordId

  9. 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.

  10. If scopeExists is FALSE, an appropriate SOAP fault MUST be generated.

  11. Validate the scopeToStore data by invoking ValidateDhcpScope with scopeToStore as Param_scope parameter. If the validation fails, an appropriate SOAP fault  MUST be generated.

  12. Update the existing scope row in ADM_DHCPScopesTable with RecordId being scopeToStore.RecordId for the following values:

  13. ScopeId

  14. ScopeName

  15. Status

  16. SubnetDelay

  17. LeaseDurationType

  18. LeaseDuration

  19. ServingClientsType

  20. Get the address range corresponding to the scope and store it in scopeRange

  21. Lookup the ADM_IPRangeTable for the row whose ScopeRecordId is equal to scopeToStore.RecordId

  22. Call the procedure GetIPRangeFromTable, passing the RecordId of the row found as Param_id and addressfamily as Param_addressfamily. Store the result into scopeRange.

  23. Update the scopeRange with the following values and update the same to the ADM_IPRangeTable:

  24. StartIPAddress

  25. EndIPAddress

  26. PrefixLength

  27. SubnetId

  28. ScopeId

  29. Description

  30. 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.

  31. Add or update the scopeRange that was created/modified into the ADM_IPRangeTable.

  32. 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:

  33. For DhcpScopeV4, the following properties are updated:

  34. DnsNameProtectionStatus

  35. DiscardDnsRecordOnLeaseDeletionStatus

  36. DnsUpdateType

  37. DnsNotRequestingClientsUpdateType

  38. DnsDisableDynamicPtrUpdates

  39. For DhcpScopeV6, the following properties are updated:

  40. DnsNameProtectionStatus

  41. DiscardDnsRecordOnLeaseDeletionStatus

  42. DnsUpdateType

  43. For each key value pair in scopeToStore.Options.OperationTracker, perform the following operations:

  44. 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:

  45. Delete the row from the ADM_DhcpOptionsTable that meets the following criteria (if it already exists):

  46. ServerRecordId is assigned dhcpServer.RecordId.

  47. ScopeRecordId is assigned scopeToStore.RecordId.

  48. OptionDefinitionRecordId is assigned DhcpOption.OptionDefinition.RecordID.

  49. UserClassRecordId is assigned DhcpOption.UserClass.RecordId.

  50. Insert a new row into ADM_DhcpOptionstable with the following values:

  51. ServerRecordId is assigned dhcpServer.RecordId.

  52. ScopeRecordId is assigned nullscopeToStore.RecordId.

  53. OptionDefinitionRecordId is assigned DhcpOption.OptionDefinition.RecordId.

  54. UserClassRecordId is assigned the value of DhcpOption.UserClass.RecordId.

  55. Values is assigned the value of DhcpOption.Values.

  56. OptionOwnerType is assigned the value of DhcpOption.OptionOwnerType.

  57. If the Key is CollectionOperations.Delete, delete the DhcpOption form ADM_DhcpOptionsTable by looking up based on the following values:

  58. ServerRecordId is assigned dhcpServer.RecordId.

  59. ScopeRecordId is assigned scopeToStore.RecordId.

  60. OptionDefinitionRecordId is assigned DhcpOption.OptionDefinition.RecordID.

  61. UserClassRecordId is assigned DhcpOption.UserClass.RecordId.

  62. For each key value pair in scopeToStore.ExclusionRanges, perform the following operations:

  63. If Key is CollectionOperations.Add, add the DhcpExclusionRange specified in Value to scopeToStore.ScopeDetails.ExclusionRanges

  64. If Key is CollectionOperations.Delete, delete the DhcpExclusionRange specified in Value to scopeToStore.ScopeDetails.ExclusionRanges.

  65. 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:

  66. 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.

  67. 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.

  68. Call SetOverallStatus with Success and 100 percent completion.