Fix ping command error handling, remove pypy from tox.ini

Change-Id: Ie7c3521f702a8db63739ddd40c73b93d67e9f2ed
This commit is contained in:
janbalaz 2016-09-12 11:29:09 -07:00
parent 8439f0cf56
commit 911c16e8eb
4 changed files with 13 additions and 12 deletions

View File

@ -10,12 +10,12 @@ lxml>=3.4.0
paramiko>=1.14.0
prettytable>=0.7.2
pymongo>=2.7.2
pytz>=2016.4
python-glanceclient>=0.15.0
python-neutronclient<3,>=2.3.6
python-novaclient>=2.18.1
python-openstackclient>=0.4.1
python-keystoneclient>=1.7.2
pytz>=2016.4
scp>=0.8.0
tabulate>=0.7.3

View File

@ -1,6 +1,6 @@
[tox]
minversion = 1.6
envlist = py27,pypy,pep8
envlist = py27,pep8
skipsdist = True
[testenv]

View File

@ -245,12 +245,10 @@ class PingTool(PerfTool):
else:
ping_cmd = "ping"
cmd = "%s -c %d -s %d %s" % (ping_cmd, ping_count, size, target_ip)
print cmd
cmd_out = self.instance.exec_command(cmd)
if not cmd_out:
res = {'protocol': 'ICMP',
'tool': 'ping',
'error': 'failed'}
res = {'packet_size': size,
'error': 'ping failed'}
return res
match = re.search(r'(\d*) packets transmitted, (\d*) ',
cmd_out)

View File

@ -558,12 +558,15 @@ def gen_report_data(proto, result):
elif proto == 'ICMP':
pkt_size_results = {}
for pkt_size_res in item['results']:
pkt_size_results[str(pkt_size_res['packet_size']) + '-byte'] = \
'%s/%s/%s/%s' % (pkt_size_res['rtt_avg_ms'],
pkt_size_res['rtt_min_ms'],
pkt_size_res['rtt_max_ms'],
pkt_size_res['rtt_stddev'])
label = str(pkt_size_res['packet_size']) + '-byte'
if 'error' in pkt_size_res:
pkt_size_results[label] = pkt_size_res['error']
else:
pkt_size_results[label] = '%s/%s/%s/%s' % \
(pkt_size_res['rtt_avg_ms'],
pkt_size_res['rtt_min_ms'],
pkt_size_res['rtt_max_ms'],
pkt_size_res['rtt_stddev'])
retval['rtt avg/min/max/stddev msec'] = pkt_size_results
if proto in ['TCP', 'Upload', 'Download']: