Add stop and message on DHCP server shutdown

This commit is contained in:
Joshua Boniface 2018-09-30 13:57:10 -04:00
parent ad3c85eda3
commit 120b770a02
1 changed files with 10 additions and 0 deletions

View File

@ -89,6 +89,8 @@ class VXNetworkInstance():
self.dhcp_flag = ( data.decode('ascii') == 'True' )
if self.dhcp_flag and self.this_router.network_state == 'primary':
self.startDHCPServer()
elif self.this_router.network_state == 'primary':
self.stopDHCPServer()
def getvni(self):
return self.vni
@ -236,4 +238,12 @@ class VXNetworkInstance():
def stopDHCPServer(self):
if self.dhcp_server:
ansiiprint.echo(
'Stopping DHCP server on interface {} (VNI {})'.format(
self.bridge_nic,
self.vni
),
'',
'o'
)
self.dhcp_server.close()