Cleanup for using cord-tester logger over scapy logger which was an ugly hack.
Change-Id: I8af565f8eb4f69ddc6605e717a0c83772cc9417f
diff --git a/src/test/dhcprelay/dhcprelayTest.py b/src/test/dhcprelay/dhcprelayTest.py
index 2cfb4be..20d3097 100644
--- a/src/test/dhcprelay/dhcprelayTest.py
+++ b/src/test/dhcprelay/dhcprelayTest.py
@@ -17,11 +17,10 @@
from nose.tools import *
from nose.twistedtools import reactor, deferred
from twisted.internet import defer
-from scapy.all import *
import time
import os, sys
from DHCP import DHCPTest
-from CordTestUtils import get_mac
+from CordTestUtils import get_mac, log_test
from OnosCtrl import OnosCtrl
from OltConfig import OltConfig
from CordTestServer import cord_test_onos_restart
@@ -29,7 +28,7 @@
from portmaps import g_subscriber_port_map
import threading, random
from threading import current_thread
-log.setLevel('INFO')
+log_test.setLevel('INFO')
class dhcprelay_exchange(CordLogger):
@@ -136,14 +135,14 @@
for config in cls.configs.items():
OnosCtrl.delete(config)
# if cls.onos_restartable is True:
- # log.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
+ # log_test.info('Cleaning up dhcp relay config by restarting ONOS with default network cfg')
# return cord_test_onos_restart(config = {})
@classmethod
def onos_load_config(cls, config):
status, code = OnosCtrl.config(config)
if status is False:
- log.info('JSON request returned status %d' %code)
+ log_test.info('JSON request returned status %d' %code)
assert_equal(status, True)
time.sleep(3)
@@ -246,7 +245,7 @@
intf_str = ','.join(intf_list)
dhcpd_cmd = '/usr/sbin/dhcpd -4 --no-pid -cf {0} -lf {1} {2}'.format(conf_file, lease_file, intf_str)
- log.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
+ log_test.info('Starting DHCPD server with command: %s' %dhcpd_cmd)
ret = os.system(dhcpd_cmd)
assert_equal(ret, 0)
time.sleep(3)
@@ -297,7 +296,7 @@
if only_discover:
cip, sip, mac, _ = self.dhcp.only_discover(multiple = True)
- log.info('Got dhcp client IP %s from server %s for mac %s' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s' %
(cip, sip, mac))
else:
cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
@@ -306,7 +305,7 @@
self.ip_count +=1
elif cip == None:
self.failure_count += 1
- log.info('Failed to get ip')
+ log_test.info('Failed to get ip')
if success_rate and self.ip_count > 0:
break
@@ -323,7 +322,7 @@
if validate:
assert_not_equal(cip, None)
assert_not_equal(sip, None)
- log.info('Got dhcp client IP %s from server %s for mac %s' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s' %
(cip, sip, self.dhcp.get_mac(cip)[0]))
return cip,sip
@@ -359,7 +358,7 @@
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac='ff:ff:ff:ff:ff:ff')
assert_equal(cip,None)
- log.info('dhcp server rejected client discover with invalid source mac, as expected')
+ log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
def test_dhcpRelay_1request_with_invalid_source_mac_multicast(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -377,7 +376,7 @@
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac='01:80:c2:01:98:05')
assert_equal(cip,None)
- log.info('dhcp server rejected client discover with invalid source mac, as expected')
+ log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
def test_dhcpRelay_1request_with_invalid_source_mac_zero(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -395,7 +394,7 @@
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(mac='00:00:00:00:00:00')
assert_equal(cip,None)
- log.info('dhcp server rejected client discover with invalid source mac, as expected')
+ log_test.info('dhcp server rejected client discover with invalid source mac, as expected')
def test_dhcpRelay_Nrequest(self, iface = 'veth0',requests=10):
mac = self.get_mac(iface)
@@ -414,10 +413,10 @@
ip_map = {}
for i in range(requests):
#mac = RandMAC()._fix()
- #log.info('mac is %s'%mac)
+ #log_test.info('mac is %s'%mac)
cip, sip = self.send_recv(update_seed = True)
if ip_map.has_key(cip):
- log.info('IP %s given out multiple times' %cip)
+ log_test.info('IP %s given out multiple times' %cip)
assert_equal(False, ip_map.has_key(cip))
ip_map[cip] = sip
time.sleep(1)
@@ -437,13 +436,13 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
cip, sip = self.send_recv(mac=mac)
- log.info('Releasing ip %s to server %s' %(cip, sip))
+ log_test.info('Releasing ip %s to server %s' %(cip, sip))
assert_equal(self.dhcp.release(cip), True)
- log.info('Triggering DHCP discover again after release')
+ log_test.info('Triggering DHCP discover again after release')
cip2, sip2 = self.send_recv(mac=mac)
- log.info('Verifying released IP was given back on rediscover')
+ log_test.info('Verifying released IP was given back on rediscover')
assert_equal(cip, cip2)
- log.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
+ log_test.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
assert_equal(self.dhcp.release(cip2), True)
def test_dhcpRelay_Nrelease(self, iface = 'veth0'):
@@ -464,25 +463,25 @@
for i in range(10):
cip, sip = self.send_recv(mac=mac, update_seed = True)
if ip_map.has_key(cip):
- log.info('IP %s given out multiple times' %cip)
+ log_test.info('IP %s given out multiple times' %cip)
assert_equal(False, ip_map.has_key(cip))
ip_map[cip] = sip
for ip in ip_map.keys():
- log.info('Releasing IP %s' %ip)
+ log_test.info('Releasing IP %s' %ip)
assert_equal(self.dhcp.release(ip), True)
ip_map2 = {}
- log.info('Triggering DHCP discover again after release')
+ log_test.info('Triggering DHCP discover again after release')
self.dhcp = DHCPTest(seed_ip = '192.170.1.10', iface = iface)
for i in range(len(ip_map.keys())):
cip, sip = self.send_recv(mac=mac, update_seed = True)
ip_map2[cip] = sip
- log.info('Verifying released IPs were given back on rediscover')
+ log_test.info('Verifying released IPs were given back on rediscover')
if ip_map != ip_map2:
- log.info('Map before release %s' %ip_map)
- log.info('Map after release %s' %ip_map2)
+ log_test.info('Map before release %s' %ip_map)
+ log_test.info('Map after release %s' %ip_map2)
assert_equal(ip_map, ip_map2)
def test_dhcpRelay_starvation(self, iface = 'veth0'):
@@ -499,7 +498,7 @@
options = options,
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
- log.info('Verifying 1 ')
+ log_test.info('Verifying 1 ')
count = 0
while True:
#mac = RandMAC()._fix()
@@ -509,7 +508,7 @@
else:
count += 1
assert_equal(count,91)
- log.info('Verifying 2 ')
+ log_test.info('Verifying 2 ')
cip, sip = self.send_recv(mac=mac, update_seed = True, validate = False)
assert_equal(cip, None)
assert_equal(sip, None)
@@ -529,13 +528,13 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
(cip, sip, mac) )
assert_not_equal(cip, None)
- log.info('Triggering DHCP discover again.')
+ log_test.info('Triggering DHCP discover again.')
new_cip, new_sip, new_mac, _ = self.dhcp.only_discover()
assert_equal(new_cip, cip)
- log.info('got same ip to smae the client when sent discover again, as expected')
+ log_test.info('got same ip to smae the client when sent discover again, as expected')
def test_dhcpRelay_same_client_multiple_request(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -551,13 +550,13 @@
options = options,
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
- log.info('Sending DHCP discover and DHCP request.')
+ log_test.info('Sending DHCP discover and DHCP request.')
cip, sip = self.send_recv(mac=mac)
mac = self.dhcp.get_mac(cip)[0]
- log.info("Sending DHCP request again.")
+ log_test.info("Sending DHCP request again.")
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
- log.info('got same ip to smae the client when sent request again, as expected')
+ log_test.info('got same ip to smae the client when sent request again, as expected')
def test_dhcpRelay_client_desired_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -575,7 +574,7 @@
self.dhcp = DHCPTest(seed_ip = '192.168.1.31', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
assert_equal(cip,self.dhcp.seed_ip)
- log.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
+ log_test.info('Got dhcp client desired IP %s from server %s for mac %s as expected' %
(cip, sip, mac) )
def test_dhcpRelay_client_desired_address_out_of_pool(self, iface = 'veth0'):
@@ -596,7 +595,7 @@
cip, sip, mac, _ = self.dhcp.only_discover(desired = True)
assert_not_equal(cip,None)
assert_not_equal(cip,self.dhcp.seed_ip)
- log.info('server offered IP from its pool when requested out of pool IP, as expected')
+ log_test.info('server offered IP from its pool when requested out of pool IP, as expected')
def test_dhcpRelay_nak_packet(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -613,12 +612,12 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request('20.20.20.31', mac)
assert_equal(new_cip, None)
- log.info('server sent NAK packet when requested other IP than that server offered')
+ log_test.info('server sent NAK packet when requested other IP than that server offered')
def test_dhcpRelay_client_requests_specific_lease_time_in_discover(self, iface = 'veth0',lease_time=700):
@@ -638,7 +637,7 @@
self.dhcp.return_option = 'lease'
cip, sip, mac, lval = self.dhcp.only_discover(lease_time=True,lease_value=lease_time)
assert_equal(lval, lease_time)
- log.info('dhcp server offered IP address with client requested lease time')
+ log_test.info('dhcp server offered IP address with client requested lease time')
def test_dhcpRelay_client_request_after_reboot(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -655,17 +654,17 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request(cip, mac)
- log.info('client rebooting...')
+ log_test.info('client rebooting...')
os.system('ifconfig '+iface+' down')
time.sleep(5)
os.system('ifconfig '+iface+' up')
new_cip2, new_sip = self.dhcp.only_request(cip, mac, cl_reboot = True)
assert_equal(new_cip2, cip)
- log.info('client got same IP after reboot, as expected')
+ log_test.info('client got same IP after reboot, as expected')
def test_dhcpRelay_after_server_reboot(self, iface = 'veth0'):
@@ -683,18 +682,18 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip, None)
new_cip, new_sip = self.dhcp.only_request(cip, mac)
- log.info('server rebooting...')
+ log_test.info('server rebooting...')
self.tearDownClass()
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip,None)
self.setUpClass()
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
- log.info('client got same IP after server rebooted, as expected')
+ log_test.info('client got same IP after server rebooted, as expected')
def test_dhcpRelay_specific_lease_time_only_in_discover_but_not_in_request_packet(self, iface = 'veth0',lease_time=700):
@@ -712,13 +711,13 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
self.dhcp.return_option = 'lease'
- log.info('Sending DHCP discover with lease time of 700')
+ log_test.info('Sending DHCP discover with lease time of 700')
cip, sip, mac, lval = self.dhcp.only_discover(lease_time = True, lease_value=lease_time)
assert_equal(lval,lease_time)
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, lease_time = True)
assert_equal(new_cip,cip)
assert_not_equal(lval, lease_time) #Negative Test Case
- log.info('client requested lease time in discover packer is not seen in server ACK packet as expected')
+ log_test.info('client requested lease time in discover packer is not seen in server ACK packet as expected')
def test_dhcpRelay_specific_lease_time_only_in_request_but_not_in_discover_packet(self, iface = 'veth0',lease_time=800):
mac = self.get_mac(iface)
@@ -738,7 +737,7 @@
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, lease_time = True,lease_value=lease_time)
assert_equal(new_cip,cip)
assert_equal(lval, lease_time)
- log.info('client requested lease time in request packet seen in servre replied ACK packet as expected')
+ log_test.info('client requested lease time in request packet seen in servre replied ACK packet as expected')
def test_dhcpRelay_client_renew_time(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -756,15 +755,15 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
- log.info('waiting for renew time..')
+ log_test.info('waiting for renew time..')
time.sleep(lval)
latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
assert_equal(latest_cip, cip)
- log.info('server renewed client IP when client sends request after renew time, as expected')
+ log_test.info('server renewed client IP when client sends request after renew time, as expected')
def test_dhcpRelay_client_rebind_time(self, iface = 'veth0'):
@@ -783,15 +782,15 @@
subnet = subnet)
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
- log.info('waiting for rebind time..')
+ log_test.info('waiting for rebind time..')
time.sleep(lval)
latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
assert_equal(latest_cip, cip)
- log.info('server renewed client IP when client sends request after rebind time, as expected')
+ log_test.info('server renewed client IP when client sends request after rebind time, as expected')
def test_dhcpRelay_client_expected_subnet_mask(self, iface = 'veth0'):
@@ -812,10 +811,10 @@
self.dhcp.return_option = 'subnet'
cip, sip, mac, subnet_mask = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(subnet_mask,expected_subnet)
- log.info('subnet mask in server offer packet is same as configured subnet mask in dhcp server')
+ log_test.info('subnet mask in server offer packet is same as configured subnet mask in dhcp server')
def test_dhcpRelay_client_sends_dhcp_request_with_wrong_subnet_mask(self, iface = 'veth0'):
@@ -834,13 +833,13 @@
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'subnet'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
- log.info("Got DHCP Ack despite of specifying wrong Subnet Mask in DHCP Request.")
+ log_test.info("Got DHCP Ack despite of specifying wrong Subnet Mask in DHCP Request.")
def test_dhcpRelay_client_expected_router_address(self, iface = 'veth0'):
@@ -863,10 +862,10 @@
self.dhcp.return_option = 'router'
cip, sip, mac, router_address_value = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(expected_router_address, router_address_value)
- log.info('router address in server offer packet is same as configured router address in dhcp server')
+ log_test.info('router address in server offer packet is same as configured router address in dhcp server')
def test_dhcpRelay_client_sends_dhcp_request_with_wrong_router_address(self, iface = 'veth0'):
@@ -885,13 +884,13 @@
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'router'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
- log.info("Got DHCP Ack despite of specifying wrong Router Address in DHCP Request.")
+ log_test.info("Got DHCP Ack despite of specifying wrong Router Address in DHCP Request.")
def test_dhcpRelay_client_expected_broadcast_address(self, iface = 'veth0'):
@@ -912,10 +911,10 @@
self.dhcp.return_option = 'broadcast_address'
cip, sip, mac, broadcast_address_value = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(expected_broadcast_address, broadcast_address_value)
- log.info('broadcast address in server offer packet is same as configured broadcast address in dhcp server')
+ log_test.info('broadcast address in server offer packet is same as configured broadcast address in dhcp server')
def test_dhcpRelay_client_sends_dhcp_request_with_wrong_broadcast_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -933,13 +932,13 @@
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'broadcast_address'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
- log.info("Got DHCP Ack despite of specifying wrong Broadcast Address in DHCP Request.")
+ log_test.info("Got DHCP Ack despite of specifying wrong Broadcast Address in DHCP Request.")
def test_dhcpRelay_client_expected_dns_address(self, iface = 'veth0'):
@@ -960,10 +959,10 @@
self.dhcp.return_option = 'dns'
cip, sip, mac, dns_address_value = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_equal(expected_dns_address, dns_address_value)
- log.info('dns address in server offer packet is same as configured dns address in dhcp server')
+ log_test.info('dns address in server offer packet is same as configured dns address in dhcp server')
def test_dhcpRelay_client_sends_request_with_wrong_dns_address(self, iface = 'veth0'):
mac = self.get_mac(iface)
@@ -981,100 +980,100 @@
self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s .' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s .' %
(cip, sip, mac) )
assert_not_equal(cip,None)
self.dhcp.send_different_option = 'dns'
new_cip, new_sip = self.dhcp.only_request(cip, mac)
assert_equal(new_cip, cip)
- log.info("Got DHCP Ack despite of specifying wrong DNS Address in DHCP Request.")
+ log_test.info("Got DHCP Ack despite of specifying wrong DNS Address in DHCP Request.")
def test_dhcpRelay_transactions_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.stats()
- log.info("Statistics for run %d",i)
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of transactions No. of successes No. of failures Running Time ")
- log.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of transactions per second in run %d:%f" %(i, self.transaction_count))
+ log_test.info("Statistics for run %d",i)
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of transactions No. of successes No. of failures Running Time ")
+ log_test.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of transactions per second in run %d:%f" %(i, self.transaction_count))
- log.info("Final Statistics for total transactions")
- log.info("----------------------------------------------------------------------------------")
- log.info("Total transactions Total No. of successes Total No. of failures Running Time ")
- log.info(" %d %d %d %d" %(self.transactions,
+ log_test.info("Final Statistics for total transactions")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
+ log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
- log.info("----------------------------------------------------------------------------------")
- log.info("Average no. of transactions per second: %d", round(self.transactions/self.running_time,0))
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Average no. of transactions per second: %d", round(self.transactions/self.running_time,0))
def test_dhcpRelay_consecutive_successes_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.stats(success_rate = True)
- log.info("Statistics for run %d",i)
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of consecutive successful transactions Running Time ")
- log.info(" %d %d " %(self.ip_count, self.diff))
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of successful transactions per second in run %d:%f" %(i, self.transaction_count))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("Statistics for run %d",i)
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of consecutive successful transactions Running Time ")
+ log_test.info(" %d %d " %(self.ip_count, self.diff))
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of successful transactions per second in run %d:%f" %(i, self.transaction_count))
+ log_test.info("----------------------------------------------------------------------------------")
- log.info("Final Statistics for total successful transactions")
- log.info("----------------------------------------------------------------------------------")
- log.info("Total transactions Total No. of consecutive successes Running Time ")
- log.info(" %d %d %d " %(self.transactions,
+ log_test.info("Final Statistics for total successful transactions")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Total transactions Total No. of consecutive successes Running Time ")
+ log_test.info(" %d %d %d " %(self.transactions,
self.total_success, self.running_time))
- log.info("----------------------------------------------------------------------------------")
- log.info("Average no. of consecutive successful transactions per second: %d", round(self.total_success/self.running_time,0))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Average no. of consecutive successful transactions per second: %d", round(self.total_success/self.running_time,0))
+ log_test.info("----------------------------------------------------------------------------------")
def test_dhcpRelay_clients_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.stats(only_discover = True)
- log.info("----------------------------------------------------------------------------------")
- log.info("Statistics for run %d of sending only DHCP Discover",i)
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of transactions No. of successes No. of failures Running Time ")
- log.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of clients per second in run %d:%f "
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Statistics for run %d of sending only DHCP Discover",i)
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of transactions No. of successes No. of failures Running Time ")
+ log_test.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of clients per second in run %d:%f "
%(i, self.transaction_count))
- log.info("----------------------------------------------------------------------------------")
- log.info("Final Statistics for total transactions of sending only DHCP Discover")
- log.info("----------------------------------------------------------------------------------")
- log.info("Total transactions Total No. of successes Total No. of failures Running Time ")
- log.info(" %d %d %d %d" %(self.transactions,
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Final Statistics for total transactions of sending only DHCP Discover")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
+ log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
- log.info("----------------------------------------------------------------------------------")
- log.info("Average no. of clients per second: %d ",
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Average no. of clients per second: %d ",
round(self.transactions/self.running_time,0))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
def test_dhcpRelay_consecutive_successful_clients_per_second(self, iface = 'veth0'):
for i in range(1,4):
self.stats(success_rate = True, only_discover = True)
- log.info("----------------------------------------------------------------------------------")
- log.info("Statistics for run %d for sending only DHCP Discover",i)
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of consecutive successful transactions Running Time ")
- log.info(" %d %d " %(self.ip_count, self.diff))
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of consecutive successful clients per second in run %d:%f" %(i, self.transaction_count))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Statistics for run %d for sending only DHCP Discover",i)
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of consecutive successful transactions Running Time ")
+ log_test.info(" %d %d " %(self.ip_count, self.diff))
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of consecutive successful clients per second in run %d:%f" %(i, self.transaction_count))
+ log_test.info("----------------------------------------------------------------------------------")
- log.info("Final Statistics for total successful transactions")
- log.info("----------------------------------------------------------------------------------")
- log.info("Total transactions Total No. of consecutive successes Running Time ")
- log.info(" %d %d %d " %(self.transactions,
+ log_test.info("Final Statistics for total successful transactions")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Total transactions Total No. of consecutive successes Running Time ")
+ log_test.info(" %d %d %d " %(self.transactions,
self.total_success, self.running_time))
- log.info("----------------------------------------------------------------------------------")
- log.info("Average no. of consecutive successful clients per second: %d", round(self.total_success/self.running_time,0))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Average no. of consecutive successful clients per second: %d", round(self.total_success/self.running_time,0))
+ log_test.info("----------------------------------------------------------------------------------")
def test_dhcpRelay_concurrent_transactions_per_second(self, iface = 'veth0'):
@@ -1099,7 +1098,7 @@
def thread_fun(i):
mac = self.get_mac('veth{}'.format(i))
cip, sip = DHCPTest(iface = 'veth{}'.format(i)).discover(mac = mac)
- log.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
+ log_test.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
self.lock.acquire()
if cip:
@@ -1151,26 +1150,26 @@
self.total_failure += self.failure_count
- log.info("----------------------------------------------------------------------------------")
- log.info("Statistics for run %d",i)
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of transactions No. of successes No. of failures Running Time ")
- log.info(" %d %d %d %d"
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Statistics for run %d",i)
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of transactions No. of successes No. of failures Running Time ")
+ log_test.info(" %d %d %d %d"
%(self.ip_count+self.failure_count,self.ip_count, self.failure_count, self.diff))
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of transactions per second in run %d:%f" %(i, self.transaction_count))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of transactions per second in run %d:%f" %(i, self.transaction_count))
+ log_test.info("----------------------------------------------------------------------------------")
- log.info("----------------------------------------------------------------------------------")
- log.info("Final Statistics for total transactions")
- log.info("----------------------------------------------------------------------------------")
- log.info("Total transactions Total No. of successes Total No. of failures Running Time ")
- log.info(" %d %d %d %d" %(self.transactions,
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Final Statistics for total transactions")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
+ log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
- log.info("----------------------------------------------------------------------------------")
- log.info("Average no. of transactions per second: %d", round(self.transactions/self.running_time,0))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Average no. of transactions per second: %d", round(self.transactions/self.running_time,0))
+ log_test.info("----------------------------------------------------------------------------------")
def test_dhcpRelay_concurrent_consecutive_successes_per_second(self, iface = 'veth0'):
@@ -1194,13 +1193,13 @@
self.host_load(g_subscriber_port_map[key])
def thread_fun(i, j):
-# log.info("Thread Name:%s",current_thread().name)
+# log_test.info("Thread Name:%s",current_thread().name)
# failure_dir[current_thread().name] = True
while failure_dir.has_key(current_thread().name) is False:
mac = RandMAC()._fix()
cip, sip = DHCPTest(iface = 'veth{}'.format(i)).discover(mac = mac)
i += 2
- log.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
+ log_test.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
self.lock.acquire()
if cip:
@@ -1256,22 +1255,22 @@
self.total_failure += self.failure_count
- log.info("Statistics for run %d",i)
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of consecutive successful transactions Running Time ")
- log.info(" %d %d " %(self.ip_count, self.diff))
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of successful transactions per second in run %d:%f" %(i, self.transaction_count))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("Statistics for run %d",i)
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of consecutive successful transactions Running Time ")
+ log_test.info(" %d %d " %(self.ip_count, self.diff))
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of successful transactions per second in run %d:%f" %(i, self.transaction_count))
+ log_test.info("----------------------------------------------------------------------------------")
- log.info("Final Statistics for total successful transactions")
- log.info("----------------------------------------------------------------------------------")
- log.info("Total transactions Total No. of consecutive successes Running Time ")
- log.info(" %d %d %d " %(self.transactions,
+ log_test.info("Final Statistics for total successful transactions")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Total transactions Total No. of consecutive successes Running Time ")
+ log_test.info(" %d %d %d " %(self.transactions,
self.total_success, self.running_time))
- log.info("----------------------------------------------------------------------------------")
- log.info("Average no. of consecutive successful transactions per second: %d", round(self.total_success/self.running_time,2))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Average no. of consecutive successful transactions per second: %d", round(self.total_success/self.running_time,2))
+ log_test.info("----------------------------------------------------------------------------------")
def test_dhcpRelay_concurrent_clients_per_second(self, iface = 'veth0'):
@@ -1296,7 +1295,7 @@
def thread_fun(i):
# mac = self.get_mac('veth{}'.format(i))
cip, sip, mac, _ = DHCPTest(iface = 'veth{}'.format(i)).only_discover(mac = RandMAC()._fix())
- log.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
+ log_test.info('Got dhcp client IP %s from server %s for mac %s'%(cip, sip, mac))
self.lock.acquire()
if cip:
@@ -1344,25 +1343,25 @@
self.total_success += self.ip_count
self.total_failure += self.failure_count
- log.info("----------------------------------------------------------------------------------")
- log.info("Statistics for run %d of sending only DHCP Discover",i)
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of transactions No. of successes No. of failures Running Time ")
- log.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
- log.info("----------------------------------------------------------------------------------")
- log.info("No. of clients per second in run %d:%f "
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Statistics for run %d of sending only DHCP Discover",i)
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of transactions No. of successes No. of failures Running Time ")
+ log_test.info(" %d %d %d %d" %(self.ip_count+self.failure_count, self.ip_count, self.failure_count, self.diff))
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("No. of clients per second in run %d:%f "
%(i, self.transaction_count))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
- log.info("Final Statistics for total transactions of sending only DHCP Discover")
- log.info("----------------------------------------------------------------------------------")
- log.info("Total transactions Total No. of successes Total No. of failures Running Time ")
- log.info(" %d %d %d %d" %(self.transactions,
+ log_test.info("Final Statistics for total transactions of sending only DHCP Discover")
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Total transactions Total No. of successes Total No. of failures Running Time ")
+ log_test.info(" %d %d %d %d" %(self.transactions,
self.total_success, self.total_failure, self.running_time))
- log.info("----------------------------------------------------------------------------------")
- log.info("Average no. of clients per second: %d ",
+ log_test.info("----------------------------------------------------------------------------------")
+ log_test.info("Average no. of clients per second: %d ",
round(self.transactions/self.running_time,0))
- log.info("----------------------------------------------------------------------------------")
+ log_test.info("----------------------------------------------------------------------------------")
def test_dhcpRelay_client_conflict(self, iface = 'veth0'):
@@ -1370,20 +1369,20 @@
self.host_load(iface)
self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
cip, sip, mac, _ = self.dhcp.only_discover()
- log.info('Got dhcp client IP %s from server %s for mac %s.' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s.' %
(cip, sip, mac) )
self.dhcp1 = DHCPTest(seed_ip = cip, iface = iface)
new_cip, new_sip, new_mac, _ = self.dhcp1.only_discover(desired = True)
new_cip, new_sip = self.dhcp1.only_request(new_cip, new_mac)
- log.info('Got dhcp client IP %s from server %s for mac %s.' %
+ log_test.info('Got dhcp client IP %s from server %s for mac %s.' %
(new_cip, new_sip, new_mac) )
- log.info("IP %s alredy consumed by mac %s." % (new_cip, new_mac))
- log.info("Now sending DHCP Request for old DHCP discover.")
+ log_test.info("IP %s alredy consumed by mac %s." % (new_cip, new_mac))
+ log_test.info("Now sending DHCP Request for old DHCP discover.")
new_cip, new_sip = self.dhcp.only_request(cip, mac)
if new_cip is None:
- log.info('Got dhcp client IP %s from server %s for mac %s.Which is expected behavior.'
+ log_test.info('Got dhcp client IP %s from server %s for mac %s.Which is expected behavior.'
%(new_cip, new_sip, new_mac) )
elif new_cip:
- log.info('Got dhcp client IP %s from server %s for mac %s.Which is not expected behavior as IP %s is already consumed.'
+ log_test.info('Got dhcp client IP %s from server %s for mac %s.Which is not expected behavior as IP %s is already consumed.'
%(new_cip, new_sip, new_mac, new_cip) )
assert_equal(new_cip, None)