-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat isc dhcp #31
Feat isc dhcp #31
Conversation
this implements #10 everything is a bit hacky and only for testing! I would not recommend using this ldap config in production.
|
||
class DhcpConfig: | ||
def __init__(self, mac, ip_address, gateway=None, networkmask=None): | ||
self.mac = mac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_mac() here?
The dhcp hostname will be set automated by socket.getfqdn()
* You can delete LDAP Entries by DN * You can get LDAP DN by IP and by MAC * You can get all objects of class "dhcpHost"
* Added method to check if ipv4/mac configuration exists * Added delete Method * Added get method for ipv4 and mac * Added a all method to get all stored configurations
* /dhcp endoint have GET,POST * /dhcp/ipv4/<ipv4> endpoint have GET,PUT,DELETE * /dhcp/mac/<mac> endpoint have GET,PUT,DELETE * The gateway and networkmask arguments are not requires anymore
So we can import this config variable from other files
else: | ||
self.ip_address = ip_address | ||
|
||
self.dhcp_hostname = socket.getfqdn() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much load will this generate if we have many requests? what about setting the FQDN in the config file and do a fallback to socket.getfqdn() is nothing is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will change that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
self.set_settings(True, mac, ip_address, gateway, networkmask) | ||
|
||
def set_settings(self, set_not_required_if_none=False, mac=None, ip_address=None, gateway=None, networkmask=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was late, i need a parameter name and tadaaaaa! set_not_required_if_none
…_value_for_not_required_parameter'
Now you have to set networkmask and gateway or you have to use CIDR notation for the ip_address parameter
For the dhcp endpoints i implemented checks for mac and ipv4 adresses
The IP Objects are not json serializable, so we cast it to string
* You can set in the [Common] Section in the config the FQDN value for the hostname that will be used for configs. (if not provided, it will get by socket.fqdn())
the validation checks now for ipv4 or ipv4 cidr notation
i think we can merge this now, but somebody should test it before |
here was rubbish |
Now it is possible to user upper- or lower- or mixedcase mac addresses
02ba4b7
to
f89aad7
Compare
tested locally, didn't found any issues. |
this adds a new API endpoint, /dhcp, to add static ip/mac adresses