Flush router interfaces configuration on switch up

In case the switch and the controller lose connectivity
or due to switch restart, re-configure all router
ports flows

Change-Id: Id08b1ea55ccdc217d181d1748b4a41669408815a
This commit is contained in:
Gal Sagie 2015-07-27 16:28:45 +03:00
parent a431e99994
commit fff4c83c45
2 changed files with 11 additions and 0 deletions

View File

@ -62,6 +62,7 @@ class L3App(DFlowApp):
self.send_port_desc_stats_request(self.dp)
self.add_flow_go_to_table(self.dp, const.L3_LOOKUP_TABLE, 1,
const.EGRESS_TABLE)
self._install_flows_on_switch_up()
def send_port_desc_stats_request(self, datapath):
ofp_parser = datapath.ofproto_parser
@ -313,3 +314,9 @@ class L3App(DFlowApp):
match=match)
self.dp.send_msg(message)
def _install_flows_on_switch_up(self):
for lrouter in self.db_store.get_routers():
for router_port in lrouter.get_ports():
router_lport = self.db_store.get_port(router_port.get_name())
self.add_new_router_port(lrouter, router_lport, router_port)

View File

@ -77,3 +77,7 @@ class DbStore(object):
for port in router.get_ports():
if port.get_mac() == interface_mac:
return router
def get_routers(self):
with self.lock:
return self.routers.values()