edited
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index ad00246..9e3fea6 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -1,4 +1,4 @@
-""" Defined Some common functions used by Conformance tests -- OF-SWITCH 1.0.0 Testcases """
+""" Some common function definitions used by Conformance tests -- OF-SWITCH 1.0.0 Testcases """
import sys
import copy
@@ -104,11 +104,11 @@
return (pkt_wildcardsrc,match1)
-def match_wthernet_src_address(self,of_ports,priority=None):
+def match_ethernet_src_address(self,of_ports,priority=None):
#Generate Match_Ethernet_SrC_Address flow
#Create a simple tcp packet and generate match on ethernet src address flow
- pkt_MatchSrc = simple_tcp_packet(dl_src='00:01:01:01:01:01')
+ pkt_MatchSrc = simple_eth_packet(dl_src='00:01:01:01:01:01')
match = parse.packet_to_flow_match(pkt_MatchSrc)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
@@ -136,7 +136,7 @@
#Generate Match_Ethernet_Dst_Address flow
#Create a simple tcp packet and generate match on ethernet dst address flow
- pkt_matchdst = simple_tcp_packet(dl_dst='00:01:01:01:01:01')
+ pkt_matchdst = simple_eth_packet(dl_dst='00:01:01:01:01:01')
match = parse.packet_to_flow_match(pkt_matchdst)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
@@ -254,8 +254,6 @@
return (pkt_matchingress,match3)
-
-
def match_vlan_id(self,of_ports,priority=None):
#Generate Match_Vlan_Id
@@ -264,7 +262,7 @@
match = parse.packet_to_flow_match(pkt_matchvlanid)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
- match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_DL_VLAN
+ match.wildcards = ofp.OFPFW_ALL^ofp.OFPFW_DL_TYPE ^ofp.OFPFW_DL_VLAN
msg = message.flow_mod()
msg.out_port = ofp.OFPP_NONE
msg.command = ofp.OFPFC_ADD
@@ -291,7 +289,7 @@
match = parse.packet_to_flow_match(pkt_matchvlanpcp)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
- match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_DL_VLAN_PCP
+ match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_DL_TYPE^ofp.OFPFW_DL_VLAN^ofp.OFPFW_DL_VLAN_PCP
msg = message.flow_mod()
msg.out_port = ofp.OFPP_NONE
msg.command = ofp.OFPFC_ADD
@@ -339,14 +337,14 @@
return (pkt_mulL2,match)
-def match_mul_L4(self,of_ports,priority=None):
+def match_mul_l4(self,of_ports,priority=None):
#Generate Match_Mul_L4 flow
#Create a simple tcp packet and generate match on tcp protocol flow
pkt_mulL4 = simple_tcp_packet(tcp_sport=111,tcp_dport=112)
match = parse.packet_to_flow_match(pkt_mulL4)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
- match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_TP_SRC ^ofp.OFPFW_TP_DST
+ match.wildcards = ofp.OFPFW_ALL^ofp.OFPFW_DL_TYPE ^ofp.OFPFW_NW_PROTO^ofp.OFPFW_TP_SRC ^ofp.OFPFW_TP_DST
msg = message.flow_mod()
msg.out_port = ofp.OFPP_NONE
msg.command = ofp.OFPFC_ADD
@@ -369,11 +367,11 @@
#Generate a Match on IP Type of service flow
#Create a simple tcp packet and generate match on Type of service
- pkt_iptos = simple_tcp_packet(ip_tos=3)
+ pkt_iptos = simple_tcp_packet(ip_tos=30)
match = parse.packet_to_flow_match(pkt_iptos)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
- match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_NW_TOS
+ match.wildcards = ofp.OFPFW_ALL^ofp.OFPFW_DL_TYPE^ofp.OFPFW_NW_PROTO ^ofp.OFPFW_NW_TOS
msg = message.flow_mod()
msg.out_port = ofp.OFPP_NONE
msg.command = ofp.OFPFC_ADD
@@ -391,6 +389,33 @@
return (pkt_iptos,match)
+def match_ip_protocol(self,of_ports,priority=None):
+ #Generate a Match on IP Protocol
+
+ #Create a simple tcp packet and generate match on Type of service
+ pkt_iptos = simple_tcp_packet()
+ match = parse.packet_to_flow_match(pkt_iptos)
+ self.assertTrue(match is not None, "Could not generate flow match from pkt")
+
+ match.wildcards = ofp.OFPFW_ALL^ofp.OFPFW_DL_TYPE^ofp.OFPFW_NW_PROTO
+ msg = message.flow_mod()
+ msg.out_port = ofp.OFPP_NONE
+ msg.command = ofp.OFPFC_ADD
+ msg.buffer_id = 0xffffffff
+ msg.match = match
+ if priority != None :
+ msg.priority = priority
+ act = action.action_output()
+ act.port = of_ports[1]
+ self.assertTrue(msg.actions.add(act), "could not add action")
+
+ rv = self.controller.message_send(msg)
+ self.assertTrue(rv != -1, "Error installing flow mod")
+ self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
+
+ return (pkt_iptos,match)
+
+
def match_tcp_src(self,of_ports,priority=None):
#Generate Match_Tcp_Src
@@ -399,7 +424,7 @@
match = parse.packet_to_flow_match(pkt_matchtSrc)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
- match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_TP_SRC
+ match.wildcards = ofp.OFPFW_ALL^ofp.OFPFW_DL_TYPE ^ofp.OFPFW_NW_PROTO ^ofp.OFPFW_TP_SRC
msg = message.flow_mod()
msg.out_port = ofp.OFPP_NONE
msg.command = ofp.OFPFC_ADD
@@ -422,11 +447,11 @@
#Generate Match_Tcp_Dst
#Create a simple tcp packet and generate match on tcp destination port flow
- pkt_Matchtdst = simple_tcp_packet(tcp_dport=112)
- match = parse.packet_to_flow_match(pkt_matchtdst)
+ pkt_matchdst = simple_tcp_packet(tcp_dport=112)
+ match = parse.packet_to_flow_match(pkt_matchdst)
self.assertTrue(match is not None, "Could not generate flow match from pkt")
- match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_TP_DST
+ match.wildcards = ofp.OFPFW_ALL ^ofp.OFPFW_DL_TYPE^ofp.OFPFW_NW_PROTO^ofp.OFPFW_TP_DST
msg = message.flow_mod()
msg.out_port = ofp.OFPP_NONE
msg.command = ofp.OFPFC_ADD
@@ -442,11 +467,7 @@
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- return (pkt_matchtdst,match)
-
-
-
-
+ return (pkt_matchdst,match)
def match_ethernet_type(self,of_ports,priority=None):
#Generate a Match_Ethernet_Type flow
@@ -472,11 +493,11 @@
rv = self.controller.message_send(msg)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
-
return (pkt_matchtype,match)
+
def strict_modify_flow_action(self,egress_port,match,priority=None):
# Strict Modify the flow Action
@@ -546,8 +567,6 @@
return (pkt,match)
-
-
########################### Verify Stats Functions ###########################################################################################
def get_flowstats(self,match):
# Generate flow_stats request
@@ -768,7 +787,6 @@
self.assertEqual(tx_byte,item.tx_bytes,"tx_bytes counter is not incremented correctly")
-
def verify_queuestats(self,port_num,queue_id,expect_packet=None,expect_byte=None):
# Verify queue counters : tx_packets and tx_bytes