summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruser <user@TRAFCLASS-PACKET1.fuel.local>2016-01-13 12:36:50 -0500
committerVincenzo Riccobene <vincenzox.m.riccobene@intel.com>2016-01-14 09:12:00 +0000
commit174560a6b7d4a23763564fcfc87c2dd7e60aa241 (patch)
treefae381ec8b1dc4d278990f780c3b71997ee33364
parent55f7c41c927320a3dac5a0907ebf66647aafd8a8 (diff)
Fix small bugs for running Apexlake on Montreal testbed
JIRA: YARDSTICK-219 Change-Id: I5f403e6c922f5e6ea790dc9cdb589cbc98e66ded Signed-off-by: user <user@TRAFCLASS-PACKET1.fuel.local>
-rwxr-xr-xsetup.py2
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc006.yaml18
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc007.yaml16
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc020.yaml24
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc021.yaml16
-rw-r--r--yardstick/vTC/apexlake/README.md6
-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
-rw-r--r--yardstick/vTC/apexlake/heat_templates/stress_workload.yaml36
-rw-r--r--yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py31
-rw-r--r--yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py27
12 files changed, 125 insertions, 123 deletions
diff --git a/setup.py b/setup.py
index eb55e9283..6b548d2d9 100755
--- a/setup.py
+++ b/setup.py
@@ -39,7 +39,7 @@ setup(
"scp",
"six",
"testrepository>=0.0.18",
- "testtools>=1.4.0"
+ "testtools>=1.4.0",
"nose"
],
extras_require={
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc006.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc006.yaml
index 3d4091293..94d52c350 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc006.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc006.yaml
@@ -7,15 +7,15 @@ scenarios:
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:
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc007.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc007.yaml
index 30d59f797..0cd0a04d4 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc007.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc007.yaml
@@ -10,14 +10,14 @@ scenarios:
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
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc020.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc020.yaml
index 8d9edfe7b..13beeffdb 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc020.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc020.yaml
@@ -1,7 +1,4 @@
---
-# Sample benchmark task config file
-# vTC
-
schema: "yardstick:task:0.1"
scenarios:
@@ -9,14 +6,14 @@ 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
@@ -24,8 +21,5 @@ scenarios:
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
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc021.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc021.yaml
index c62ce2a32..be410dfe2 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc021.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc021.yaml
@@ -6,14 +6,14 @@ scenarios:
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
diff --git a/yardstick/vTC/apexlake/README.md b/yardstick/vTC/apexlake/README.md
index ca4f4ded6..b89df0725 100644
--- a/yardstick/vTC/apexlake/README.md
+++ b/yardstick/vTC/apexlake/README.md
@@ -108,6 +108,12 @@ Then create the smcroute configuration file /etc/smcroute.conf
- $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.
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')
diff --git a/yardstick/vTC/apexlake/heat_templates/stress_workload.yaml b/yardstick/vTC/apexlake/heat_templates/stress_workload.yaml
index 1a2f7dbb3..85477fe85 100644
--- a/yardstick/vTC/apexlake/heat_templates/stress_workload.yaml
+++ b/yardstick/vTC/apexlake/heat_templates/stress_workload.yaml
@@ -2,9 +2,6 @@ heat_template_version: 2014-10-16
description: HOT template to create a DPI
parameters:
- nic_type:
- type: string
- default: normal
name:
type: string
default: cpu_stress
@@ -24,44 +21,17 @@ resources:
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:
@@ -107,6 +77,6 @@ resources:
$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 }
diff --git a/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py b/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py
index 29b3e369f..bad250e7b 100644
--- a/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py
+++ b/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py
@@ -108,7 +108,7 @@ class TestDpdkPacketGenInitialization(unittest.TestCase):
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 ' \
@@ -150,7 +150,7 @@ class TestDpdkPacketGenInitialization(unittest.TestCase):
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 ' \
@@ -317,19 +317,20 @@ class MockRunCommand:
@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:
@@ -337,19 +338,21 @@ class MockRunCommand:
@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
diff --git a/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py b/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py
index c44df6d9f..9d517bcf7 100644
--- a/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py
+++ b/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py
@@ -43,33 +43,39 @@ def dummy_os_kill(pid, signal, get_counters=None):
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
@@ -247,14 +253,15 @@ class InstantiationValidationInitTest(unittest.TestCase):
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]