From e92742f9c0f25134774f2c8246d9da1bf4851f14 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 23 Feb 2019 14:39:26 +0100 Subject: [PATCH] [controller] move post config part out of init() --- p4app/controller.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/p4app/controller.py b/p4app/controller.py index 9f871b3..3c3d6d7 100644 --- a/p4app/controller.py +++ b/p4app/controller.py @@ -35,7 +35,6 @@ class L2Controller(object): self.v4_routes['base'].append({ "net": "10.0.42.0/24", "port": "4"}) self.init_boilerplate(sw_name) - self.init() def init_boilerplate(self, sw_name): self.topo = Topology(db="topology.db") @@ -44,17 +43,15 @@ class L2Controller(object): self.cpu_port = self.topo.get_cpu_port_index(self.sw_name) self.controller = SimpleSwitchAPI(self.thrift_port) self.intf = str(self.topo.get_cpu_port_intf(self.sw_name).replace("eth0", "eth1")) - - def init(self): self.controller.reset_state() - self.fill_tables() - self.config_hosts() - self.add_mirror() - def add_mirror(self): if self.cpu_port: self.controller.mirroring_add(100, self.cpu_port) + def config(self): + self.fill_tables() + self.config_hosts() + def fill_tables(self): for v6route in self.v6_routes[self.mode]: self.controller.table_add("v6_routing", "set_egress_port", [v6route['net']], [v6route['port']]) @@ -130,4 +127,5 @@ if __name__ == "__main__": controller = L2Controller(sw_name) controller.commandline() + controller.config() controller.run_cpu_port_loop()