Add option to specify dataplane network name

Change-Id: I2c48e2eb1bbba06d9e8e8d7c00c444108ee493db
This commit is contained in:
Yichen Wang 2015-11-20 11:46:44 -08:00
parent 465c158fa5
commit 2cf7167718
4 changed files with 25 additions and 8 deletions

View File

@ -17,7 +17,8 @@ VMTP Usage
[--inter-node-only] [--protocols <T|U|I>] [--inter-node-only] [--protocols <T|U|I>]
[--bandwidth <bandwidth>] [--tcpbuf <tcp_pkt_size1,...>] [--bandwidth <bandwidth>] [--tcpbuf <tcp_pkt_size1,...>]
[--udpbuf <udp_pkt_size1,...>] [--udpbuf <udp_pkt_size1,...>]
[--reuse_network_name <network_name>] [--no-env] [--reuse_network_name <network_name>]
[--os-dataplane-network <network_name>] [--no-env]
[--vnic-type <direct|macvtap|normal>] [-d] [-v] [--vnic-type <direct|macvtap|normal>] [-d] [-v]
[--stop-on-error] [--vm-image-url <url_to_image>] [--stop-on-error] [--vm-image-url <url_to_image>]
[--test-description <test_description>] [--test-description <test_description>]
@ -63,6 +64,9 @@ VMTP Usage
Bytes, e.g. --udpbuf 128,2048. (default=128,1024,8192) Bytes, e.g. --udpbuf 128,2048. (default=128,1024,8192)
--reuse_network_name <network_name> --reuse_network_name <network_name>
the network to be reused for performing tests the network to be reused for performing tests
--os-dataplane-network <network_name>
Internal network name for OpenStack to hold data plane
traffic
--no-env do not read env variables --no-env do not read env variables
--vnic-type <direct|macvtap|normal> --vnic-type <direct|macvtap|normal>
binding vnic type for test VMs binding vnic type for test VMs

View File

@ -161,6 +161,9 @@ udp_loss_rate_range: [2, 5]
# 0 means unlimited, which can be overridden at the command line using --bandwidth # 0 means unlimited, which can be overridden at the command line using --bandwidth
vm_bandwidth: 0 vm_bandwidth: 0
# Internal network name for OpenStack to hold data plane traffic
os_dataplane_network: 'physnet1'
####################################### #######################################
# VMTP MongoDB Connection information # VMTP MongoDB Connection information
####################################### #######################################

View File

@ -378,21 +378,22 @@ class Network(object):
''' '''
agents = self.neutron_client.list_agents()['agents'] agents = self.neutron_client.list_agents()['agents']
dp_net = self.config.os_dataplane_network
internal_iface_dict = {} internal_iface_dict = {}
for agent in agents: for agent in agents:
agent_type = agent['agent_type'] agent_type = agent['agent_type']
hostname = agent['host'] hostname = agent['host']
if 'Linux bridge' in agent_type: if 'Linux bridge' in agent_type:
agent_detail = self.neutron_client.show_agent(agent['id'])['agent'] agent_detail = self.neutron_client.show_agent(agent['id'])['agent']
if 'physnet1' in agent_detail['configurations']['interface_mappings']: if dp_net in agent_detail['configurations']['interface_mappings']:
ifname = agent_detail['configurations']['interface_mappings']['physnet1'] ifname = agent_detail['configurations']['interface_mappings'][dp_net]
internal_iface_dict[hostname] = ifname internal_iface_dict[hostname] = ifname
elif 'Open vSwitch' in agent_type: elif 'Open vSwitch' in agent_type:
network_type = self.vm_int_net[0]['provider:network_type'] network_type = self.vm_int_net[0]['provider:network_type']
agent_detail = self.neutron_client.show_agent(agent['id'])['agent'] agent_detail = self.neutron_client.show_agent(agent['id'])['agent']
if network_type == "vlan": if network_type == "vlan":
if 'physnet1' in agent_detail['configurations']['bridge_mappings']: if dp_net in agent_detail['configurations']['bridge_mappings']:
brname = agent_detail['configurations']['bridge_mappings']['physnet1'] brname = agent_detail['configurations']['bridge_mappings'][dp_net]
internal_iface_dict[hostname] = brname internal_iface_dict[hostname] = brname
elif network_type == "vxlan" or network_type == 'gre': elif network_type == "vxlan" or network_type == 'gre':
ipaddr = agent_detail['configurations']['tunneling_ip'] ipaddr = agent_detail['configurations']['tunneling_ip']

View File

@ -764,6 +764,12 @@ def parse_opts_from_cli():
help='the network to be reused for performing tests', help='the network to be reused for performing tests',
metavar='<network_name>') metavar='<network_name>')
parser.add_argument('--os-dataplane-network', dest='os_dataplane_network',
action='store',
default=None,
help='Internal network name for OpenStack to hold data plane traffic',
metavar='<network_name>')
parser.add_argument('--no-env', dest='no_env', parser.add_argument('--no-env', dest='no_env',
default=False, default=False,
action='store_true', action='store_true',
@ -914,6 +920,9 @@ def merge_opts_to_configs(opts):
if opts.reuse_network_name: if opts.reuse_network_name:
config.reuse_network_name = opts.reuse_network_name config.reuse_network_name = opts.reuse_network_name
if opts.os_dataplane_network:
config.os_dataplane_network = opts.os_dataplane_network
##################################################### #####################################################
# Set Ganglia server ip and port if the monitoring (-m) # Set Ganglia server ip and port if the monitoring (-m)
# option is enabled. # option is enabled.