[controller] clear tables before filling

This commit is contained in:
Nico Schottelius 2019-02-23 14:49:18 +01:00
parent e92742f9c0
commit 8a14c40c7b

View file

@ -53,9 +53,11 @@ class L2Controller(object):
self.config_hosts() self.config_hosts()
def fill_tables(self): def fill_tables(self):
self.controller.table_clear("v6_routing")
for v6route in self.v6_routes[self.mode]: for v6route in self.v6_routes[self.mode]:
self.controller.table_add("v6_routing", "set_egress_port", [v6route['net']], [v6route['port']]) self.controller.table_add("v6_routing", "set_egress_port", [v6route['net']], [v6route['port']])
self.controller.table_clear("v4_routing")
for v4route in self.v4_routes[self.mode]: for v4route in self.v4_routes[self.mode]:
self.controller.table_add("v4_routing", "set_egress_port", [v4route['net']], [v4route['port']]) self.controller.table_add("v4_routing", "set_egress_port", [v4route['net']], [v4route['port']])
@ -64,7 +66,12 @@ class L2Controller(object):
- all routes are networks (no /128 v6 or /32 v4 - all routes are networks (no /128 v6 or /32 v4
- hosts get the first ip address in the network - hosts get the first ip address in the network
""" """
pass for v6route in self.v6_routes[self.mode]:
self.controller.table_add("v6_routing", "set_egress_port", [v6route['net']], [v6route['port']])
for v4route in self.v4_routes[self.mode]:
self.controller.table_add("v4_routing", "set_egress_port", [v4route['net']], [v4route['port']])
def debug_print_pkg(self, pkg, msg="INCOMING"): def debug_print_pkg(self, pkg, msg="INCOMING"):
log.info("{}: {}".format(msg, self.debug_format_pkg(pkg))) log.info("{}: {}".format(msg, self.debug_format_pkg(pkg)))