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:

  1. Use the Param_addressfamily to determine the simple table within ADM_DHCPReservationTable compound table to perform the rest of the processing.

  2. If Param_reservationId is not specified, a new row has to be added. Otherwise look up the row with Param_reservationId as RecordId:

  3. Set ScopeRecordId of the row to Param_scopeId.

  4. Set IPAddressRecordId of the row to Param_addressId.

  5. Copy Param_reservationDetails to ReservationDetails of the row.

  6. Update/insert the row into the table.

  7. If the new row has been added, assign RecordId to Result_reservationId. Otherwise assign Param_reservationId to Result_reservationId.