Support for PVP and PVVP scenerios using Vanilla OVS was added.
VMs are configured to forward traffic between virtual interfaces
by standard linux capabilities. Traffic generator script was updated
to accept MAC and IP address configuration to allow VM forwarding
configuration.
VSPERF-66, VSPERF-70
Change-Id: Ia70ab6be547b39928a1eae319faba779d4e29284
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Signed-off-by: Dino Simeon Madarang <dino.simeonx.madarang@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
Reviewed-by: Gene Snider <eugene.snider@huawei.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Tv Rao <tv.rao@freescale.com>
# For 2 VNFs you may use [(4,5), (6, 7)]
GUEST_CORE_BINDING = [(6, 7), (9, 10)]
+GUEST_START_TIMEOUT = 120
GUEST_OVS_DPDK_DIR = '/root/ovs_dpdk'
OVS_DPDK_SHARE = '/mnt/ovs_dpdk_share'
+
+# IP addresses to use for Vanilla OVS PVP testing
+# Consider using RFC 2544/3330 recommended IP addresses for benchmark testing.
+# Network: 198.18.0.0/15
+# Netmask: 255.254.0.0
+# Broadcast: 198.19.255.255
+# First IP: 198.18.0.1
+# Last IP: 198.19.255.254
+# Hosts: 131070
+#
+
+# ARP entries for the IXIA ports and the bridge you are using:
+VANILLA_TGEN_PORT1_IP = '1.1.1.10'
+VANILLA_TGEN_PORT1_MAC = 'AA:BB:CC:DD:EE:FF'
+
+VANILLA_TGEN_PORT2_IP = '1.1.2.10'
+VANILLA_TGEN_PORT2_MAC = 'AA:BB:CC:DD:EE:F0'
+
+VANILLA_BRIDGE_IP = ['1.1.1.5/16', '1.1.1.6/16']
+
+VANILLA_NIC1_NAME = ['eth0', 'eth2']
+VANILLA_NIC2_NAME = ['eth1', 'eth3']
+
+VANILLA_NIC1_IP_CIDR = ['192.168.1.2/24', '192.168.1.4/24']
+VANILLA_NIC2_IP_CIDR = ['192.168.1.3/24', '192.168.1.5/24']
+
+VNF_AFFINITIZATION_ON = True
packet_sizes_cli = get_test_param('pkt_sizes')
if packet_sizes_cli:
self._packet_sizes = [int(x.strip())
- for x in packet_sizes_cli.split(',')]
+ for x in packet_sizes_cli.split(',')]
else:
self._packet_sizes = settings.getValue('TRAFFICGEN_PKT_SIZES')
str(self._traffic_gen_class))
for packet_size in self._packet_sizes:
- traffic['l2'] = {'framesize': packet_size}
+ # Merge framesize with the default traffic definition
+ if 'l2' in traffic:
+ traffic['l2'] = dict(traffic['l2'],
+ **{'framesize': packet_size})
+ else:
+ traffic['l2'] = {'framesize': packet_size}
+
if traffic['traffic_type'] == 'back2back':
result = self._traffic_gen_class.send_rfc2544_back2back(
traffic, trials=self._trials,
"""
import logging
+from vnfs.vnf.vnf import IVnf
class VnfController(object):
"""VNF controller class
:param vnf_class: The VNF class to be used.
"""
+ # reset VNF ID counter for each testcase
+ IVnf.reset_vnf_counter()
+
+ # setup controller with requested number of VNFs
self._logger = logging.getLogger(__name__)
self._vnf_class = vnf_class
self._deployment_scenario = deployment_scenario.upper()
raise NotImplementedError(
"The VswitchController does not implement the \"get_ports_info\" "
"function.")
+
+ def dump_vswitch_flows(self):
+ """ Dumps flows from vswitch
+ """
+ raise NotImplementedError(
+ "The VswitchController does not implement the "
+ "\"dump_vswitch_flows\" function.")
"""
self._logger.debug('get_ports_info using ' + str(self._vswitch_class))
return self._vswitch.get_ports(settings.getValue('VSWITCH_BRIDGE_NAME'))
+
+ def dump_vswitch_flows(self):
+ """See IVswitchController for description
+ """
+ self._vswitch.dump_flows(settings.getValue('VSWITCH_BRIDGE_NAME'))
"""
self._logger.debug('get_ports_info using ' + str(self._vswitch_class))
return self._vswitch.get_ports(settings.getValue('VSWITCH_BRIDGE_NAME'))
+
+ def dump_vswitch_flows(self):
+ """See IVswitchController for description
+ """
+ self._vswitch.dump_flows(settings.getValue('VSWITCH_BRIDGE_NAME'))
"""
self._logger.debug('get_ports_info using ' + str(self._vswitch_class))
return self._vswitch.get_ports(settings.getValue('VSWITCH_BRIDGE_NAME'))
+
+ def dump_vswitch_flows(self):
+ """See IVswitchController for description
+ """
+ self._vswitch.dump_flows(settings.getValue('VSWITCH_BRIDGE_NAME'))
+October 2015
+==============
+New
+---
+- Support of PVP and PVVP deployment scenarios using Vanilla OVS
+
September 2015
==============
New
-------
- xmlunit output is currently disabled
-- VNF support.
./vsperf --conf-file <path_to_settings_py>
+Executing PVP tests using Vanilla OVS
+-------------------------------------
+To run tests using Vanilla OVS:
+
+1. Set the following variables:
+
+ .. code-block:: console
+
+ VSWITCH = 'OvsVanilla'
+ VNF = 'QemuVirtioNet'
+
+ VANILLA_TGEN_PORT1_IP = n.n.n.n
+ VANILLA_TGEN_PORT1_MAC = nn:nn:nn:nn:nn:nn
+
+ VANILLA_TGEN_PORT2_IP = n.n.n.n
+ VANILLA_TGEN_PORT2_MAC = nn:nn:nn:nn:nn:nn
+
+ VANILLA_BRIDGE_IP = n.n.n.n
+
+ or use --test-param
+
+ ./vsperf --conf-file user_settings.py
+ --test-param "vanilla_tgen_tx_ip=n.n.n.n;
+ vanilla_tgen_tx_mac=nn:nn:nn:nn:nn:nn"
+
+
+2. Recompile src for Vanilla OVS testing
+ .. code-block:: console
+
+ cd src
+ make cleanse
+ make WITH_LINUX=/lib/modules/`uname -r`/build
+
+3. Run test:
+
+ .. code-block:: console
+
+ ./vsperf --conf-file <path_to_settings_py>
GOTCHAs:
--------
import core.component_factory as component_factory
from core.loader import Loader
from tools.report import report
-from conf import settings
+from conf import settings as S
class TestCase(object):
"""TestCase base class
'bidir': self._bidir,
'multistream': self._multistream}
+ # OVS Vanilla requires guest VM MAC address and IPs
+ # to work
+ if (self.deployment in ["pvp", "pvvp"] and
+ S.getValue('VSWITCH') == "OvsVanilla"):
+
+ traffic['l2'] = {'srcmac': S.getValue('GUEST_NET2_MAC')[0],
+ 'dstmac': S.getValue('GUEST_NET1_MAC')[0]}
+
+ traffic['l3'] = {'srcip':
+ S.getValue('VANILLA_TGEN_PORT1_IP'),
+ 'dstip':
+ S.getValue('VANILLA_TGEN_PORT2_IP')}
+
vswitch = vswitch_ctl.get_vswitch()
# TODO BOM 15-08-07 the frame mod code assumes that the
# physical ports are ports 1 & 2. The actual numbers
# need to be retrived from the vSwitch and the metadata value
# updated accordingly.
- bridge = settings.getValue('VSWITCH_BRIDGE_NAME')
+ bridge = S.getValue('VSWITCH_BRIDGE_NAME')
if self._frame_mod == "vlan":
# 0x8100 => VLAN ethertype
self._logger.debug(" **** VLAN ***** ")
with traffic_ctl:
traffic_ctl.send_traffic(traffic)
+ # dump vswitch flows before they are affected by VNF termination
+ vswitch_ctl.dump_vswitch_flows()
+
self._logger.debug("Traffic Results:")
traffic_ctl.print_results()
-frEncapsulation ::ixNet::OBJ-null \
-incrementPerVcVlanMode noIncrement \
-incrementVlanMode noIncrement \
- -mac "00:00:00:00:00:01" \
+ -mac $srcMac \
-macRangeMode normal \
-numberOfVcs 1 \
-siteId 0 \
-frEncapsulation ::ixNet::OBJ-null \
-incrementPerVcVlanMode noIncrement \
-incrementVlanMode noIncrement \
- -mac "00:01:00:05:08:00" \
+ -mac $dstMac \
-macRangeMode normal \
-numberOfVcs 1 \
-siteId 0 \
#
set sg_field $ixNetSG_Stack(3)/field:"ipv4.header.srcIp-27"
ixNet setMultiAttrs $sg_field \
- -singleValue {1.1.1.1} \
+ -singleValue $srcIp \
-seed {1} \
-optionalEnabled True \
-fullMesh False \
-valueList {{0.0.0.0}} \
-stepValue {0.0.0.0} \
-fixedBits {0.0.0.0} \
- -fieldValue {1.1.1.1} \
+ -fieldValue $srcIp \
-auto False \
-randomMask {0.0.0.0} \
-trackingEnabled False \
#
set sg_field $ixNetSG_Stack(3)/field:"ipv4.header.dstIp-28"
ixNet setMultiAttrs $sg_field \
- -singleValue {90.90.90.90} \
+ -singleValue $dstIp \
-seed {1} \
-optionalEnabled True \
-fullMesh False \
-valueList {{0.0.0.0}} \
-stepValue {0.0.0.0} \
-fixedBits {0.0.0.0} \
- -fieldValue {90.90.90.90} \
+ -fieldValue $dstIp \
-auto False \
-randomMask {0.0.0.0} \
-trackingEnabled False \
#
set sg_field $ixNetSG_Stack(3)/field:"ipv4.header.srcIp-27"
ixNet setMultiAttrs $sg_field \
- -singleValue {1.1.1.1} \
+ -singleValue $srcIp \
-seed {1} \
-optionalEnabled True \
-fullMesh False \
#
set sg_field $ixNetSG_Stack(3)/field:"ipv4.header.dstIp-28"
ixNet setMultiAttrs $sg_field \
- -singleValue {90.90.90.90} \
+ -singleValue $dstIp \
-seed {1} \
-optionalEnabled True \
-fullMesh False \
-valueList {{0.0.0.0}} \
-stepValue {0.0.0.0} \
-fixedBits {0.0.0.0} \
- -fieldValue {90.90.90.90} \
+ -fieldValue $dstIp \
-auto False \
-randomMask {0.0.0.0} \
-trackingEnabled False \
def __init__(self):
"""
- :param timeout: Time to wait for login prompt. If set to
- 0 do not wait.
- :param number: Number of QEMU instance, used when multiple QEMU
- instances are started at once.
- :param args: Arguments to pass to QEMU.
-
- :returns: None
+ Initialisation function.
"""
super(IVnfQemu, self).__init__()
self._logger = logging.getLogger(__name__)
'-cpu', 'host',
'-drive', 'if=scsi,file=' +
S.getValue('GUEST_IMAGE')[self._number],
- '-drive',
- 'if=scsi,file=fat:rw:%s,snapshot=off' %
- S.getValue('GUEST_SHARE_DIR')[self._number],
'-boot', 'c', '--enable-kvm',
'-monitor', 'unix:%s,server,nowait' % self._monitor,
'-object',
Start QEMU instance, login and prepare for commands.
"""
super(IVnfQemu, self).start()
- self._affinitize()
+ if S.getValue('VNF_AFFINITIZATION_ON'):
+ self._affinitize()
if self._timeout:
self._login()
def __init__(self):
"""
- :param timeout: Time to wait for login prompt. If set to
- 0 do not wait.
- :param number: Number of QEMU instance, used when multiple QEMU
- instances are started at once.
- :param args: Arguments to pass to QEMU.
-
- :returns: None
+ Initialisation function.
"""
super(IVnfQemuDpdk, self).__init__()
- self._cmd += []
+ self._cmd += ['-drive',
+ 'if=scsi,file=fat:rw:%s,snapshot=off' %
+ S.getValue('GUEST_SHARE_DIR')[self._number],
+ ]
def _modify_dpdk_makefile(self):
"""
--- /dev/null
+# Copyright 2016 Intel Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Automation of QEMU hypervisor for launching virtio-net enabled guests.
+"""
+
+import logging
+from vnfs.qemu.qemu import IVnfQemu
+from conf import settings as S
+from conf import get_test_param
+from tools import tasks
+
+class QemuVirtioNet(IVnfQemu):
+ """
+ Control an instance of QEMU with virtio-net guest communication.
+ """
+
+ def __init__(self):
+ """
+ Initialisation function.
+ """
+ super(QemuVirtioNet, self).__init__()
+ self._logger = logging.getLogger(__name__)
+
+ # insert vanilla ovs specific modules
+ tasks.run_task(['sudo', 'modprobe', 'vhost_net'], self._logger,
+ 'Loading vhost_net module...', True)
+
+ # calculate indexes of guest devices (e.g. charx, dpdkvhostuserx)
+ i = self._number * 2
+ if1 = str(i)
+ if2 = str(i + 1)
+ self._net1 = S.getValue('VANILLA_NIC1_NAME')[self._number]
+ self._net2 = S.getValue('VANILLA_NIC2_NAME')[self._number]
+
+ self._cmd += ['-netdev',
+ 'type=tap,id=' + self._net1 +
+ ',script=no,downscript=no,' +
+ 'ifname=tap' + if1 + ',vhost=on',
+ '-device',
+ 'virtio-net-pci,mac=' +
+ S.getValue('GUEST_NET1_MAC')[self._number] +
+ ',netdev=' + self._net1 + ',csum=off,gso=off,' +
+ 'guest_tso4=off,guest_tso6=off,guest_ecn=off',
+ '-netdev',
+ 'type=tap,id=' + self._net2 +
+ ',script=no,downscript=no,' +
+ 'ifname=tap' + if2 + ',vhost=on',
+ '-device',
+ 'virtio-net-pci,mac=' +
+ S.getValue('GUEST_NET2_MAC')[self._number] +
+ ',netdev=' + self._net2 + ',csum=off,gso=off,' +
+ 'guest_tso4=off,guest_tso6=off,guest_ecn=off',
+ ]
+
+ # helper functions
+
+ def _config_guest_loopback(self):
+ """
+ Configure VM to perform forwarding between NICs
+ """
+
+ # Disable services (F16)
+ self.execute_and_wait('systemctl stop iptables.service')
+ self.execute_and_wait('systemctl stop irqbalance.service')
+
+ nic1_name = get_test_param('vanilla_nic1_name', self._net1)
+ self.execute('ifconfig ' + nic1_name + ' ' +
+ S.getValue('VANILLA_NIC1_IP_CIDR')[self._number])
+
+ nic2_name = get_test_param('vanilla_nic2_name', self._net2)
+ self.execute('ifconfig ' + nic2_name + ' ' +
+ S.getValue('VANILLA_NIC2_IP_CIDR')[self._number])
+
+ # configure linux bridge
+ self.execute('brctl addbr br0')
+ self.execute('brctl addif br0 ' + self._net1 + ' ' + self._net2)
+ self.execute('ifconfig br0 ' +
+ S.getValue('VANILLA_BRIDGE_IP')[self._number])
+
+ # Add the arp entries for the IXIA ports and the bridge you are using.
+ # Use command line values if provided.
+ trafficgen_mac = get_test_param('vanilla_tgen_port1_mac',
+ S.getValue('VANILLA_TGEN_PORT1_MAC'))
+ trafficgen_ip = get_test_param('vanilla_tgen_port1_ip',
+ S.getValue('VANILLA_TGEN_PORT1_IP'))
+
+ self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
+
+ trafficgen_mac = get_test_param('vanilla_tgen_port2_mac',
+ S.getValue('VANILLA_TGEN_PORT2_MAC'))
+ trafficgen_ip = get_test_param('vanilla_tgen_port2_ip',
+ S.getValue('VANILLA_TGEN_PORT2_IP'))
+
+ self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
+
+ # Enable forwarding
+ self.execute('sysctl -w net.ipv4.ip_forward=1')
+
+ # Controls source route verification
+ # 0 means no source validation
+ self.execute('sysctl -w net.ipv4.conf.all.rp_filter=0')
+ self.execute('sysctl -w net.ipv4.conf.' + self._net1 + '.rp_filter=0')
+ self.execute('sysctl -w net.ipv4.conf.' + self._net2 + '.rp_filter=0')
"""
self.execute(cmd)
self.wait(prompt=prompt, timeout=timeout)
+
+ @staticmethod
+ def reset_vnf_counter():
+ """
+ Reset internal VNF counters
+
+ This method is static
+ """
+ IVnf._number_vnfs = 0
+
bridge = self._bridges[switch_name]
bridge.del_flow(flow)
+ def dump_flows(self, switch_name):
+ """See IVswitch for general description
+ """
+ bridge = self._bridges[switch_name]
+ bridge.dump_flows()
+
@staticmethod
def _get_port_count(bridge, param):
"""Returns the number of ports having a certain parameter
from vswitches.vswitch import IVSwitch
from src.ovs import VSwitchd, OFBridge
from tools.module_manager import ModuleManager, KernelModuleInsertMode
+from tools import tasks
+_LOGGER = logging.getLogger(__name__)
VSWITCHD_CONST_ARGS = ['--', '--log-file']
class OvsVanilla(IVSwitch):
_logger = logging.getLogger()
_ports = settings.getValue('VSWITCH_VANILLA_PHY_PORT_NAMES')
_current_id = 0
+ _vport_id = 0
def __init__(self):
#vswitchd_args = VSWITCHD_CONST_ARGS
Kills ovsdb and vswitchd and removes kernel modules.
"""
+ # remove all tap interfaces
+ for i in range(self._vport_id):
+ tapx = 'tap' + str(i)
+ tasks.run_task(['sudo', 'ip', 'tuntap', 'del',
+ tapx, 'mode', 'tap'],
+ _LOGGER, 'Deleting ' + tapx, False)
+ self._vport_id = 0
+
self._vswitchd.kill()
self._module_manager.remove_modules()
+
def add_switch(self, switch_name):
"""See IVswitch for general description
"""
"defined in config!")
raise
+ if not self._ports[self._current_id]:
+ self._logger.error("VSWITCH_VANILLA_PHY_PORT_NAMES not set")
+ raise ValueError("Invalid VSWITCH_VANILLA_PHY_PORT_NAMES")
+
bridge = self._bridges[switch_name]
port_name = self._ports[self._current_id]
params = []
+
+ # For PVP only
+ tasks.run_task(['sudo', 'ifconfig', port_name, '0'],
+ _LOGGER, 'Remove IP', False)
+
of_port = bridge.add_port(port_name, params)
self._current_id += 1
return (port_name, of_port)
def add_vport(self, switch_name):
- """See IVswitch for general description"""
- raise NotImplementedError("Not implemented for Vanilla OVS.")
+ """
+ Method adds virtual port into OVS vanilla
+
+ See IVswitch for general description
+ """
+ # Create tap devices for the VM
+ tap_name = 'tap' + str(self._vport_id)
+ self._vport_id += 1
+
+ tasks.run_task(['sudo', 'ip', 'tuntap', 'del',
+ tap_name, 'mode', 'tap'],
+ _LOGGER, 'Creating tap device...', False)
+
+ tasks.run_task(['sudo', 'ip', 'tuntap', 'add',
+ tap_name, 'mode', 'tap'],
+ _LOGGER, 'Creating tap device...', False)
+
+ tasks.run_task(['sudo', 'ifconfig', tap_name, '0'],
+ _LOGGER, 'Bring up ' + tap_name, False)
+
+ bridge = self._bridges[switch_name]
+ of_port = bridge.add_port(tap_name, [])
+ return (tap_name, of_port)
+
def get_ports(self, switch_name):
"""See IVswitch for general description
flow = flow or {}
bridge = self._bridges[switch_name]
bridge.del_flow(flow)
+
+ def dump_flows(self, switch_name):
+ """See IVswitch for general description
+ """
+ bridge = self._bridges[switch_name]
+ bridge.dump_flows()
For flow==None, all flows are deleted
"""
raise NotImplementedError()
+
+ def dump_flows(self, switch_name):
+ """Dump flows from the logical switch
+
+ :param switch_name: The switch on which to operate
+ """
+ raise NotImplementedError()