An operator can turn a DHCP lease into a reservation with one call #170

Open
opened 2026-10-31 12:42:19 -04:00 by claude · 0 comments
Owner
  • Draft: PN-26
  • Priority: medium (the most common DHCP console action)
  • Agent: coder
  • Depends on: #58
  • Decisions: none

Why

Making a device keep its address today means copying the lease into a new reservation by hand.

What changes

  • New POST api/dhcp-leases/{id}/reservation in DhcpLeasesController.cs, requiring dhcpscopes:write, the permission reservation writes use (DhcpReservationsController.cs:116).
  • It resolves the scope from LeaseEntity.ScopeId, which #58 adds (leases refer to their scope by id), then creates a DhcpReservationEntity (scope id, client identifier, IP address, host name).
  • Technical call: move the validation in DhcpReservationsController.Create (line 115) into a shared helper both paths use.
  • It returns 409 when the identifier or address is already reserved, and 400 for a prefix-delegation lease (LeaseEntity.PrefixLength set).

Acceptance

  • This test fails first: Reserve_ForAnActiveLease_CreatesAReservationWithItsAddress in src/dotnet/tests/Ninlil.Web.Tests.
  • Tests for 409 and 400; a lease whose scope was renamed after it was granted still reserves into that scope.
  • Gate: dotnet test src/dotnet/tests/Ninlil.Web.Tests.

Source

audit-feature-parity.md §2A #14; DEDUPE.md P2.

- **Draft:** PN-26 - **Priority:** medium (the most common DHCP console action) - **Agent:** coder - **Depends on:** #58 - **Decisions:** none ### Why Making a device keep its address today means copying the lease into a new reservation by hand. ### What changes - New `POST api/dhcp-leases/{id}/reservation` in `DhcpLeasesController.cs`, requiring `dhcpscopes:write`, the permission reservation writes use (`DhcpReservationsController.cs:116`). - It resolves the scope from `LeaseEntity.ScopeId`, which #58 adds (leases refer to their scope by id), then creates a `DhcpReservationEntity` (scope id, client identifier, IP address, host name). - Technical call: move the validation in `DhcpReservationsController.Create` (line 115) into a shared helper both paths use. - It returns 409 when the identifier or address is already reserved, and 400 for a prefix-delegation lease (`LeaseEntity.PrefixLength` set). ### Acceptance - [ ] This test fails first: `Reserve_ForAnActiveLease_CreatesAReservationWithItsAddress` in `src/dotnet/tests/Ninlil.Web.Tests`. - [ ] Tests for 409 and 400; a lease whose scope was renamed after it was granted still reserves into that scope. - [ ] Gate: `dotnet test src/dotnet/tests/Ninlil.Web.Tests`. ### Source `audit-feature-parity.md` §2A #14; DEDUPE.md P2.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#170
No description provided.