From 8a14c40c7b0f05095875eea04da7d69a809cf6c1 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 23 Feb 2019 14:49:18 +0100 Subject: [PATCH] [controller] clear tables before filling --- p4app/controller.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/p4app/controller.py b/p4app/controller.py index 3c3d6d7..9139e74 100644 --- a/p4app/controller.py +++ b/p4app/controller.py @@ -53,9 +53,11 @@ class L2Controller(object): self.config_hosts() def fill_tables(self): + self.controller.table_clear("v6_routing") for v6route in self.v6_routes[self.mode]: 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]: 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 - 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"): log.info("{}: {}".format(msg, self.debug_format_pkg(pkg)))