Remove useless data synchronization code

The ovs online events will handle the flow entries when
local controller restarts.

Change-Id: I4108fb1e135b0e00d77b8a8d99e28f25ff670645
Closes-Bug: #1594240
This commit is contained in:
Li Ma 2016-07-25 17:01:25 +08:00
parent eec2128eb4
commit 57b71b7c50
6 changed files with 11 additions and 79 deletions

View File

@ -79,7 +79,11 @@ class DHCPApp(DFlowApp):
self.packet_in_handler)
def switch_features_handler(self, ev):
self._install_flows_on_switch_up()
self._install_dhcp_broadcast_match_flow()
self.add_flow_go_to_table(self.get_datapath(),
const.DHCP_TABLE,
const.PRIORITY_DEFAULT,
const.L2_LOOKUP_TABLE)
# TODO(gampel) handle network changes
def packet_in_handler(self, event):
@ -476,20 +480,6 @@ class DHCPApp(DFlowApp):
const.PRIORITY_MEDIUM,
const.DHCP_TABLE, match=match)
def _install_flows_on_switch_up(self):
self._install_dhcp_broadcast_match_flow()
self.add_flow_go_to_table(self.get_datapath(),
const.DHCP_TABLE,
const.PRIORITY_DEFAULT,
const.L2_LOOKUP_TABLE)
for lswitch in self.db_store.get_lswitchs():
self.update_logical_switch(lswitch)
for port in self.db_store.get_ports():
if port.get_external_value('is_local'):
self.add_local_port(port)
def _install_dhcp_unicast_match_flow(self, ip_addr, network_id):
parser = self.get_datapath().ofproto_parser
match = parser.OFPMatch(eth_type=ether.ETH_TYPE_IP,

View File

@ -81,7 +81,9 @@ class L2App(df_base_app.DFlowApp):
const.PRIORITY_DEFAULT,
const.INGRESS_DISPATCH_TABLE)
self._install_flows_on_switch_up()
# Clear local networks cache so the multicast/broadcast flows
# are installed correctly
self.local_networks.clear()
def _add_arp_responder(self, lport):
if not self.is_install_arp_responder:
@ -143,7 +145,6 @@ class L2App(df_base_app.DFlowApp):
match=match)
def remove_local_port(self, lport):
lport_id = lport.get_id()
mac = lport.get_mac()
network_id = lport.get_external_value('local_network_id')
@ -203,9 +204,7 @@ class L2App(df_base_app.DFlowApp):
out_port=ofproto.OFPP_ANY,
out_group=ofproto.OFPG_ANY,
match=match)
self._del_multicast_broadcast_handling_for_port(network_id, lport_id)
self._remove_arp_responder(lport)
def remove_remote_port(self, lport):
@ -233,13 +232,10 @@ class L2App(df_base_app.DFlowApp):
out_port=ofproto.OFPP_ANY,
out_group=ofproto.OFPG_ANY,
match=match)
self._del_multicast_broadcast_handling_for_port(network_id, lport_id)
self._remove_arp_responder(lport)
def add_local_port(self, lport):
if self.get_datapath() is None:
return
@ -422,7 +418,6 @@ class L2App(df_base_app.DFlowApp):
match=match)
def add_remote_port(self, lport):
if self.get_datapath() is None:
return
@ -455,18 +450,6 @@ class L2App(df_base_app.DFlowApp):
table_id=const.EGRESS_TABLE,
priority=const.PRIORITY_MEDIUM,
match=match)
self._add_multicast_broadcast_handling_for_port(network_id, lport_id,
tunnel_key)
self._add_arp_responder(lport)
def _install_flows_on_switch_up(self):
# Clear local networks cache so the multicast/broadcast flows
# are installed correctly
self.local_networks.clear()
for port in self.db_store.get_ports():
if port.get_external_value('is_local'):
self.add_local_port(port)
else:
self.add_remote_port(port)

View File

