From 2cf7167718953e0797ccafb3d916919334865542 Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Fri, 20 Nov 2015 11:46:44 -0800 Subject: [PATCH] Add option to specify dataplane network name Change-Id: I2c48e2eb1bbba06d9e8e8d7c00c444108ee493db --- doc/source/usage.rst | 6 +++++- vmtp/cfg.default.yaml | 9 ++++++--- vmtp/network.py | 9 +++++---- vmtp/vmtp.py | 9 +++++++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 26ab6c2..f5cbb2d 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -17,7 +17,8 @@ VMTP Usage [--inter-node-only] [--protocols ] [--bandwidth ] [--tcpbuf ] [--udpbuf ] - [--reuse_network_name ] [--no-env] + [--reuse_network_name ] + [--os-dataplane-network ] [--no-env] [--vnic-type ] [-d] [-v] [--stop-on-error] [--vm-image-url ] [--test-description ] @@ -63,6 +64,9 @@ VMTP Usage Bytes, e.g. --udpbuf 128,2048. (default=128,1024,8192) --reuse_network_name the network to be reused for performing tests + --os-dataplane-network + Internal network name for OpenStack to hold data plane + traffic --no-env do not read env variables --vnic-type binding vnic type for test VMs diff --git a/vmtp/cfg.default.yaml b/vmtp/cfg.default.yaml index 55d8f56..4ac7043 100644 --- a/vmtp/cfg.default.yaml +++ b/vmtp/cfg.default.yaml @@ -105,7 +105,7 @@ internal_cidr_v6: ['2001:45::/64','2001:46::/64'] # By default the SSH library will try several methods to authenticate: # - password if provided on the command line # - user's own key pair (under the home directory $HOME) if already setup -# - the below key pair if not empty +# - the below key pair if not empty # If you want to use a specific key pair, specify the key pair files here. # This can be a pathname that is absolute or relative to the current directory public_key_file: @@ -128,10 +128,10 @@ ping_count: 2 ping_pass_threshold: 80 # Max retry count for ssh to a VM (5 seconds between retries) -ssh_retry_count: 50 +ssh_retry_count: 50 # General retry count -generic_retry_count: 50 +generic_retry_count: 50 # Times to run when measuring TCP Throughput tcp_tp_loop_count: 3 @@ -161,6 +161,9 @@ udp_loss_rate_range: [2, 5] # 0 means unlimited, which can be overridden at the command line using --bandwidth vm_bandwidth: 0 +# Internal network name for OpenStack to hold data plane traffic +os_dataplane_network: 'physnet1' + ####################################### # VMTP MongoDB Connection information ####################################### diff --git a/vmtp/network.py b/vmtp/network.py index 989b4a8..4907412 100644 --- a/vmtp/network.py +++ b/vmtp/network.py @@ -378,21 +378,22 @@ class Network(object): ''' agents = self.neutron_client.list_agents()['agents'] + dp_net = self.config.os_dataplane_network internal_iface_dict = {} for agent in agents: agent_type = agent['agent_type'] hostname = agent['host'] if 'Linux bridge' in agent_type: agent_detail = self.neutron_client.show_agent(agent['id'])['agent'] - if 'physnet1' in agent_detail['configurations']['interface_mappings']: - ifname = agent_detail['configurations']['interface_mappings']['physnet1'] + if dp_net in agent_detail['configurations']['interface_mappings']: + ifname = agent_detail['configurations']['interface_mappings'][dp_net] internal_iface_dict[hostname] = ifname elif 'Open vSwitch' in agent_type: network_type = self.vm_int_net[0]['provider:network_type'] agent_detail = self.neutron_client.show_agent(agent['id'])['agent'] if network_type == "vlan": - if 'physnet1' in agent_detail['configurations']['bridge_mappings']: - brname = agent_detail['configurations']['bridge_mappings']['physnet1'] + if dp_net in agent_detail['configurations']['bridge_mappings']: + brname = agent_detail['configurations']['bridge_mappings'][dp_net] internal_iface_dict[hostname] = brname elif network_type == "vxlan" or network_type == 'gre': ipaddr = agent_detail['configurations']['tunneling_ip'] diff --git a/vmtp/vmtp.py b/vmtp/vmtp.py index 367cabd..38b9227 100755 --- a/vmtp/vmtp.py +++ b/vmtp/vmtp.py @@ -764,6 +764,12 @@ def parse_opts_from_cli(): help='the network to be reused for performing tests', metavar='') + 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='') + parser.add_argument('--no-env', dest='no_env', default=False, action='store_true', @@ -914,6 +920,9 @@ def merge_opts_to_configs(opts): if 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) # option is enabled.