Merge into master from pull request #116:
oft: Add 'disable-ipv6' option (https://github.com/floodlight/oftest/pull/116)
diff --git a/oft b/oft
index 8a7272b..4ef82eb 100755
--- a/oft
+++ b/oft
@@ -85,6 +85,7 @@
"default_timeout" : 2,
"minsize" : 0,
"random_seed" : None,
+ "disable_ipv6" : False,
# Other configuration
"port_map" : {},
@@ -194,6 +195,8 @@
help="Minimum allowable packet size on the dataplane.")
group.add_option("--random-seed", type="int",
help="Random number generator seed")
+ group.add_option("--disable-ipv6", action="store_true",
+ help="Disable IPv6 tests")
parser.add_option_group(group)
# Might need this if other parsers want command line
diff --git a/src/python/oftest/packet.py b/src/python/oftest/packet.py
index 9631e02..1ed100f 100644
--- a/src/python/oftest/packet.py
+++ b/src/python/oftest/packet.py
@@ -4,15 +4,17 @@
"""
Wrap scapy to satisfy pylint
"""
+from oftest import config
import sys
try:
import scapy.config
import scapy.route
- import scapy.route6
import scapy.layers.l2
import scapy.layers.inet
- import scapy.layers.inet6
+ if not config["disable_ipv6"]:
+ import scapy.route6
+ import scapy.layers.inet6
except ImportError:
sys.exit("Need to install scapy for packet parsing")
@@ -22,10 +24,12 @@
Dot1Q = scapy.layers.l2.Dot1Q
IP = scapy.layers.inet.IP
IPOption = scapy.layers.inet.IPOption
-IPv6 = scapy.layers.inet6.IPv6
ARP = scapy.layers.inet.ARP
TCP = scapy.layers.inet.TCP
UDP = scapy.layers.inet.UDP
ICMP = scapy.layers.inet.ICMP
-ICMPv6Unknown = scapy.layers.inet6.ICMPv6Unknown
-ICMPv6EchoRequest = scapy.layers.inet6.ICMPv6EchoRequest
+
+if not config["disable_ipv6"]:
+ IPv6 = scapy.layers.inet6.IPv6
+ ICMPv6Unknown = scapy.layers.inet6.ICMPv6Unknown
+ ICMPv6EchoRequest = scapy.layers.inet6.ICMPv6EchoRequest