Add option to run same network test only

Add new command line option to allow the user to run only tests with
the same L2 network:

   vmtp.py --same-network-only

Change-Id: If7346f74c329c62d1c6b36aa80cb389258503f9a
This commit is contained in:
John Wu 2015-12-16 14:13:09 -08:00
parent 041039359b
commit 8d091e3866
3 changed files with 19 additions and 5 deletions

View File

@ -15,9 +15,9 @@ VMTP Usage
[--mongod-server <server ip>] [--json <file>]
[--tp-tool <nuttcp|iperf>]
[--availability_zone <availability_zone>] [--hypervisor [<az>:]
<hostname>] [--inter-node-only] [--protocols <T|U|I>]
[--bandwidth <bandwidth>] [--tcpbuf <tcp_pkt_size1,...>]
[--udpbuf <udp_pkt_size1,...>]
<hostname>] [--inter-node-only] [--same-network-only]
[--protocols <T|U|I>] [--bandwidth <bandwidth>]
[--tcpbuf <tcp_pkt_size1,...>] [--udpbuf <udp_pkt_size1,...>]
[--reuse_network_name <network_name>]
[--os-dataplane-network <network_name>]
[--delete-image-after-run] [--no-env]
@ -56,6 +56,7 @@ VMTP Usage
--hypervisor [<az>:] <hostname>
hypervisor to use (1 per arg, up to 2 args)
--inter-node-only only measure inter-node
--same-network-only only measure same network
--protocols <T|U|I> protocols T(TCP), U(UDP), I(ICMP) - default=TUI (all)
--bandwidth <bandwidth>
the bandwidth limit for TCP/UDP flows in K/M/Gbps,

View File

@ -114,6 +114,8 @@ class Network(object):
config.dns_nameservers,
subnet_v6, cidr_v6, config.ipv6_mode)
self.vm_int_net.append(int_net)
if config.same_network_only:
break
else:
for (net, subnet, cidr) in zip(config.internal_network_name,
config.internal_subnet_name,
@ -121,6 +123,8 @@ class Network(object):
int_net = self.create_net(net, subnet, cidr,
config.dns_nameservers)
self.vm_int_net.append(int_net)
if config.same_network_only:
break
# Add both internal networks to router interface to enable
# network to network connectivity

View File

@ -309,8 +309,11 @@ class VmtpTest(object):
client.buginf('SSH connected')
client.create()
FlowPrinter.print_desc('External-VM (upload/download)')
target_ip = self.server.ssh_access.host
if self.config.same_network_only:
target_ip = self.server.internal_ip
res = client.run_client('External-VM',
self.server.ssh_access.host,
target_ip,
self.server,
bandwidth=self.config.vm_bandwidth,
bidirectional=True)
@ -370,7 +373,7 @@ class VmtpTest(object):
self.server.internal_ip)
self.client.dispose()
self.client = None
if not self.config.reuse_network_name:
if not self.config.reuse_network_name and not self.config.same_network_only:
# Different network
self.create_flow_client(client_az, self.net.vm_int_net[1])
@ -741,6 +744,11 @@ def parse_opts_from_cli():
action='store_true',
help='only measure inter-node')
parser.add_argument('--same-network-only', dest='same_network_only',
default=False,
action='store_true',
help='only measure same network')
parser.add_argument('--protocols', dest='protocols',
action='store',
default='TUI',
@ -850,6 +858,7 @@ def merge_opts_to_configs(opts):
config.debug = opts.debug
config.stop_on_error = opts.stop_on_error
config.inter_node_only = opts.inter_node_only
config.same_network_only = opts.same_network_only
if config.public_key_file and not os.path.isfile(config.public_key_file):
print('Warning: invalid public_key_file:' + config.public_key_file)