use the singleton logger object
There was no need for each test file to have its own logger.
diff --git a/tests/bsn_ipmask.py b/tests/bsn_ipmask.py
index 489b980..6a4d389 100644
--- a/tests/bsn_ipmask.py
+++ b/tests/bsn_ipmask.py
@@ -14,8 +14,6 @@
#@var port_map Local copy of the configuration map from OF port
# numbers to OS interfaces
im_port_map = None
-#@var im_logger Local logger object
-im_logger = None
#@var im_config Local copy of global configuration data
im_config = None
@@ -27,11 +25,8 @@
basic.test_set_init(config)
global im_port_map
- global im_logger
global im_config
- im_logger = logging.getLogger("ipmask")
- im_logger.info("Initializing test set")
im_port_map = config["port_map"]
im_config = config
@@ -68,7 +63,7 @@
Use the BSN_SET_IP_MASK vendor command to change the IP mask for the
given wildcard index
"""
- im_logger.info("Setting index %d to mask is %s" % (index, mask))
+ logging.info("Setting index %d to mask is %s" % (index, mask))
m = message.vendor()
m.vendor = 0x005c16c7
m.data = struct.pack("!LBBBBL", 0, index, 0, 0, 0, mask)
@@ -99,34 +94,34 @@
"IP src must be wildcarded")
for index in range(0, 64):
mask = self.bsn_get_ip_mask(index)
- im_logger.info("Index %d mask is %s" %
+ logging.info("Index %d mask is %s" %
(index, scapy.utils.ltoa(mask)))
self.assertEqual(mask, normal_ip_mask(index), "Unexpected IP mask")
for index in range(0, 64):
mask = normal_ip_mask(index)
if mask == 0:
- im_logger.info("Skipping IP wildcard index %d" % index)
+ logging.info("Skipping IP wildcard index %d" % index)
else:
- im_logger.info("Testing IP wildcard index %d" % index)
+ logging.info("Testing IP wildcard index %d" % index)
self.check_ip_mask(True, index, mask)
self.check_ip_mask(False, index, mask)
- im_logger.info("Setting fancy IP masks")
+ logging.info("Setting fancy IP masks")
for index in range(0, 64):
self.bsn_set_ip_mask(index, fancy_ip_mask(index))
for index in range(0, 64):
mask = self.bsn_get_ip_mask(index)
- im_logger.info("Index %d mask is %s" %
+ logging.info("Index %d mask is %s" %
(index, scapy.utils.ltoa(mask)))
self.assertEqual(mask, fancy_ip_mask(index), "Unexpected IP mask")
for index in range(0, 64):
mask = fancy_ip_mask(index)
if mask == 0:
- im_logger.info("Skipping IP wildcard index %d" % index)
+ logging.info("Skipping IP wildcard index %d" % index)
else:
- im_logger.info("Testing IP wildcard index %d" % index)
+ logging.info("Testing IP wildcard index %d" % index)
self.check_ip_mask(True, index, mask)
self.check_ip_mask(False, index, mask)
@@ -156,7 +151,7 @@
pkt1 = simple_tcp_packet(ip_src=ip1)
pkt2 = simple_tcp_packet(ip_src=ip2)
pkt3 = simple_tcp_packet(ip_src=ip3)
- msg = lambda ip: im_logger.info("Testing source IP %s" % ip)
+ msg = lambda ip: logging.info("Testing source IP %s" % ip)
else:
wildcards = ((ofp.OFPFW_ALL ^ ofp.OFPFW_DL_TYPE ^ ofp.OFPFW_NW_DST_MASK)
| (index << ofp.OFPFW_NW_DST_SHIFT))
@@ -164,9 +159,9 @@
pkt1 = simple_tcp_packet(ip_dst=ip1)
pkt2 = simple_tcp_packet(ip_dst=ip2)
pkt3 = simple_tcp_packet(ip_dst=ip3)
- msg = lambda ip: im_logger.info("Testing dest IP %s" % ip)
+ msg = lambda ip: logging.info("Testing dest IP %s" % ip)
- rc = delete_all_flows(self.controller, im_logger)
+ rc = delete_all_flows(self.controller)
self.assertEqual(rc, 0, "Failed to delete all flows")
rc = self.controller.message_send(flow_msg_create(