The AddOrUpdateReservation procedure can be used to add or update a reservation entry in the ADM_DHCPReservationTable. The following are the input parameters to this procedure:
Param_addressfamily: The address family to specify the table against which the reservation processing has to be performed.
Param_reservationId: This is the RecordId of the DHCP reservation to be modified. If this is not specified, a new reservation row will be created.
Param_scopeId: This is the RecordId of the DHCP scope instance in ADM_DHCPScopesTable to which the reservation has to be added.
Param_addressId: This is the RecordId of the IPAM IP address in ADM_IPAddressTable to which the reservation is associated with.
Param_reservationDetails: This specifies ReservationDetails for the reservation being added or updated.
The procedure returns the following as the output parameter.
Result_reservationId: The RecordId of the DHCP reservation row if the row has been added.
The following are the processing steps involved:
Use the Param_addressfamily to determine the simple table within ADM_DHCPReservationTable compound table to perform the rest of the processing.
If Param_reservationId is not specified, a new row has to be added. Otherwise look up the row with Param_reservationId as RecordId:
Set ScopeRecordId of the row to Param_scopeId.
Set IPAddressRecordId of the row to Param_addressId.
Copy Param_reservationDetails to ReservationDetails of the row.
Update/insert the row into the table.
If the new row has been added, assign RecordId to Result_reservationId. Otherwise assign Param_reservationId to Result_reservationId.