|
|
|
@ -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()
|
|
|
|
|