OpenFlowSwitchMixin: do not override delete_flows
With this change the delete_flow variant implementation
of OpenFlowSwitchMixin, which was overriding the parent implementation
from ovs_lib in an incompatible way using the native ryu implementation,
is renamed into uninstall_flows.
As discussed in bug 1628455, the approach consisting in
extending the _keyword dict to convert ovs-ofctl rules into ryu
parameters does not seem practical.
This change also updates calls to delete_flows so that, when
enabled, the native interface will be used. Similar calls outside neutron
repo need to be updated as well, which will be done in separate changes.
Change-Id: I90ff1055d367609694eef975c7d084e4cd7a2cf4
Closes-Bug: 1628455
Needed-By: Idd2315565cc9c88319984d83487148bf498e91ab
(cherry picked from commit 2c54cc22ef
)
This commit is contained in:
parent
01d8262664
commit
245b45d81c
|
@ -123,7 +123,7 @@ class QosOVSAgentDriver(qos.QosLinuxAgentDriver):
|
|||
RULE_TYPE_DSCP_MARKING, 0)
|
||||
if dscp_port:
|
||||
port_num = dscp_port['vif_port'].ofport
|
||||
self.br_int.delete_flows(in_port=port_num, table=0, reg2=0)
|
||||
self.br_int.uninstall_flows(in_port=port_num, table=0, reg2=0)
|
||||
else:
|
||||
LOG.debug("delete_dscp_marking was received for port %s but "
|
||||
"no port information was stored to be deleted",
|
||||
|
|
|
@ -45,7 +45,8 @@ class OVSDVRProcessMixin(object):
|
|||
(_dp, ofp, ofpp) = self._get_dp()
|
||||
match = self._dvr_process_ipv4_match(ofp, ofpp,
|
||||
vlan_tag=vlan_tag, gateway_ip=gateway_ip)
|
||||
self.delete_flows(table_id=self.dvr_process_table_id, match=match)
|
||||
self.uninstall_flows(table_id=self.dvr_process_table_id,
|
||||
match=match)
|
||||
|
||||
@staticmethod
|
||||
def _dvr_process_ipv6_match(ofp, ofpp, vlan_tag, gateway_mac):
|
||||
|
@ -67,7 +68,8 @@ class OVSDVRProcessMixin(object):
|
|||
(_dp, ofp, ofpp) = self._get_dp()
|
||||
match = self._dvr_process_ipv6_match(ofp, ofpp,
|
||||
vlan_tag=vlan_tag, gateway_mac=gateway_mac)
|
||||
self.delete_flows(table_id=self.dvr_process_table_id, match=match)
|
||||
self.uninstall_flows(table_id=self.dvr_process_table_id,
|
||||
match=match)
|
||||
|
||||
@staticmethod
|
||||
def _dvr_process_in_match(ofp, ofpp, vlan_tag, vif_mac):
|
||||
|
@ -107,7 +109,7 @@ class OVSDVRProcessMixin(object):
|
|||
table_id = self.dvr_process_table_id
|
||||
match = self._dvr_process_in_match(ofp, ofpp,
|
||||
vlan_tag=vlan_tag, vif_mac=vif_mac)
|
||||
self.delete_flows(table_id=table_id, match=match)
|
||||
self.uninstall_flows(table_id=table_id, match=match)
|
||||
match = self._dvr_process_out_match(ofp, ofpp,
|
||||
vlan_tag=vlan_tag, vif_mac=vif_mac)
|
||||
self.delete_flows(table_id=table_id, match=match)
|
||||
self.uninstall_flows(table_id=table_id, match=match)
|
||||
|
|
|
@ -83,7 +83,7 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
else:
|
||||
vlan_vid = segmentation_id | ofp.OFPVID_PRESENT
|
||||
match = self._local_vlan_match(ofp, ofpp, port, vlan_vid)
|
||||
self.delete_flows(match=match)
|
||||
self.uninstall_flows(match=match)
|
||||
|
||||
@staticmethod
|
||||
def _dvr_to_src_mac_match(ofp, ofpp, vlan_tag, dst_mac):
|
||||
|
@ -118,7 +118,7 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
(_dp, ofp, ofpp) = self._get_dp()
|
||||
match = self._dvr_to_src_mac_match(ofp, ofpp,
|
||||
vlan_tag=vlan_tag, dst_mac=dst_mac)
|
||||
self.delete_flows(table_id=table_id, match=match)
|
||||
self.uninstall_flows(table_id=table_id, match=match)
|
||||
|
||||
def add_dvr_mac_vlan(self, mac, port):
|
||||
self.install_goto(table_id=constants.LOCAL_SWITCHING,
|
||||
|
@ -129,8 +129,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
|
||||
def remove_dvr_mac_vlan(self, mac):
|
||||
# REVISIT(yamamoto): match in_port as well?
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
eth_src=mac)
|
||||
self.uninstall_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
eth_src=mac)
|
||||
|
||||
def add_dvr_mac_tun(self, mac, port):
|
||||
self.install_goto(table_id=constants.LOCAL_SWITCHING,
|
||||
|
@ -140,8 +140,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
dest_table_id=constants.DVR_TO_SRC_MAC)
|
||||
|
||||
def remove_dvr_mac_tun(self, mac, port):
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
in_port=port, eth_src=mac)
|
||||
self.uninstall_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
in_port=port, eth_src=mac)
|
||||
|
||||
@staticmethod
|
||||
def _arp_reply_match(ofp, ofpp, port):
|
||||
|
@ -179,8 +179,10 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
def set_allowed_macs_for_port(self, port, mac_addresses=None,
|
||||
allow_all=False):
|
||||
if allow_all:
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING, in_port=port)
|
||||
self.delete_flows(table_id=constants.MAC_SPOOF_TABLE, in_port=port)
|
||||
self.uninstall_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
in_port=port)
|
||||
self.uninstall_flows(table_id=constants.MAC_SPOOF_TABLE,
|
||||
in_port=port)
|
||||
return
|
||||
mac_addresses = mac_addresses or []
|
||||
for address in mac_addresses:
|
||||
|
@ -198,8 +200,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
continue
|
||||
flow_mac = matches['eth_src']
|
||||
if netaddr.EUI(flow_mac) not in mac_addresses:
|
||||
self.delete_flows(table_id=constants.MAC_SPOOF_TABLE,
|
||||
in_port=port, eth_src=flow_mac)
|
||||
self.uninstall_flows(table_id=constants.MAC_SPOOF_TABLE,
|
||||
in_port=port, eth_src=flow_mac)
|
||||
self.install_goto(table_id=constants.LOCAL_SWITCHING,
|
||||
priority=9, in_port=port,
|
||||
dest_table_id=constants.MAC_SPOOF_TABLE)
|
||||
|
@ -230,13 +232,13 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
def delete_arp_spoofing_protection(self, port):
|
||||
(_dp, ofp, ofpp) = self._get_dp()
|
||||
match = self._arp_reply_match(ofp, ofpp, port=port)
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
match=match)
|
||||
self.uninstall_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
match=match)
|
||||
match = self._icmpv6_reply_match(ofp, ofpp, port=port)
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
match=match)
|
||||
self.uninstall_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
match=match)
|
||||
self.delete_arp_spoofing_allow_rules(port)
|
||||
|
||||
def delete_arp_spoofing_allow_rules(self, port):
|
||||
self.delete_flows(table_id=constants.ARP_SPOOF_TABLE,
|
||||
in_port=port)
|
||||
self.uninstall_flows(table_id=constants.ARP_SPOOF_TABLE,
|
||||
in_port=port)
|
||||
|
|
|
@ -54,7 +54,7 @@ class OVSPhysicalBridge(ovs_bridge.OVSAgentBridge,
|
|||
def reclaim_local_vlan(self, port, lvid):
|
||||
(_dp, ofp, ofpp) = self._get_dp()
|
||||
match = self._local_vlan_match(ofp, ofpp, port, lvid)
|
||||
self.delete_flows(match=match)
|
||||
self.uninstall_flows(match=match)
|
||||
|
||||
def add_dvr_mac_vlan(self, mac, port):
|
||||
self.install_output(table_id=constants.DVR_NOT_LEARN_VLAN,
|
||||
|
@ -62,5 +62,5 @@ class OVSPhysicalBridge(ovs_bridge.OVSAgentBridge,
|
|||
|
||||
def remove_dvr_mac_vlan(self, mac):
|
||||
# REVISIT(yamamoto): match in_port as well?
|
||||
self.delete_flows(table_id=constants.DVR_NOT_LEARN_VLAN,
|
||||
self.uninstall_flows(table_id=constants.DVR_NOT_LEARN_VLAN,
|
||||
eth_src=mac)
|
||||
|
|
|
@ -164,7 +164,7 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
|
|||
(_dp, ofp, ofpp) = self._get_dp()
|
||||
match = self._local_vlan_match(ofp, ofpp, segmentation_id)
|
||||
table_id = constants.TUN_TABLE[network_type]
|
||||
self.delete_flows(table_id=table_id, match=match)
|
||||
self.uninstall_flows(table_id=table_id, match=match)
|
||||
|
||||
@staticmethod
|
||||
def _flood_to_tun_match(ofp, ofpp, vlan):
|
||||
|
@ -185,7 +185,7 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
|
|||
def delete_flood_to_tun(self, vlan):
|
||||
(_dp, ofp, ofpp) = self._get_dp()
|
||||
match = self._flood_to_tun_match(ofp, ofpp, vlan)
|
||||
self.delete_flows(table_id=constants.FLOOD_TO_TUN, match=match)
|
||||
self.uninstall_flows(table_id=constants.FLOOD_TO_TUN, match=match)
|
||||
|
||||
@staticmethod
|
||||
def _unicast_to_tun_match(ofp, ofpp, vlan, mac):
|
||||
|
@ -208,7 +208,7 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
|
|||
match = ofpp.OFPMatch(vlan_vid=vlan | ofp.OFPVID_PRESENT)
|
||||
else:
|
||||
match = self._unicast_to_tun_match(ofp, ofpp, vlan, mac)
|
||||
self.delete_flows(table_id=constants.UCAST_TO_TUN, match=match)
|
||||
self.uninstall_flows(table_id=constants.UCAST_TO_TUN, match=match)
|
||||
|
||||
@staticmethod
|
||||
def _arp_responder_match(ofp, ofpp, vlan, ip):
|
||||
|
@ -247,7 +247,8 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
|
|||
eth_type=ether_types.ETH_TYPE_ARP)
|
||||
else:
|
||||
match = self._arp_responder_match(ofp, ofpp, vlan, ip)
|
||||
self.delete_flows(table_id=constants.ARP_RESPONDER, match=match)
|
||||
self.uninstall_flows(table_id=constants.ARP_RESPONDER,
|
||||
match=match)
|
||||
|
||||
def setup_tunnel_port(self, network_type, port):
|
||||
self.install_goto(dest_table_id=constants.TUN_TABLE[network_type],
|
||||
|
@ -255,7 +256,7 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
|
|||
in_port=port)
|
||||
|
||||
def cleanup_tunnel_port(self, port):
|
||||
self.delete_flows(in_port=port)
|
||||
self.uninstall_flows(in_port=port)
|
||||
|
||||
def add_dvr_mac_tun(self, mac, port):
|
||||
self.install_output(table_id=constants.DVR_NOT_LEARN,
|
||||
|
@ -265,8 +266,8 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
|
|||
|
||||
def remove_dvr_mac_tun(self, mac):
|
||||
# REVISIT(yamamoto): match in_port as well?
|
||||
self.delete_flows(table_id=constants.DVR_NOT_LEARN,
|
||||
eth_src=mac)
|
||||
self.uninstall_flows(table_id=constants.DVR_NOT_LEARN,
|
||||
eth_src=mac)
|
||||
|
||||
def deferred(self):
|
||||
# REVISIT(yamamoto): This is for API compat with "ovs-ofctl"
|
||||
|
|
|
@ -99,9 +99,9 @@ class OpenFlowSwitchMixin(object):
|
|||
return match
|
||||
return ofpp.OFPMatch(**match_kwargs)
|
||||
|
||||
def delete_flows(self, table_id=None, strict=False, priority=0,
|
||||
cookie=0, cookie_mask=0,
|
||||
match=None, **match_kwargs):
|
||||
def uninstall_flows(self, table_id=None, strict=False, priority=0,
|
||||
cookie=0, cookie_mask=0,
|
||||
match=None, **match_kwargs):
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
if table_id is None:
|
||||
table_id = ofp.OFPTT_ALL
|
||||
|
@ -142,7 +142,7 @@ class OpenFlowSwitchMixin(object):
|
|||
for c in cookies:
|
||||
LOG.warning(_LW("Deleting flow with cookie 0x%(cookie)x"),
|
||||
{'cookie': c})
|
||||
self.delete_flows(cookie=c, cookie_mask=((1 << 64) - 1))
|
||||
self.uninstall_flows(cookie=c, cookie_mask=((1 << 64) - 1))
|
||||
|
||||
def install_goto_next(self, table_id):
|
||||
self.install_goto(table_id=table_id, dest_table_id=table_id + 1)
|
||||
|
|
|
@ -99,8 +99,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
|
||||
def remove_dvr_mac_vlan(self, mac):
|
||||
# REVISIT(yamamoto): match in_port as well?
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
eth_src=mac)
|
||||
self.delete_flows(table=constants.LOCAL_SWITCHING,
|
||||
dl_src=mac)
|
||||
|
||||
def add_dvr_mac_tun(self, mac, port):
|
||||
# Table LOCAL_SWITCHING will now sort DVR traffic from other
|
||||
|
@ -112,8 +112,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
dest_table_id=constants.DVR_TO_SRC_MAC)
|
||||
|
||||
def remove_dvr_mac_tun(self, mac, port):
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
in_port=port, eth_src=mac)
|
||||
self.delete_flows(table=constants.LOCAL_SWITCHING,
|
||||
in_port=port, dl_src=mac)
|
||||
|
||||
def install_icmpv6_na_spoofing_protection(self, port, ip_addresses):
|
||||
# Allow neighbor advertisements as long as they match addresses
|
||||
|
@ -136,8 +136,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
def set_allowed_macs_for_port(self, port, mac_addresses=None,
|
||||
allow_all=False):
|
||||
if allow_all:
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING, in_port=port)
|
||||
self.delete_flows(table_id=constants.MAC_SPOOF_TABLE, in_port=port)
|
||||
self.delete_flows(table=constants.LOCAL_SWITCHING, in_port=port)
|
||||
self.delete_flows(table=constants.MAC_SPOOF_TABLE, in_port=port)
|
||||
return
|
||||
mac_addresses = mac_addresses or []
|
||||
for address in mac_addresses:
|
||||
|
@ -153,8 +153,8 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
continue
|
||||
flow_mac = flow.split('dl_src=')[1].split(' ')[0].split(',')[0]
|
||||
if netaddr.EUI(flow_mac) not in mac_addresses:
|
||||
self.delete_flows(table_id=constants.MAC_SPOOF_TABLE,
|
||||
in_port=port, eth_src=flow_mac)
|
||||
self.delete_flows(table=constants.MAC_SPOOF_TABLE,
|
||||
in_port=port, dl_src=flow_mac)
|
||||
self.add_flow(table=constants.LOCAL_SWITCHING,
|
||||
priority=9, in_port=port,
|
||||
actions=("resubmit(,%s)" % constants.MAC_SPOOF_TABLE))
|
||||
|
@ -177,13 +177,13 @@ class OVSIntegrationBridge(ovs_bridge.OVSAgentBridge):
|
|||
actions=("resubmit(,%s)" % constants.ARP_SPOOF_TABLE))
|
||||
|
||||
def delete_arp_spoofing_protection(self, port):
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
self.delete_flows(table=constants.LOCAL_SWITCHING,
|
||||
in_port=port, proto='arp')
|
||||
self.delete_flows(table_id=constants.LOCAL_SWITCHING,
|
||||
self.delete_flows(table=constants.LOCAL_SWITCHING,
|
||||
in_port=port, nw_proto=const.PROTO_NUM_IPV6_ICMP,
|
||||
icmp_type=const.ICMPV6_TYPE_NA)
|
||||
self.delete_arp_spoofing_allow_rules(port)
|
||||
|
||||
def delete_arp_spoofing_allow_rules(self, port):
|
||||
self.delete_flows(table_id=constants.ARP_SPOOF_TABLE,
|
||||
self.delete_flows(table=constants.ARP_SPOOF_TABLE,
|
||||
in_port=port)
|
||||
|
|
|
@ -56,5 +56,5 @@ class OVSPhysicalBridge(ovs_bridge.OVSAgentBridge,
|
|||
|
||||
def remove_dvr_mac_vlan(self, mac):
|
||||
# REVISIT(yamamoto): match in_port as well?
|
||||
self.delete_flows(table_id=constants.DVR_NOT_LEARN_VLAN,
|
||||
eth_src=mac)
|
||||
self.delete_flows(table=constants.DVR_NOT_LEARN_VLAN,
|
||||
dl_src=mac)
|
||||
|
|
|
@ -234,8 +234,8 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
|
|||
|
||||
def remove_dvr_mac_tun(self, mac):
|
||||
# REVISIT(yamamoto): match in_port as well?
|
||||
self.delete_flows(table_id=constants.DVR_NOT_LEARN,
|
||||
eth_src=mac)
|
||||
self.delete_flows(table=constants.DVR_NOT_LEARN,
|
||||
dl_src=mac)
|
||||
|
||||
def deferred(self):
|
||||
return DeferredOVSTunnelBridge(self)
|
||||
|
|
|
@ -75,7 +75,7 @@ class OpenFlowSwitchMixin(object):
|
|||
actions="drop",
|
||||
**self._conv_args(kwargs))
|
||||
|
||||
def delete_flows(self, **kwargs):
|
||||
def uninstall_flows(self, **kwargs):
|
||||
# NOTE(yamamoto): super() points to ovs_lib.OVSBridge.
|
||||
# See ovs_bridge.py how this class is actually used.
|
||||
if kwargs:
|
||||
|
|
|
@ -209,7 +209,7 @@ class OVSDVRNeutronAgent(object):
|
|||
self.dvr_mac_address)
|
||||
# Remove existing flows in integration bridge
|
||||
if self.conf.AGENT.drop_flows_on_start:
|
||||
self.int_br.delete_flows()
|
||||
self.int_br.uninstall_flows()
|
||||
|
||||
# Add a canary flow to int_br to track OVS restarts
|
||||
self.int_br.setup_canary_table()
|
||||
|
|
|
@ -997,7 +997,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
|
|||
# the flows on br-int, so that traffic doesn't get flooded over
|
||||
# while flows are missing.
|
||||
self.int_br.delete_port(self.conf.OVS.int_peer_patch_port)
|
||||
self.int_br.delete_flows()
|
||||
self.int_br.uninstall_flows()
|
||||
self.int_br.setup_default_table()
|
||||
|
||||
def setup_ancillary_bridges(self, integ_br, tun_br):
|
||||
|
@ -1059,7 +1059,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
|
|||
"ports. Agent terminated!"))
|
||||
sys.exit(1)
|
||||
if self.conf.AGENT.drop_flows_on_start:
|
||||
self.tun_br.delete_flows()
|
||||
self.tun_br.uninstall_flows()
|
||||
|
||||
def setup_tunnel_br_flows(self):
|
||||
'''Setup the tunnel bridge.
|
||||
|
@ -1103,7 +1103,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
|
|||
br.set_secure_mode()
|
||||
br.setup_controllers(self.conf)
|
||||
if cfg.CONF.AGENT.drop_flows_on_start:
|
||||
br.delete_flows()
|
||||
br.uninstall_flows()
|
||||
br.setup_default_table()
|
||||
self.phys_brs[physical_network] = br
|
||||
|
||||
|
@ -1193,7 +1193,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
|
|||
for ofport in ofports_deleted:
|
||||
if self.prevent_arp_spoofing:
|
||||
self.int_br.delete_arp_spoofing_protection(port=ofport)
|
||||
self.int_br.delete_flows(in_port=ofport)
|
||||
self.int_br.uninstall_flows(in_port=ofport)
|
||||
# store map for next iteration
|
||||
self.vifname_to_ofport_map = current
|
||||
return moved_ports
|
||||
|
|
|
@ -311,7 +311,7 @@ class ARPSpoofTestCase(OVSAgentTestBase):
|
|||
|
||||
class CanaryTableTestCase(OVSAgentTestBase):
|
||||
def test_canary_table(self):
|
||||
self.br_int.delete_flows()
|
||||
self.br_int.uninstall_flows()
|
||||
self.assertEqual(constants.OVS_RESTARTED,
|
||||
self.br_int.check_canary_table())
|
||||
self.br_int.setup_canary_table()
|
||||
|
|
|
@ -45,10 +45,11 @@ class OVSBridgeTestBase(ovs_test_base.OVSRyuTestBase):
|
|||
mock.patch.object(self.br, '_get_dp', autospec=True,
|
||||
return_value=self._get_dp()).start()
|
||||
mock__send_msg = mock.patch.object(self.br, '_send_msg').start()
|
||||
mock_delete_flows = mock.patch.object(self.br, 'delete_flows').start()
|
||||
mock_delete_flows = mock.patch.object(self.br,
|
||||
'uninstall_flows').start()
|
||||
self.mock = mock.Mock()
|
||||
self.mock.attach_mock(mock__send_msg, '_send_msg')
|
||||
self.mock.attach_mock(mock_delete_flows, 'delete_flows')
|
||||
self.mock.attach_mock(mock_delete_flows, 'uninstall_flows')
|
||||
|
||||
def _get_dp(self):
|
||||
return self.dp, self.ofp, self.ofpp
|
||||
|
@ -172,7 +173,7 @@ class OVSDVRProcessTestMixin(object):
|
|||
gateway_ip=gateway_ip)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=self.dvr_process_table_id,
|
||||
call.uninstall_flows(table_id=self.dvr_process_table_id,
|
||||
match=ofpp.OFPMatch(
|
||||
eth_type=self.ether_types.ETH_TYPE_ARP,
|
||||
arp_tpa=gateway_ip,
|
||||
|
@ -208,7 +209,7 @@ class OVSDVRProcessTestMixin(object):
|
|||
gateway_mac=gateway_mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=self.dvr_process_table_id,
|
||||
call.uninstall_flows(table_id=self.dvr_process_table_id,
|
||||
match=ofpp.OFPMatch(
|
||||
eth_src=gateway_mac,
|
||||
eth_type=self.ether_types.ETH_TYPE_IPV6,
|
||||
|
@ -259,11 +260,11 @@ class OVSDVRProcessTestMixin(object):
|
|||
vif_mac=vif_mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=self.dvr_process_table_id,
|
||||
call.uninstall_flows(table_id=self.dvr_process_table_id,
|
||||
match=ofpp.OFPMatch(
|
||||
eth_dst=vif_mac,
|
||||
vlan_vid=vlan_tag | ofp.OFPVID_PRESENT)),
|
||||
call.delete_flows(table_id=self.dvr_process_table_id,
|
||||
call.uninstall_flows(table_id=self.dvr_process_table_id,
|
||||
match=ofpp.OFPMatch(
|
||||
eth_src=vif_mac,
|
||||
vlan_vid=vlan_tag | ofp.OFPVID_PRESENT)),
|
||||
|
|
|
@ -116,7 +116,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
self.br.reclaim_local_vlan(port=port, segmentation_id=segmentation_id)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(
|
||||
call.uninstall_flows(
|
||||
match=ofpp.OFPMatch(
|
||||
in_port=port,
|
||||
vlan_vid=segmentation_id | ofp.OFPVID_PRESENT)),
|
||||
|
@ -129,7 +129,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
self.br.reclaim_local_vlan(port=port, segmentation_id=segmentation_id)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(
|
||||
call.uninstall_flows(
|
||||
match=ofpp.OFPMatch(
|
||||
in_port=port,
|
||||
vlan_vid=ofp.OFPVID_NONE)),
|
||||
|
@ -175,7 +175,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
dst_mac=dst_mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=1,
|
||||
call.uninstall_flows(table_id=1,
|
||||
match=ofpp.OFPMatch(
|
||||
eth_dst=dst_mac,
|
||||
vlan_vid=vlan_tag | ofp.OFPVID_PRESENT)),
|
||||
|
@ -221,7 +221,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
dst_mac=dst_mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=2,
|
||||
call.uninstall_flows(table_id=2,
|
||||
match=ofpp.OFPMatch(
|
||||
eth_dst=dst_mac,
|
||||
vlan_vid=vlan_tag | ofp.OFPVID_PRESENT)),
|
||||
|
@ -252,7 +252,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
self.br.remove_dvr_mac_vlan(mac=mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, table_id=0),
|
||||
call.uninstall_flows(eth_src=mac, table_id=0),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
||||
|
@ -280,7 +280,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
port = 8888
|
||||
self.br.remove_dvr_mac_tun(mac=mac, port=port)
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, in_port=port, table_id=0),
|
||||
call.uninstall_flows(eth_src=mac, in_port=port, table_id=0),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
||||
|
@ -387,14 +387,14 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
self.br.delete_arp_spoofing_protection(port)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=0, match=ofpp.OFPMatch(
|
||||
call.uninstall_flows(table_id=0, match=ofpp.OFPMatch(
|
||||
eth_type=self.ether_types.ETH_TYPE_ARP,
|
||||
in_port=8888)),
|
||||
call.delete_flows(table_id=0, match=ofpp.OFPMatch(
|
||||
call.uninstall_flows(table_id=0, match=ofpp.OFPMatch(
|
||||
eth_type=self.ether_types.ETH_TYPE_IPV6,
|
||||
icmpv6_type=self.icmpv6.ND_NEIGHBOR_ADVERT,
|
||||
in_port=8888,
|
||||
ip_proto=self.in_proto.IPPROTO_ICMPV6)),
|
||||
call.delete_flows(table_id=24, in_port=port),
|
||||
call.uninstall_flows(table_id=24, in_port=port),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
|
|
@ -115,7 +115,7 @@ class OVSPhysicalBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.reclaim_local_vlan(port=port, lvid=lvid)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(
|
||||
call.uninstall_flows(
|
||||
match=ofpp.OFPMatch(
|
||||
in_port=port,
|
||||
vlan_vid=lvid | ofp.OFPVID_PRESENT)),
|
||||
|
@ -146,6 +146,6 @@ class OVSPhysicalBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.remove_dvr_mac_vlan(mac=mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, table_id=3),
|
||||
call.uninstall_flows(eth_src=mac, table_id=3),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
|
|
@ -291,7 +291,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
segmentation_id=segmentation_id)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(
|
||||
call.uninstall_flows(
|
||||
table_id=4,
|
||||
match=ofpp.OFPMatch(tunnel_id=segmentation_id)),
|
||||
]
|
||||
|
@ -325,7 +325,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.delete_flood_to_tun(vlan=vlan)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=22,
|
||||
call.uninstall_flows(table_id=22,
|
||||
match=ofpp.OFPMatch(vlan_vid=vlan | ofp.OFPVID_PRESENT)),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
@ -363,7 +363,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.delete_unicast_to_tun(vlan=vlan, mac=mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=20,
|
||||
call.uninstall_flows(table_id=20,
|
||||
match=ofpp.OFPMatch(
|
||||
eth_dst=mac, vlan_vid=vlan | ofp.OFPVID_PRESENT)),
|
||||
]
|
||||
|
@ -375,7 +375,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.delete_unicast_to_tun(vlan=vlan, mac=mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(table_id=20,
|
||||
call.uninstall_flows(table_id=20,
|
||||
match=ofpp.OFPMatch(vlan_vid=vlan | ofp.OFPVID_PRESENT)),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
@ -424,7 +424,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.delete_arp_responder(vlan=vlan, ip=ip)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(
|
||||
call.uninstall_flows(
|
||||
match=ofpp.OFPMatch(
|
||||
eth_type=self.ether_types.ETH_TYPE_ARP,
|
||||
arp_tpa=ip,
|
||||
|
@ -439,7 +439,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.delete_arp_responder(vlan=vlan, ip=ip)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(
|
||||
call.uninstall_flows(
|
||||
match=ofpp.OFPMatch(
|
||||
eth_type=self.ether_types.ETH_TYPE_ARP,
|
||||
vlan_vid=vlan | ofp.OFPVID_PRESENT),
|
||||
|
@ -469,7 +469,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.cleanup_tunnel_port(port=port)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(in_port=port),
|
||||
call.uninstall_flows(in_port=port),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
||||
|
@ -497,6 +497,6 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
self.br.remove_dvr_mac_tun(mac=mac)
|
||||
(dp, ofp, ofpp) = self._get_dp()
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, table_id=9),
|
||||
call.uninstall_flows(eth_src=mac, table_id=9),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
|
|
@ -165,7 +165,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
mac = '00:02:b3:13:fe:3d'
|
||||
self.br.remove_dvr_mac_vlan(mac=mac)
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, table_id=0),
|
||||
call.delete_flows(dl_src=mac, table=0),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
||||
|
@ -184,7 +184,7 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
port = 8888
|
||||
self.br.remove_dvr_mac_tun(mac=mac, port=port)
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, table_id=0, in_port=port),
|
||||
call.delete_flows(dl_src=mac, table=0, in_port=port),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
||||
|
@ -231,10 +231,10 @@ class OVSIntegrationBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase):
|
|||
port = 8888
|
||||
self.br.delete_arp_spoofing_protection(port)
|
||||
expected = [
|
||||
call.delete_flows(table_id=0, in_port=8888, proto='arp'),
|
||||
call.delete_flows(table_id=0, in_port=8888,
|
||||
call.delete_flows(table=0, in_port=8888, proto='arp'),
|
||||
call.delete_flows(table=0, in_port=8888,
|
||||
icmp_type=const.ICMPV6_TYPE_NA,
|
||||
nw_proto=const.PROTO_NUM_IPV6_ICMP),
|
||||
call.delete_flows(table_id=24, in_port=8888),
|
||||
call.delete_flows(table=24, in_port=8888),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
|
|
@ -92,6 +92,6 @@ class OVSPhysicalBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
mac = '00:02:b3:13:fe:3d'
|
||||
self.br.remove_dvr_mac_vlan(mac=mac)
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, table_id=3),
|
||||
call.delete_flows(dl_src=mac, table=3),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
|
|
@ -264,7 +264,7 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
|
|||
mac = '00:02:b3:13:fe:3d'
|
||||
self.br.remove_dvr_mac_tun(mac=mac)
|
||||
expected = [
|
||||
call.delete_flows(eth_src=mac, table_id=9),
|
||||
call.delete_flows(dl_src=mac, table=9),
|
||||
]
|
||||
self.assertEqual(expected, self.mock.mock_calls)
|
||||
|
||||
|
|
|
@ -1389,7 +1389,7 @@ class TestOvsNeutronAgent(object):
|
|||
mock.patch.object(self.agent, 'patch_tun_ofport', new=2),\
|
||||
mock.patch.object(self.agent, 'patch_int_ofport', new=2),\
|
||||
mock.patch.object(self.agent.tun_br,
|
||||
'delete_flows') as delete,\
|
||||
'uninstall_flows') as delete,\
|
||||
mock.patch.object(self.agent.int_br,
|
||||
"add_patch_port") as int_patch_port,\
|
||||
mock.patch.object(self.agent.tun_br,
|
||||
|
@ -1454,7 +1454,7 @@ class TestOvsNeutronAgent(object):
|
|||
fdb_entry = {'net3': {}}
|
||||
with mock.patch.object(self.agent.tun_br, 'add_flow') as add_flow_fn,\
|
||||
mock.patch.object(self.agent.tun_br,
|
||||
'delete_flows') as del_flow_fn,\
|
||||
'uninstall_flows') as del_flow_fn,\
|
||||
mock.patch.object(self.agent,
|
||||
'_setup_tunnel_port') as add_tun_fn,\
|
||||
mock.patch.object(self.agent,
|
||||
|
@ -1592,11 +1592,11 @@ class TestOvsNeutronAgent(object):
|
|||
lvm.tun_ofports = set(['1', '2'])
|
||||
with mock.patch.object(self.agent.tun_br, 'mod_flow') as mod_flow_fn,\
|
||||
mock.patch.object(self.agent.tun_br,
|
||||
'delete_flows') as delete_flows_fn:
|
||||
'uninstall_flows') as uninstall_flows_fn:
|
||||
self.agent.del_fdb_flow(self.agent.tun_br, n_const.FLOODING_ENTRY,
|
||||
'1.1.1.1', lvm, '3')
|
||||
self.assertFalse(mod_flow_fn.called)
|
||||
self.assertFalse(delete_flows_fn.called)
|
||||
self.assertFalse(uninstall_flows_fn.called)
|
||||
|
||||
def test_recl_lv_port_to_preserve(self):
|
||||
self._prepare_l2_pop_ofports()
|
||||
|
@ -2062,7 +2062,8 @@ class TestOvsNeutronAgent(object):
|
|||
expected = [
|
||||
mock.call(in_port=1)
|
||||
]
|
||||
self.assertEqual(expected, self.agent.int_br.delete_flows.mock_calls)
|
||||
self.assertEqual(expected,
|
||||
self.agent.int_br.uninstall_flows.mock_calls)
|
||||
self.assertEqual(newmap, self.agent.vifname_to_ofport_map)
|
||||
self.assertFalse(
|
||||
self.agent.int_br.delete_arp_spoofing_protection.called)
|
||||
|
@ -2126,9 +2127,9 @@ class TestOvsNeutronAgentRyu(TestOvsNeutronAgent,
|
|||
def test_cleanup_stale_flows(self):
|
||||
uint64_max = (1 << 64) - 1
|
||||
with mock.patch.object(self.agent.int_br,
|
||||
'dump_flows') as dump_flows,\
|
||||
'dump_flows') as dump_flows,\
|
||||
mock.patch.object(self.agent.int_br,
|
||||
'delete_flows') as del_flow:
|
||||
'uninstall_flows') as uninstall_flows:
|
||||
self.agent.int_br.set_agent_uuid_stamp(1234)
|
||||
dump_flows.return_value = [
|
||||
# mock ryu.ofproto.ofproto_v1_3_parser.OFPFlowStats
|
||||
|
@ -2143,8 +2144,8 @@ class TestOvsNeutronAgentRyu(TestOvsNeutronAgent,
|
|||
cookie_mask=uint64_max),
|
||||
mock.call(cookie=9029,
|
||||
cookie_mask=uint64_max)]
|
||||
del_flow.assert_has_calls(expected, any_order=True)
|
||||
self.assertEqual(len(expected), len(del_flow.mock_calls))
|
||||
uninstall_flows.assert_has_calls(expected, any_order=True)
|
||||
self.assertEqual(len(expected), len(uninstall_flows.mock_calls))
|
||||
|
||||
|
||||
class AncillaryBridgesTest(object):
|
||||
|
|
Loading…
Reference in New Issue