Set up DHCP config properly

This commit is contained in:
Joshua Boniface 2018-09-30 12:59:33 -04:00
parent a65f876483
commit e4509d356a
1 changed files with 10 additions and 6 deletions

View File

@ -48,7 +48,6 @@ class VXNetworkInstance():
self.vxlan_nic = 'vxlan{}'.format(self.vni) self.vxlan_nic = 'vxlan{}'.format(self.vni)
self.bridge_nic = 'br{}'.format(self.vni) self.bridge_nic = 'br{}'.format(self.vni)
self.dhcp_reservations = {}
self.firewall_rules = {} self.firewall_rules = {}
self.createNetwork() self.createNetwork()
@ -79,16 +78,21 @@ class VXNetworkInstance():
if data != None and self.dhcp_flag != data.decode('ascii'): if data != None and self.dhcp_flag != data.decode('ascii'):
self.dhcp_flag = ( data.decode('ascii') == 'True' ) self.dhcp_flag = ( data.decode('ascii') == 'True' )
if self.dhcp_flag: if self.dhcp_flag:
self.dhcp_instance = DHCPServer.DHCPServer(self.vni, self.config) dhcp_config = DHCPServer.DHCPServerConfiguration(
zk_conn=self.zk_conn,
ipaddr=self.ip_gateway,
iface=self.bridge_nic,
vni=self.vni,
network=self.ip_network,
router=[self.ip_gateway],
dns_servers=[]
)
self.dhcp_instance = DHCPServer.DHCPServer(self.vni, dhcp_config)
else: else:
self.dhcp_instance.remove() self.dhcp_instance.remove()
self.dhcp_instance = None self.dhcp_instance = None
@zk_conn.ChildrenWatch('/networks/{}/dhcp_reservations'.format(self.vni))
def watch_network_dhcp_reservations(data, event=''):
print(data)
def getvni(self): def getvni(self):
return self.vni return self.vni