Handle new gateways better

This commit is contained in:
Joshua Boniface 2018-09-30 19:19:06 -04:00
parent b0084f6a18
commit 0b5a492859
1 changed files with 2 additions and 1 deletions

View File

@ -79,9 +79,10 @@ 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 and self.ip_gateway != data.decode('ascii'): if data and self.ip_gateway != data.decode('ascii'):
orig_gateway = self.ip_gateway
self.ip_gateway = data.decode('ascii') self.ip_gateway = data.decode('ascii')
if self.this_router.network_state == 'primary': if self.this_router.network_state == 'primary':
if self.ip_gateway: if orig_gateway:
self.removeGatewayAddress() self.removeGatewayAddress()
self.createGatewayAddress() self.createGatewayAddress()