Added option "--minsize"
The 'minsize' parameter specifies the minimum allowable packet size on the dataplane.
All test packet sizes use this as the floor.
The default is 0.
diff --git a/tests/oft b/tests/oft
index 7229920..ce6e4ce 100755
--- a/tests/oft
+++ b/tests/oft
@@ -184,6 +184,7 @@
"allow_user" : False,
"fail_skipped" : False,
"default_timeout" : 2,
+ "minsize" : 0,
}
# Default test priority
@@ -277,6 +278,10 @@
help="Return failure if any test was skipped")
parser.add_option("--default-timeout", type="int",
help="Timeout in seconds for most operations")
+ parser.add_option("--minsize", type="int",
+ help="Minimum allowable packet size on the dataplane.",
+ default=0)
+
# Might need this if other parsers want command line
# parser.allow_interspersed_args = False
(options, args) = parser.parse_args()
@@ -581,6 +586,7 @@
_verb = 2
oftest.ofutils.default_timeout = config["default_timeout"]
+testutils.MINSIZE = config['minsize']
if os.getuid() != 0 and not config["allow_user"]:
print "ERROR: Super-user privileges required. Please re-run with " \
diff --git a/tests/testutils.py b/tests/testutils.py
index 9b9940e..daa8ce1 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -27,6 +27,8 @@
TCP_PROTOCOL = 0x6
UDP_PROTOCOL = 0x11
+MINSIZE = 0
+
def clear_switch(parent, port_list, logger):
"""
Clear the switch configuration
@@ -97,6 +99,10 @@
shouldn't assume anything about this packet other than that
it is a valid ethernet/IP/TCP frame.
"""
+
+ if MINSIZE > pktlen:
+ pktlen = MINSIZE
+
# Note Dot1Q.id is really CFI
if (dl_vlan_enable):
pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
@@ -144,6 +150,10 @@
shouldn't assume anything about this packet other than that
it is a valid ethernet/ICMP frame.
"""
+
+ if MINSIZE > pktlen:
+ pktlen = MINSIZE
+
if (dl_vlan_enable):
pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
scapy.Dot1Q(prio=dl_vlan_pcp, id=0, vlan=dl_vlan)/ \
@@ -162,6 +172,10 @@
dl_dst='00:01:02:03:04:05',
dl_src='01:80:c2:00:00:00',
dl_type=0x88cc):
+
+ if MINSIZE > pktlen:
+ pktlen = MINSIZE
+
pkt = scapy.Ether(dst=dl_dst, src=dl_src, type=dl_type)
pkt = pkt/("0" * (pktlen - len(pkt)))