use the singleton logger object
There was no need for each test file to have its own logger.
diff --git a/tests/pktact.py b/tests/pktact.py
index fd1b014..ef7505e 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -35,8 +35,6 @@
#@var port_map Local copy of the configuration map from OF port
# numbers to OS interfaces
pa_port_map = None
-#@var pa_logger Local logger object
-pa_logger = None
#@var pa_config Local copy of global configuration data
pa_config = None
@@ -100,11 +98,8 @@
basic.test_set_init(config)
global pa_port_map
- global pa_logger
global pa_config
- pa_logger = logging.getLogger("pkt_act")
- pa_logger.info("Initializing test set")
pa_port_map = config["port_map"]
pa_config = config
@@ -137,12 +132,12 @@
act = action.action_output()
for idx in range(len(of_ports)):
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
ingress_port = of_ports[idx]
egress_port = of_ports[(idx + 1) % len(of_ports)]
- pa_logger.info("Ingress " + str(ingress_port) +
+ logging.info("Ingress " + str(ingress_port) +
" to egress " + str(egress_port))
match.in_port = ingress_port
@@ -154,12 +149,12 @@
act.port = egress_port
self.assertTrue(request.actions.add(act), "Could not add action")
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " +
+ logging.info("Sending packet to dp port " +
str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
@@ -172,7 +167,7 @@
(rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(port_number=exp_port,
exp_pkt=exp_pkt_arg)
self.assertTrue(rcv_pkt is not None, "Did not receive packet")
- pa_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " +
+ logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " +
str(rcv_port))
self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
self.assertEqual(str(pkt), str(rcv_pkt),
@@ -206,7 +201,7 @@
"Could not generate flow match from pkt")
act = action.action_output()
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
ingress_port = of_ports[0]
@@ -220,12 +215,12 @@
act.max_len = 65535
self.assertTrue(request.actions.add(act), "Could not add action")
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " +
+ logging.info("Sending packet to dp port " +
str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
@@ -234,8 +229,8 @@
self.assertTrue(response is not None,
'Packet in message not received by controller')
if not dataplane.match_exp_pkt(pkt, response.data):
- pa_logger.debug("Sent %s" % format_packet(pkt))
- pa_logger.debug("Resp %s" % format_packet(response.data))
+ logging.debug("Sent %s" % format_packet(pkt))
+ logging.debug("Resp %s" % format_packet(response.data))
self.assertTrue(False,
'Response packet does not match send packet' +
' for controller port')
@@ -291,12 +286,12 @@
egress_port = of_ports[(idx + 1) % len(of_ports)]
for egress_queue_id in self.portQueuesGet(queue_stats, egress_port):
- pa_logger.info("Ingress " + str(ingress_port)
+ logging.info("Ingress " + str(ingress_port)
+ " to egress " + str(egress_port)
+ " queue " + str(egress_queue_id)
)
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
match.in_port = ingress_port
@@ -309,7 +304,7 @@
act.queue_id = egress_queue_id
self.assertTrue(request.actions.add(act), "Could not add action")
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -322,7 +317,7 @@
(qs_before, p) = self.controller.transact(request)
self.assertNotEqual(qs_before, None, "Queue stats request failed")
- pa_logger.info("Sending packet to dp port " +
+ logging.info("Sending packet to dp port " +
str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
@@ -335,7 +330,7 @@
(rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(port_number=exp_port,
exp_pkt=exp_pkt_arg)
self.assertTrue(rcv_pkt is not None, "Did not receive packet")
- pa_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " +
+ logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " +
str(rcv_port))
self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
self.assertEqual(str(pkt), str(rcv_pkt),
@@ -414,17 +409,17 @@
ingress_port = of_ports[idx]
egress_port = ofp.OFPP_CONTROLLER
- pa_logger.info("Ingress port " + str(ingress_port)
+ logging.info("Ingress port " + str(ingress_port)
+ ", controller port queues "
+ str(self.portQueuesGet(queue_stats, egress_port)))
for egress_queue_id in self.portQueuesGet(queue_stats, egress_port):
- pa_logger.info("Ingress " + str(ingress_port)
+ logging.info("Ingress " + str(ingress_port)
+ " to egress " + str(egress_port)
+ " queue " + str(egress_queue_id)
)
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
match.in_port = ingress_port
@@ -437,7 +432,7 @@
act.queue_id = egress_queue_id
self.assertTrue(request.actions.add(act), "Could not add action")
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -450,7 +445,7 @@
(qs_before, p) = self.controller.transact(request)
self.assertNotEqual(qs_before, None, "Queue stats request failed")
- pa_logger.info("Sending packet to dp port " +
+ logging.info("Sending packet to dp port " +
str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
@@ -472,8 +467,8 @@
self.assertTrue(response is not None,
'Packet in message not received by controller')
if not dataplane.match_exp_pkt(pkt, response.data):
- basic_logger.debug("Sent %s" % format_packet(pkt))
- basic_logger.debug("Resp %s" % format_packet(response.data))
+ logging.debug("Sent %s" % format_packet(pkt))
+ logging.debug("Resp %s" % format_packet(response.data))
self.assertTrue(False,
'Response packet does not match send packet' +
' for controller port')
@@ -537,13 +532,13 @@
act = action.action_output()
for idx in range(len(of_ports)):
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
ingress_port = of_ports[idx]
egress_port1 = of_ports[(idx + 1) % len(of_ports)]
egress_port2 = of_ports[(idx + 2) % len(of_ports)]
- pa_logger.info("Ingress " + str(ingress_port) +
+ logging.info("Ingress " + str(ingress_port) +
" to egress " + str(egress_port1) + " and " +
str(egress_port2))
@@ -556,21 +551,21 @@
self.assertTrue(request.actions.add(act), "Could not add action1")
act.port = egress_port2
self.assertTrue(request.actions.add(act), "Could not add action2")
- # pa_logger.info(request.show())
+ # logging.info(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " +
+ logging.info("Sending packet to dp port " +
str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
yes_ports = set([egress_port1, egress_port2])
no_ports = set(of_ports).difference(yes_ports)
receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports,
- self, pa_logger, pa_config)
+ self, pa_config)
class DirectMCNonIngress(basic.SimpleDataPlane):
"""
@@ -597,10 +592,10 @@
act = action.action_output()
for ingress_port in of_ports:
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
- pa_logger.info("Ingress " + str(ingress_port) +
+ logging.info("Ingress " + str(ingress_port) +
" all non-ingress ports")
match.in_port = ingress_port
@@ -613,18 +608,18 @@
act.port = egress_port
self.assertTrue(request.actions.add(act),
"Could not add output to " + str(egress_port))
- pa_logger.debug(request.show())
+ logging.debug(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, pa_logger, pa_config)
+ self, pa_config)
class DirectMC(basic.SimpleDataPlane):
@@ -652,10 +647,10 @@
act = action.action_output()
for ingress_port in of_ports:
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
- pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+ logging.info("Ingress " + str(ingress_port) + " to all ports")
match.in_port = ingress_port
request = message.flow_mod()
@@ -668,17 +663,16 @@
act.port = egress_port
self.assertTrue(request.actions.add(act),
"Could not add output to " + str(egress_port))
- # pa_logger.info(request.show())
+ # logging.info(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
- receive_pkt_check(self.dataplane, pkt, of_ports, [], self,
- pa_logger, pa_config)
+ receive_pkt_check(self.dataplane, pkt, of_ports, [], self, pa_config)
class Flood(basic.SimpleDataPlane):
"""
@@ -703,10 +697,10 @@
act = action.action_output()
for ingress_port in of_ports:
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
- pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+ logging.info("Ingress " + str(ingress_port) + " to all ports")
match.in_port = ingress_port
request = message.flow_mod()
@@ -715,18 +709,18 @@
act.port = ofp.OFPP_FLOOD
self.assertTrue(request.actions.add(act),
"Could not add flood port action")
- pa_logger.info(request.show())
+ logging.info(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, pa_logger, pa_config)
+ self, pa_config)
class FloodPlusIngress(basic.SimpleDataPlane):
"""
@@ -752,10 +746,10 @@
act = action.action_output()
for ingress_port in of_ports:
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
- pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+ logging.info("Ingress " + str(ingress_port) + " to all ports")
match.in_port = ingress_port
request = message.flow_mod()
@@ -767,17 +761,16 @@
act.port = ofp.OFPP_IN_PORT
self.assertTrue(request.actions.add(act),
"Could not add ingress port for output")
- pa_logger.info(request.show())
+ logging.info(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
- receive_pkt_check(self.dataplane, pkt, of_ports, [], self,
- pa_logger, pa_config)
+ receive_pkt_check(self.dataplane, pkt, of_ports, [], self, pa_config)
class All(basic.SimpleDataPlane):
"""
@@ -802,10 +795,10 @@
act = action.action_output()
for ingress_port in of_ports:
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
- pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+ logging.info("Ingress " + str(ingress_port) + " to all ports")
match.in_port = ingress_port
request = message.flow_mod()
@@ -814,18 +807,18 @@
act.port = ofp.OFPP_ALL
self.assertTrue(request.actions.add(act),
"Could not add ALL port action")
- pa_logger.info(request.show())
+ logging.info(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
yes_ports = set(of_ports).difference([ingress_port])
receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
- self, pa_logger, pa_config)
+ self, pa_config)
class AllPlusIngress(basic.SimpleDataPlane):
"""
@@ -851,10 +844,10 @@
act = action.action_output()
for ingress_port in of_ports:
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
- pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+ logging.info("Ingress " + str(ingress_port) + " to all ports")
match.in_port = ingress_port
request = message.flow_mod()
@@ -866,17 +859,16 @@
act.port = ofp.OFPP_IN_PORT
self.assertTrue(request.actions.add(act),
"Could not add ingress port for output")
- pa_logger.info(request.show())
+ logging.info(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
- receive_pkt_check(self.dataplane, pkt, of_ports, [], self,
- pa_logger, pa_config)
+ receive_pkt_check(self.dataplane, pkt, of_ports, [], self, pa_config)
class FloodMinusPort(basic.SimpleDataPlane):
"""
@@ -903,15 +895,14 @@
act = action.action_output()
for idx in range(len(of_ports)):
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
ingress_port = of_ports[idx]
no_flood_idx = (idx + 1) % len(of_ports)
no_flood_port = of_ports[no_flood_idx]
rv = port_config_set(self.controller, no_flood_port,
- ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD,
- pa_logger)
+ ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD)
self.assertEqual(rv, 0, "Failed to set port config")
match.in_port = ingress_port
@@ -922,24 +913,23 @@
act.port = ofp.OFPP_FLOOD
self.assertTrue(request.actions.add(act),
"Could not add flood port action")
- pa_logger.info(request.show())
+ logging.info(request.show())
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
rv = self.controller.message_send(request)
self.assertTrue(rv != -1, "Error installing flow mod")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
- pa_logger.info("No flood port is " + str(no_flood_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("No flood port is " + str(no_flood_port))
self.dataplane.send(ingress_port, str(pkt))
no_ports = set([ingress_port, no_flood_port])
yes_ports = set(of_ports).difference(no_ports)
- receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports, self,
- pa_logger, pa_config)
+ receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports, self, pa_config)
# Turn no flood off again
rv = port_config_set(self.controller, no_flood_port,
- 0, ofp.OFPPC_NO_FLOOD, pa_logger)
+ 0, ofp.OFPPC_NO_FLOOD)
self.assertEqual(rv, 0, "Failed to reset port config")
#@todo Should check no other packets received
@@ -951,9 +941,8 @@
class BaseMatchCase(basic.SimpleDataPlane):
def setUp(self):
basic.SimpleDataPlane.setUp(self)
- self.logger = pa_logger
def runTest(self):
- self.logger.info("BaseMatchCase")
+ logging.info("BaseMatchCase")
class ExactMatch(BaseMatchCase):
"""
@@ -1004,7 +993,7 @@
self.flowMsgs = {}
def _ClearTable(self):
- rc = delete_all_flows(self.controller, self.logger)
+ rc = delete_all_flows(self.controller)
self.assertEqual(rc, 0, "Failed to delete all flows")
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -1039,7 +1028,7 @@
self._ClearTable()
# Sanity check flow at lower priority from pA to pB
- self.logger.info("runPrioFlows(pA=%d,pB=%d,pC=%d,ph=%d,pl=%d"
+ logging.info("runPrioFlows(pA=%d,pB=%d,pC=%d,ph=%d,pl=%d"
% (portA, portB, portC, prioHigher, prioLower))
# Sanity check flow at lower priority from pA to pC
@@ -1072,7 +1061,7 @@
wildcards=wildcards,
egr_ports=egp)
request.priority = prio
- self.logger.debug("Install flow with priority " + str(prio))
+ logging.debug("Install flow with priority " + str(prio))
flow_msg_install(self, request, clear_table_override=False)
self.flowMsgs[prio] = request
@@ -1082,7 +1071,7 @@
msg.command = ofp.OFPFC_DELETE_STRICT
# This *must* be set for DELETE
msg.out_port = ofp.OFPP_NONE
- self.logger.debug("Remove flow with priority " + str(prio))
+ logging.debug("Remove flow with priority " + str(prio))
self.controller.message_send(msg)
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
else:
@@ -1093,10 +1082,8 @@
if pkt == None:
pkt = self.pkt
- self.logger.info("Pkt match test: " + str(inp) +
- " to " + str(egp))
- self.logger.debug("Send packet: " + str(inp) + " to "
- + str(egp))
+ logging.info("Pkt match test: " + str(inp) + " to " + str(egp))
+ logging.debug("Send packet: " + str(inp) + " to " + str(egp))
self.dataplane.send(inp, str(pkt))
receive_pkt_verify(self, egp, pkt, inp)
@@ -1321,8 +1308,8 @@
of_ports = pa_port_map.keys()
of_ports.sort()
ing_port = of_ports[0]
- pa_logger.info("Sending packet to " + str(ing_port))
- pa_logger.debug("Data: " + str(pkt).encode('hex'))
+ logging.info("Sending packet to " + str(ing_port))
+ logging.debug("Data: " + str(pkt).encode('hex'))
self.dataplane.send(ing_port, str(pkt))
class PacketOnlyTagged(basic.DataPlaneOnly):
@@ -1335,8 +1322,8 @@
of_ports = pa_port_map.keys()
of_ports.sort()
ing_port = of_ports[0]
- pa_logger.info("Sending packet to " + str(ing_port))
- pa_logger.debug("Data: " + str(pkt).encode('hex'))
+ logging.info("Sending packet to " + str(ing_port))
+ logging.debug("Data: " + str(pkt).encode('hex'))
self.dataplane.send(ing_port, str(pkt))
test_prio["PacketOnly"] = -1
@@ -1393,7 +1380,7 @@
ing_port = of_ports[0]
egr_ports = of_ports[1]
- rv = delete_all_flows(self.controller, pa_logger)
+ rv = delete_all_flows(self.controller)
self.assertEqual(rv, 0, "Failed to delete all flows")
len_untagged = 100
@@ -1412,12 +1399,12 @@
action_list=[vid_act])
flow_msg_install(self, request)
- pa_logger.debug("Send untagged packet: " + str(ing_port) + " to " +
+ logging.debug("Send untagged packet: " + str(ing_port) + " to " +
str(egr_ports))
self.dataplane.send(ing_port, str(untagged_pkt))
receive_pkt_verify(self, egr_ports, exp_pkt, ing_port)
- pa_logger.debug("Send tagged packet: " + str(ing_port) + " to " +
+ logging.debug("Send tagged packet: " + str(ing_port) + " to " +
str(egr_ports))
self.dataplane.send(ing_port, str(tagged_pkt))
receive_pkt_verify(self, egr_ports, exp_pkt, ing_port)
@@ -1724,7 +1711,7 @@
flow_count = test_param_get(self.config, 'ft_flow_count', default=20)
iter_count = test_param_get(self.config, 'ft_iter_count', default=10)
- pa_logger.info("Running flow toggle with %d flows, %d iterations" %
+ logging.info("Running flow toggle with %d flows, %d iterations" %
(flow_count, iter_count))
acts = []
acts.append(action.action_output())
@@ -1758,8 +1745,8 @@
flows[toggle].append(msg)
# Show two sample flows
- pa_logger.debug(flows[0][0].show())
- pa_logger.debug(flows[1][0].show())
+ logging.debug(flows[0][0].show())
+ logging.debug(flows[1][0].show())
# Install the first set of flows
for f_idx in range(flow_count):
@@ -1767,7 +1754,7 @@
self.assertTrue(rv != -1, "Error installing flow %d" % f_idx)
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Installed %d flows" % flow_count)
+ logging.info("Installed %d flows" % flow_count)
# Repeatedly modify all the flows back and forth
updates = 0
@@ -1776,7 +1763,7 @@
start = time.time()
for iter_idx in range(iter_count):
if not iter_idx % mod_val:
- pa_logger.info("Flow Toggle: iter %d of %d. " %
+ logging.info("Flow Toggle: iter %d of %d. " %
(iter_idx, iter_count) +
"%d updates in %d secs" %
(updates, time.time() - start))
@@ -1792,8 +1779,8 @@
end = time.time()
divisor = end - start or (end - start + 1)
- pa_logger.info("Flow toggle: %d iterations" % iter_count)
- pa_logger.info(" %d flow mods in %d secs, %d mods/sec" %
+ logging.info("Flow toggle: %d iterations" % iter_count)
+ logging.info(" %d flow mods in %d secs, %d mods/sec" %
(updates, end - start, updates/divisor))
@@ -1829,11 +1816,11 @@
def runTest(self):
count = test_param_get(self.config, 'iter_count', default=10)
tests_done = 0
- pa_logger.info("Running iteration test " + str(count) + " times")
+ logging.info("Running iteration test " + str(count) + " times")
start = time.time()
last = start
for idx in range(count):
- pa_logger.info("Iteration " + str(idx + 1))
+ logging.info("Iteration " + str(idx + 1))
for cls in iter_classes:
test = cls()
test.inheritSetup(self)
@@ -1842,17 +1829,17 @@
# Report update about every minute, between tests
if time.time() - last > 60:
last = time.time()
- pa_logger.info(
+ logging.info(
"IterCases: Iter %d of %d; Ran %d tests in %d " %
(idx, count, tests_done, last - start) +
"seconds so far")
stats = all_stats_get(self)
last = time.time()
- pa_logger.info("\nIterCases ran %d tests in %d seconds." %
+ logging.info("\nIterCases ran %d tests in %d seconds." %
(tests_done, last - start))
- pa_logger.info(" flows: %d. packets: %d. bytes: %d" %
+ logging.info(" flows: %d. packets: %d. bytes: %d" %
(stats["flows"], stats["packets"], stats["bytes"]))
- pa_logger.info(" active: %d. lookups: %d. matched %d." %
+ logging.info(" active: %d. lookups: %d. matched %d." %
(stats["active"], stats["lookups"], stats["matched"]))
# Don't run by default
@@ -1903,14 +1890,14 @@
of_ports.sort()
self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
- delete_all_flows(self.controller, pa_logger)
+ delete_all_flows(self.controller)
pkt = simple_tcp_packet()
ingress_port = of_ports[0]
egress_port = of_ports[1]
def testField(field, mask):
- pa_logger.info("Testing field %s" % field)
+ logging.info("Testing field %s" % field)
def addFlow(matching, priority, output_port):
match = packet_to_flow_match(self, pkt)
@@ -1932,7 +1919,7 @@
act = action.action_output()
act.port = output_port
self.assertTrue(request.actions.add(act), "Could not add action")
- pa_logger.info("Inserting flow")
+ logging.info("Inserting flow")
self.controller.message_send(request)
# This flow should match.
@@ -1942,7 +1929,7 @@
self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
- pa_logger.info("Sending packet to dp port " + str(ingress_port))
+ logging.info("Sending packet to dp port " + str(ingress_port))
self.dataplane.send(ingress_port, str(pkt))
exp_pkt_arg = None
@@ -1954,7 +1941,7 @@
(rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(port_number=exp_port,
exp_pkt=exp_pkt_arg)
self.assertTrue(rcv_pkt is not None, "Did not receive packet")
- pa_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " + str(rcv_port))
+ logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " + str(rcv_port))
self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
self.assertEqual(str(pkt), str(rcv_pkt), 'Response packet does not match send packet')