Project

General

Profile

Actions

Feature #20522

closed

Command: dhcp list/add/remove reservation

Added by Kavita Gaikwad over 6 years ago. Updated 2 months ago.

Status:
Rejected
Priority:
Normal
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Lukas's comment on github issue[https://github.com/theforeman/foreman_maintain/issues/75]:

Hello,

I wrote and tested these commands on both Server and Capsule versions 6.2 and 6.3. It would be nice idea to write a small script/command to allow users to add/list/delete DHCP reservations:

foreman-maintain dhcp list-reservations [subnet]
foreman-maintain dhcp add-reservation [subnet] [ip] [mac] [name]
foreman-maintain dhcp remove-reservation [subnet] [ip]

  • LIST OF RESERVATIONS FOR NETWORK 192.168.220.0

curl -ks --cert /etc/foreman/client_cert.pem --key /etc/foreman/client_key.pem --cacert /etc/foreman/proxy_ca.pem https://$(hostname):9090/dhcp/192.168.220.0 | json_reformat

  • ADD RESERVATION FOR 52:51:00:aa:bb:cc IP 192.168.220.201 AND NAME one.nested.lan

curl -ks --cert /etc/foreman/client_cert.pem --key /etc/foreman/client_key.pem --cacert /etc/foreman/proxy_ca.pem -X POST -d '' "https://$(hostname):9090/dhcp/192.168.220.0?ip=192.168.220.201&mac=52:51:00:aa:bb:cc&name=one.nested.lan"

  • DELETE RESERVATION IP 192.168.220.201

curl -ks --cert /etc/foreman/client_cert.pem --key /etc/foreman/client_key.pem --cacert /etc/foreman/proxy_ca.pem -X DELETE "https://$(hostname):9090/dhcp/192.168.220.0/192.168.220.201"

  • On Capsule server the path for certification files is different, the rest is the same:

curl -ks --cert /etc/foreman-proxy/foreman_ssl_cert.pem --key /etc/foreman-proxy/foreman_ssl_key.pem --cacert /etc/foreman-proxy/foreman_ssl_ca.pem https://$(hostname):9090/dhcp/192.168.220.0 | json_reformat

The script needs to check if PEM file exists so it will work on both Capsule and Server.

Using Ruby REST HTTP library would be preferred. Note this DHCP API is very stable and does not change a lot.


Related issues 1 (0 open1 closed)

Related to Foreman Maintain - Refactor #20722: Refactoring needed for foreman-proxy feature for DHCP config checkDuplicateKavita Gaikwad08/24/2017Actions
Actions #1

Updated by Kavita Gaikwad over 6 years ago

  • Tracker changed from Bug to Feature
Actions #2

Updated by Kavita Gaikwad over 6 years ago

  • Target version set to 1.17.0
Actions #3

Updated by Kavita Gaikwad over 6 years ago

  • Pull request https://github.com/theforeman/foreman_maintain/pull/84 added
Actions #4

Updated by Kavita Gaikwad over 6 years ago

  • Status changed from New to Ready For Testing
Actions #5

Updated by Kavita Gaikwad over 6 years ago

  • Target version changed from 1.17.0 to 216
Actions #6

Updated by Kavita Gaikwad over 6 years ago

  • Related to Refactor #20722: Refactoring needed for foreman-proxy feature for DHCP config check added
Actions #7

Updated by Anonymous almost 6 years ago

  • Target version deleted (1.18.0)
Actions #8

Updated by Eric Helms 2 months ago

  • Status changed from Ready For Testing to Rejected
Actions

Also available in: Atom PDF