3.19.4.4.1.3 CreateDhcpScopeDelegate
The CreateDhcpScopeDelegate processing is done when the IpamOperationWithProgressParameter.OperationId is AdminOperationId.CreateDhcpScope. The IpamOperationWithProgressParameter instance MUST be of type CreateDhcpScopeParameters.
This operation creates a new 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 CreateDhcpScopeParameters, generate an appropriate SOAP fault (section 2.2.2.1). Project IpamOperationWithProgressParameter in a local variable as CreateDhcpScopeParameters.
If CreateDhcpScopeParameters.Scope is NULL, generate an appropriate SOAP fault.
Store CreateDhcpScopeParameters.Scope as 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 the dhcpServer variable.
Based on the following conditions, check if the scope already exists. Store the result in scopeExists flag:
If scopeToStore.RecordId is specified, look up the row in ADM_DHCPScopesTable for the row with RecordId 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 flag is TRUE, an appropriate SOAP fault MUST be generated.
Validate the scopeToStore data by invoking ValidateDhcpScope with scopeToStore as the Param_dhcpScope parameter. If the validation fails, an appropriate SOAP fault MUST be generated.
Insert a new row in ADM_DHCPScopesTable with RecordId being scopeToStore.RecordId and with the following values:
ScopeId
ScopeName
Status
SubnetDelay
LeaseDurationType
LeaseDuration
ServingClientsType
Create a new instance of IPRange based on addressfamily and assign it to 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 ADM_IPRangeTable.
If CreateDhcpScopeParameters.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
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 the value portion of the 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 the ADM_DhcpOptionstable with the following values:
ServerRecordId is assigned dhcpServer.RecordId.
ScopeRecordId is assigned scopeToStore.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 from ADM_DhcpOptionsTable by looking it 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.