@ -83,7 +83,9 @@ class L2App(df_base_app.DFlowApp):
const.PRIORITY_DEFAULT,
const.INGRESS_DISPATCH_TABLE)
self._install_flows_on_switch_up()
# Clear local networks cache so the multicast/broadcast flows
# are installed correctly
self.local_networks.clear()
def _add_arp_responder(self, lport):
if not self.is_install_arp_responder:
@ -311,7 +313,6 @@ class L2App(df_base_app.DFlowApp):
match=match)
def remove_remote_port(self, lport):
lport_id = lport.get_id()
mac = lport.get_mac()
network_id = lport.get_external_value('local_network_id')
@ -351,7 +352,6 @@ class L2App(df_base_app.DFlowApp):
lport_id, network_id, segmentation_id)
def add_local_port(self, lport):
if self.get_datapath() is None:
return
@ -729,7 +729,6 @@ class L2App(df_base_app.DFlowApp):
match=match)
def add_remote_port(self, lport):
if self.get_datapath() is None:
return
@ -782,30 +781,17 @@ class L2App(df_base_app.DFlowApp):
table_id=const.EGRESS_TABLE,
priority=const.PRIORITY_MEDIUM,
match=match)
self._add_multicast_broadcast_handling_for_remote_port(lport_id,
port_key,
network_id,
segmentation_id,
ofport)
def _install_flows_on_switch_up(self):
# Clear local networks cache so the multicast/broadcast flows
# are installed correctly
self.local_networks.clear()
for port in self.db_store.get_ports():
if port.get_external_value('is_local'):
self.add_local_port(port)
else:
self.add_remote_port(port)
def _install_network_flows_on_first_port_up(self,
segmentation_id,
network_type,
local_network_id):
LOG.info(_LI('Install network flows on first port up.'))
network = self.local_networks.get(local_network_id)
if network:
local_ports = network.get('local')

View File

@ -44,7 +44,6 @@ class L3App(DFlowApp):
const.L3_LOOKUP_TABLE,
const.PRIORITY_DEFAULT,
const.EGRESS_TABLE)
self._install_flows_on_switch_up()
def packet_in_handler(self, event):
msg = event.msg
@ -137,7 +136,6 @@ class L3App(DFlowApp):
self.get_datapath().send_msg(out)
def add_router_port(self, router, router_port, local_network_id):
datapath = self.get_datapath()
if datapath is None:
return
@ -268,7 +266,6 @@ class L3App(DFlowApp):
match=match)
def remove_router_port(self, router_port, local_network_id):
parser = self.get_datapath().ofproto_parser
ofproto = self.get_datapath().ofproto
tunnel_key = router_port.get_tunnel_key()
@ -314,12 +311,3 @@ class L3App(DFlowApp):
out_port=ofproto.OFPP_ANY,
out_group=ofproto.OFPG_ANY,
match=match)
def _install_flows_on_switch_up(self):
for lrouter in self.db_store.get_routers():
for router_port in lrouter.get_ports():
local_network_id = self.db_store.get_network_id(
router_port.get_lswitch_id(),
)
self.add_router_port(lrouter, router_port,
local_network_id)

View File

@ -34,7 +34,6 @@ class L3ProactiveApp(DFlowApp):
const.L3_LOOKUP_TABLE,
const.PRIORITY_DEFAULT,
const.EGRESS_TABLE)
self._install_flows_on_switch_up()
def add_router_port(self, router, router_port, local_network_id):
datapath = self.get_datapath()
@ -181,7 +180,6 @@ class L3ProactiveApp(DFlowApp):
match=match)
def remove_router_port(self, router_port, local_network_id):
parser = self.get_datapath().ofproto_parser
ofproto = self.get_datapath().ofproto
tunnel_key = router_port.get_tunnel_key()
@ -317,14 +315,3 @@ class L3ProactiveApp(DFlowApp):
out_port=ofproto.OFPP_ANY,
out_group=ofproto.OFPG_ANY,
match=match)
def _install_flows_on_switch_up(self):
for lrouter in self.db_store.get_routers():
for router_port in lrouter.get_ports():
local_network_id = self.db_store.get_network_id(
router_port.get_lswitch_id(),
)
self.add_router_port(lrouter, router_port,
local_network_id)
for lport in self.db_store.get_ports():
self._add_port(lport)

View File

@ -49,7 +49,6 @@ class SGApp(df_base_app.DFlowApp):
@staticmethod
def _split_range(range_start, range_end, full_mask):
bit_flag = 1
last_temp_start = range_start
last_temp_end = last_temp_start
@ -231,7 +230,6 @@ class SGApp(df_base_app.DFlowApp):
@staticmethod
def _get_rule_flows_match_except_net_addresses(secgroup_rule):
protocol = secgroup_rule.get_protocol()
port_range_max = secgroup_rule.get_port_range_max()
port_range_min = secgroup_rule.get_port_range_min()