Major overhaul of oftest command interface
Added tests/oft as top level executable
Support command line options for many config params
Use logging module for output
Got rid of oft_config.py; consolidate configuration in
oft (top level script) and pass around as a dictionary
Add oft_assert.py (the one useful piece of oft_config that
remained).
diff --git a/src/python/oftest/parse.py b/src/python/oftest/parse.py
index af1faed..018b70b 100644
--- a/src/python/oftest/parse.py
+++ b/src/python/oftest/parse.py
@@ -12,7 +12,6 @@
from scapy.all import *
except:
sys.exit("Need to install scapy for packet parsing")
-import oft_config
"""
of_message.py
@@ -21,10 +20,8 @@
function information into the of_message namespace
"""
-parse_debug_level = oft_config.DEBUG_VERBOSE
-
-def dbg(self, level, string):
- debug_log("PARSE", parse_debug_level, level, string)
+parse_logger = logging.getLogger("parse")
+#parse_logger.setLevel(logging.DEBUG)
# These message types are subclassed
msg_type_subclassed = [
@@ -119,7 +116,7 @@
sub_hdr.unpack(binary_string[OFP_HEADER_BYTES:])
return error_to_class_map[sub_hdr.type]()
else:
- dbg(oft_config.DEBUG_ERROR, "Cannot parse pkt to message")
+ parse_logger.error("Cannot parse pkt to message")
return None
def of_message_parse(binary_string, raw=False):
@@ -138,7 +135,7 @@
"""
if raw:
- dbg(oft_config.DEBUG_ERROR, "raw packet message parsing not supported")
+ parse_logger.error("raw packet message parsing not supported")
return None
obj = _of_message_to_object(binary_string)
@@ -162,7 +159,7 @@
"""
if raw:
- dbg(oft_config.DEBUG_ERROR, "raw packet message parsing not supported")
+ parse_logger.error("raw packet message parsing not supported")
return None
hdr = ofp_header()
@@ -261,7 +258,7 @@
#@todo check min length of packet
if pkt_format.upper() != "L2":
- dbg(oft_config.DEBUG_ERROR, "Only L2 supported for packet_to_flow")
+ parse_logger.error("Only L2 supported for packet_to_flow")
return None
ether = scapy.all.Ether(packet)