Add tests to verify match on ARP sender and target IPs
diff --git a/tests/flow_matches.py b/tests/flow_matches.py
index 592d7c3..9d04093 100644
--- a/tests/flow_matches.py
+++ b/tests/flow_matches.py
@@ -679,6 +679,83 @@
self.assertTrue(response is not None, "PacketIn not received for non matching packet")
+class ArpSenderIP(base_tests.SimpleDataPlane):
+
+ """"Verify match on single Header Field -- Arp Protocol"""
+
+ def runTest(self):
+
+ logging.info("Running Arp Protocol test")
+
+ of_ports = config["port_map"].keys()
+ of_ports.sort()
+ self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+ #Clear Switch State
+ delete_all_flows(self.controller)
+
+ egress_port=of_ports[1]
+ no_ports=set(of_ports).difference([egress_port])
+ yes_ports = of_ports[1]
+
+ logging.info("Inserting a flow with match on Arp Protocol ")
+ logging.info("Sending matching and non-matching arp packets")
+ logging.info("Verifying only matching packets implements the action specified in the flow")
+
+ #Create a flow matching on ARP sender IP
+ (pkt,match) = match_arp_sender(self,of_ports)
+
+ #Send Packet matching the flow
+ self.dataplane.send(of_ports[0], str(pkt))
+
+ #Verify packet implements the action specified in the flow
+ receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
+
+ #Create a non-matching packet , verify packet_in get generated
+ pkt2 = simple_arp_packet(ip_snd="10.10.0.10");
+ self.dataplane.send(of_ports[0], str(pkt2))
+ (response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN,timeout=4)
+ self.assertTrue(response is not None, "PacketIn not received for non matching packet")
+
+class ArpTargetIP(base_tests.SimpleDataPlane):
+
+ """"Verify match on single Header Field -- Arp Protocol"""
+
+ def runTest(self):
+
+ logging.info("Running Arp Protocol test")
+
+ of_ports = config["port_map"].keys()
+ of_ports.sort()
+ self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
+
+ #Clear Switch State
+ delete_all_flows(self.controller)
+
+ egress_port=of_ports[1]
+ no_ports=set(of_ports).difference([egress_port])
+ yes_ports = of_ports[1]
+
+ logging.info("Inserting a flow with match on Arp Protocol ")
+ logging.info("Sending matching and non-matching arp packets")
+ logging.info("Verifying only matching packets implements the action specified in the flow")
+
+ #Create a flow matching on ARP target IP
+ (pkt,match) = match_arp_target(self,of_ports)
+
+ #Send Packet matching the flow
+ self.dataplane.send(of_ports[0], str(pkt))
+
+ #Verify packet implements the action specified in the flow
+ receive_pkt_check(self.dataplane,pkt,[yes_ports],no_ports,self)
+
+ #Create a non-matching packet , verify packet_in get generated
+ pkt2 = simple_arp_packet(ip_tgt="10.10.0.10");
+ self.dataplane.send(of_ports[0], str(pkt2))
+ (response, raw) = self.controller.poll(ofp.OFPT_PACKET_IN,timeout=4)
+ self.assertTrue(response is not None, "PacketIn not received for non matching packet")
+
+
class ExactMatch(base_tests.SimpleDataPlane):
"""Verify match on Single header field -- Exact Match """