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 paramiko>=1.14.0
prettytable>=0.7.2 prettytable>=0.7.2
pymongo>=2.7.2 pymongo>=2.7.2
pytz>=2016.4
python-glanceclient>=0.15.0 python-glanceclient>=0.15.0
python-neutronclient<3,>=2.3.6 python-neutronclient<3,>=2.3.6
python-novaclient>=2.18.1 python-novaclient>=2.18.1
python-openstackclient>=0.4.1 python-openstackclient>=0.4.1
python-keystoneclient>=1.7.2 python-keystoneclient>=1.7.2
pytz>=2016.4
scp>=0.8.0 scp>=0.8.0
tabulate>=0.7.3 tabulate>=0.7.3

View File

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

View File

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

View File

@ -558,9 +558,12 @@ def gen_report_data(proto, result):
elif proto == 'ICMP': elif proto == 'ICMP':
pkt_size_results = {} pkt_size_results = {}
for pkt_size_res in item['results']: for pkt_size_res in item['results']:
label = str(pkt_size_res['packet_size']) + '-byte'
pkt_size_results[str(pkt_size_res['packet_size']) + '-byte'] = \ if 'error' in pkt_size_res:
'%s/%s/%s/%s' % (pkt_size_res['rtt_avg_ms'], 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_min_ms'],
pkt_size_res['rtt_max_ms'], pkt_size_res['rtt_max_ms'],
pkt_size_res['rtt_stddev']) pkt_size_res['rtt_stddev'])