Properly handle creating gateways and DHCP servers
This commit is contained in:
parent
3e937362cd
commit
ce6d863424
|
@ -71,14 +71,17 @@ class VXNetworkInstance():
|
||||||
@zk_conn.DataWatch('/networks/{}/ip_gateway'.format(self.vni))
|
@zk_conn.DataWatch('/networks/{}/ip_gateway'.format(self.vni))
|
||||||
def watch_network_gateway(data, stat, event=''):
|
def watch_network_gateway(data, stat, event=''):
|
||||||
if data != None and self.ip_gateway != data.decode('ascii'):
|
if data != None and self.ip_gateway != data.decode('ascii'):
|
||||||
self.removeAddress()
|
if self.this_router.isprimary():
|
||||||
|
self.removeGatewayAddress()
|
||||||
self.ip_gateway = data.decode('ascii')
|
self.ip_gateway = data.decode('ascii')
|
||||||
self.addAddress()
|
self.createGatewayAddress()
|
||||||
|
|
||||||
@zk_conn.DataWatch('/networks/{}/dhcp_flag'.format(self.vni))
|
@zk_conn.DataWatch('/networks/{}/dhcp_flag'.format(self.vni))
|
||||||
def watch_network_dhcp_status(data, stat, event=''):
|
def watch_network_dhcp_status(data, stat, event=''):
|
||||||
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 and self.this_router.isprimary():
|
||||||
|
createDHCPServer()
|
||||||
|
|
||||||
def getvni(self):
|
def getvni(self):
|
||||||
return self.vni
|
return self.vni
|
||||||
|
|
Loading…
Reference in New Issue