"scp",
"six",
"testrepository>=0.0.18",
- "testtools>=1.4.0"
+ "testtools>=1.4.0",
"nose"
],
extras_require={
options:
packet_size: 1280
- vlan_sender: 1007
- vlan_receiver: 1006
- default_net_name: monitoring
- default_subnet_name: monitoring_subnet
- vlan_net_1_name: inbound_traffic_network
- vlan_subnet_1_name: inbound_traffic_subnet
- vlan_net_2_name: inbound_traffic_network
- vlan_subnet_2_name: inbound_traffic_subnet
- vnic_type: direct # [normal (OvS), direct (SR-IOV)]
+ vlan_sender: 2025
+ vlan_receiver: 2021
+ default_net_name: net04
+ default_subnet_name: net04__subnet
+ vlan_net_1_name: apexlake_inbound_net
+ vlan_subnet_1_name: inbound_sub
+ vlan_net_2_name: apexlake_outbound_net
+ vlan_subnet_2_name: outbound_sub
+ vnic_type: direct
vtc_flavor: m1.large
runner:
options:
packet_size: 1280
- vlan_sender: 1007
- vlan_receiver: 1006
- default_net_name: monitoring
- default_subnet_name: monitoring_subnet
- vlan_net_1_name: inbound_traffic_network
- vlan_subnet_1_name: inbound_traffic_subnet
- vlan_net_2_name: inbound_traffic_network
- vlan_subnet_2_name: inbound_traffic_subnet
+ vlan_sender: 2025
+ vlan_receiver: 2021
+ default_net_name: net04
+ default_subnet_name: net04__subnet
+ vlan_net_1_name: apexlake_inbound_net
+ vlan_subnet_1_name: inbound_sub
+ vlan_net_2_name: apexlake_outbound_net
+ vlan_subnet_2_name: outbound_sub
vnic_type: direct # [normal (OvS), direct (SR-IOV)]
vtc_flavor: m1.large
num_of_neighbours: 2
---
-# Sample benchmark task config file
-# vTC
-
schema: "yardstick:task:0.1"
scenarios:
type: vtc_instantiation_validation
options:
- vlan_sender: 1007
- vlan_receiver: 1006
- default_net_name: monitoring
- default_subnet_name: monitoring_subnet
- vlan_net_1_name: inbound_traffic_network
- vlan_subnet_1_name: inbound_traffic_subnet
- vlan_net_2_name: inbound_traffic_network
- vlan_subnet_2_name: inbound_traffic_subnet
+ vlan_sender: 2025
+ vlan_receiver: 2021
+ default_net_name: net04
+ default_subnet_name: net04__subnet
+ vlan_net_1_name: apexlake_inbound_net
+ vlan_subnet_1_name: inbound_sub
+ vlan_net_2_name: apexlake_outbound_net
+ vlan_subnet_2_name: outbound_sub
vnic_type: direct # [normal (OvS), direct (SR-IOV)]
vtc_flavor: m1.large
type: Iteration
iterations: 1
-# dummy context, will not be used by vTC
context:
- type: Node
- name: LF
- file: /etc/yardstick/nodes/fuel_virtual/pod.yaml
+ type: Dummy
type: vtc_instantiation_validation_noisy
options:
- vlan_sender: 1007
- vlan_receiver: 1006
- default_net_name: monitoring
- default_subnet_name: monitoring_subnet
- vlan_net_1_name: inbound_traffic_network
- vlan_subnet_1_name: inbound_traffic_subnet
- vlan_net_2_name: inbound_traffic_network
- vlan_subnet_2_name: inbound_traffic_subnet
+ vlan_sender: 2025
+ vlan_receiver: 2021
+ default_net_name: net04
+ default_subnet_name: net04__subnet
+ vlan_net_1_name: apexlake_inbound_net
+ vlan_subnet_1_name: inbound_sub
+ vlan_net_2_name: apexlake_outbound_net
+ vlan_subnet_2_name: outbound_sub
vnic_type: direct # [normal (OvS), direct (SR-IOV)]
vtc_flavor: m1.large
num_of_neighbours: 2
- $echo mgroup from $SMCROUTE_NIC group 224.192.16.1 > /etc/smcroute.conf
+At the end of this procedure it will be necessary to perform the following actions to add the user to the sudoers:
+
+ - adduser USERNAME sudo
+ - echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+
+
Experiment using SR-IOV configuration on the compute node
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
In order to enable SR-IOV interfaces on the physical NIC of the compute node, a compatible NIC is required.
import os
import commands
-import signal
+# import signal
import time
from experimental_framework.benchmarks import benchmark_base_class as base
from experimental_framework.constants import framework_parameters as fp
self.res_dir = common.get_result_dir()
pids = self._get_pids()
for pid in pids:
- os.kill(pid, signal.SIGTERM)
+ # os.kill(pid, signal.SIGTERM)
+ command = 'sudo kill ' + str(pid)
+ common.run_command(command)
# initialization of the VLAN interface
- command = "ip link add link "
+ command = "sudo ip link add link "
command += self.interface_name
command += " name "
command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
common.run_command(command)
# set up the new
- command = 'ifconfig ' + self.interface_name + '.' + \
+ command = 'sudo ifconfig ' + self.interface_name + '.' + \
self.params[VLAN_RECEIVER]
# An IP address is required for the interface to receive a multicast
# flow. The specific address is not important
common.run_command(command)
# configure smcroute
- command = "echo 'mgroup from "
+ command = "sudo echo 'mgroup from "
command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
command += " group "
command += MULTICAST_GROUP
common.run_command(command)
# run smcroute on the interface
- command = 'smcroute -d'
+ command = 'sudo smcroute -d'
common.run_command(command)
# Start the packet checker
- # TODO: Compile "make" the packet sniffer
- command = "chmod +x {}".format(self.pkt_checker_command)
+ current_dir = os.path.dirname(os.path.realpath(__file__))
+ dir_list = self.pkt_checker_command.split('/')
+ directory = '/'.join(dir_list[0:len(dir_list)-1])
+ os.chdir(directory)
+ command = "make"
common.run_command(command)
- command = self.pkt_checker_command
+ os.chdir(current_dir)
+
+ command = "sudo chmod +x {}".format(self.pkt_checker_command)
+ common.run_command(command)
+
+ command = 'sudo ' + self.pkt_checker_command
command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
command += ' 128'
command += ' &'
"""
pids = self._get_pids()
for pid in pids:
- os.kill(pid, signal.SIGTERM)
+ # os.kill(pid, signal.SIGTERM)
+ command = 'sudo kill ' + str(pid)
+ common.run_command(command)
# stop smcroute on the interface
- command = 'smcroute -k'
+ command = 'sudo smcroute -k'
common.run_command(command)
# finalization of the VLAN interface
- command = "ip link delete "
+ command = "sudo ip link delete "
command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
common.run_command(command)
"The provided template file does not exist")
RESULT_DIR = "/tmp/apexlake/results/"
+ if not os.path.isdir(RESULT_DIR):
+ os.mkdir(RESULT_DIR)
# Validate and assign Iterations
if cf.CFSG_ITERATIONS in CONF_FILE.get_variable_list(cf.CFS_GENERAL):
# Avoid to show the output of the packet generator
self.command_options.append('> /dev/null')
# Prepare the command to be invoked
- self.command = self.directory + self.program_name
+ self.command = 'sudo ' + self.directory + self.program_name
for opt in self.command_options:
self.command += (' ' + opt)
if pcap_file_0 and vlan_0:
# Initialize NIC 1
# bus_address_1 = dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1]
interface_1 = dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1]
- common.run_command('ifconfig ' + interface_1 + ' down')
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ifconfig ' + interface_1 + ' down')
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --unbind ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --bind=igb_uio ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
if dpdk_interfaces == 2:
# Initialize NIC 2
# bus_address_2 = dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2]
interface_2 = dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2]
- common.run_command('ifconfig ' + interface_2 + ' down')
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ifconfig ' + interface_2 + ' down')
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --unbind ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --bind=igb_uio ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
'generation usage. Please specify one or two '
'NICs')
# Initialize NIC 1
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --unbind ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
time.sleep(5)
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --bind=ixgbe ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1])
- common.run_command('ifconfig ' +
+ common.run_command('sudo ifconfig ' +
dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] +
' up')
if dpdk_interfaces == 2:
# Initialize NIC 2
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --unbind ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
time.sleep(5)
- common.run_command(dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
+ common.run_command('sudo ' +
+ dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] +
'tools/dpdk_nic_bind.py --bind=ixgbe ' +
dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2])
- common.run_command('ifconfig ' +
+ common.run_command('sudo ifconfig ' +
dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] +
' up')
description: HOT template to create a DPI
parameters:
- nic_type:
- type: string
- default: normal
name:
type: string
default: cpu_stress
network_id: { get_resource: internal_net }
cidr: 10.100.0.0/24
- router:
- properties:
- admin_state_up: true
- name: router
- type: OS::Neutron::Router
-
- router_gateway:
- properties:
- network: external
- router_id: { get_resource: router }
- type: OS::Neutron::RouterGateway
-
- router_interface_0:
- properties:
- router_id: { get_resource: router }
- subnet_id: { get_resource: internal_subnet }
- type: OS::Neutron::RouterInterface
-
- vm1_port_1:
+ port:
type: OS::Neutron::Port
properties:
network: { get_resource: internal_net }
- binding:vnic_type: { get_param: nic_type }
fixed_ips:
- subnet: { get_resource: internal_subnet }
- flavor_1:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 4096
- vcpus: 4
-
vm1:
type: OS::Nova::Server
properties:
name: traffic_vm1
- key_name: test
image: ubuntu1404
user_data:
str_replace:
$CORES: { get_param: cores }
$MEMORY: { get_param: memory }
- flavor: { get_resource: flavor_1 }
+ flavor: m1.small
networks:
- - port: { get_resource: vm1_port_1 }
+ - port: { get_resource: port }
mock_init_input_validation.return_value = None
mock_get_core_nics.return_value = "{corenics}"
mock_path.isfile.return_value = True
- expected = 'pktgen_dir/program -c coremask -n memchannel ' \
+ expected = 'sudo pktgen_dir/program -c coremask -n memchannel ' \
'--proc-type auto --file-prefix pg -- -T -P -m ' \
'"{corenics}" -f base_dir/experimental_framework/' \
'packet_generators/dpdk_pktgen/lua_file ' \
mock_init_input_validation.return_value = None
mock_get_core_nics.return_value = "{corenics}"
mock_path.isfile.return_value = True
- expected = 'pktgen_dir/program -c coremask -n memchannel ' \
+ expected = 'sudo pktgen_dir/program -c coremask -n memchannel ' \
'--proc-type auto --file-prefix pg -- -T -P -m ' \
'"{corenics}" -f base_dir/experimental_framework/' \
'packet_generators/dpdk_pktgen/lua_file ' \
@staticmethod
def mock_run_command(command=None):
- if command == 'ifconfig interface_1 down':
+ if command == 'sudo ifconfig interface_1 down':
MockRunCommand.ret_val[0] = True
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py --unbind 1:00.0':
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
+ '--unbind 1:00.0':
MockRunCommand.ret_val[1] = True
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py ' \
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
'--bind=igb_uio 1:00.0':
MockRunCommand.ret_val[2] = True
- if command == 'ifconfig interface_2 down':
+ if command == 'sudo ifconfig interface_2 down':
MockRunCommand.ret_val[3] = True
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py ' \
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
'--unbind 1:00.1':
MockRunCommand.ret_val[4] = True
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py ' \
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
'--bind=igb_uio 1:00.1':
MockRunCommand.ret_val[5] = True
else:
@staticmethod
def mock_run_command_finalization(command=None):
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py --unbind 1:00.0':
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
+ '--unbind 1:00.0':
MockRunCommand.ret_val_finalization[0] = True
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py ' \
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
'--bind=ixgbe 1:00.0':
MockRunCommand.ret_val_finalization[1] = True
- if command == 'ifconfig interface_1 up':
+ if command == 'sudo ifconfig interface_1 up':
MockRunCommand.ret_val_finalization[2] = True
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py --unbind 1:00.1':
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
+ '--unbind 1:00.1':
MockRunCommand.ret_val_finalization[3] = True
- if command == 'dpdk_directory/tools/dpdk_nic_bind.py ' \
+ if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
'--bind=ixgbe 1:00.1':
MockRunCommand.ret_val_finalization[4] = True
- if command == 'ifconfig interface_2 up':
+ if command == 'sudo ifconfig interface_2 up':
MockRunCommand.ret_val_finalization[5] = True
else:
return MockRunCommand.ret_val_finalization
def dummy_run_command(command, get_counters=None):
if get_counters:
return command_counter
- if command == 'smcroute -k':
+ if command == 'sudo smcroute -k':
command_counter[0] += 1
return
- elif command == 'ip link delete interface.100':
+ elif command == 'sudo ip link delete interface.100':
command_counter[1] += 1
return
+ elif command == 'sudo kill 1234':
+ kill_counter[0] += 1
+ return
+ elif command == 'sudo kill 4321':
+ kill_counter[1] += 1
+ return
raise Exception(command)
def dummy_run_command_2(command, get_counters=None):
if get_counters:
return command_counter
- if command == 'ip link add link interface name interface.' \
+ if command == 'sudo ip link add link interface name interface.' \
'100 type vlan id 100':
command_counter[0] += 1
return
- elif command == 'ifconfig interface.100 10.254.254.254 up':
+ elif command == 'sudo ifconfig interface.100 10.254.254.254 up':
command_counter[1] += 1
return
- elif command == "echo 'mgroup from interface.100 group 224.192.16.1' > " \
- "/etc/smcroute.conf":
+ elif command == "sudo echo 'mgroup from interface.100 group" \
+ " 224.192.16.1' > /etc/smcroute.conf":
command_counter[2] += 1
return
- elif command == "smcroute -d":
+ elif command == "sudo smcroute -d":
command_counter[3] += 1
return
- elif command == "test_sniff interface.100 128 &":
+ elif command == "sudo test_sniff interface.100 128 &":
command_counter[4] += 1
return
self.assertEqual(dummy_os_kill('', '', True), [1, 1])
self.assertEqual(dummy_run_command('', True), [1, 1, 0, 0, 0])
+ @mock.patch('os.chdir')
@mock.patch('experimental_framework.common.run_command',
side_effect=dummy_run_command_2)
@mock.patch('experimental_framework.benchmarks.'
'instantiation_validation_benchmark.'
'InstantiationValidationBenchmark._get_pids')
@mock.patch('os.kill', side_effect=dummy_os_kill)
- def test__init_packet_checker_for_success(self, mock_kill,
- mock_pids, mock_run_command):
+ def test__init_packet_checker_for_success(self, mock_kill, mock_pids,
+ mock_run_command, mock_chdir):
global command_counter
command_counter = [0, 0, 0, 0, 0]
mock_pids.return_value = [1234, 4321]