Support multiple packet sizes for ping
Change-Id: I4af268e68bb7e299ba47a1d26eaa52e16d47e447
This commit is contained in:
parent
3a33e062fb
commit
2ac7fbaec2
@ -152,7 +152,7 @@ Then copy it to OpenStack using the glance CLI:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
glance --os-image-api-version 1 image-create --file /tmp/vmtp/trusty-server-cloudimg-amd64-uefi1.img --disk-format qcow2 --container-format bare --name 'Ubuntu 14.04'
|
||||
glance --os-image-api-version 1 image-create --file /tmp/vmtp/trusty-server-cloudimg-amd64-uefi1.img --disk-format qcow2 --container-format bare --name 'Ubuntu Server 14.04'
|
||||
|
||||
Then list the images to verify:
|
||||
|
||||
|
@ -152,6 +152,10 @@ tcp_pkt_sizes: [65536]
|
||||
# Can be overridden at the command line using --udpbuf
|
||||
udp_pkt_sizes: [128, 1024, 8192]
|
||||
|
||||
# List of packet sizes to measure with ping
|
||||
# By default we measure for 64 (small), 391 (IMIX average) and 1500 (large)
|
||||
icmp_pkt_sizes: [64, 391, 1500]
|
||||
|
||||
# UDP packet loss rate threshold in percentage beyond which bandwidth
|
||||
# iterations stop and below which iteration with a higher
|
||||
# bandwidth continues
|
||||
|
@ -91,6 +91,8 @@ class Credentials(object):
|
||||
self.rc_cacert = value
|
||||
elif name == "REGION_NAME":
|
||||
self.rc_region_name = value
|
||||
elif name == "PASSWORD" and not pwd:
|
||||
pwd = value
|
||||
else:
|
||||
LOG.error('Error: rc file does not exist %s', openrc_file)
|
||||
success = False
|
||||
|
@ -229,7 +229,7 @@ class PingTool(PerfTool):
|
||||
def __init__(self, instance):
|
||||
PerfTool.__init__(self, 'ping', instance)
|
||||
|
||||
def run_client(self, target_ip, ping_count=5):
|
||||
def _run_client(self, target_ip, ping_count, size=32):
|
||||
'''Perform the ping operation
|
||||
:return: a dict containing the results stats
|
||||
|
||||
@ -241,9 +241,11 @@ class PingTool(PerfTool):
|
||||
rtt min/avg/max/mdev = 0.455/0.528/0.596/0.057 ms
|
||||
'''
|
||||
if self.instance.config.ipv6_mode:
|
||||
cmd = "ping6 -c " + str(ping_count) + " " + str(target_ip)
|
||||
ping_cmd = "ping6"
|
||||
else:
|
||||
cmd = "ping -c " + str(ping_count) + " " + str(target_ip)
|
||||
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',
|
||||
@ -270,8 +272,7 @@ class PingTool(PerfTool):
|
||||
rtt_max = 0
|
||||
rtt_avg = 0
|
||||
rtt_stddev = 0
|
||||
res = {'protocol': 'ICMP',
|
||||
'tool': 'ping',
|
||||
res = {'packet_size': size,
|
||||
'tx_packets': tx_packets,
|
||||
'rx_packets': rx_packets,
|
||||
'rtt_min_ms': rtt_min,
|
||||
@ -280,6 +281,16 @@ class PingTool(PerfTool):
|
||||
'rtt_stddev': rtt_stddev}
|
||||
return res
|
||||
|
||||
def run_client(self, target_ip, ping_count=10):
|
||||
size_results = []
|
||||
res = {'protocol': 'ICMP',
|
||||
'tool': 'ping',
|
||||
'results': size_results}
|
||||
size_list = self.instance.config.icmp_pkt_sizes
|
||||
for size in size_list:
|
||||
size_results.append(self._run_client(target_ip, ping_count, size))
|
||||
return res
|
||||
|
||||
def get_server_launch_cmd(self):
|
||||
# not applicable
|
||||
return None
|
||||
|
55
vmtp/vmtp.py
55
vmtp/vmtp.py
@ -545,18 +545,26 @@ def gen_report_data(proto, result):
|
||||
if 'jitter' in item:
|
||||
retval[item['pkt_size']]['jitter'] = item['jitter']
|
||||
elif proto == 'ICMP':
|
||||
for key in ['rtt_avg_ms', 'rtt_max_ms', 'rtt_min_ms', 'rtt_stddev']:
|
||||
retval[key] = item[key]
|
||||
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'])
|
||||
retval['rtt avg/min/max/stddev msec'] = pkt_size_results
|
||||
|
||||
if proto in ['TCP', 'Upload', 'Download']:
|
||||
for key in retval:
|
||||
retval[key] = '{0:n}'.format(retval[key] / tcp_test_count)
|
||||
except Exception:
|
||||
retval = "ERROR! Check JSON outputs for more details."
|
||||
|
||||
traceback.print_exc()
|
||||
return retval
|
||||
|
||||
def print_report(results):
|
||||
|
||||
# In order to parse the results with less logic, we are encoding the results as below:
|
||||
# Same Network = 0, Different Network = 1
|
||||
# Fixed IP = 0, Floating IP = 1
|
||||
@ -798,6 +806,13 @@ def parse_opts_from_cli():
|
||||
'e.g. --udpbuf 128,2048. (default=128,1024,8192)',
|
||||
metavar='<udp_pkt_size1,...>')
|
||||
|
||||
parser.add_argument('--icmp_pkt_sizes', dest='icmp_pkt_sizes',
|
||||
action='store',
|
||||
default=0,
|
||||
help='list of ICMP packet sizes in Bytes, '
|
||||
'e.g. --icmp_pkt_sizes 128,2048. (default=64,391,1500 391=IMIX avg)',
|
||||
metavar='<icmp_pkt_size1,...>')
|
||||
|
||||
parser.add_argument('--reuse_network_name', dest='reuse_network_name',
|
||||
action='store',
|
||||
default=None,
|
||||
@ -875,6 +890,17 @@ def parse_opts_from_cli():
|
||||
|
||||
return parser.parse_known_args()[0]
|
||||
|
||||
def decode_size_list(argname, size_list):
|
||||
try:
|
||||
pkt_sizes = size_list.split(',')
|
||||
for i in xrange(len(pkt_sizes)):
|
||||
pkt_sizes[i] = int(pkt_sizes[i])
|
||||
except ValueError:
|
||||
LOG.error('Invalid %s parameter. A valid input must be '
|
||||
'integers seperated by comma.' % argname)
|
||||
sys.exit(1)
|
||||
return pkt_sizes
|
||||
|
||||
def merge_opts_to_configs(opts):
|
||||
|
||||
default_cfg_file = resource_string(__name__, "cfg.default.yaml")
|
||||
@ -968,26 +994,15 @@ def merge_opts_to_configs(opts):
|
||||
config.vm_bandwidth = int(val * (10 ** (ex_unit * 3)))
|
||||
|
||||
|
||||
# the pkt size for TCP and UDP
|
||||
# the pkt size for TCP, UDP and ICMP
|
||||
if opts.tcp_pkt_sizes:
|
||||
try:
|
||||
config.tcp_pkt_sizes = opts.tcp_pkt_sizes.split(',')
|
||||
for i in xrange(len(config.tcp_pkt_sizes)):
|
||||
config.tcp_pkt_sizes[i] = int(config.tcp_pkt_sizes[i])
|
||||
except ValueError:
|
||||
LOG.error('Invalid --tcpbuf parameter. A valid input must be '
|
||||
'integers seperated by comma.')
|
||||
sys.exit(1)
|
||||
config.tcp_pkt_sizes = decode_size_list('--tcpbuf', opts.tcp_pkt_sizes)
|
||||
|
||||
if opts.udp_pkt_sizes:
|
||||
try:
|
||||
config.udp_pkt_sizes = opts.udp_pkt_sizes.split(',')
|
||||
for i in xrange(len(config.udp_pkt_sizes)):
|
||||
config.udp_pkt_sizes[i] = int(config.udp_pkt_sizes[i])
|
||||
except ValueError:
|
||||
LOG.error('Invalid --udpbuf parameter. A valid input must be '
|
||||
'integers seperated by comma.')
|
||||
sys.exit(1)
|
||||
config.udp_pkt_sizes = decode_size_list('--udpbuf', opts.udp_pkt_sizes)
|
||||
|
||||
if opts.icmp_pkt_sizes:
|
||||
config.icmp_pkt_sizes = decode_size_list('--icmp_pkt_sizes', opts.icmp_pkt_sizes)
|
||||
|
||||
if opts.reuse_network_name:
|
||||
config.reuse_network_name = opts.reuse_network_name
|
||||
|
Loading…
x
Reference in New Issue
Block a user