Skip to content
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

Merged
merged 42 commits into from
Feb 15, 2016
Merged

Feat isc dhcp #31

merged 42 commits into from
Feb 15, 2016

Conversation

bastelfreak
Copy link
Member

this adds a new API endpoint, /dhcp, to add static ip/mac adresses


class DhcpConfig:
def __init__(self, mac, ip_address, gateway=None, networkmask=None):
self.mac = mac
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_mac() here?

@bastelfreak bastelfreak mentioned this pull request Jan 28, 2016
* 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()
Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will change that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it uses now a config value, implemented in b3c514a and 8cd88d3


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):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_not_required_if_none

watman

Copy link
Member

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

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
@sebastianrakel
Copy link
Member

i think we can merge this now, but somebody should test it before

@bastelfreak
Copy link
Member Author

here was rubbish

@bastelfreak
Copy link
Member Author

tested locally, didn't found any issues.

bastelfreak added a commit that referenced this pull request Feb 15, 2016
@bastelfreak bastelfreak merged commit 304396c into master Feb 15, 2016
@bastelfreak bastelfreak deleted the feat-isc-dhcp branch February 15, 2016 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants