From 903e94b51905edbe634d71e5c196504b69ab7bfd Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 24 Sep 2018 01:34:20 -0400 Subject: [PATCH] Correct handling of network lists --- router-daemon/pvcrd/RouterInstance.py | 4 +++- router-daemon/pvcrd/VXNetworkInstance.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/router-daemon/pvcrd/RouterInstance.py b/router-daemon/pvcrd/RouterInstance.py index 5d321753..cfc57f87 100644 --- a/router-daemon/pvcrd/RouterInstance.py +++ b/router-daemon/pvcrd/RouterInstance.py @@ -96,6 +96,8 @@ class RouterInstance(): def updatenetworklist(self, s_network): self.s_network = s_network + for network in s_network: + self.network_list.append(network.getvni()) # Flush all VMs on the host def set_secondary(self): @@ -133,7 +135,7 @@ class RouterInstance(): # Display router information to the terminal ansiiprint.echo('{}{} keepalive{}'.format(ansiiprint.purple(), self.name, ansiiprint.end()), '', 't') - ansiiprint.echo('{0}Active networks:{1} {2} {0}Free memory [MiB]:{1} {3} {0}Used memory [MiB]:{1} {4} {0}Load:{1} {5}'.format(ansiiprint.bold(), ansiiprint.end(), self.networks_count, self.memfree, self.memused, self.cpuload), '', 'c') + ansiiprint.echo('{0}Active networks:{1} {2} {0}Free memory [MiB]:{1} {3} {0}Used memory [MiB]:{1} {4} {0}Load:{1} {5}'.format(ansiiprint.bold(), ansiiprint.end(), self.network_list, self.memfree, self.memused, self.cpuload), '', 'c') # Update our local router lists for router_name in self.t_router: diff --git a/router-daemon/pvcrd/VXNetworkInstance.py b/router-daemon/pvcrd/VXNetworkInstance.py index cedf17ae..bb2d2b98 100644 --- a/router-daemon/pvcrd/VXNetworkInstance.py +++ b/router-daemon/pvcrd/VXNetworkInstance.py @@ -74,6 +74,9 @@ class VXNetworkInstance(): if data != None and self.dhcp_flag != data.decode('ascii'): self.dhcp_flag = ( data.decode('ascii') == 'True' ) + def getvni(self): + return self.vni + def createNetwork(self): ansiiprint.echo('Creating VNI {} device on interface {}'.format(self.vni, self.vni_dev), '', 'o') common.run_os_command('ip link add {} type vxlan id {} dstport 4789 dev {}'.format(self.vxlan_nic, self.vni, self.vni_dev))