aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/vTC/apexlake/experimental_framework
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/vTC/apexlake/experimental_framework')
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py36
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/common.py2
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py34
3 files changed, 47 insertions, 25 deletions
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
index 049912305..c85aff5a9 100644
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
+++ b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
@@ -14,7 +14,7 @@
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
@@ -162,10 +162,12 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
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]
@@ -173,7 +175,7 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
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
@@ -181,7 +183,7 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
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
@@ -189,14 +191,22 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
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 += ' &'
@@ -210,14 +220,16 @@ class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
"""
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)
diff --git a/yardstick/vTC/apexlake/experimental_framework/common.py b/yardstick/vTC/apexlake/experimental_framework/common.py
index afe70241a..f16a423fc 100644
--- a/yardstick/vTC/apexlake/experimental_framework/common.py
+++ b/yardstick/vTC/apexlake/experimental_framework/common.py
@@ -119,6 +119,8 @@ def init_general_vars(api=False):
"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):
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
index 347d51af3..6dc32b671 100644
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
+++ b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
@@ -111,7 +111,7 @@ class DpdkPacketGenerator(base_packet_generator.BasePacketGenerator):
# 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:
@@ -212,22 +212,26 @@ class DpdkPacketGenerator(base_packet_generator.BasePacketGenerator):
# 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])
@@ -244,26 +248,30 @@ class DpdkPacketGenerator(base_packet_generator.BasePacketGenerator):
'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')