From 1ce98c7510f810a5ee790523a0dcbf429961adda Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Wed, 22 Nov 2017 16:26:29 -0800 Subject: Add support to use vswitch to handle V2V in PVVP SRIOV scenario 1. Add support to use vswitch to handle V2V in PVVP SRIOV scenario 2. Update nfvbenchvm to 0.5: (1) Update VPP to 17.10; (2) Update DPDK testpmd to 17.08; (3) Change kernel to based on longterm lineup; Change-Id: I944489579a4cd92d17075e80870bbdb32512a150 Signed-off-by: Yichen Wang --- nfvbench/cfg.default.yaml | 7 ++++++- nfvbench/chain_clients.py | 36 ++++++++++++++++++++++++------------ nfvbench/nfvbench.py | 25 ++++++++++++++++++++----- nfvbench/nfvbenchvm/nfvbenchvm.conf | 2 ++ 4 files changed, 52 insertions(+), 18 deletions(-) (limited to 'nfvbench') diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml index 83dd5ac..a8bdc2b 100644 --- a/nfvbench/cfg.default.yaml +++ b/nfvbench/cfg.default.yaml @@ -253,6 +253,11 @@ internal_networks: segmentation_id: physical_network: +# In the scenario of PVVP + SRIOV, there is choice of how the traffic will be +# handled in the middle network. The default (false) will use vswitch, while +# SRIOV can be used by toggling below setting. +use_sriov_middle_net: false + # EXT chain only. Names of edge networks which will be used to send traffic via traffic generator. external_networks: left: 'nfvbench-net0' @@ -400,4 +405,4 @@ factory_class: 'BasicFactory' # Custom label added for every perf record generated during this run. # Can be overriden by --user-label -user_label: \ No newline at end of file +user_label: diff --git a/nfvbench/chain_clients.py b/nfvbench/chain_clients.py index d9a39af..57b15ee 100644 --- a/nfvbench/chain_clients.py +++ b/nfvbench/chain_clients.py @@ -145,11 +145,11 @@ class BasicStageClient(object): LOG.info('Created network: %s.', name) return network - def _create_port(self, net): + def _create_port(self, net, vnic_type='normal'): body = { "port": { 'network_id': net['id'], - 'binding:vnic_type': 'direct' if self.config.sriov else 'normal' + 'binding:vnic_type': vnic_type } } port = self.neutron.create_port(body) @@ -305,7 +305,7 @@ class BasicStageClient(object): else: LOG.error('Unable to delete flavor: %s', self.config.flavor_type) - def get_config_file(self, chain_index, src_mac, dst_mac): + def get_config_file(self, chain_index, src_mac, dst_mac, intf_mac1, intf_mac2): boot_script_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'nfvbenchvm/', self.nfvbenchvm_config_name) @@ -317,6 +317,8 @@ class BasicStageClient(object): vm_config = { 'forwarder': self.config.vm_forwarder, + 'intf_mac1': intf_mac1, + 'intf_mac2': intf_mac2, 'tg_gateway1_ip': self.config.traffic_generator.tg_gateway_ip_addrs[0], 'tg_gateway2_ip': self.config.traffic_generator.tg_gateway_ip_addrs[1], 'tg_net1': self.config.traffic_generator.ip_addrs[0], @@ -479,11 +481,13 @@ class PVPStageClient(BasicStageClient): if reusable_vm: self.vms.append(reusable_vm) else: + vnic_type = 'direct' if self.config.sriov else 'normal' + ports = [self._create_port(net, vnic_type) for net in self.nets] config_file = self.get_config_file(chain_index, self.config.generator_config.src_device.mac, - self.config.generator_config.dst_device.mac) - - ports = [self._create_port(net) for net in self.nets] + self.config.generator_config.dst_device.mac, + ports[0]['mac_address'], + ports[1]['mac_address']) self.created_ports.extend(ports) self.vms.append(self._create_server(name, ports, az, config_file)) self._ensure_vms_active() @@ -542,11 +546,15 @@ class PVVPStageClient(BasicStageClient): if reusable_vm0 and reusable_vm1: self.vms.extend([reusable_vm0, reusable_vm1]) else: - vm0_port_net0 = self._create_port(vm0_nets[0]) - vm0_port_net2 = self._create_port(vm0_nets[1]) + edge_vnic_type = 'direct' if self.config.sriov else 'normal' + middle_vnic_type = 'direct' \ + if self.config.sriov and self.config.use_sriov_middle_net \ + else 'normal' + vm0_port_net0 = self._create_port(vm0_nets[0], edge_vnic_type) + vm0_port_net2 = self._create_port(vm0_nets[1], middle_vnic_type) - vm1_port_net2 = self._create_port(vm1_nets[1]) - vm1_port_net1 = self._create_port(vm1_nets[0]) + vm1_port_net2 = self._create_port(vm1_nets[1], middle_vnic_type) + vm1_port_net1 = self._create_port(vm1_nets[0], edge_vnic_type) self.created_ports.extend([vm0_port_net0, vm0_port_net2, @@ -558,10 +566,14 @@ class PVVPStageClient(BasicStageClient): # TG0 (net0) -> VM0 (net2) -> VM1 (net2) -> TG1 (net1) config_file0 = self.get_config_file(chain_index, self.config.generator_config.src_device.mac, - vm1_port_net2['mac_address']) + vm1_port_net2['mac_address'], + vm0_port_net0['mac_address'], + vm0_port_net2['mac_address']) config_file1 = self.get_config_file(chain_index, vm0_port_net2['mac_address'], - self.config.generator_config.dst_device.mac) + self.config.generator_config.dst_device.mac, + vm1_port_net2['mac_address'], + vm1_port_net1['mac_address']) self.vms.append(self._create_server(name0, [vm0_port_net0, vm0_port_net2], diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py index d1bd0d9..4c9f56c 100644 --- a/nfvbench/nfvbench.py +++ b/nfvbench/nfvbench.py @@ -284,6 +284,12 @@ def parse_opts_from_cli(): action='store_true', help='Use SRIOV (no vswitch - requires SRIOV support in compute nodes)') + parser.add_argument('--use-sriov-middle-net', dest='use_sriov_middle_net', + default=None, + action='store_true', + help='Use SRIOV to handle the middle network traffic ' + '(PVVP with SRIOV only)') + parser.add_argument('-d', '--debug', dest='debug', action='store_true', default=None, @@ -491,20 +497,29 @@ def main(): config.sriov = True if opts.log_file: config.log_file = opts.log_file + if opts.service_chain: + config.service_chain = opts.service_chain + if opts.service_chain_count: + config.service_chain_count = opts.service_chain_count - # show running config in json format - if opts.show_config: - print json.dumps(config, sort_keys=True, indent=4) - sys.exit(0) + if opts.use_sriov_middle_net: + if (not config.sriov) or (not config.service_chain == ChainType.PVVP): + raise Exception("--use-sriov-middle-net is only valid for PVVP with SRIOV") + config.use_sriov_middle_net = True if config.sriov and config.service_chain != ChainType.EXT: # if sriov is requested (does not apply to ext chains) # make sure the physnet names are specified check_physnet("left", config.internal_networks.left) check_physnet("right", config.internal_networks.right) - if config.service_chain == ChainType.PVVP: + if config.service_chain == ChainType.PVVP and config.use_sriov_middle_net: check_physnet("middle", config.internal_networks.middle) + # show running config in json format + if opts.show_config: + print json.dumps(config, sort_keys=True, indent=4) + sys.exit(0) + # update the config in the config plugin as it might have changed # in a copy of the dict (config plugin still holds the original dict) config_plugin.set_config(config) diff --git a/nfvbench/nfvbenchvm/nfvbenchvm.conf b/nfvbench/nfvbenchvm/nfvbenchvm.conf index 0b76244..3bc6ace 100644 --- a/nfvbench/nfvbenchvm/nfvbenchvm.conf +++ b/nfvbench/nfvbenchvm/nfvbenchvm.conf @@ -1,4 +1,6 @@ FORWARDER={forwarder} +INTF_MAC1={intf_mac1} +INTF_MAC2={intf_mac2} TG_MAC1={tg_mac1} TG_MAC2={tg_mac2} VNF_GATEWAY1_CIDR={vnf_gateway1_cidr} -- cgit 1.2.3-korg