OMAPI (dhcpd):
-
omshell
:
-
omshell
is a command-line tool provided withdhcpd
for interactive management of the DHCP server through OMAPI. - It allows you to connect to the DHCP server and execute commands to make configuration changes, retrieve lease information, and manage other aspects of the server.
- OMAPI Commands:
- With OMAPI, you primarily use a set of C API functions to interact with the DHCP server programmatically.
- These functions include operations such as opening and closing connections, creating and modifying DHCP objects (e.g., leases, subnets, hosts), and sending configuration changes to the server.
Kea REST API:
- HTTP Methods:
- The Kea REST API utilizes standard HTTP methods such as GET, POST, PUT, and DELETE to interact with the server.
- Each method corresponds to a specific action or operation that can be performed on the Kea server.
- REST API Endpoints:
- Kea exposes a set of RESTful endpoints that correspond to different resources and functionalities within the DHCP server.
- For example, you may have endpoints for managing DHCP subnets, lease reservations, configuration options, or server statistics.
- JSON or XML Payloads:
- When interacting with the Kea REST API, you typically use JSON or XML payloads to send data to the server or receive responses.
- These payloads contain the necessary information to perform operations such as configuring subnets, retrieving lease details, or modifying server settings.
Here’s an example to illustrate the command differences:
OMAPI (dhcpd):
$ omshell
> server localhost
> key omapi_key
> connect
> new lease
> set lease.ip-address = 192.168.1.100
> set lease.hw-address = 00:11:22:33:44:55
> update
> quit
Kea REST API:
$ curl -X POST -H "Content-Type: application/json" -d '
{
"subnet_id": 1,
"ip_address": "192.168.1.100",
"hw_address": "00:11:22:33:44:55"
}' http://localhost:8000/leases
In the example above, with OMAPI, you interact directly with the DHCP server using the omshell
tool and a series of commands to create a new lease. On the other hand, with the Kea REST API, you use the curl
command (e.g.), to send a POST request with a JSON payload to the /leases
endpoint on the Kea server to achieve the same result.
These examples highlight the differences in command syntax and the mechanisms used to interact with the DHCP server. The Kea REST API provides a more standardized and web-based approach, while OMAPI relies on the OMAPI-specific commands and the C API for configuration and management. Not sure whether this affects the users or not – it depends on whether the switch to Kea means certain OMAPI calls don’t have a Kea REST API analog, which means some other things might quit working, or work differently.
Really need to do a command coverage chart to see how this might play out.
My best stab at that chart
These are a lot of the things that map, I think. Not exhaustive, but at first blush, it looks as though if you can do it with OMAPI, you can also do it with Kea. It also looks like Kea provides new functionality that OMAPI didn’t provide. Maybe this isn’t as big a deal as I was worried about.
I only looked at the top 20%, skipping endpoints like Enable DHCP
, etc. Feel free to critique, or better yet, add the ones that bother you to the table below. Just remember that there are about 140 endpoints in Kea alone. I tried to pick and choose the ones that might not be similar.
Operation | Kea REST API Command | dhcpd OMAPI Command |
---|---|---|
Create a subnet | subnetn-add | new subnet |
Update a subnet | subnetn-update | modify subnet |
Delete a subnet | subnetn-del | remove subnet |
Get subnet details | subnetn-get | open subnet |
Reserve a lease | leasen-add | new lease |
Update a lease | leasen-update | modify lease |
Release a lease | leasen-del | remove lease |
Get lease details | leasen-get | open lease |
Configure options | config-set | new option-def |
Update option details | config-set | modify option-def |
Delete an option | config-set | remove option-def |
Get option details | config-get | open option-def |
Get server statistics | statistic-get(-all) | server-statistics |
Get server configuration | config-get | server-config |
Update server configuration | config-set | set-config |
Create host reservation | reservation-add | new host |
Update host details | reservation-del/reservation-add | modify host |
Delete a host | reservation-del | remove host |
Get host details | reservation-get-by-hostname | open host |
Set failover configuration | config-set | N/A |
Set shared network configuration | networkn-add | N/A |
Get shared network details | networkn-get | N/A |
Add lease to host | leasen-add | N/A |
Remove lease from host | leasen-del | N/A |
Create reservation scope | reservation-add | N/A |
Update reservation scope | reservation-del/reservation-add | N/A |
Delete reservation scope | reservation-del | N/A |
Get reservation scope details | reservation-get-all/reservation-get-hostname | N/A |