aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-08-03 15:09:29 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-03 15:09:29 +0000
commit4d36bbf0990fc6ddb59092dd8bd7f985392907cb (patch)
tree351b34cc94e8836fb57096b8314af0eed40d5181 /yardstick
parent4f13caca517bd6ff31c0213ec7f9d8809dd4ef3c (diff)
parentd455f3b56c866b0e61394a01f0a07e05831f3044 (diff)
Merge "DRAFT: remove apexlake"
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/__init__.py6
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py88
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py99
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_throughput.py88
-rw-r--r--yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py98
-rw-r--r--yardstick/vTC/__init__.py0
-rw-r--r--yardstick/vTC/apexlake/.gitignore2
-rw-r--r--yardstick/vTC/apexlake/MANIFEST.in7
-rw-r--r--yardstick/vTC/apexlake/README.rst238
-rw-r--r--yardstick/vTC/apexlake/__init__.py17
-rw-r--r--yardstick/vTC/apexlake/apexlake.conf36
-rwxr-xr-xyardstick/vTC/apexlake/bin/run_tests.sh16
-rw-r--r--yardstick/vTC/apexlake/docs/source/api.rst5
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/__init__.py22
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/api.py153
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py283
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py17
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py85
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py260
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py94
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py97
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py140
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py39
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/common.py622
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/constants/__init__.py17
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py102
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py34
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/deployment_unit.py120
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/heat_manager.py103
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py236
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py19
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile19
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c146
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py19
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py32
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py351
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua74
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua132
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst26
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcapbin172 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcapbin1064 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcapbin168 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcapbin1320 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcapbin1632 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcapbin1558 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcapbin295 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcapbin553 -> 0 bytes
-rw-r--r--yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcapbin104 -> 0 bytes
-rwxr-xr-xyardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh21
-rw-r--r--yardstick/vTC/apexlake/heat_templates/stress_workload.yaml83
-rw-r--r--yardstick/vTC/apexlake/heat_templates/stress_workload_liberty.yaml79
-rw-r--r--yardstick/vTC/apexlake/heat_templates/vTC.yaml192
-rw-r--r--yardstick/vTC/apexlake/heat_templates/vTC_liberty.yaml191
-rw-r--r--yardstick/vTC/apexlake/setup.py55
-rw-r--r--yardstick/vTC/apexlake/tests/api_test.py147
-rw-r--r--yardstick/vTC/apexlake/tests/base_packet_generator_test.py30
-rw-r--r--yardstick/vTC/apexlake/tests/benchmark_base_class_test.py86
-rw-r--r--yardstick/vTC/apexlake/tests/benchmarking_unit_test.py481
-rw-r--r--yardstick/vTC/apexlake/tests/common_test.py665
-rw-r--r--yardstick/vTC/apexlake/tests/conf_file_sections_test.py30
-rw-r--r--yardstick/vTC/apexlake/tests/data/common/conf.cfg43
-rw-r--r--yardstick/vTC/apexlake/tests/data/common/file_replacement.txt1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp199
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml199
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml199
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml207
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv3
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv5
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp199
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml212
-rw-r--r--yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json1
-rw-r--r--yardstick/vTC/apexlake/tests/deployment_unit_test.py279
-rw-r--r--yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py710
-rw-r--r--yardstick/vTC/apexlake/tests/generates_template_test.py102
-rw-r--r--yardstick/vTC/apexlake/tests/heat_manager_test.py235
-rw-r--r--yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py339
-rw-r--r--yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py150
-rw-r--r--yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py119
-rw-r--r--yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py162
-rw-r--r--yardstick/vTC/apexlake/tests/tree_node_test.py98
89 files changed, 0 insertions, 10106 deletions
diff --git a/yardstick/__init__.py b/yardstick/__init__.py
index 2f5ae9feb..c1010d98c 100644
--- a/yardstick/__init__.py
+++ b/yardstick/__init__.py
@@ -10,16 +10,10 @@
from __future__ import absolute_import
import logging
import os
-import sys
-import yardstick.vTC.apexlake as apexlake
from yardstick.common import constants
from yardstick.common import utils as yardstick_utils
-# Hack to be able to run apexlake unit tests
-# without having to install apexlake.
-sys.path.append(os.path.dirname(apexlake.__file__))
-
yardstick_utils.makedirs(constants.LOG_DIR)
LOG_FILE = os.path.join(constants.LOG_DIR, 'yardstick.log')
LOG_FORMATTER = ('%(asctime)s '
diff --git a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py b/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py
deleted file mode 100644
index ac57c929c..000000000
--- a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from __future__ import absolute_import
-import logging
-import os
-
-from yardstick.benchmark.scenarios import base
-import experimental_framework.api as api
-
-LOG = logging.getLogger(__name__)
-
-
-class VtcInstantiationValidation(base.Scenario):
- """Execute Instantiation Validation TC on the vTC
- """
- __scenario_type__ = "vtc_instantiation_validation"
-
- def __init__(self, scenario_cfg, context_cfg):
- self.scenario_cfg = scenario_cfg
- self.context_cfg = context_cfg
- self.options = None
- self.setup_done = False
-
- def setup(self):
- """scenario setup"""
-
- self.options = self.scenario_cfg['options']
- self.setup_done = True
-
- def run(self, result):
- """execute test"""
-
- if not self.setup_done:
- self.setup()
-
- heat_template = 'vTC.yaml'
- iterations = 1
-
- openstack_credentials = {
- 'ip_controller': '0.0.0.0',
- 'heat_url': '***',
- 'auth_uri': os.environ.get('OS_AUTH_URL'),
- 'user': os.environ.get('OS_USERNAME'),
- 'password': os.environ.get('OS_PASSWORD'),
- 'project': os.environ.get('OS_TENANT_NAME')
- }
- heat_template_parameters = {
- 'default_net': self.options['default_net_name'],
- 'default_subnet': self.options['default_subnet_name'],
- 'source_net': self.options['vlan_net_1_name'],
- 'source_subnet': self.options['vlan_subnet_1_name'],
- 'destination_net': self.options['vlan_net_2_name'],
- 'destination_subnet': self.options['vlan_subnet_2_name']
- }
- deployment_configuration = {
- 'vnic_type': [self.options['vnic_type']],
- 'vtc_flavor': [self.options['vtc_flavor']]
- }
-
- test_case = dict()
- test_case['name'] = 'instantiation_validation_benchmark.' \
- 'InstantiationValidationBenchmark'
- test_case['params'] = dict()
- test_case['params']['throughput'] = '1'
- test_case['params']['vlan_sender'] = str(self.options['vlan_sender'])
- test_case['params']['vlan_receiver'] = \
- str(self.options['vlan_receiver'])
-
- res = dict()
- try:
- res = api.FrameworkApi.execute_framework(
- [test_case],
- iterations,
- heat_template,
- heat_template_parameters,
- deployment_configuration,
- openstack_credentials)
- except Exception:
- LOG.exception('Exception')
- LOG.info('Got output: %s', res)
- result.update(res)
diff --git a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py b/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py
deleted file mode 100644
index d3a9a9a02..000000000
--- a/yardstick/benchmark/scenarios/networking/vtc_instantiation_validation_noisy.py
+++ /dev/null
@@ -1,99 +0,0 @@
-#############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from __future__ import absolute_import
-import logging
-import os
-
-from yardstick.benchmark.scenarios import base
-import experimental_framework.api as api
-
-LOG = logging.getLogger(__name__)
-
-
-class VtcInstantiationValidationNoisy(base.Scenario):
- """Execute Instantiation Validation TC on the vTC
- """
- __scenario_type__ = "vtc_instantiation_validation_noisy"
-
- def __init__(self, scenario_cfg, context_cfg):
- self.scenario_cfg = scenario_cfg
- self.context_cfg = context_cfg
- self.options = None
- self.setup_done = False
-
- def setup(self):
- """scenario setup"""
-
- self.options = self.scenario_cfg['options']
- self.setup_done = True
-
- def run(self, result):
- """execute test"""
-
- if not self.setup_done:
- self.setup()
-
- heat_template = 'vTC.yaml'
- iterations = 1
-
- openstack_credentials = {
- 'ip_controller': '0.0.0.0',
- 'heat_url': '***',
- 'auth_uri': os.environ.get('OS_AUTH_URL'),
- 'user': os.environ.get('OS_USERNAME'),
- 'password': os.environ.get('OS_PASSWORD'),
- 'project': os.environ.get('OS_TENANT_NAME')
- }
- heat_template_parameters = {
- 'default_net': self.options['default_net_name'],
- 'default_subnet': self.options['default_subnet_name'],
- 'source_net': self.options['vlan_net_1_name'],
- 'source_subnet': self.options['vlan_subnet_1_name'],
- 'destination_net': self.options['vlan_net_2_name'],
- 'destination_subnet': self.options['vlan_subnet_2_name']
- }
- deployment_configuration = {
- 'vnic_type': [self.options['vnic_type']],
- 'vtc_flavor': [self.options['vtc_flavor']]
- }
-
- test_case = dict()
- test_case['name'] = 'instantiation_validation_noisy_neighbors_' \
- 'benchmark.' \
- 'InstantiationValidationNoisyNeighborsBenchmark'
- test_case['params'] = dict()
- test_case['params']['throughput'] = '1'
- test_case['params']['vlan_sender'] = str(self.options['vlan_sender'])
- test_case['params']['vlan_receiver'] = \
- str(self.options['vlan_receiver'])
- test_case['params']['num_of_neighbours'] = \
- str(self.options['num_of_neighbours'])
- test_case['params']['amount_of_ram'] = \
- str(self.options['amount_of_ram'])
- test_case['params']['number_of_cores'] = \
- str(self.options['number_of_cores'])
- test_case['params']['network'] = \
- str(self.options['default_net_name'])
- test_case['params']['subnet'] = \
- str(self.options['default_subnet_name'])
-
- res = dict()
- try:
- res = api.FrameworkApi.execute_framework(
- [test_case],
- iterations,
- heat_template,
- heat_template_parameters,
- deployment_configuration,
- openstack_credentials)
- except Exception:
- LOG.exception('Exception')
- LOG.info('Got output: %s', res)
- result.update(res)
diff --git a/yardstick/benchmark/scenarios/networking/vtc_throughput.py b/yardstick/benchmark/scenarios/networking/vtc_throughput.py
deleted file mode 100644
index b9cb0b1e7..000000000
--- a/yardstick/benchmark/scenarios/networking/vtc_throughput.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from __future__ import absolute_import
-import logging
-import os
-
-from yardstick.benchmark.scenarios import base
-from experimental_framework import api as api
-
-LOG = logging.getLogger(__name__)
-
-
-class VtcThroughput(base.Scenario):
- """Execute Instantiation Validation TC on the vTC
- """
- __scenario_type__ = "vtc_throughput"
-
- def __init__(self, scenario_cfg, context_cfg):
- self.scenario_cfg = scenario_cfg
- self.context_cfg = context_cfg
- self.options = None
- self.setup_done = False
-
- def setup(self):
- """scenario setup"""
-
- self.options = self.scenario_cfg['options']
- self.setup_done = True
-
- def run(self, result):
- """execute test"""
-
- if not self.setup_done:
- self.setup()
-
- heat_template = 'vTC.yaml'
- iterations = 1
-
- openstack_credentials = {
- 'ip_controller': '0.0.0.0',
- 'heat_url': '***',
- 'auth_uri': os.environ.get('OS_AUTH_URL'),
- 'user': os.environ.get('OS_USERNAME'),
- 'password': os.environ.get('OS_PASSWORD'),
- 'project': os.environ.get('OS_TENANT_NAME')
- }
- heat_template_parameters = {
- 'default_net': self.options['default_net_name'],
- 'default_subnet': self.options['default_subnet_name'],
- 'source_net': self.options['vlan_net_1_name'],
- 'source_subnet': self.options['vlan_subnet_1_name'],
- 'destination_net': self.options['vlan_net_2_name'],
- 'destination_subnet': self.options['vlan_subnet_2_name']
- }
- deployment_configuration = {
- 'vnic_type': [self.options['vnic_type']],
- 'vtc_flavor': [self.options['vtc_flavor']]
- }
-
- test_case = dict()
- test_case['name'] = 'rfc2544_throughput_benchmark.' \
- 'RFC2544ThroughputBenchmark'
- test_case['params'] = dict()
- test_case['params']['packet_size'] = str(self.options['packet_size'])
- test_case['params']['vlan_sender'] = str(self.options['vlan_sender'])
- test_case['params']['vlan_receiver'] = \
- str(self.options['vlan_receiver'])
-
- res = dict()
- try:
- res = api.FrameworkApi.execute_framework(
- [test_case],
- iterations,
- heat_template,
- heat_template_parameters,
- deployment_configuration,
- openstack_credentials)
- except Exception:
- LOG.exception("Exception")
- LOG.info('Got output: %s', res)
- result.update(res)
diff --git a/yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py b/yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py
deleted file mode 100644
index 38ebc4c42..000000000
--- a/yardstick/benchmark/scenarios/networking/vtc_throughput_noisy.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from __future__ import absolute_import
-import logging
-import os
-
-from yardstick.benchmark.scenarios import base
-import experimental_framework.api as api
-
-LOG = logging.getLogger(__name__)
-
-
-class VtcThroughputNoisy(base.Scenario):
- """Execute Instantiation Validation TC on the vTC
- """
- __scenario_type__ = "vtc_throughput_noisy"
-
- def __init__(self, scenario_cfg, context_cfg):
- self.scenario_cfg = scenario_cfg
- self.context_cfg = context_cfg
- self.options = None
- self.setup_done = False
-
- def setup(self):
- """scenario setup"""
-
- self.options = self.scenario_cfg['options']
- self.setup_done = True
-
- def run(self, result):
- """execute test"""
-
- if not self.setup_done:
- self.setup()
-
- heat_template = 'vTC.yaml'
- iterations = 1
-
- openstack_credentials = {
- 'ip_controller': '0.0.0.0',
- 'heat_url': '***',
- 'auth_uri': os.environ.get('OS_AUTH_URL'),
- 'user': os.environ.get('OS_USERNAME'),
- 'password': os.environ.get('OS_PASSWORD'),
- 'project': os.environ.get('OS_TENANT_NAME')
- }
- heat_template_parameters = {
- 'default_net': self.options['default_net_name'],
- 'default_subnet': self.options['default_subnet_name'],
- 'source_net': self.options['vlan_net_1_name'],
- 'source_subnet': self.options['vlan_subnet_1_name'],
- 'destination_net': self.options['vlan_net_2_name'],
- 'destination_subnet': self.options['vlan_subnet_2_name']
- }
- deployment_configuration = {
- 'vnic_type': [self.options['vnic_type']],
- 'vtc_flavor': [self.options['vtc_flavor']]
- }
-
- test_case = dict()
- test_case['name'] = 'multi_tenancy_throughput_benchmark.' \
- 'MultiTenancyThroughputBenchmark'
- test_case['params'] = dict()
- test_case['params']['packet_size'] = str(self.options['packet_size'])
- test_case['params']['vlan_sender'] = str(self.options['vlan_sender'])
- test_case['params']['vlan_receiver'] = \
- str(self.options['vlan_receiver'])
- test_case['params']['num_of_neighbours'] = \
- str(self.options['num_of_neighbours'])
- test_case['params']['amount_of_ram'] = \
- str(self.options['amount_of_ram'])
- test_case['params']['number_of_cores'] = \
- str(self.options['number_of_cores'])
- test_case['params']['network'] = \
- str(self.options['default_net_name'])
- test_case['params']['subnet'] = \
- str(self.options['default_subnet_name'])
-
- res = dict()
- try:
- res = api.FrameworkApi.execute_framework(
- [test_case],
- iterations,
- heat_template,
- heat_template_parameters,
- deployment_configuration,
- openstack_credentials)
- except Exception:
- LOG.exception('Exception')
- LOG.info('Got output: %s', res)
- result.update(res)
diff --git a/yardstick/vTC/__init__.py b/yardstick/vTC/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/yardstick/vTC/__init__.py
+++ /dev/null
diff --git a/yardstick/vTC/apexlake/.gitignore b/yardstick/vTC/apexlake/.gitignore
deleted file mode 100644
index ddcd58683..000000000
--- a/yardstick/vTC/apexlake/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-benchmark.log
-
diff --git a/yardstick/vTC/apexlake/MANIFEST.in b/yardstick/vTC/apexlake/MANIFEST.in
deleted file mode 100644
index f784569e9..000000000
--- a/yardstick/vTC/apexlake/MANIFEST.in
+++ /dev/null
@@ -1,7 +0,0 @@
-recursive-include bin *.py
-recursive-include benchmarks *.py
-recursive-include heat_templates *
-recursive-include packet_generators *
-recursive-include etc *.cfg *.json
-include *.py
-include README.rst
diff --git a/yardstick/vTC/apexlake/README.rst b/yardstick/vTC/apexlake/README.rst
deleted file mode 100644
index 06a795c12..000000000
--- a/yardstick/vTC/apexlake/README.rst
+++ /dev/null
@@ -1,238 +0,0 @@
-.. _DPDK: http://dpdk.org/doc/nics
-.. _DPDK-pktgen: https://github.com/Pktgen/Pktgen-DPDK/
-.. _SRIOV: https://wiki.openstack.org/wiki/SR-IOV-Passthrough-For-Networking
-.. _PORTSEC: https://wiki.openstack.org/wiki/Neutron/ML2PortSecurityExtensionDriver
-
-===========================
-Apexlake installation guide
-===========================
-ApexLake is a framework that provides automatic execution of experiments and related data collection to help
-the user validating the infrastructure from the perspective of a Virtual Network Function.
-To do so in the context of Yardstick, the virtual Traffic Classifier network function is utilized.
-
-
-Hardware dependencies to run the framework
-==========================================
-In order to run the framework some hardware dependencies are required to run ApexLake.
-
-The framework needs to be installed on a physical node where the DPDK packet DPDK-pktgen_
-can be correctly installed and executed.
-That requires for the packet generator to have 2 NICs DPDK_ Compatible.
-
-The 2 NICs will be connected to the switch where the Openstack VM network is managed.
-
-The switch is required to support multicast traffic and snooping protocol.
-
-The corresponding ports to which the cables are connected will be configured as VLAN trunks
-using two of the VLAN IDs available for Neutron.
-The mentioned VLAN IDs will be required in further configuration steps.
-
-
-Software dependencies to run the framework
-==========================================
-Before to start the framework, a set of dependencies are required to be installed.
-In the following a set of instructions to be executed on the Linux shell to install dependencies
-and configure the environment is presented.
-
-1. Install dependencies.
-
-To install the dependencies required by the framework it is necessary install the following packages.
-The following example is provided for Ubuntu and need to be executed as root.
-::
-
- apt-get install python-dev
- apt-get install python-pip
- apt-get install python-mock
- apt-get install tcpreplay
- apt-get install libpcap-dev
-
-2. Source OpenStack openrc file.
-
-::
-
- source openrc
-
-3. Configure Openstack Neutron
-
-In order to support traffic generation and management by the virtual Traffic Classifier,
-the configuration of the port security driver extension is required for Neutron.
-For further details please follow the following link: PORTSEC_
-This step can be skipped in case the target OpenStack is Juno or Kilo release,
-but it is required to support Liberty.
-It is therefore required to indicate the release version in the configuration file apexlake.conf.
-
-4. Create 2 Networks based on VLANs in Neutron.
-
-In order for the network communication between the packet generator and the Compute node to
-work fine, it is required to create through Neutron two networks and map those on the VLAN IDs
-that have been previously used for the configuration on the physical switch.
-The underlying switch needs to be configured accordingly.
-::
-
- VLAN_1=2032
- VLAN_2=2033
- PHYSNET=physnet2
- neutron net-create apexlake_inbound_network \
- --provider:network_type vlan \
- --provider:segmentation_id $VLAN_1 \
- --provider:physical_network $PHYSNET
-
- neutron subnet-create apexlake_inbound_network \
- 192.168.0.0/24 --name apexlake_inbound_subnet
-
- neutron net-create apexlake_outbound_network \
- --provider:network_type vlan \
- --provider:segmentation_id $VLAN_2 \
- --provider:physical_network $PHYSNET
-
- neutron subnet-create apexlake_outbound_network 192.168.1.0/24 \
- --name apexlake_outbound_subnet
-
-5. Download Ubuntu Cloud Image and load it on Glance
-
-The virtual Traffic Classifier is supported on top of Ubuntu 14.04 cloud image.
-The image can be downloaded on the local machine and loaded on Glance using the following commands:
-::
-
- wget cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
- glance image-create \
- --name ubuntu1404 \
- --is-public true \
- --disk-format qcow \
- --container-format bare \
- --file trusty-server-cloudimg-amd64-disk1.img
-
-6. Configure the Test Cases.
-
-The VLAN tags are also required into the test case Yardstick yaml file as parameters the following test cases:
- - TC 006
- - TC 007
- - TC 020
- - TC 021
-
-
-Install and configure DPDK Pktgen
-+++++++++++++++++++++++++++++++++
-The execution of the framework is based on DPDK Pktgen.
-If DPDK Pktgen has not been installed on the system by the user, it is necessary to download, compile and configure it.
-The user can create a directory and download the dpdk packet generator source code:
-::
-
- cd experimental_framework/libraries
- mkdir dpdk_pktgen
- git clone https://github.com/pktgen/Pktgen-DPDK.git
-
-For the installation and configuration of DPDK and DPDK Pktgen please follow the official DPDK Pktgen README file.
-Once the installation is completed, it is necessary to load the DPDK kernel driver, as follow:
-::
-
- insmod uio
- insmod DPDK_DIR/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
-
-It is required to properly set the configuration file according to the system on Pktgen runs on.
-A description of the required configuration parameters and examples is provided in the following:
-::
-
- [PacketGen]
- packet_generator = dpdk_pktgen
-
- # This is the directory where the packet generator is installed
- # (if the user previously installed dpdk-pktgen,
- # it is required to provide the director where it is installed).
- pktgen_directory = /home/user/software/dpdk_pktgen/dpdk/examples/pktgen/
-
- # This is the directory where DPDK is installed
- dpdk_directory = /home/user/apexlake/experimental_framework/libraries/Pktgen-DPDK/dpdk/
-
- # Name of the dpdk-pktgen program that starts the packet generator
- program_name = app/app/x86_64-native-linuxapp-gcc/pktgen
-
- # DPDK coremask (see DPDK-Pktgen readme)
- coremask = 1f
-
- # DPDK memory channels (see DPDK-Pktgen readme)
- memory_channels = 3
-
- # Name of the interface of the pktgen to be used to send traffic (vlan_sender)
- name_if_1 = p1p1
-
- # Name of the interface of the pktgen to be used to receive traffic (vlan_receiver)
- name_if_2 = p1p2
-
- # PCI bus address correspondent to if_1
- bus_slot_nic_1 = 01:00.0
-
- # PCI bus address correspondent to if_2
- bus_slot_nic_2 = 01:00.1
-
-
-To find the parameters related to names of the NICs and addresses of the PCI buses
-the user may find useful to run the DPDK tool nic_bind as follows:
-::
-
- DPDK_DIR/tools/dpdk_nic_bind.py --status
-
-which lists the NICs available on the system, show the available drivers and bus addresses for each interface.
-Please make sure to select NICs which are DPDK compatible.
-
-Installation and configuration of smcroute
-++++++++++++++++++++++++++++++++++++++++++
-The user is required to install smcroute which is used by the framework to support multicast communications.
-In the following a list of commands to be ran to download and install smroute is provided.
-::
-
- cd ~
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- git reset --hard c3f5c56
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- sudo make install
- cd ..
-
-It is required to do the reset to the specified commit ID.
-It is also required to create a configuration file using the following command:
-
- SMCROUTE_NIC=(name of the nic)
-
-where name of the nic is the name used previously for the variable "name_if_2".
-In the example it would be:
-::
-
- SMCROUTE_NIC=p1p2
-
-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.
-NIC configuration depends on model and vendor. After proper configuration to support SR-IOV,
-a proper configuration of openstack is required.
-For further information, please look at the _SRIOV configuration guide
-
-
-Finalize installation the framework on the system
-=================================================
-
-The installation of the framework on the system requires the setup of the project.
-After entering into the apexlake directory, it is sufficient to run the following command.
-::
-
- python setup.py install
-
-Since some elements are copied into the /tmp directory (see configuration file) it could be necessary
-to repeat this step after a reboot of the host.
diff --git a/yardstick/vTC/apexlake/__init__.py b/yardstick/vTC/apexlake/__init__.py
deleted file mode 100644
index 8898092d0..000000000
--- a/yardstick/vTC/apexlake/__init__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-Benchmarking Framework
-"""
diff --git a/yardstick/vTC/apexlake/apexlake.conf b/yardstick/vTC/apexlake/apexlake.conf
deleted file mode 100644
index 826e3daca..000000000
--- a/yardstick/vTC/apexlake/apexlake.conf
+++ /dev/null
@@ -1,36 +0,0 @@
-[General]
-debug = false
-
-
-[OpenStack]
-#release = juno
-#release = kilo
-release = liberty
-
-[PacketGen]
-packet_generator = dpdk_pktgen
-pktgen_directory = /home/user/IntelLabs/benchmarking-framework/experimental_framework/libraries/pktgen-2.9.5/
-dpdk_directory = /home/user/IntelLabs/benchmarking-framework/experimental_framework/libraries/dpdk-2.1.0/
-program_name = app/app/x86_64-native-linuxapp-gcc/pktgen
-coremask = 1f
-memory_channels = 3
-bus_slot_nic_1 = 21:00.0
-bus_slot_nic_2 = 21:00.1
-name_if_1 = p2p1
-name_if_2 = p2p2
-
-
-
-[Experiment-VNF]
-
-
-[InfluxDB]
-influxdb_ip_address = 192.168.1.1
-influxdb_port = 8086
-influxdb_db_name = database
-
-
-[Deployment-parameters]
-
-
-[Testcase-parameters]
diff --git a/yardstick/vTC/apexlake/bin/run_tests.sh b/yardstick/vTC/apexlake/bin/run_tests.sh
deleted file mode 100755
index 402a6d7fe..000000000
--- a/yardstick/vTC/apexlake/bin/run_tests.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2016-2017 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.
-export PYTHONPATH=`pwd`
-nosetests --with-coverage --cover-erase --cover-package experimental_framework
diff --git a/yardstick/vTC/apexlake/docs/source/api.rst b/yardstick/vTC/apexlake/docs/source/api.rst
deleted file mode 100644
index 38085900b..000000000
--- a/yardstick/vTC/apexlake/docs/source/api.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-.. automodule:: experimental_framework.api
- :members:
- :undoc-members:
- :inherited-members:
- :show-inheritance:
diff --git a/yardstick/vTC/apexlake/experimental_framework/__init__.py b/yardstick/vTC/apexlake/experimental_framework/__init__.py
deleted file mode 100644
index 9c4eef12d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/__init__.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-Experimental Framework
-"""
-from __future__ import absolute_import
-import os
-
-APEX_LAKE_ROOT = os.path.realpath(
- os.path.join(os.path.dirname(os.path.dirname(__file__))))
diff --git a/yardstick/vTC/apexlake/experimental_framework/api.py b/yardstick/vTC/apexlake/experimental_framework/api.py
deleted file mode 100644
index 24dd1f89a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/api.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import experimental_framework.benchmarking_unit as b_unit
-from experimental_framework import heat_template_generation, common
-
-
-class FrameworkApi(object):
-
- @staticmethod
- def init():
- """
- Initializes the Framework
-
- :return: None
- """
- common.init(api=True)
-
- # @staticmethod
- # def get_available_test_cases():
- # """
- # Returns a list of available test cases.
- # This list include eventual modules developed by the user, if any.
- # Each test case is returned as a string that represents the full name
- # of the test case and that can be used to get more information
- # calling get_test_case_features(test_case_name)
- #
- # :return: list of strings
- # """
- # return b_unit.BenchmarkingUnit.get_available_test_cases()
-
- @staticmethod
- def get_test_case_features(test_case):
- """
- Returns a list of features (description, requested parameters,
- allowed values, etc.) for a specified test case.
-
- :param test_case: name of the test case (string)
- The string represents the test case and can be
- obtained calling "get_available_test_cases()"
- method.
-
- :return: dict() containing the features of the test case
- """
- if not isinstance(test_case, str):
- raise ValueError('The provided test_case parameter has to be '
- 'a string')
- benchmark = b_unit.BenchmarkingUnit.get_required_benchmarks(
- [test_case])[0]
- return benchmark.get_features()
-
- @staticmethod
- def execute_framework(
- test_cases,
- iterations,
- heat_template,
- heat_template_parameters,
- deployment_configuration,
- openstack_credentials
- ):
- """
- Executes the framework according the inputs
-
- :param test_cases: Test cases to be ran on the workload
- (dict() of dict())
-
- Example:
- test_case = dict()
- test_case['name'] = 'module.Class'
- test_case['params'] = dict()
- test_case['params']['throughput'] = '1'
- test_case['params']['vlan_sender'] = '1007'
- test_case['params']['vlan_receiver'] = '1006'
- test_cases = [test_case]
-
- :param iterations: Number of cycles to be executed (int)
-
- :param heat_template: (string) File name of the heat template of the
- workload to be deployed. It contains the
- parameters to be evaluated in the form of
- #parameter_name. (See heat_templates/vTC.yaml as
- example).
-
- :param heat_template_parameters: (dict) Parameters to be provided
- as input to the heat template.
- See http://docs.openstack.org/developer/heat/
- template_guide/hot_guide.html - section
- "Template input parameters" for further info.
-
- :param deployment_configuration: ( dict[string] = list(strings) ) )
- Dictionary of parameters representing the
- deployment configuration of the workload
- The key is a string corresponding to the name of
- the parameter, the value is a list of strings
- representing the value to be assumed by a specific
- param.
- The parameters are user defined: they have to
- correspond to the place holders (#parameter_name)
- specified in the heat template.
-
- :return: dict() Containing results
- """
- common.init(api=True)
-
- # Input Validation
- common.InputValidation.validate_os_credentials(openstack_credentials)
- credentials = openstack_credentials
-
- msg = 'The provided heat_template does not exist'
- if common.RELEASE == 'liberty':
- heat_template = 'vTC_liberty.yaml'
- else:
- heat_template = 'vTC.yaml'
- template = "{}{}".format(common.get_template_dir(), heat_template)
- common.InputValidation.validate_file_exist(template, msg)
-
- msg = 'The provided iterations variable must be an integer value'
- common.InputValidation.validate_integer(iterations, msg)
-
- msg = 'The provided heat_template_parameters variable must be a ' \
- 'dictionary'
- common.InputValidation.validate_dictionary(heat_template_parameters,
- msg)
- log_msg = "Generation of all the heat templates " \
- "required by the experiment"
- common.LOG.info(log_msg)
- heat_template_generation.generates_templates(heat_template,
- deployment_configuration)
- benchmarking_unit = \
- b_unit.BenchmarkingUnit(
- heat_template, credentials, heat_template_parameters,
- iterations, test_cases)
- try:
- common.LOG.info("Benchmarking Unit initialization")
- benchmarking_unit.initialize()
- common.LOG.info("Benchmarking Unit Running")
- results = benchmarking_unit.run_benchmarks()
- finally:
- common.LOG.info("Benchmarking Unit Finalization")
- benchmarking_unit.finalize()
- return results
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py b/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py
deleted file mode 100644
index 56ea6d2f0..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarking_unit.py
+++ /dev/null
@@ -1,283 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-The Benchmarking Unit manages the Benchmarking of VNFs orchestrating the
-initialization, execution and finalization
-"""
-
-
-from __future__ import absolute_import
-import json
-import time
-import inspect
-
-from experimental_framework.benchmarks import benchmark_base_class as base
-from experimental_framework import common
-# from experimental_framework import data_manager as data
-from experimental_framework import heat_template_generation as heat
-from experimental_framework import deployment_unit as deploy
-from six.moves import range
-
-
-class BenchmarkingUnit:
- """
- Management of the overall Benchmarking process
- """
-
- def __init__(self, heat_template_name, openstack_credentials,
- heat_template_parameters, iterations, benchmarks):
- """
- :param heat_template_name: (str) Name of the heat template.
-
- :param openstack_credentials: (dict) Credentials for openstack.
- Required fields are: 'ip_controller', 'heat_url',
- 'user', 'password', 'auth_uri', 'project'.
-
- :param heat_template_parameters: (dict) parameters to be given as
- input to the heat template. Required keys depend on
- the specific heat template.
-
- :param iterations: (int) number of cycles to be executed.
-
- :param benchmarks: (list[str]) List of the names of the
- benchmarks/test_cases to be executed in the cycle.
-
- :return: None
- """
- # Loads vars from configuration file
- self.template_file_extension = common.TEMPLATE_FILE_EXTENSION
- self.template_dir = common.get_template_dir()
- self.results_directory = str(common.RESULT_DIR) + str(time.time())
-
- # Initializes other internal variable from parameters
- self.template_name = heat_template_name
- self.iterations = iterations
- self.required_benchmarks = benchmarks
- self.template_files = []
- self.benchmarks = list()
- self.benchmark_names = list()
- # self.data_manager = data.DataManager(self.results_directory)
- self.heat_template_parameters = heat_template_parameters
- self.template_files = \
- heat.get_all_heat_templates(self.template_dir,
- self.template_file_extension)
- common.DEPLOYMENT_UNIT = deploy.DeploymentUnit(openstack_credentials)
-
- def initialize(self):
- """
- Initialize the environment in order to run the benchmarking
-
- :return: None
- """
- for benchmark in self.required_benchmarks:
- benchmark_class = BenchmarkingUnit.get_benchmark_class(
- benchmark['name'])
- # Need to generate a unique name for the benchmark
- # (since there is the possibility to have different
- # instances of the same benchmark)
- self.benchmarks.append(benchmark_class(
- self.get_benchmark_name(benchmark['name']),
- benchmark['params']))
-
- # for template_file_name in self.template_files:
- # experiment_name = BenchmarkingUnit.extract_experiment_name(
- # template_file_name)
- # self.data_manager.create_new_experiment(experiment_name)
- # for benchmark in self.benchmarks:
- # self.data_manager.add_benchmark(experiment_name,
- # benchmark.get_name())
-
- def finalize(self):
- """
- Finalizes the Benchmarking Unit
- Destroys all the stacks deployed by the framework and save results on
- csv file.
-
- :return: None
- """
- # self.data_manager.generate_result_csv_file()
- common.DEPLOYMENT_UNIT.destroy_all_deployed_stacks()
-
- def run_benchmarks(self):
- """
- Runs all the requested benchmarks and collect the results.
-
- :return: None
- """
- common.LOG.info('Run Benchmarking Unit')
-
- experiment = {}
- result = {}
- for iteration in range(self.iterations):
- common.LOG.info('Iteration %s', iteration)
- for template_file_name in self.template_files:
- experiment_name = BenchmarkingUnit.\
- extract_experiment_name(template_file_name)
- experiment['experiment_name'] = experiment_name
- configuration = self.\
- get_experiment_configuration(template_file_name)
- # self.data_manager.add_configuration(experiment_name,
- # configuration)
- for key in configuration.keys():
- experiment[key] = configuration[key]
- # metadata = dict()
- # metadata['experiment_name'] = experiment_name
- # self.data_manager.add_metadata(experiment_name, metadata)
-
- # For each benchmark in the cycle the workload is deployed
- for benchmark in self.benchmarks:
- log_msg = 'Benchmark {} started on {}'.format(
- benchmark.get_name(), template_file_name
- )
- common.LOG.info(log_msg)
-
- # Initialization of Benchmark
- benchmark.init()
- log_msg = 'Template {} deployment START'.\
- format(experiment_name)
- common.LOG.info(log_msg)
-
- # Deployment of the workload
- deployment_success = \
- common.DEPLOYMENT_UNIT.deploy_heat_template(
- self.template_dir + template_file_name,
- experiment_name,
- self.heat_template_parameters)
-
- if deployment_success:
- log_msg = 'Template {} deployment COMPLETED'.format(
- experiment_name)
- common.LOG.info(log_msg)
- else:
- log_msg = 'Template {} deployment FAILED'.format(
- experiment_name)
- common.LOG.info(log_msg)
- continue
-
- # Running the Benchmark/test case
- result = benchmark.run()
- # self.data_manager.add_data_points(experiment_name,
- # benchmark.get_name(),
- # result)
-
- # Terminate the workload
- log_msg = 'Destroying deployment for experiment {}'.\
- format(experiment_name)
- common.LOG.info(log_msg)
- common.DEPLOYMENT_UNIT.destroy_heat_template(
- experiment_name)
-
- # Finalize the benchmark
- benchmark.finalize()
- log_msg = 'Benchmark {} terminated'.format(
- benchmark.__class__.__name__)
- common.LOG.info(log_msg)
- # self.data_manager.generate_result_csv_file()
-
- experiment['benchmark'] = benchmark.get_name()
- for key in benchmark.get_params():
- experiment[key] = benchmark.get_params()[key]
- common.LOG.info('Benchmark Finished')
- # self.data_manager.generate_result_csv_file()
- common.LOG.info('Benchmarking Unit: Experiments completed!')
- return result
-
- def get_experiment_configuration(self, template_file_name):
- """
- Reads and returns the configuration for the specific experiment
- (heat template)
-
- :param template_file_name: (str) Name of the file for the heat
- template for which it is requested the configuration
-
- :return: dict() Configuration parameters and values
- """
- file_name = "{}{}.json".format(self.template_dir, template_file_name)
- with open(file_name) as json_file:
- configuration = json.load(json_file)
- return configuration
-
- def get_benchmark_name(self, name, instance=0):
- """
- Returns the name to be used for the benchmark/test case (TC).
- This is required since each benchmark/TC could be run more than once
- within the same cycle, with different initialization parameters.
- In order to distinguish between them, a unique name is generated.
-
- :param name: (str) original name of the benchmark/TC
-
- :param instance: (int) number of instance already in the queue for
- this type of benchmark/TC.
-
- :return: (str) name to be assigned to the benchmark/TC
- """
- if name + "_" + str(instance) in self.benchmark_names:
- instance += 1
- return self.get_benchmark_name(name, instance)
- self.benchmark_names.append(name + "_" + str(instance))
- return name + "_" + str(instance)
-
- @staticmethod
- def extract_experiment_name(template_file_name):
- """
- Generates a unique experiment name for a given template.
-
- :param template_file_name: (str) File name of the template used
- during the experiment string
-
- :return: (str) Experiment Name
- """
- strings = template_file_name.split('.')
- return ".".join(strings[:(len(strings) - 1)])
-
- @staticmethod
- def get_benchmark_class(complete_module_name):
- """
- Returns the classes included in a given module.
-
- :param complete_module_name: (str) Complete name of the module as
- returned by get_available_test_cases.
-
- :return: Class related to the benchmark/TC present in the requested
- module.
- """
- strings = complete_module_name.split('.')
- class_name = 'experimental_framework.benchmarks.{}'.format(strings[0])
- pkg = __import__(class_name, globals(), locals(), [], 0)
- module = getattr(getattr(pkg, 'benchmarks'), strings[0])
- members = inspect.getmembers(module)
- for m in members:
- if inspect.isclass(m[1]):
- class_name = m[1]("", dict()).__class__.__name__
- if isinstance(m[1]("", dict()), base.BenchmarkBaseClass) and \
- not class_name == 'BenchmarkBaseClass':
- return m[1]
-
- @staticmethod
- def get_required_benchmarks(required_benchmarks):
- """
- Returns instances of required test cases.
-
- :param required_benchmarks: (list() of strings) Benchmarks to be
- executed by the experimental framework.
-
- :return: list() of BenchmarkBaseClass
- """
- benchmarks = list()
- for b in required_benchmarks:
- class_ = BenchmarkingUnit.get_benchmark_class(b)
- instance = class_("", dict())
- benchmarks.append(instance)
- return benchmarks
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py
deleted file mode 100644
index 99635a45a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/__init__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-Benchmarks to be executed within the framework
-"""
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py
deleted file mode 100644
index 38c91ee3a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/benchmark_base_class.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-from __future__ import absolute_import
-import abc
-
-
-class BenchmarkBaseClass(object):
- """
- This class represents a Benchmark that we want to run on the platform.
- One of them will be the calculation of the throughput changing the
- configuration parameters
- """
-
- def __init__(self, name, params):
- if not params:
- params = dict()
- if not isinstance(params, dict):
- raise ValueError("Parameters need to be provided in a dict")
-
- for param in self.get_features()['parameters']:
- if param not in list(params.keys()):
- params[param] = self.get_features()['default_values'][param]
-
- for param in self.get_features()['parameters']:
- if param in self.get_features()['allowed_values'] and \
- params[param] not in \
- (self.get_features())['allowed_values'][param]:
- raise ValueError('Value of parameter "' + param +
- '" is not allowed')
- self.name = name
- self.params = params
-
- def get_name(self):
- return self.name
-
- def get_params(self):
- return self.params
-
- def get_features(self):
- features = dict()
- features['description'] = 'Please implement the method ' \
- '"get_features" for your benchmark'
- features['parameters'] = list()
- features['allowed_values'] = dict()
- features['default_values'] = dict()
- return features
-
- @abc.abstractmethod
- def init(self):
- """
- Initializes the benchmark
- :return:
- """
- raise NotImplementedError("Subclass must implement abstract method")
-
- @abc.abstractmethod
- def finalize(self):
- """
- Finalizes the benchmark
- :return:
- """
- raise NotImplementedError("Subclass must implement abstract method")
-
- @abc.abstractmethod
- def run(self):
- """
- This method executes the specific benchmark on the VNF already
- instantiated
- :return: list of dictionaries (every dictionary contains the results
- of a data point
- """
- raise NotImplementedError("Subclass must implement abstract method")
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
deleted file mode 100644
index db9d449ef..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_benchmark.py
+++ /dev/null
@@ -1,260 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import os
-# import signal
-import time
-
-import subprocess
-from experimental_framework.benchmarks import benchmark_base_class as base
-from experimental_framework.constants import framework_parameters as fp
-from experimental_framework.constants import conf_file_sections as cfs
-from experimental_framework.packet_generators import dpdk_packet_generator \
- as dpdk
-import experimental_framework.common as common
-from six.moves import range
-
-
-THROUGHPUT = 'throughput'
-VLAN_SENDER = 'vlan_sender'
-VLAN_RECEIVER = 'vlan_receiver'
-PACKETS_FILE_NAME = 'packets.res'
-PACKET_CHECKER_PROGRAM_NAME = 'test_sniff'
-MULTICAST_GROUP = '224.192.16.1'
-
-
-class InstantiationValidationBenchmark(base.BenchmarkBaseClass):
-
- def __init__(self, name, params):
- base.BenchmarkBaseClass.__init__(self, name, params)
- self.base_dir = os.path.join(
- common.get_base_dir(), fp.EXPERIMENTAL_FRAMEWORK_DIR,
- fp.DPDK_PKTGEN_DIR)
- self.results_file = self.base_dir + PACKETS_FILE_NAME
- self.lua_file = self.base_dir + 'constant_traffic.lua'
- self.res_dir = ''
- self.interface_name = ''
-
- # Set the packet checker command
- self.pkt_checker_command = os.path.join(
- common.get_base_dir(),
- 'experimental_framework/libraries/',
- 'packet_checker/',
- PACKET_CHECKER_PROGRAM_NAME + ' ')
-
- def init(self):
- """
- Initialize the benchmark
- :return: None
- """
- pass
-
- def finalize(self):
- """
- Finalizes the benchmark
- :return: None
- """
- pass
-
- def get_features(self):
- features = dict()
- features['description'] = 'Instantiation Validation Benchmark'
- features['parameters'] = [THROUGHPUT, VLAN_SENDER, VLAN_RECEIVER]
- features['allowed_values'] = dict()
- features['allowed_values'][THROUGHPUT] = [str(x) for x in range(100)]
- features['allowed_values'][VLAN_SENDER] = [str(x) for x in
- range(-1, 4096)]
- features['allowed_values'][VLAN_RECEIVER] = [str(x)
- for x in range(-1, 4096)]
- features['default_values'] = dict()
- features['default_values'][THROUGHPUT] = '1'
- features['default_values'][VLAN_SENDER] = '-1'
- features['default_values'][VLAN_RECEIVER] = '-1'
- return features
-
- def run(self):
- # Setup packet generator
- traffic_time = '10'
- packet_size = '512'
- traffic_rate_percentage = self.params[THROUGHPUT]
-
- dpdk_pktgen_vars = common.get_dpdk_pktgen_vars()
- # bus_address = dpdk_pktgen_vars[cfs.CFSP_DPDK_BUS_SLOT_NIC_2]
- self.interface_name = dpdk_pktgen_vars[cfs.CFSP_DPDK_NAME_IF_2]
- packetgen = dpdk.DpdkPacketGenerator()
- self._configure_lua_file(traffic_rate_percentage, traffic_time)
- packetgen.init_dpdk_pktgen(dpdk_interfaces=1,
- pcap_file_0='packet_' + packet_size +
- '.pcap',
- pcap_file_1='igmp.pcap',
- lua_script='constant_traffic.lua',
- vlan_0=self.params[VLAN_SENDER],
- vlan_1=self.params[VLAN_RECEIVER])
-
- self._init_packet_checker()
- # Send constant traffic at a specified rate
- common.LOG.debug('Start the packet generator')
- packetgen.send_traffic()
- common.LOG.debug('Stop the packet generator')
- time.sleep(5)
- self._finalize_packet_checker()
- self._reset_lua_file(traffic_rate_percentage, traffic_time)
- return self._get_results()
-
- def _configure_lua_file(self, traffic_rate_percentage, traffic_time):
- """
- Configure the packet gen to write the results into the right file
- :return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
- common.replace_in_file(self.lua_file, 'local traffic_rate = 0',
- 'local traffic_rate = ' +
- traffic_rate_percentage)
- common.replace_in_file(self.lua_file, 'local traffic_delay = 0',
- 'local traffic_delay = ' + traffic_time)
-
- def _reset_lua_file(self, traffic_rate_percentage, traffic_time):
- """
- Configure the packet gen to write the results into the right file
- :param traffic_rate_percentage:
- :param traffic_time:
- :return: None
- """
-
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
- common.replace_in_file(self.lua_file, 'local traffic_rate = ' +
- traffic_rate_percentage,
- 'local traffic_rate = 0')
- common.replace_in_file(self.lua_file, 'local traffic_delay = ' +
- traffic_time, 'local traffic_delay = 0')
-
- def _get_results(self):
- ret_val = dict()
- packet_checker_res = 0
- if self.res_dir:
- packet_checker_res = \
- int(common.get_file_first_line(self.res_dir +
- 'packet_checker.res'))
- pkt_gen_res = int(common.get_file_first_line(self.results_file))
- if pkt_gen_res <= packet_checker_res or \
- (float(pkt_gen_res - packet_checker_res) / pkt_gen_res) <= 0.1:
- ret_val['failure'] = '0'
- else:
- ret_val['failure'] = '1'
- return ret_val
-
- def _init_packet_checker(self):
- """
- Sets up the multicast and starts the packet checker
- :return:
- """
- # Kill any other process running from previous failed execution
- self.res_dir = common.get_result_dir()
- pids = self._get_pids()
- for pid in pids:
- # os.kill(pid, signal.SIGTERM)
- command = 'sudo kill ' + str(pid)
- common.run_command(command)
-
- # initialization of the VLAN interface
- command = "sudo ip link add link "
- command += self.interface_name
- command += " name "
- command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
- command += " type vlan id " + self.params[VLAN_RECEIVER]
- common.run_command(command)
-
- # set up the new
- 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
- command += ' 10.254.254.254 up netmask 255.255.255.248'
- common.run_command(command)
-
- command = "sudo ifconfig "
- command += self.interface_name + "." + self.params[VLAN_RECEIVER]
- command += " promisc"
- common.run_command(command)
-
- # configure smcroute
- command = "sudo echo 'mgroup from "
- command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
- command += " group "
- command += MULTICAST_GROUP
- command += "' > /etc/smcroute.conf"
- common.run_command(command)
-
- # run smcroute on the interface
- command = 'sudo smcroute -d'
- common.run_command(command)
- time.sleep(3)
-
- # Start the packet checker
- current_dir = os.path.dirname(os.path.realpath(__file__))
- dir_list = self.pkt_checker_command.split('/')
- directory = os.pathsep.join(dir_list[0:len(dir_list) - 1])
- os.chdir(directory)
- command = "make"
- common.run_command(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 += ' &'
- common.run_command(command)
-
- def _finalize_packet_checker(self):
- """
- Obtains the PID of the packet checker and sends an alarm to
- terminate it
- :return: None
- """
- pids = self._get_pids()
- for pid in pids:
- # os.kill(pid, signal.SIGTERM)
- command = 'sudo kill ' + str(pid)
- common.run_command(command)
-
- # stop smcroute on the interface
- command = 'sudo smcroute -k'
- common.run_command(command)
-
- # finalization of the VLAN interface
- command = "sudo ip link delete "
- command += self.interface_name + '.' + self.params[VLAN_RECEIVER]
- common.run_command(command)
-
- def _get_pids(self):
- """
- Returns a list of integers containing the pid or the pids of the
- processes currently running on the host
- :return: type: list of int
- """
- output = subprocess.check_output(
- 'pgrep "{}"'.format(PACKET_CHECKER_PROGRAM_NAME))
- if not output:
- pids = []
- else:
- pids = [int(x) for x in output.splitlines()]
- return pids
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py
deleted file mode 100644
index 5569b6c12..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/instantiation_validation_noisy_neighbors_benchmark.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-from __future__ import absolute_import
-from experimental_framework import common
-from experimental_framework.benchmarks import \
- instantiation_validation_benchmark as base
-from six.moves import range
-
-
-NUM_OF_NEIGHBORS = 'num_of_neighbours'
-AMOUNT_OF_RAM = 'amount_of_ram'
-NUMBER_OF_CORES = 'number_of_cores'
-NETWORK_NAME = 'network'
-SUBNET_NAME = 'subnet'
-
-
-class InstantiationValidationNoisyNeighborsBenchmark(
- base.InstantiationValidationBenchmark):
-
- def __init__(self, name, params):
- base.InstantiationValidationBenchmark.__init__(self, name, params)
-
- if common.RELEASE == 'liberty':
- temp_name = 'stress_workload_liberty.yaml'
- else:
- temp_name = 'stress_workload.yaml'
-
- self.template_file = common.get_template_dir() + \
- temp_name
- self.stack_name = 'neighbour'
- self.neighbor_stack_names = []
-
- def get_features(self):
- features = super(InstantiationValidationNoisyNeighborsBenchmark,
- self).get_features()
- features['description'] = 'Instantiation Validation Benchmark ' \
- 'with noisy neghbors'
- features['parameters'].append(NUM_OF_NEIGHBORS)
- features['parameters'].append(AMOUNT_OF_RAM)
- features['parameters'].append(NUMBER_OF_CORES)
- features['parameters'].append(NETWORK_NAME)
- features['parameters'].append(SUBNET_NAME)
- features['allowed_values'][NUM_OF_NEIGHBORS] = \
- ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values'][NUMBER_OF_CORES] = \
- ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values'][AMOUNT_OF_RAM] = \
- ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
- '10G']
- features['default_values'][NUM_OF_NEIGHBORS] = '1'
- features['default_values'][NUMBER_OF_CORES] = '1'
- features['default_values'][AMOUNT_OF_RAM] = '256M'
- features['default_values'][NETWORK_NAME] = ''
- features['default_values'][SUBNET_NAME] = ''
- return features
-
- def init(self):
- super(InstantiationValidationNoisyNeighborsBenchmark, self).init()
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
- heat_param = dict()
- heat_param['network'] = self.params[NETWORK_NAME]
- heat_param['subnet'] = self.params[SUBNET_NAME]
- heat_param['cores'] = self.params['number_of_cores']
- heat_param['memory'] = self.params['amount_of_ram']
- for i in range(0, int(self.params['num_of_neighbours'])):
- stack_name = self.stack_name + str(i)
- common.DEPLOYMENT_UNIT.deploy_heat_template(self.template_file,
- stack_name,
- heat_param)
- self.neighbor_stack_names.append(stack_name)
-
- def finalize(self):
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
- # destroy neighbor stacks
- for stack_name in self.neighbor_stack_names:
- common.DEPLOYMENT_UNIT.destroy_heat_template(stack_name)
- self.neighbor_stack_names = list()
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
deleted file mode 100644
index 44c9f327a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/multi_tenancy_throughput_benchmark.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-from __future__ import absolute_import
-from experimental_framework.benchmarks import rfc2544_throughput_benchmark \
- as base
-from experimental_framework import common
-from six.moves import range
-
-
-NETWORK_NAME = 'network'
-SUBNET_NAME = 'subnet'
-
-
-class MultiTenancyThroughputBenchmark(base.RFC2544ThroughputBenchmark):
-
- def __init__(self, name, params):
- base.RFC2544ThroughputBenchmark.__init__(self, name, params)
-
- if common.RELEASE == 'liberty':
- temp_name = 'stress_workload_liberty.yaml'
- else:
- temp_name = 'stress_workload.yaml'
-
- self.template_file = "{}{}".format(common.get_template_dir(),
- temp_name)
- self.stack_name = 'neighbour'
- self.neighbor_stack_names = list()
-
- def get_features(self):
- features = super(MultiTenancyThroughputBenchmark, self).get_features()
- features['description'] = \
- 'RFC 2544 Throughput calculation with ' \
- 'memory-bound noisy neighbors'
- features['parameters'].append('num_of_neighbours')
- features['parameters'].append('amount_of_ram')
- features['parameters'].append('number_of_cores')
- features['parameters'].append(NETWORK_NAME)
- features['parameters'].append(SUBNET_NAME)
- features['allowed_values']['num_of_neighbours'] = \
- ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values']['number_of_cores'] = \
- ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- features['allowed_values']['amount_of_ram'] = \
- ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
- '10G']
- features['default_values'][NETWORK_NAME] = ''
- features['default_values'][SUBNET_NAME] = ''
- features['default_values']['num_of_neighbours'] = '1'
- features['default_values']['number_of_cores'] = '1'
- features['default_values']['amount_of_ram'] = '256M'
- return features
-
- def init(self):
- """
- Initialize the benchmark
- return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
- heat_param = dict()
- heat_param['cores'] = self.params['number_of_cores']
- heat_param['memory'] = self.params['amount_of_ram']
- heat_param['network'] = self.params[NETWORK_NAME]
- heat_param['subnet'] = self.params[SUBNET_NAME]
- for i in range(0, int(self.params['num_of_neighbours'])):
- stack_name = self.stack_name + str(i)
- common.DEPLOYMENT_UNIT.deploy_heat_template(self.template_file,
- stack_name,
- heat_param)
- self.neighbor_stack_names.append(stack_name)
-
- def finalize(self):
- """
- Finalizes the benchmark
- return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
- # destroy neighbor stacks
- for stack_name in self.neighbor_stack_names:
- common.DEPLOYMENT_UNIT.destroy_heat_template(stack_name)
- self.neighbor_stack_names = list()
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py
deleted file mode 100644
index 5c7b55e42..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/rfc2544_throughput_benchmark.py
+++ /dev/null
@@ -1,140 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-from __future__ import absolute_import
-from six.moves import range
-
-from experimental_framework.benchmarks import benchmark_base_class
-from experimental_framework.packet_generators \
- import dpdk_packet_generator as dpdk
-import experimental_framework.common as common
-from experimental_framework.constants import framework_parameters as fp
-
-
-PACKET_SIZE = 'packet_size'
-VLAN_SENDER = 'vlan_sender'
-VLAN_RECEIVER = 'vlan_receiver'
-
-
-class RFC2544ThroughputBenchmark(benchmark_base_class.BenchmarkBaseClass):
- """
- Calculates the throughput of the VNF under test according to the RFC2544.
- """
-
- def __init__(self, name, params):
- benchmark_base_class.BenchmarkBaseClass.__init__(self, name, params)
- self.base_dir = common.get_base_dir() + \
- fp.EXPERIMENTAL_FRAMEWORK_DIR + fp.DPDK_PKTGEN_DIR
- self.results_file = self.base_dir + 'experiment.res'
- self.lua_file = self.base_dir + 'rfc2544.lua'
-
- def init(self):
- """
- Initialize the benchmark
- :return: None
- """
- pass
-
- def finalize(self):
- """
- :return: None
- """
- pass
-
- def get_features(self):
- """
- Returns the features associated to the benchmark
- :return:
- """
- features = dict()
- features['description'] = 'RFC 2544 Throughput calculation'
- features['parameters'] = [PACKET_SIZE, VLAN_SENDER, VLAN_RECEIVER]
- features['allowed_values'] = dict()
- features['allowed_values'][PACKET_SIZE] = ['64', '128', '256', '512',
- '1024', '1280', '1514']
- features['allowed_values'][VLAN_SENDER] = [str(x) for x in
- range(-1, 4096)]
- features['allowed_values'][VLAN_RECEIVER] = [str(x) for x in
- range(-1, 4096)]
- features['default_values'] = dict()
- features['default_values'][PACKET_SIZE] = '1280'
- features['default_values'][VLAN_SENDER] = '1007'
- features['default_values'][VLAN_RECEIVER] = '1006'
- return features
-
- def run(self):
- """
- Sends and receive traffic according to the RFC methodology in order
- to measure the throughput of the workload
- :return: Results of the testcase (type: dict)
- """
- packet_size = self._extract_packet_size_from_params()
-
- # Packetgen management
- packetgen = dpdk.DpdkPacketGenerator()
- self._configure_lua_file()
- packetgen.init_dpdk_pktgen(dpdk_interfaces=2,
- pcap_file_0='packet_' +
- packet_size + '.pcap',
- pcap_file_1='igmp.pcap',
- lua_script='rfc2544.lua',
- vlan_0=self.params[VLAN_SENDER],
- vlan_1=self.params[VLAN_RECEIVER])
- common.LOG.debug('Start the packet generator - packet size: ' +
- str(packet_size))
- packetgen.send_traffic()
- common.LOG.debug('Stop the packet generator')
-
- return self._get_results()
-
- def _extract_packet_size_from_params(self):
- """
- Extracts packet sizes from parameters
- :return: packet_sizes (list)
- """
- packet_size = '1280' # default value
- if PACKET_SIZE in list(self.params.keys()) and \
- isinstance(self.params[PACKET_SIZE], str):
- packet_size = self.params[PACKET_SIZE]
- return packet_size
-
- def _configure_lua_file(self):
- """
- Configure the packet gen to write the results into the right file
- :return: None
- """
- common.replace_in_file(self.lua_file, 'local out_file = ""',
- 'local out_file = "' +
- self.results_file + '"')
-
- def _reset_lua_file(self):
- """
- Sets back the configuration of the local file var to the default
- :return:
- """
- common.replace_in_file(self.lua_file, 'local out_file = "' +
- self.results_file + '"',
- 'local out_file = ""')
-
- def _get_results(self):
- """
- Returns the results of the experiment
- :return: None
- """
- throughput = common.get_file_first_line(self.results_file)
- ret_val = dict()
- try:
- ret_val['throughput'] = int(throughput)
- except:
- ret_val['throughput'] = 0
- return ret_val
diff --git a/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py b/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py
deleted file mode 100644
index 5891832f2..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/benchmarks/test_benchmark.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import time
-
-from experimental_framework.benchmarks import benchmark_base_class as base
-
-
-class TestBenchmark(base.BenchmarkBaseClass):
-
- def init(self):
- pass
-
- def finalize(self):
- pass
-
- def get_features(self):
- features = dict()
- features['description'] = 'Test Benchmark'
- features['parameters'] = list()
- features['allowed_values'] = dict()
- features['default_values'] = dict()
- return features
-
- def run(self):
- time.sleep(10)
- return dict()
diff --git a/yardstick/vTC/apexlake/experimental_framework/common.py b/yardstick/vTC/apexlake/experimental_framework/common.py
deleted file mode 100644
index feea8bde6..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/common.py
+++ /dev/null
@@ -1,622 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import print_function
-from __future__ import absolute_import
-import os
-import re
-import six.moves.configparser
-import logging
-import fileinput
-from experimental_framework.constants import conf_file_sections as cf
-from experimental_framework.constants import framework_parameters as fp
-
-
-# ------------------------------------------------------
-# List of common variables
-# ------------------------------------------------------
-
-allowed_releases = ['liberty', 'kilo', 'juno']
-
-LOG = None
-CONF_FILE = None
-DEPLOYMENT_UNIT = None
-ITERATIONS = None
-RELEASE = None
-
-BASE_DIR = None
-RESULT_DIR = None
-TEMPLATE_DIR = None
-TEMPLATE_NAME = None
-TEMPLATE_FILE_EXTENSION = None
-
-PKTGEN = None
-PKTGEN_DIR = None
-PKTGEN_DPDK_DIRECTORY = None
-PKTGEN_PROGRAM = None
-PKTGEN_COREMASK = None
-PKTGEN_MEMCHANNEL = None
-PKTGEN_BUS_SLOT_NIC_1 = None
-PKTGEN_BUS_SLOT_NIC_2 = None
-PKTGEN_NAME_NIC_1 = None
-PKTGEN_NAME_NIC_2 = None
-
-INFLUXDB_IP = None
-INFLUXDB_PORT = None
-INFLUXDB_DB_NAME = None
-
-
-# ------------------------------------------------------
-# Initialization and Input 'heat_templates/'validation
-# ------------------------------------------------------
-
-def init(api=False):
- global BASE_DIR
- # BASE_DIR = os.getcwd()
- BASE_DIR = os.path.dirname(os.path.abspath(__file__))
- BASE_DIR = BASE_DIR.replace('/experimental_framework', '')
- BASE_DIR = InputValidation.validate_directory_exist_and_format(
- BASE_DIR, "Error 000001")
-
- init_conf_file(api)
- init_log()
- init_general_vars(api)
- if CONF_FILE.get_variable_list(cf.CFS_PKTGEN):
- init_pktgen()
-
-
-def init_conf_file(api=False):
- global CONF_FILE
- if api:
- CONF_FILE = ConfigurationFile(cf.get_sections_api(),
- '/tmp/apexlake/apexlake.conf')
- else:
- CONF_FILE = ConfigurationFile(cf.get_sections(),
- '/tmp/apexlake/apexlake.conf')
-
-
-def init_general_vars(api=False):
- global TEMPLATE_FILE_EXTENSION
- global TEMPLATE_NAME
- global TEMPLATE_DIR
- global RESULT_DIR
- global ITERATIONS
- global RELEASE
-
- TEMPLATE_FILE_EXTENSION = '.yaml'
-
- # Check Section in Configuration File
- InputValidation.\
- validate_configuration_file_section(
- cf.CFS_GENERAL,
- "Section " + cf.CFS_GENERAL +
- "is not present in configuration file")
-
- InputValidation.\
- validate_configuration_file_section(
- cf.CFS_OPENSTACK,
- "Section " + cf.CFS_OPENSTACK +
- "is not present in configuration file")
-
- TEMPLATE_DIR = '/tmp/apexlake/heat_templates/'
- # if not os.path.exists(TEMPLATE_DIR):
- # os.makedirs(TEMPLATE_DIR)
- # cmd = "cp /tmp/apexlake/heat_templates/*.yaml {}".format(TEMPLATE_DIR)
- # run_command(cmd)
-
- if not api:
- # Validate template name
- InputValidation.\
- validate_configuration_file_parameter(
- cf.CFS_GENERAL,
- cf.CFSG_TEMPLATE_NAME,
- "Parameter " + cf.CFSG_TEMPLATE_NAME +
- "is not present in configuration file")
- TEMPLATE_NAME = CONF_FILE.get_variable(cf.CFS_GENERAL,
- cf.CFSG_TEMPLATE_NAME)
- InputValidation.validate_file_exist(
- TEMPLATE_DIR + TEMPLATE_NAME,
- "The provided template file does not exist")
-
- RESULT_DIR = "/tmp/apexlake/results/"
- if not os.path.isdir(RESULT_DIR):
- os.makedirs(RESULT_DIR)
-
- if cf.CFSO_RELEASE in CONF_FILE.get_variable_list(cf.CFS_OPENSTACK):
- RELEASE = CONF_FILE.get_variable(cf.CFS_OPENSTACK, cf.CFSO_RELEASE)
- if RELEASE not in allowed_releases:
- raise ValueError("Release {} is not supported".format(RELEASE))
-
- # Validate and assign Iterations
- if cf.CFSG_ITERATIONS in CONF_FILE.get_variable_list(cf.CFS_GENERAL):
- ITERATIONS = int(CONF_FILE.get_variable(cf.CFS_GENERAL,
- cf.CFSG_ITERATIONS))
- else:
- ITERATIONS = 1
-
-
-def init_log():
- global LOG
- LOG = logging.getLogger()
- debug = CONF_FILE.get_variable(cf.CFS_GENERAL, cf.CFSG_DEBUG)
- if debug == 'true' or debug == 'True':
- LOG.setLevel(level=logging.DEBUG)
- else:
- LOG.setLevel(level=logging.INFO)
- log_formatter = logging.Formatter("%(asctime)s --- %(message)s")
- file_handler = logging.FileHandler("{0}/{1}.log".format("./", "benchmark"))
- file_handler.setFormatter(log_formatter)
- file_handler.setLevel(logging.DEBUG)
- LOG.addHandler(file_handler)
-
-
-# ------------------------------------------------------
-# InfluxDB conf variables
-# ------------------------------------------------------
-def init_influxdb():
- global INFLUXDB_IP
- global INFLUXDB_PORT
- global INFLUXDB_DB_NAME
-
- INFLUXDB_IP = CONF_FILE.get_variable(cf.CFS_INFLUXDB, cf.CFSI_IDB_IP)
- INFLUXDB_PORT = CONF_FILE.get_variable(cf.CFS_INFLUXDB, cf.CFSI_IDB_PORT)
- INFLUXDB_DB_NAME = CONF_FILE.get_variable(cf.CFS_INFLUXDB,
- cf.CFSI_IDB_DB_NAME)
-
-
-# ------------------------------------------------------
-# Packet Generator conf variables
-# ------------------------------------------------------
-def init_pktgen():
- global PKTGEN
- global PKTGEN_DIR
- global PKTGEN_PROGRAM
- global PKTGEN_COREMASK
- global PKTGEN_MEMCHANNEL
- global PKTGEN_BUS_SLOT_NIC_1
- global PKTGEN_BUS_SLOT_NIC_2
- global PKTGEN_DPDK_DIRECTORY
- global PKTGEN_NAME_NIC_1
- global PKTGEN_NAME_NIC_2
-
- msg = "Section {} is not present in the configuration file".\
- format(cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_section(cf.CFS_PKTGEN, msg)
-
- pktgen_var_list = CONF_FILE.get_variable_list(cf.CFS_PKTGEN)
- PKTGEN = 'dpdk_pktgen' # default value
- if cf.CFSP_PACKET_GENERATOR in pktgen_var_list:
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_PACKET_GENERATOR, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_PACKET_GENERATOR, msg)
- PKTGEN = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_PACKET_GENERATOR)
-
- if PKTGEN not in fp.get_supported_packet_generators():
- raise ValueError('The specified packet generator is not supported '
- 'by the framework')
-
- # Check if the packet gen is dpdk_pktgen
- if PKTGEN == cf.CFSP_PG_DPDK:
- # Validation of DPDK pktgen directory
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_PKTGEN_DIRECTORY, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PKTGEN_DIRECTORY, msg)
- PKTGEN_DIR = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PKTGEN_DIRECTORY)
- msg = "The directory {} does not exist.".format(PKTGEN_DIR)
- PKTGEN_DIR = InputValidation.validate_directory_exist_and_format(
- PKTGEN_DIR, msg)
-
- # Validation of the DPDK program name
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_PROGRAM_NAME, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PROGRAM_NAME, msg)
- PKTGEN_PROGRAM = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_PROGRAM_NAME)
-
- # Validation of the DPDK Coremask parameter
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_COREMASK, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_COREMASK, msg)
- PKTGEN_COREMASK = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_COREMASK)
-
- # Validation of the DPDK Memory Channel parameter
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_MEMORY_CHANNEL, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_MEMORY_CHANNEL, msg)
- PKTGEN_MEMCHANNEL = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_MEMORY_CHANNEL)
-
- # Validation of the DPDK Bus Slot 1
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_BUS_SLOT_NIC_1, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_1, msg)
- PKTGEN_BUS_SLOT_NIC_1 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_1)
-
- # Validation of the DPDK Bus Slot 2
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_BUS_SLOT_NIC_2, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_2, msg)
- PKTGEN_BUS_SLOT_NIC_2 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_BUS_SLOT_NIC_2)
-
- # Validation of the DPDK NIC 1
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_NAME_IF_1, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_1, msg)
- PKTGEN_NAME_NIC_1 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_1)
-
- # Validation of the DPDK NIC 2
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_NAME_IF_2, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_2, msg)
- PKTGEN_NAME_NIC_2 = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_NAME_IF_2)
-
- # Validation of DPDK directory parameter
- msg = "Parameter {} is not present in section {}".format(
- cf.CFSP_DPDK_DPDK_DIRECTORY, cf.CFS_PKTGEN)
- InputValidation.validate_configuration_file_parameter(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_DPDK_DIRECTORY, msg)
- PKTGEN_DPDK_DIRECTORY = CONF_FILE.get_variable(
- cf.CFS_PKTGEN, cf.CFSP_DPDK_DPDK_DIRECTORY)
- msg = "Directory {} does not exist".format(
- cf.CFSP_DPDK_DPDK_DIRECTORY)
- PKTGEN_DPDK_DIRECTORY = InputValidation.\
- validate_directory_exist_and_format(PKTGEN_DPDK_DIRECTORY, msg)
-
-
-# ------------------------------------------------------
-# Configuration file access
-# ------------------------------------------------------
-
-class ConfigurationFile:
- """
- Used to extract data from the configuration file
- """
-
- def __init__(self, sections, config_file='conf.cfg'):
- """
- Reads configuration file sections
-
- :param sections: list of strings representing the sections to be
- loaded
- :param config_file: name of the configuration file (string)
- :return: None
- """
- InputValidation.validate_string(
- config_file, "The configuration file name must be a string")
- # config_file = BASE_DIR + config_file
- InputValidation.validate_file_exist(
- config_file, 'The provided configuration file does not exist')
- self.config = six.moves.configparser.ConfigParser()
- self.config.read(config_file)
- for section in sections:
- setattr(
- self, section, ConfigurationFile.
- _config_section_map(section, self.config))
-
- @staticmethod
- def _config_section_map(section, config_file):
- """
- Returns a dictionary with the configuration values for the specific
- section
-
- :param section: section to be loaded (string)
- :param config_file: name of the configuration file (string)
- :return: dict
- """
- dict1 = dict()
- options = config_file.options(section)
- for option in options:
- dict1[option] = config_file.get(section, option)
- return dict1
-
- def get_variable(self, section, variable_name):
- """
- Returns the value correspondent to a variable
-
- :param section: section to be loaded (string)
- :param variable_name: name of the variable (string)
- :return: string
- """
- message = "The variable name must be a string"
- InputValidation.validate_string(variable_name, message)
- if variable_name in self.get_variable_list(section):
- sect = getattr(self, section)
- return sect[variable_name]
- else:
- exc_msg = 'Parameter {} is not in the {} section of the ' \
- 'conf file'.format(variable_name, section)
- raise ValueError(exc_msg)
-
- def get_variable_list(self, section):
- """
- Returns the list of the available variables in a section
- :param section: section to be loaded (string)
- :return: list
- """
- try:
- return getattr(self, section)
- except:
- msg = 'Section {} not found in the configuration file'.\
- format(section)
- raise ValueError(msg)
-
-
-# ------------------------------------------------------
-# Get OpenStack Credentials
-# ------------------------------------------------------
-def get_credentials():
- """
- Returns the credentials for OpenStack access from the configuration file
- :return: dictionary
- """
- credentials = dict()
- credentials[cf.CFSO_IP_CONTROLLER] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_IP_CONTROLLER)
- credentials[cf.CFSO_HEAT_URL] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_HEAT_URL)
- credentials[cf.CFSO_USER] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_USER)
- credentials[cf.CFSO_PASSWORD] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_PASSWORD)
- credentials[cf.CFSO_AUTH_URI] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_AUTH_URI)
- credentials[cf.CFSO_PROJECT] = CONF_FILE.get_variable(
- cf.CFS_OPENSTACK, cf.CFSO_PROJECT)
- return credentials
-
-
-# ------------------------------------------------------
-# Manage files
-# ------------------------------------------------------
-
-def get_heat_template_params():
- """
- Returns the list of deployment parameters from the configuration file
- for the heat template
-
- :return: dict
- """
- heat_parameters_list = CONF_FILE.get_variable_list(
- cf.CFS_DEPLOYMENT_PARAMETERS)
- testcase_parameters = dict()
- for param in heat_parameters_list:
- testcase_parameters[param] = CONF_FILE.get_variable(
- cf.CFS_DEPLOYMENT_PARAMETERS, param)
- return testcase_parameters
-
-
-def get_testcase_params():
- """
- Returns the list of testcase parameters from the configuration file
-
- :return: dict
- """
- testcase_parameters = dict()
- parameters = CONF_FILE.get_variable_list(cf.CFS_TESTCASE_PARAMETERS)
- for param in parameters:
- testcase_parameters[param] = CONF_FILE.get_variable(
- cf.CFS_TESTCASE_PARAMETERS, param)
- return testcase_parameters
-
-
-def get_file_first_line(file_name):
- """
- Returns the first line of a file
-
- :param file_name: name of the file to be read (str)
- :return: str
- """
- message = "The name of the file must be a string"
- InputValidation.validate_string(file_name, message)
- message = 'The file {} does not exist'.format(file_name)
- InputValidation.validate_file_exist(file_name, message)
- res = open(file_name, 'r')
- return res.readline()
-
-
-def replace_in_file(file, text_to_search, text_to_replace):
- """
- Replaces a string within a file
-
- :param file: name of the file (str)
- :param text_to_search: text to be replaced
- :param text_to_replace: new text that will replace the previous
- :return: None
- """
- message = 'The text to be replaced in the file must be a string'
- InputValidation.validate_string(text_to_search, message)
- message = 'The text to replace in the file must be a string'
- InputValidation.validate_string(text_to_replace, message)
- message = "The name of the file must be a string"
- InputValidation.validate_string(file, message)
- message = "The file does not exist"
- InputValidation.validate_file_exist(file, message)
- for line in fileinput.input(file, inplace=True):
- print((line.replace(text_to_search, text_to_replace).rstrip()))
-
-
-# ------------------------------------------------------
-# Shell interaction
-# ------------------------------------------------------
-def run_command(command):
- LOG.info("Running command: {}".format(command))
- return os.system(command)
-
-
-def push_data_influxdb(data):
- ip = INFLUXDB_IP
- port = INFLUXDB_PORT
- db_name = INFLUXDB_DB_NAME
- command = "curl -i -XPOST 'http://{}:{}/write?db={}' " \
- "--data-binary {}".format(ip, port, db_name, data)
- run_command(command)
-
-
-# ------------------------------------------------------
-# Expose variables to other modules
-# ------------------------------------------------------
-
-def get_base_dir():
- return BASE_DIR
-
-
-def get_template_dir():
- return TEMPLATE_DIR
-
-
-def get_result_dir():
- return RESULT_DIR
-
-
-def get_dpdk_pktgen_vars():
- if not (PKTGEN == 'dpdk_pktgen'):
- return dict()
- ret_val = dict()
- ret_val[cf.CFSP_DPDK_PKTGEN_DIRECTORY] = PKTGEN_DIR
- ret_val[cf.CFSP_DPDK_DPDK_DIRECTORY] = PKTGEN_DPDK_DIRECTORY
- ret_val[cf.CFSP_DPDK_PROGRAM_NAME] = PKTGEN_PROGRAM
- ret_val[cf.CFSP_DPDK_COREMASK] = PKTGEN_COREMASK
- ret_val[cf.CFSP_DPDK_MEMORY_CHANNEL] = PKTGEN_MEMCHANNEL
- ret_val[cf.CFSP_DPDK_BUS_SLOT_NIC_1] = PKTGEN_BUS_SLOT_NIC_1
- ret_val[cf.CFSP_DPDK_BUS_SLOT_NIC_2] = PKTGEN_BUS_SLOT_NIC_2
- ret_val[cf.CFSP_DPDK_NAME_IF_1] = PKTGEN_NAME_NIC_1
- ret_val[cf.CFSP_DPDK_NAME_IF_2] = PKTGEN_NAME_NIC_2
- return ret_val
-
-
-# ------------------------------------------------------
-# Configuration Variables from Config File
-# ------------------------------------------------------
-def get_deployment_configuration_variables_from_conf_file():
- variables = dict()
- types = dict()
- all_variables = CONF_FILE.get_variable_list(cf.CFS_EXPERIMENT_VNF)
- for var in all_variables:
- v = CONF_FILE.get_variable(cf.CFS_EXPERIMENT_VNF, var)
- type = re.findall(r'@\w*', v)
- values = re.findall(r'\"(.+?)\"', v)
- variables[var] = values
- try:
- types[var] = type[0][1:]
- except IndexError:
- LOG.debug("No type has been specified for variable " + var)
- return variables
-
-
-# ------------------------------------------------------
-# benchmarks from Config File
-# ------------------------------------------------------
-def get_benchmarks_from_conf_file():
- requested_benchmarks = list()
- benchmarks = \
- CONF_FILE.get_variable(cf.CFS_GENERAL, cf.CFSG_BENCHMARKS).split(', ')
- for benchmark in benchmarks:
- requested_benchmarks.append(benchmark)
- return requested_benchmarks
-
-
-class InputValidation(object):
-
- @staticmethod
- def validate_string(param, message):
- if not isinstance(param, str):
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_integer(param, message):
- if not isinstance(param, int):
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_dictionary(param, message):
- if not isinstance(param, dict):
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_file_exist(file_name, message):
- if not os.path.isfile(file_name):
- raise ValueError(message + ' ' + file_name)
- return True
-
- @staticmethod
- def validate_directory_exist_and_format(directory, message):
- if not os.path.isdir(directory):
- raise ValueError(message)
- if not directory.endswith('/'):
- return directory + '/'
- return directory
-
- @staticmethod
- def validate_configuration_file_parameter(section, parameter, message):
- params = CONF_FILE.get_variable_list(section)
- if parameter not in params:
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_configuration_file_section(section, message):
- if section not in cf.get_sections():
- raise ValueError(message)
- return True
-
- @staticmethod
- def validate_boolean(boolean, message):
- if isinstance(boolean, bool):
- return boolean
- if isinstance(boolean, str):
- if boolean == 'True':
- return True
- if boolean == 'False':
- return False
- raise ValueError(message)
-
- @staticmethod
- def validate_os_credentials(credentials):
- if not isinstance(credentials, dict):
- raise ValueError(
- 'The provided openstack_credentials '
- 'variable must be in dictionary format')
-
- credential_keys = ['ip_controller', 'heat_url', 'user', 'password',
- 'auth_uri', 'project']
- missing = [
- credential_key
- for credential_key in credential_keys
- if credential_key not in list(credentials.keys())
- ]
- if len(missing) == 0:
- return True
- msg = 'OpenStack Credentials Error! ' \
- 'The following parameters are missing: {}'.\
- format(", ".join(missing))
- raise ValueError(msg)
diff --git a/yardstick/vTC/apexlake/experimental_framework/constants/__init__.py b/yardstick/vTC/apexlake/experimental_framework/constants/__init__.py
deleted file mode 100644
index 8178e022d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/constants/__init__.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-Constants
-"""
diff --git a/yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py b/yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py
deleted file mode 100644
index ce46d800a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/constants/conf_file_sections.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-# ------------------------------------------------------
-# Configuration File Sections
-# ------------------------------------------------------
-CFS_PKTGEN = 'PacketGen'
-CFS_GENERAL = 'General'
-CFS_OPENSTACK = 'OpenStack'
-CFS_EXPERIMENT_VNF = 'Experiment-VNF'
-CFS_EXPERIMENT_GENERIC = 'Experiment-generic'
-CFS_TESTCASE_PARAMETERS = 'Testcase-parameters'
-CFS_DEPLOYMENT_PARAMETERS = 'Deployment-parameters'
-CFS_INFLUXDB = 'InfluxDB'
-
-
-def get_sections():
- return [
- CFS_PKTGEN,
- CFS_GENERAL,
- CFS_OPENSTACK,
- CFS_EXPERIMENT_VNF,
- # CFS_EXPERIMENT_GENERIC,
- CFS_TESTCASE_PARAMETERS,
- CFS_DEPLOYMENT_PARAMETERS,
- CFS_INFLUXDB
- # Add here eventually new sections in configuration file ...
- ]
-
-
-def get_sections_api():
- return [
- CFS_PKTGEN,
- CFS_GENERAL,
- CFS_INFLUXDB,
- CFS_OPENSTACK
- # Add here eventually new sections in configuration file ...
- ]
-
-# ------------------------------------------------------
-# General section parameters
-# ------------------------------------------------------
-CFSG_ITERATIONS = 'iterations'
-CFSG_TEMPLATE_DIR = 'template_dir'
-CFSG_TEMPLATE_NAME = 'template_base_name'
-CFSG_RESULT_DIRECTORY = 'results_directory'
-CFSG_BENCHMARKS = 'benchmarks'
-CFSG_DEBUG = 'debug'
-
-
-# ------------------------------------------------------
-# InfluxDB
-# ------------------------------------------------------
-CFSI_IDB_IP = 'influxdb_ip_address'
-CFSI_IDB_PORT = 'influxdb_port'
-CFSI_IDB_DB_NAME = 'influxdb_db_name'
-
-
-# ------------------------------------------------------
-# Packet generator section parameters
-# ------------------------------------------------------
-CFSP_PACKET_GENERATOR = 'packet_generator'
-CFSP_DPDK_PKTGEN_DIRECTORY = 'pktgen_directory'
-CFSP_DPDK_DPDK_DIRECTORY = 'dpdk_directory'
-CFSP_DPDK_PROGRAM_NAME = 'program_name'
-CFSP_DPDK_COREMASK = 'coremask'
-CFSP_DPDK_MEMORY_CHANNEL = 'memory_channels'
-CFSP_DPDK_BUS_SLOT_NIC_1 = 'bus_slot_nic_1'
-CFSP_DPDK_BUS_SLOT_NIC_2 = 'bus_slot_nic_2'
-CFSP_DPDK_NAME_IF_1 = 'name_if_1'
-CFSP_DPDK_NAME_IF_2 = 'name_if_2'
-
-
-# ------------------------------------------------------
-# Supported Packet generators
-# ------------------------------------------------------
-CFSP_PG_NONE = 'none'
-CFSP_PG_DPDK = 'dpdk_pktgen'
-
-
-# ------------------------------------------------------
-# OpenStack section variables
-# ------------------------------------------------------
-CFSO_IP_CONTROLLER = 'ip_controller'
-CFSO_HEAT_URL = 'heat_url'
-CFSO_USER = 'user'
-CFSO_PASSWORD = 'password'
-CFSO_AUTH_URI = 'auth_uri'
-CFSO_PROJECT = 'project'
-CFSO_RELEASE = 'release'
diff --git a/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py b/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py
deleted file mode 100644
index 6e651bf19..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/constants/framework_parameters.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-from __future__ import absolute_import
-from experimental_framework.constants import conf_file_sections as cfs
-
-# ------------------------------------------------------
-# Directories and file locations
-# ------------------------------------------------------
-EXPERIMENTAL_FRAMEWORK_DIR = 'experimental_framework/'
-EXPERIMENT_TEMPLATE_NAME = 'experiment'
-TEMPLATE_FILE_EXTENSION = '.yaml'
-DPDK_PKTGEN_DIR = 'packet_generators/dpdk_pktgen/'
-PCAP_DIR = 'packet_generators/pcap_files/'
-
-
-def get_supported_packet_generators():
- return [
- cfs.CFSP_PG_NONE,
- cfs.CFSP_PG_DPDK
- # Add here any other supported packet generator
- ]
diff --git a/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py b/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py
deleted file mode 100644
index 0bb507c51..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/deployment_unit.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import os
-import time
-
-from experimental_framework import heat_manager
-from experimental_framework import common
-
-MAX_RETRY = 3
-
-
-class DeploymentUnit:
- """
- This unit is in charge to manage the deployment of the workloads under
- test and any other workloads necessary to
- the benchmark
- """
-
- def __init__(self, openstack_credentials):
- self.heat_manager = heat_manager.HeatManager(openstack_credentials)
- self.deployed_stacks = list()
-
- def destroy_heat_template(self, stack_name):
- """
- Destroys a stack
- :param stack_name: Stack of the name to be destroyed (sting)
- :return: None
- """
- try:
- if self.heat_manager.check_stack_status(stack_name):
- if stack_name in self.deployed_stacks:
- self.deployed_stacks.remove(stack_name)
- self.heat_manager.delete_stack(stack_name)
-
- status = self.heat_manager.check_stack_status(stack_name)
- while status and 'DELETE_IN_PROGRESS' in status:
- common.LOG.info(status)
- time.sleep(5)
- status = self.heat_manager.check_stack_status(stack_name)
- return True
- except Exception:
- common.LOG.debug("check_stack_status", exc_info=True)
- return False
-
- def destroy_all_deployed_stacks(self):
- """
- Destroys all the stacks currently deployed
- :return: None
- """
- for stack in self.deployed_stacks:
- if self.heat_manager.is_stack_deployed(stack):
- self.destroy_heat_template(stack)
-
- def deploy_heat_template(self, template_file, stack_name, parameters,
- attempt=0):
- """
- Deploys a heat template and in case of failure retries 3 times
- :param template_file: full path file name of the heat template
- :param stack_name: name of the stack to deploy
- :param parameters: parameters to be given to the heat template
- :param attempt: number of current attempt
- :return: returns True in case the creation is completed
- returns False in case the creation is failed
- """
- if not os.path.isfile(template_file):
- raise ValueError('The specified file does not exist ("' +
- template_file + '")')
- try:
- self.heat_manager.create_stack(template_file, stack_name,
- parameters)
- deployed = True
- except Exception:
- common.LOG.debug("create_stack", exc_info=True)
- deployed = False
-
- if not deployed and 'COMPLETE' in \
- self.heat_manager.check_stack_status(stack_name):
- try:
- self.destroy_heat_template(stack_name)
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
-
- status = self.heat_manager.check_stack_status(stack_name)
- while status and 'CREATE_IN_PROGRESS' in status:
- time.sleep(5)
- status = self.heat_manager.check_stack_status(stack_name)
- if status and ('FAILED' in status or 'NOT_FOUND' in status):
- if attempt < MAX_RETRY:
- attempt += 1
- try:
- self.destroy_heat_template(stack_name)
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
- return self.deploy_heat_template(template_file, stack_name,
- parameters, attempt)
- else:
- try:
- self.destroy_heat_template(stack_name)
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
- finally:
- return False
- if self.heat_manager.check_stack_status(stack_name) and \
- 'COMPLETE' in self.heat_manager.\
- check_stack_status(stack_name):
- self.deployed_stacks.append(stack_name)
- return True
diff --git a/yardstick/vTC/apexlake/experimental_framework/heat_manager.py b/yardstick/vTC/apexlake/experimental_framework/heat_manager.py
deleted file mode 100644
index a3233349d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/heat_manager.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-from keystoneclient.v2_0 import client as keystoneClient
-from heatclient import client as heatClient
-from heatclient.common import template_utils
-
-import experimental_framework.common as common
-
-__author__ = 'vmriccox'
-
-
-class HeatManager:
-
- def __init__(self, credentials):
- self.ip_controller = credentials['ip_controller']
- self.heat_url = credentials['heat_url']
- self.user = credentials['user']
- self.password = credentials['password']
- self.auth_uri = credentials['auth_uri']
- self.project_id = credentials['project']
- self.heat = None
-
- def init_heat(self):
- keystone = keystoneClient.Client(username=self.user,
- password=self.password,
- tenant_name=self.project_id,
- auth_url=self.auth_uri)
- auth_token = keystone.auth_token
- self.heat_url = keystone.service_catalog.url_for(
- service_type='orchestration')
- self.heat = heatClient.Client('1', endpoint=self.heat_url,
- token=auth_token)
-
- def print_stacks(self, name=None):
- for stack in self.heat.stacks.list():
- if (name and stack.stack_name == name) or not name:
- common.LOG.info("Stack Name: " + stack.stack_name)
- common.LOG.info("Stack Status: " + stack.stack_status)
-
- def create_stack(self, template_file, stack_name, parameters):
- self.init_heat()
- # self.print_stacks()
- tpl_files, template = \
- template_utils.get_template_contents(template_file)
-
- fields = {
- 'template': template,
- 'files': dict(list(tpl_files.items()))
- }
- self.heat.stacks.create(stack_name=stack_name, files=fields['files'],
- template=template, parameters=parameters)
- self.print_stacks(stack_name)
-
- def is_stack_deployed(self, stack_name):
- self.init_heat()
- if stack_name in self.heat.stacks.list():
- return True
- return False
-
- def check_stack_status(self, stack_name):
- """
- Returns a string representing the status of a stack from Heat
- perspective
- :param stack_name: Name of the stack to be checked (type: str)
- :return: (type: str)
- """
- if self.heat:
- for stack in self.heat.stacks.list():
- if stack.stack_name == stack_name:
- return stack.stack_status
- return 'NOT_FOUND'
-
- def validate_heat_template(self, heat_template_file):
- self.init_heat()
- if not self.heat.stacks.validate(template=open(heat_template_file,
- 'r').read()):
- raise ValueError('The provided heat template "' +
- heat_template_file +
- '" is not in the correct format')
-
- def delete_stack(self, stack_name):
- self.init_heat()
- try:
- for stack in self.heat.stacks.list():
- if stack.stack_name == stack_name:
- self.heat.stacks.delete(stack.id)
- return True
- except Exception:
- common.LOG.debug("destroy_heat_template", exc_info=True)
- return False
diff --git a/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py b/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
deleted file mode 100644
index bbf55853d..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/heat_template_generation.py
+++ /dev/null
@@ -1,236 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-"""
-Generation of the heat templates from the base template
-"""
-
-from __future__ import absolute_import
-import os
-import shutil
-
-from oslo_serialization import jsonutils
-
-from experimental_framework import common
-from experimental_framework.constants import framework_parameters as fp
-
-
-class TreeNode:
- """
- This class represent the node of the configuration tree.\
- Each node represents a single configuration value for a single
- configuration parameter.
- """
-
- def __init__(self):
- self.up = None
- self.down = []
- self.variable_name = ''
- self.variable_value = 0
-
- def add_child(self, node):
- """
- Adds a node as a child for the current node
- :param node: node to be added as a child (type: TreeNode)
- :return: None
- """
- node.up = self
- self.down.append(node)
-
- def get_parent(self):
- """
- Returns the parent node of the current one
- :return type: TreeNode
- """
- return self.up
-
- def get_children(self):
- """
- Returns the children of the current node
- :return type: list of TreeNode
- """
- if len(self.down) == 0:
- # return [self]
- return []
- return self.down
-
- def get_variable_name(self):
- """
- Returns the name of the variable correspondent to the current node
- :return type: str
- """
- return self.variable_name
-
- def get_variable_value(self):
- """
- Returns the value of the variable correspondent to the current node
- :return type: str or int
- """
- return self.variable_value
-
- def set_variable_name(self, name):
- """
- Sets the name of the variable for the current node
- :param name: Name of the variable (type: str)
- :return None
- """
- self.variable_name = name
-
- def set_variable_value(self, value):
- """
- Sets the value of the variable for the current node
- :param value: value of the variable (type: str)
- :return None
- """
- self.variable_value = value
-
- def get_path(self):
- """
- Returns all the path from the current node to the root of the tree.
- :return type: list of TreeNode
- """
- ret_val = []
- if not self.up:
- ret_val.append(self)
- return ret_val
- for node in self.up.get_path():
- ret_val.append(node)
- ret_val.append(self)
- return ret_val
-
- def __str__(self):
- return str(self.variable_name) + " --> " + str(self.variable_value)
-
- def __repr__(self):
- return str(self.variable_name) + " = " + str(self.variable_value)
-
- @staticmethod
- def _get_leaves(node, leaves):
- """
- Returns all the leaves of a tree.
- It changes the "leaves" list.
- :param node: root of the tree (type: TreeNode)
- :param leaves: partial list of leaves (type: list of TreeNode)
- :return type: None
- """
- children = node.get_children()
- if len(children) == 0:
- leaves.append(node)
- return
- for child in children:
- TreeNode._get_leaves(child, leaves)
-
- @staticmethod
- def get_leaves(node):
- """
- Returns all the leaves of a tree.
- :param node: root of the tree (TreeNode)
- :return type: list
- """
- leaves = list()
- TreeNode._get_leaves(node, leaves)
- return leaves
-
-
-template_name = fp.EXPERIMENT_TEMPLATE_NAME
-
-
-def generates_templates(base_heat_template, deployment_configuration):
- """
- Generates the heat templates for the experiments
- :return: None
- """
- # Load useful parameters from file
- template_dir = common.get_template_dir()
- template_file_extension = fp.TEMPLATE_FILE_EXTENSION
- template_base_name = base_heat_template
-
- variables = deployment_configuration
-
- # Delete the templates eventually generated in previous running of the
- # framework
- common.LOG.info("Removing the heat templates previously generated")
- command = "rm {}{}_*".format(template_dir, template_name)
- os.system(command)
-
- # Creation of the tree with all the new configurations
- common.LOG.info("Creation of the tree with all the new configurations")
- tree = TreeNode()
- for variable in variables:
- leaves = TreeNode.get_leaves(tree)
- common.LOG.debug("LEAVES: " + str(leaves))
- common.LOG.debug("VALUES: " + str(variables[variable]))
-
- for value in variables[variable]:
- for leaf in leaves:
- new_node = TreeNode()
- new_node.set_variable_name(variable)
- new_node.set_variable_value(value)
- leaf.add_child(new_node)
-
- common.LOG.debug("CONFIGURATION TREE: " + str(tree))
-
- common.LOG.info("Heat Template and metadata file creation")
- leaves = TreeNode.get_leaves(tree)
- counter = 1
- for leaf in leaves:
- heat_template_vars = leaf.get_path()
- if os.path.isabs(template_base_name):
- base_template = template_base_name
- else:
- base_template = template_dir + template_base_name
- new_template = template_dir + template_name
- new_template += "_" + str(counter) + template_file_extension
- shutil.copy(base_template, new_template)
-
- metadata = {}
- for var in heat_template_vars:
- if var.get_variable_name():
- common.replace_in_file(new_template, "#" +
- var.get_variable_name(),
- var.get_variable_value())
- metadata[var.get_variable_name()] = var.get_variable_value()
-
- # Save the metadata on a JSON file
- with open(new_template + ".json", 'w') as outfile:
- # sort keys to maintain persistent order for git
- jsonutils.dump(metadata, outfile, sort_keys=True)
-
- common.LOG.debug("Heat Templates and Metadata file " + str(counter) +
- " created")
- counter += 1
-
- # Creation of the template files
- common.LOG.info(str(counter - 1) + " Heat Templates and Metadata files "
- "created")
-
-
-def get_all_heat_templates(template_dir, template_file_extension):
- """
- Loads and returns all the generated heat templates
- :param template_dir: directory to search in (type: str)
- :param template_file_extension: extension of the file for templates
- (type: str)
- :return: type: list
- """
- template_files = []
- for dirname, dirnames, filenames in os.walk(template_dir):
- for filename in filenames:
- if template_file_extension in filename and \
- filename.endswith(template_file_extension) and \
- template_name in filename:
- template_files.append(filename)
- template_files.sort()
- return template_files
diff --git a/yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py b/yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py
deleted file mode 100644
index 876e3ca31..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/libraries/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-Libraries to be used by the framework.
-"""
-
-__author__ = 'vmriccox'
diff --git a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile b/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile
deleted file mode 100644
index 95a2b23b5..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-CC=gcc
-LDFLAGS= -lpcap
-testsniffmake: test_sniff.c
- $(CC) $(CFLAGS) -o test_sniff test_sniff.c $(LDFLAGS)
diff --git a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c b/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c
deleted file mode 100644
index a4eda3cff..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/libraries/packet_checker/test_sniff.c
+++ /dev/null
@@ -1,146 +0,0 @@
-// Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-//
-// 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.
-
-#include <pcap.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netinet/if_ether.h>
-
-static int expected_tos = -1;
-static int cmatch = 0;
-
-
-/* 4 bytes IP address */
-typedef struct ip_address
-{
- u_char byte1;
- u_char byte2;
- u_char byte3;
- u_char byte4;
-} ip_address;
-
-
-/* IPv4 header */
-typedef struct ip_header
-{
- u_char ver_ihl;
- u_char tos;
- u_short tlen;
- u_short identification;
- u_short flags_fo;
- u_char ttl;
- u_char proto;
- u_short crc;
- ip_address saddr;
- ip_address daddr;
- u_int op_pad;
-} ip_header;
-
-
-/* UDP header*/
-typedef struct udp_header
-{
- u_short sport; // Source port
- u_short dport; // Destination port
- u_short len; // Datagram length
- u_short crc; // Checksum
-} udp_header;
-
-
-/* Save results on file */
-void save_and_exit(int sig)
-{
- write_file();
- exit(0);
-}
-
-
-/*
- * This callback function is called for each received packet
- */
-void stats_collection(u_char *useless,
- const struct pcap_pkthdr* pkthdr,
- const u_char* packet)
-{
- ip_header *ih;
- udp_header *uh;
- u_int ip_len;
- ih = (ip_header *) (packet + 14);
- ip_len = (ih->ver_ihl & 0xf) * 4;
- u_char tos = ih->tos;
- // Counter update
- if(tos==expected_tos)
- cmatch ++;
-}
-
-
-int main(int argc,char **argv)
-{
- int i;
- char *dev;
- char errbuf[PCAP_ERRBUF_SIZE];
- pcap_t* descr;
- const u_char *packet;
- struct pcap_pkthdr hdr;
- struct ether_header *eptr;
-
- if(argc != 3)
- {
- fprintf(stdout,"Usage: %s interface_name expected_tos\n", argv[0]);
- exit(1);
- }
-
- expected_tos = atoi(argv[2]);
-
- /* Setup signal to stop the sniffer */
- signal(SIGTERM, save_and_exit);
-
- /* Take a device to read from */
- dev = argv[1];
- if(dev == NULL)
- {
- printf("%s\n",errbuf);
- exit(1);
- }
-
- /* Open device for reading */
- descr = pcap_open_live(dev, BUFSIZ, 0, -1, errbuf);
- if(descr == NULL)
- {
- printf("pcap_open_live(): %s\n", errbuf);
- exit(1);
- }
-
- /* Start the loop to be run for each packet */
- pcap_loop(descr, -1, stats_collection, NULL);
- return 0;
-}
-
-
-int write_file()
-{
- FILE *f = fopen("/tmp/apexlake/results/packet_checker.res", "w");
- if (f == NULL)
- {
- printf("Error opening file!\n");
- exit(1);
- }
- fprintf(f, "%d\n", cmatch);
- fclose(f);
-}
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py b/yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py
deleted file mode 100644
index 935f144f4..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-Packet generators
-"""
-
-__author__ = 'vmriccox'
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py b/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py
deleted file mode 100644
index 57f586463..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/base_packet_generator.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import abc
-
-
-class BasePacketGenerator:
-
- def __init__(self):
- pass
-
- @abc.abstractmethod
- def send_traffic(self):
- """
- Starts the traffic generation.
- According to the specific packet generator it requires prior
- initialization
- :return: None
- """
- raise NotImplementedError("Subclass must implement abstract method")
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
deleted file mode 100644
index bd81527a2..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_packet_generator.py
+++ /dev/null
@@ -1,351 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import os
-import time
-
-
-import experimental_framework.common as common
-from experimental_framework.constants import conf_file_sections as conf_file
-from experimental_framework.constants import framework_parameters as fp
-from experimental_framework.packet_generators import base_packet_generator
-
-
-class DpdkPacketGenerator(base_packet_generator.BasePacketGenerator):
-
- def __init__(self):
- base_packet_generator.BasePacketGenerator.__init__(self)
- self.command = ''
- self.directory = ''
- self.program_name = ''
- self.command_options = list()
- self.dpdk_interfaces = -1
-
- def send_traffic(self):
- """
- Calls the packet generator and starts to send traffic
- Blocking call
- """
- current_dir = os.path.dirname(os.path.realpath(__file__))
- DpdkPacketGenerator._chdir(self.directory)
- dpdk_vars = common.get_dpdk_pktgen_vars()
- self._init_physical_nics(self.dpdk_interfaces, dpdk_vars)
- common.run_command(self.command)
- self._finalize_physical_nics(self.dpdk_interfaces, dpdk_vars)
- DpdkPacketGenerator._chdir(current_dir)
-
- def init_dpdk_pktgen(self,
- dpdk_interfaces,
- lua_script='generic_test.lua',
- pcap_file_0='',
- pcap_file_1='',
- vlan_0='',
- vlan_1=''):
- """
- Initializes internal parameters and configuration of the module.
- Needs to be called before the send_traffic
- :param dpdk_interfaces: Number of interfaces to be used (type: int)
- :param lua_script: Full path of the Lua script to be used (type: str)
- :param pcap_file_0: Full path of the Pcap file to be used for port 0
- (type: str)
- :param pcap_file_1: Full path of the Pcap file to be used for port 1
- (type: str)
- :param vlan_0: VLAN tag to be used for port 0 (type: str)
- :param vlan_1: VLAN tag to be used for port 1 (type: str)
- :return:
- """
- # Input Validation
- if pcap_file_0 and not vlan_0:
- message = 'In order to use NIC_0, the parameter vlan_0 is required'
- raise ValueError(message)
- if dpdk_interfaces > 1 and pcap_file_1 and not vlan_1:
- message = 'in order to use NIC_1, the parameter vlan_1 is required'
- raise ValueError(message)
-
- self.dpdk_interfaces = dpdk_interfaces
- vars = common.get_dpdk_pktgen_vars()
-
- lua_directory = common.get_base_dir()
- lua_directory += fp.EXPERIMENTAL_FRAMEWORK_DIR
- lua_directory += fp.DPDK_PKTGEN_DIR
-
- pcap_directory = common.get_base_dir()
- pcap_directory += fp.EXPERIMENTAL_FRAMEWORK_DIR
- pcap_directory += fp.PCAP_DIR
-
- DpdkPacketGenerator._init_input_validation(pcap_file_0,
- pcap_file_1,
- lua_script,
- pcap_directory,
- lua_directory,
- vars)
-
- self.directory = vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY]
- self.program_name = vars[conf_file.CFSP_DPDK_PROGRAM_NAME]
-
- core_nics = DpdkPacketGenerator.\
- _get_core_nics(dpdk_interfaces, vars[conf_file.CFSP_DPDK_COREMASK])
- self.command_options = ['-c ' + vars[conf_file.CFSP_DPDK_COREMASK],
- '-n ' + vars[conf_file.
- CFSP_DPDK_MEMORY_CHANNEL],
- '--proc-type auto',
- '--file-prefix pg',
- '-- -T',
- '-P',
- '-m "' + core_nics + '"',
- '-f ' + lua_directory + lua_script,
- '-s 0:' + pcap_directory + pcap_file_0]
-
- if pcap_file_1:
- self.command_options.append('-s 1:' + pcap_directory + pcap_file_1)
-
- # Avoid to show the output of the packet generator
- self.command_options.append('> /dev/null')
- # Prepare the command to be invoked
- self.command = 'sudo ' + self.directory + self.program_name
- for opt in self.command_options:
- self.command += (' ' + opt)
- if pcap_file_0 and vlan_0:
- DpdkPacketGenerator._change_vlan(pcap_directory, pcap_file_0,
- vlan_0)
- if pcap_file_1 and vlan_1:
- DpdkPacketGenerator._change_vlan(pcap_directory, pcap_file_1,
- vlan_1)
-
- @staticmethod
- def _get_core_nics(dpdk_interfaces, coremask):
- """
- Retruns the core_nics string to be used in the dpdk pktgen command
- :param dpdk_interfaces: number of interfaces to be used in the pktgen
- (type: int)
- :param coremask: hexadecimal value representing the cores assigned to
- the pktgen (type: str)
- :return: Returns the core nics param for pktgen (type: str)
- """
- if dpdk_interfaces == 1:
- return DpdkPacketGenerator._cores_configuration(coremask, 1, 2, 0)
- elif dpdk_interfaces == 2:
- return DpdkPacketGenerator._cores_configuration(coremask, 1, 2, 2)
- raise ValueError("This framework only supports two ports to generate "
- "traffic")
-
- @staticmethod
- def _change_vlan(pcap_directory, pcap_file, vlan):
- common.LOG.info("Changing VLAN Tag on Packet: " + pcap_file +
- ". New VLAN Tag is " + vlan)
- command = "chmod +x {}{}".format(pcap_directory, 'vlan_tag.sh')
- common.run_command(command)
- command = pcap_directory + 'vlan_tag.sh '
- command += pcap_directory + pcap_file + ' ' + vlan
- common.run_command(command)
-
- @staticmethod
- def _init_input_validation(pcap_file_0, pcap_file_1, lua_script,
- pcap_directory, lua_directory, variables):
- """
- Validates the input parameters values and raises an exception if
- there is any non valid param
- :param pcap_file_0: file name of the pcap file for NIC 0
- (it does not includes the path) (type: str)
- :param pcap_file_1: file name of the pcap file for NIC 1
- (it does not includes the path) (type: str)
- :param lua_script: file name of the lua script to be used
- (it does not includes the path) (type: str)
- :param pcap_directory: directory where the pcap files are located
- (type: str)
- :param lua_directory: directory where the lua scripts are located
- (type: str)
- :param variables: variables for the packet gen from configuration file
- (type: dict)
- :return: None
- """
- if not pcap_directory:
- raise ValueError("pcap_directory not provided correctly")
- if not pcap_file_0:
- raise ValueError("pcap_file_0 not provided correctly")
- if not pcap_file_1:
- raise ValueError("pcap_file_1 not provided correctly")
- if not lua_script:
- raise ValueError("lua_script not provided correctly")
- if not os.path.isfile(pcap_directory + pcap_file_0):
- raise ValueError("The file " + pcap_file_0 + " does not exist")
- if not os.path.isfile(pcap_directory + pcap_file_1):
- raise ValueError("The file " + pcap_file_1 + " does not exist")
- if not os.path.isfile(lua_directory + lua_script):
- raise ValueError("The file " + lua_script + " does not exist")
- for var in [conf_file.CFSP_DPDK_PKTGEN_DIRECTORY,
- conf_file.CFSP_DPDK_PROGRAM_NAME,
- conf_file.CFSP_DPDK_COREMASK,
- conf_file.CFSP_DPDK_MEMORY_CHANNEL]:
- if variables.get(var, '') == '':
- raise ValueError("The variable " + var + " does not exist")
-
- @staticmethod
- def _chdir(directory):
- """
- Changes the current directory
- :param directory: directory where to move (type: str)
- :return: None
- """
- os.chdir(directory)
-
- def _init_physical_nics(self, dpdk_interfaces, dpdk_vars):
- """
- Initializes the physical interfaces
- :param dpdk_interfaces: Number of interfaces to be used (type: int)
- :param dpdk_vars: variables from config file related to DPDK pktgen
- (type: dict)
- :return: None
- """
- if not dpdk_interfaces == 1 and not dpdk_interfaces == 2:
- raise ValueError('The number of NICs can be 1 or 2')
- # 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('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('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('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('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])
-
- def _finalize_physical_nics(self, dpdk_interfaces, dpdk_vars):
- """
- Finalizes the physical interfaces
- :param dpdk_interfaces: Number of interfaces to be used (type: int)
- :param dpdk_vars: variables from config file related to DPDK pktgen
- (type: dict)
- :return: None
- """
- if not dpdk_interfaces == 1 and not dpdk_interfaces == 2:
- raise ValueError('No interfaces have been indicated for packet '
- 'generation usage. Please specify one or two '
- 'NICs')
- # Initialize NIC 1
- 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('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('sudo ifconfig ' +
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] +
- ' up')
- if dpdk_interfaces == 2:
- # Initialize NIC 2
- 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('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('sudo ifconfig ' +
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] +
- ' up')
-
- @staticmethod
- def _cores_configuration(coremask, pktgen_cores=1, nic_1_cores=2,
- nic_2_cores=2):
- """
- Calculation of the core_nics parameter which is necessary for the
- packet generator to run
-
- :param coremask: Hexadecimal value indicating the cores to be assigned
- to the whole dpdk pktgen software (included the
- ones to receive and send packets from NICs)
- (type: str)
- :param pktgen_cores: number of cores to be assigned to main thread of
- the pktgen directly
- :param nic_1_cores: number of cores to be assigned to the first NIC
- :param nic_2_nics: number of cores to be assigned to the second NIC
- :return: returns the core_nics parameter (type: str)
- """
- required_cores = pktgen_cores + nic_1_cores + nic_2_cores
- bin_coremask = bin(int(coremask, 16))[2:]
- index = len(bin_coremask)
- cores = []
- while index >= 0:
- index -= 1
- if bin_coremask[index] == '1':
- core = index
- cores.append(core)
- if len(cores) < required_cores:
- raise ValueError('The provided coremask does not provide'
- ' enough cores for the DPDK packet generator')
- # ret_pktgen_cores = []
- ret_nic_1_cores = []
- ret_nic_2_cores = []
- current_core = 0
-
- if nic_2_cores > 0:
- ret_nic_2_cores.append(cores[current_core])
- current_core += 1
- if nic_2_cores > 1:
- ret_nic_2_cores.append(cores[current_core])
- current_core += 1
-
- if nic_1_cores > 0:
- ret_nic_1_cores.append(cores[current_core])
- current_core += 1
- if nic_1_cores > 1:
- ret_nic_1_cores.append(cores[current_core])
- current_core += 1
-
- # for n in range(0, pktgen_cores):
- # ret_pktgen_cores.append(cores[n])
- # for n in range(0, nic_1_cores):
- # ret_nic_1_cores.append(cores[pktgen_cores + n])
- # for n in range(0, nic_2_cores):
- # ret_nic_2_cores.append(cores[pktgen_cores + nic_1_cores + n])
-
- corenics = ''
- if nic_1_cores > 0:
- if nic_1_cores < 2:
- corenics += str(ret_nic_1_cores[0]) + '.0'
- if nic_1_cores == 2:
- corenics += '[' + str(ret_nic_1_cores[0])
- corenics += ':' + str(ret_nic_1_cores[1])
- corenics += '].0'
- if nic_2_cores > 0:
- corenics += ','
- if nic_2_cores < 2:
- corenics += str(ret_nic_2_cores[0]) + '.1'
- if nic_2_cores == 2:
- corenics += '[' + str(ret_nic_2_cores[0])
- corenics += ':' + str(ret_nic_2_cores[1])
- corenics += '].1'
- return corenics
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua
deleted file mode 100644
index 3348b286b..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/constant_traffic.lua
+++ /dev/null
@@ -1,74 +0,0 @@
------------------------------------------------------------------------------
--- Copyright (c) 2015 Intel Research and Development Ireland Ltd.
---
--- 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.
------------------------------------------------------------------------------
-
------------------------------------
------ Constant traffic sender -----
------------------------------------
-
-package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"
-require "Pktgen";
-
------ Packet Gen Configuration
-local sendport = "0";
-pktgen.vlan(sendport, "on");
-pktgen.ping4("all");
-pktgen.icmp_echo("all", "on");
-pktgen.process("all", "on");
-
-
------ Script Configuration
-local traffic_delay = 0;
-local traffic_rate = 0;
-local out_file = "";
-
-
-function start_traffic(rate)
- local endStats, diff, prev, iteration, flag, found;
- flag = false;
- found = false;
-
- -- Send traffic at the specified rate
- print("Start Generation");
- pktgen.set(sendport, "rate", rate);
- sleep(1);
- pktgen.start(sendport);
- sleep(traffic_delay);
- pktgen.stop(sendport);
- print("Stop Generation");
-
- -- Collect statistics about the experiment
- endStats = pktgen.portStats("all", "port");
- sent_packets = endStats[0].opackets
- return sent_packets;
-end
-
-
-pktgen.clr();
-print("INSTANTIATION VALIDATION TEST")
-
--- Write output on log file
-file = io.open(out_file, "w");
-
--- Start experiment
-packets = start_traffic(traffic_rate);
-print("SENT PACKETS: " .. packets);
-file:write(packets);
-
--- Close the log file
-file:close();
-
--- Quit the environment
-os.exit(1);
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua b/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua
deleted file mode 100644
index d20a29b03..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/dpdk_pktgen/rfc2544.lua
+++ /dev/null
@@ -1,132 +0,0 @@
------------------------------------------------------------------------------
--- Copyright (c) 2015 Intel Research and Development Ireland Ltd.
---
--- 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.
------------------------------------------------------------------------------
-
--------------------------------
------ RFC-2544 throughput -----
--------------------------------
-
-package.path = package.path ..";?.lua;test/?.lua;app/?.lua;../?.lua"
-require "Pktgen";
-
------ Packet Gen Configuration
-local sendport = "0";
-local recvport = "1";
-pktgen.set(recvport, "rate", 1);
-pktgen.vlan(sendport, "on");
-pktgen.ping4("all");
-pktgen.icmp_echo("all", "on");
-pktgen.process("all", "on");
-
-
------ RFC2544 Configuration
-local traffic_delay = 60; -- Time in seconds to delay.
-local multicast_delay = 15; -- Time in seconds to delay.
-local starting_rate = 100; -- Initial Rate in %
-local step = 100; -- Initial Step in %
-local down_limit = 0;
-local up_limit = 100;
-
-
--- Creation of a module
---local rfc2544 = {}
-function start_traffic(rate)
- local endStats, diff, prev, iteration, flag, found;
- flag = false;
- found = false;
-
- print("PACKET GENERATION - " .. rate .. "%\n");
-
- -- Send packet to join the multicast group
- print("Join Multicast Group");
- pktgen.start(recvport);
- sleep(multicast_delay);
- pktgen.stop(recvport);
- pktgen.clr();
-
-
- -- Send traffic at the specified rate
- print("Start Generation");
- pktgen.set(sendport, "rate", rate);
- sleep(1);
- pktgen.start(sendport);
- sleep(traffic_delay);
- pktgen.stop(sendport);
- print("Stop Generation");
- sleep(5);
-
- -- Collect statistics about the experiment
- endStats = pktgen.portStats("all", "port");
- diff = endStats[0].opackets - endStats[1].ipackets;
- if ( endStats[0].opackets <= 0) then
- diff = 0;
- else
- diff = diff / endStats[0].opackets;
- end
- pktgen.clr();
-
- print("Missing packets: " .. (diff * 100));
-
- -- Adjust variable for the next race
- prev_rate = rate;
- step = step/2;
-
- if ( diff > 0.01) then
- if(endStats[0].opackets > 0) then
- up_limit = rate;
- rate = math.floor(rate - (step));
- end
- else
- down_limit = rate;
- rate = math.floor(rate + (step));
- print("\nRATE: " .. rate .. " RECEIVED PACKETS: " .. endStats[1].ipackets .. " ");
- found = true;
- end
-
- printf("DOWN LIMIT: %d\n", down_limit);
- printf("UP LIMIT: %d\n", up_limit);
-
- if ( rate >= 100 ) then
- rate = 100;
- end
-
- if ( prev ~= rate and rate < up_limit and rate >= down_limit and step >= 1 ) then
- if (step < 1 and not found ) or (step >= 1 ) then
- return start_traffic(rate);
- end
- end
- sleep(3);
- return down_limit;
-end
-local out_file = "";
-local starting_rate = 100;
-
-pktgen.clr();
-print("RFC 2544 THROUGHPUT CALCULATION");
-
--- Write output on log file
-file = io.open(out_file, "w");
-
--- Start experiment
---rate = rfc2544.start_traffic(starting_rate)
-rate = start_traffic(starting_rate);
-print("RATE: " .. rate);
-file:write(rate);
-
--- Close the log file
-file:close();
-
--- Quit the environment
-os.exit(1);
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst
deleted file mode 100644
index 9223be6c9..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/LICENSE.rst
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2015 MediaNetLab of National Center of Scientific Research "Demokritos".
-
-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.
-
-
-This license is related to the following files included in this directory:
-
-- igmp.pcap
-- packet_1024.pcap
-- packet_1280.pcap
-- packet_128.pcap
-- packet_1514.pcap
-- packet_1518.pcap
-- packet_256.pcap
-- packet_512.pcap
-- packet_64.pcap
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcap
deleted file mode 100644
index 1b8f24b29..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/igmp.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcap
deleted file mode 100644
index 445f05a26..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1024.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcap
deleted file mode 100644
index df91f9bb9..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_128.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcap
deleted file mode 100644
index 58cb704f9..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1280.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcap
deleted file mode 100644
index be23d4e96..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1514.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcap
deleted file mode 100644
index a99c4480a..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_1518.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcap
deleted file mode 100644
index 21c34c2c2..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_256.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcap
deleted file mode 100644
index 8e52ecdd8..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_512.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcap b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcap
deleted file mode 100644
index 9438270bc..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/packet_64.pcap
+++ /dev/null
Binary files differ
diff --git a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh b/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh
deleted file mode 100755
index 8564ddd42..000000000
--- a/yardstick/vTC/apexlake/experimental_framework/packet_generators/pcap_files/vlan_tag.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-#!/bin/bash
-
-INPUT_FILE=$1
-VLAN_TAG=$2
-
-tcprewrite --enet-vlan=add --enet-vlan-tag=$VLAN_TAG --enet-vlan-cfi=0 --enet-vlan-pri=0 --infile=$INPUT_FILE --outfile=$INPUT_FILE
diff --git a/yardstick/vTC/apexlake/heat_templates/stress_workload.yaml b/yardstick/vTC/apexlake/heat_templates/stress_workload.yaml
deleted file mode 100644
index 559f46d92..000000000
--- a/yardstick/vTC/apexlake/heat_templates/stress_workload.yaml
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (c) 2016-2017 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- name:
- type: string
- default: cpu_stress
- cores:
- type: string
- memory:
- type: string
- network:
- type: string
- subnet:
- type: string
-
-resources:
- port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: network }
- fixed_ips:
- - subnet: { get_param: subnet }
-
- vm1:
- type: OS::Nova::Server
- properties:
- name: traffic_vm1
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- ifconfig eth1 up
- dhclient eth1
-
- sed -i 's/localhost/localhost traffic_vm1/g' /etc/hosts
- touch /etc/resolvconf/resolv.conf.d/tail
- echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
- resolvconf -u
- echo 'nameserver 10.118.32.193' > /etc/resolv.conf
-
-
- # Installation of stress
- apt-get install -y stress
-
- cd /home/clouduser
-
- # workload setup
- echo 'stress -c $CORES --vm-bytes $MEMORY' > ./stress.sh
- chmod +x ./stress.sh
- nohup ./stress.sh &
- #nohup stress -c #CORES --vm-bytes #MEMORY
-
- params:
- $NAME: { get_param: name }
- $CORES: { get_param: cores }
- $MEMORY: { get_param: memory }
-
- flavor: m1.small
- networks:
- - port: { get_resource: port }
diff --git a/yardstick/vTC/apexlake/heat_templates/stress_workload_liberty.yaml b/yardstick/vTC/apexlake/heat_templates/stress_workload_liberty.yaml
deleted file mode 100644
index 07f659063..000000000
--- a/yardstick/vTC/apexlake/heat_templates/stress_workload_liberty.yaml
+++ /dev/null
@@ -1,79 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 user@TRAFCLASS-PACKET1.fuel.local and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- name:
- type: string
- default: cpu_stress
- cores:
- type: string
- memory:
- type: string
- network:
- type: string
- subnet:
- type: string
-
-resources:
- port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: network }
- port_security_enabled: false
- fixed_ips:
- - subnet: { get_param: subnet }
-
- vm1:
- type: OS::Nova::Server
- properties:
- name: traffic_vm1
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- ifconfig eth1 up
- dhclient eth1
-
- sed -i 's/localhost/localhost traffic_vm1/g' /etc/hosts
- touch /etc/resolvconf/resolv.conf.d/tail
- echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
- resolvconf -u
- echo 'nameserver 10.118.32.193' > /etc/resolv.conf
-
-
- # Installation of stress
- apt-get install -y stress
-
- cd /home/clouduser
-
- # workload setup
- echo 'stress -c $CORES --vm-bytes $MEMORY' > ./stress.sh
- chmod +x ./stress.sh
- nohup ./stress.sh &
- #nohup stress -c #CORES --vm-bytes #MEMORY
-
- params:
- $NAME: { get_param: name }
- $CORES: { get_param: cores }
- $MEMORY: { get_param: memory }
-
- flavor: m1.small
- networks:
- - port: { get_resource: port }
diff --git a/yardstick/vTC/apexlake/heat_templates/vTC.yaml b/yardstick/vTC/apexlake/heat_templates/vTC.yaml
deleted file mode 100644
index 86692084d..000000000
--- a/yardstick/vTC/apexlake/heat_templates/vTC.yaml
+++ /dev/null
@@ -1,192 +0,0 @@
-# Copyright (c) 2016-2017 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.
-heat_template_version: 2014-10-16
-description: HOT template to deploy a virtual Traffic Classifier
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 2000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
- ### DEFAULT NETWORK FOR MNGM
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- #key_name: { get_param: key_name }
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
- # Creation of a user
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:yardstick | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- # Fix Network Confiuration
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- touch /etc/resolvconf/resolv.conf.d/tail
- #echo 'nameserver 192.168.10.1' > /etc/resolvconf/resolv.conf.d/tail
- #echo 'nameserver 10.20.0.2' > /etc/resolvconf/resolv.conf.d/tail
- echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
- resolvconf -u
-
-
- echo 'nameserver 10.118.32.193' > /etc/resolv.conf
-
-
- # Install vTC Dependencies
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev bison flex byacc libjson0-dev libcurl4-gnutls-dev jq dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
- apt-get install -y byacc libtool libcurl4-openssl-dev
-
- cd /home/clouduser
-
- # Setup multicast
- echo mgroup from eth1 group 224.192.16.1 > /etc/smcroute.conf
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- git reset --hard c3f5c56
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- rm resp.json
- curl -X POST -u "mPkgwvJPsTFS8hYmHk:SDczcrK4cvnkMRWSEchB3ANcWbqFXqPx" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token=38uFQuhEdPvCTbhc7k >> resp.json
- access_token=`jq -r '.access_token' resp.json`
- git clone https://x-token-auth:${access_token}@bitbucket.org/akiskourtis/vtc.git
- cd vtc
- git checkout -b stable
- #Build nDPI library
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
-
- #Build PF_RING library
- cd ..
- cd PF_RING
- make
- #Build PF_RING examples, including the modified pfbridge, with nDPI integrated.
- cd userland/examples/
- sed -i 's#EXTRA_LIBS =#EXTRA_LIBS='"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c#' ./Makefile
- sed -i 's# -Ithird-party# -Ithird-party/ -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'#' ./Makefile
- echo $NDPI_DIR
- make
- cd ../..
- cd ..
- cd ..
-
- # To use PF_RING driver use the following
- #sudo rmmod pf_ring
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=16384 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- sleep 5
-
- # To use the Linux kernel driver use the following
- cd /home/clouduser/
- sudo nohup ./vtc/nDPI/example/ndpiReader -i eth1 -a eth2 &
- sleep 5
-
- curl --data-ascii "{\"classification_rules\":[{\"RuleId\":\"1\",\"ToS\":\"16\"}]}" http://localhost:9999/classifier/classification_rules/224.192.16.1 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- #$IP_FAMILY: { get_param: ip_family }
- flavor: #vtc_flavor
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/heat_templates/vTC_liberty.yaml b/yardstick/vTC/apexlake/heat_templates/vTC_liberty.yaml
deleted file mode 100644
index 715a181a5..000000000
--- a/yardstick/vTC/apexlake/heat_templates/vTC_liberty.yaml
+++ /dev/null
@@ -1,191 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 user@TRAFCLASS-PACKET1.fuel.local and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-heat_template_version: 2014-10-16
-description: HOT template to deploy a virtual Traffic Classifier
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 2000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
- ### DEFAULT NETWORK FOR MNGM
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- port_security_enabled: true
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- port_security_enabled: false
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- port_security_enabled: false
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- #key_name: { get_param: key_name }
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
- # Creation of a user
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:yardstick | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
- ifconfig 10.254.254.253 up netmask 255.255.255.248
-
- # Fix Network Confiuration
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- touch /etc/resolvconf/resolv.conf.d/tail
- #echo 'nameserver 192.168.10.1' > /etc/resolvconf/resolv.conf.d/tail
- #echo 'nameserver 10.20.0.2' > /etc/resolvconf/resolv.conf.d/tail
- echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
- resolvconf -u
-
-
- echo 'nameserver 10.118.32.193' > /etc/resolv.conf
-
-
- # Install vTC Dependencies
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev bison flex byacc libjson0-dev libcurl4-gnutls-dev jq dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
- apt-get install -y byacc libtool libcurl4-openssl-dev
-
- cd /home/clouduser
-
- # Setup multicast
- echo mgroup from eth1 group 224.192.16.1 > /etc/smcroute.conf
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- git reset --hard c3f5c56
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- rm resp.json
- curl -X POST -u "mPkgwvJPsTFS8hYmHk:SDczcrK4cvnkMRWSEchB3ANcWbqFXqPx" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token=38uFQuhEdPvCTbhc7k >> resp.json
- access_token=`jq -r '.access_token' resp.json`
- git clone https://x-token-auth:${access_token}@bitbucket.org/akiskourtis/vtc.git
- cd vtc
- git checkout -b stable
- #Build nDPI library
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
-
- #Build PF_RING library
- cd ..
- cd PF_RING
- make
- #Build PF_RING examples, including the modified pfbridge, with nDPI integrated.
- cd userland/examples/
- sed -i 's#EXTRA_LIBS =#EXTRA_LIBS='"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c#' ./Makefile
- sed -i 's# -Ithird-party# -Ithird-party/ -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'#' ./Makefile
- echo $NDPI_DIR
- make
- cd ../..
- cd ..
- cd ..
-
- # To use PF_RING driver use the following
- #sudo rmmod pf_ring
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=16384 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- sleep 5
-
- # To use the Linux kernel driver use the following
- cd /home/clouduser/
- sudo nohup ./vtc/nDPI/example/ndpiReader -i eth1 -a eth2 &
- sleep 5
-
- curl --data-ascii "{\"classification_rules\":[{\"RuleId\":\"1\",\"ToS\":\"16\"}]}" http://localhost:9999/classifier/classification_rules/224.192.16.1 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- #$IP_FAMILY: { get_param: ip_family }
- flavor: #vtc_flavor
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/setup.py b/yardstick/vTC/apexlake/setup.py
deleted file mode 100644
index 0211a57c1..000000000
--- a/yardstick/vTC/apexlake/setup.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-"""
-Experimental Framework
-"""
-
-from __future__ import absolute_import
-from distutils.core import setup
-
-
-setup(name='apexlake',
- version='1.0',
- description='Framework to automatically run experiments/benchmarks '
- 'with VMs within OpenStack environments',
- author='Intel Research and Development Ireland Ltd',
- author_email='vincenzo.m.riccobene@intel.com',
- license='Apache 2.0',
- url='www.intel.com',
- packages=['experimental_framework',
- 'experimental_framework.benchmarks',
- 'experimental_framework.packet_generators',
- 'experimental_framework.libraries',
- 'experimental_framework.constants'],
- include_package_data=True,
- package_data={
- 'experimental_framework': [
- 'packet_generators/dpdk_pktgen/*.lua',
- 'packet_generators/pcap_files/*.pcap',
- 'packet_generators/pcap_files/*.sh',
- 'libraries/packet_checker/*'
- ]
- },
- data_files=[
- ('/tmp/apexlake/', ['apexlake.conf']),
- ('/tmp/apexlake/heat_templates/',
- ['heat_templates/vTC.yaml']),
- ('/tmp/apexlake/heat_templates/',
- ['heat_templates/stress_workload.yaml']),
- ('/tmp/apexlake/heat_templates/',
- ['heat_templates/vTC_liberty.yaml']),
- ('/tmp/apexlake/heat_templates/',
- ['heat_templates/stress_workload_liberty.yaml'])
- ])
diff --git a/yardstick/vTC/apexlake/tests/api_test.py b/yardstick/vTC/apexlake/tests/api_test.py
deleted file mode 100644
index b6191ed8f..000000000
--- a/yardstick/vTC/apexlake/tests/api_test.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-from __future__ import absolute_import
-import unittest
-import mock
-import os
-import experimental_framework.common as common
-from experimental_framework import APEX_LAKE_ROOT
-from experimental_framework.api import FrameworkApi
-from experimental_framework.benchmarking_unit import BenchmarkingUnit
-import experimental_framework.benchmarks.\
- instantiation_validation_benchmark as iv
-from six.moves import map
-from six.moves import range
-
-
-class DummyBenchmarkingUnit(BenchmarkingUnit):
-
- def __init__(self):
- BenchmarkingUnit.__init__(self)
-
- @staticmethod
- def get_available_test_cases():
- return ['BenchA', 'BenchB']
-
- @staticmethod
- def get_required_benchmarks(required_benchmarks):
- common.BASE_DIR = "base_dir/"
- return [iv.InstantiationValidationBenchmark('benchmark', dict())]
-
-
-class DummyBenchmarkingUnit2(BenchmarkingUnit):
-
- counter_init = 0
- counter_finalize = 0
- counter_run = 0
-
- def __init__(self, base_heat_template, credentials,
- heat_template_parameters, iterations, test_cases):
- DummyBenchmarkingUnit.counter_init = 0
- DummyBenchmarkingUnit.counter_finalize = 0
- DummyBenchmarkingUnit.counter_run = 0
-
- def initialize(self):
- DummyBenchmarkingUnit2.counter_init += 1
-
- def run_benchmarks(self):
- DummyBenchmarkingUnit2.counter_run += 1
-
- def finalize(self):
- DummyBenchmarkingUnit2.counter_finalize += 1
-
-
-class TestGeneratesTemplate(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('experimental_framework.common.init')
- def test_init_for_success(self, mock_init):
- FrameworkApi.init()
- mock_init.assert_called_once_with(api=True)
-
- # @mock.patch('experimental_framework.benchmarking_unit.BenchmarkingUnit.'
- # 'get_available_test_cases',
- # side_effect=DummyBenchmarkingUnit.get_available_test_cases)
- # def test_get_available_test_cases_for_success(self, mock_bench):
- # expected = ['BenchA', 'BenchB']
- # output = FrameworkApi.get_available_test_cases()
- # self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.benchmarking_unit.BenchmarkingUnit.'
- 'get_required_benchmarks',
- side_effect=DummyBenchmarkingUnit.get_required_benchmarks)
- def test_get_test_case_features_for_success(self, mock_get_req_bench):
- expected = dict()
- expected['description'] = 'Instantiation Validation Benchmark'
- expected['parameters'] = [
- iv.THROUGHPUT,
- iv.VLAN_SENDER,
- iv.VLAN_RECEIVER]
- expected['allowed_values'] = dict()
- expected['allowed_values'][iv.THROUGHPUT] = \
- list(map(str, list(range(0, 100))))
- expected['allowed_values'][iv.VLAN_SENDER] = \
- list(map(str, list(range(-1, 4096))))
- expected['allowed_values'][iv.VLAN_RECEIVER] = \
- list(map(str, list(range(-1, 4096))))
- expected['default_values'] = dict()
- expected['default_values'][iv.THROUGHPUT] = '1'
- expected['default_values'][iv.VLAN_SENDER] = '-1'
- expected['default_values'][iv.VLAN_RECEIVER] = '-1'
-
- test_case = 'instantiation_validation_benchmark.' \
- 'InstantiationValidationBenchmark'
- output = FrameworkApi.get_test_case_features(test_case)
- self.assertEqual(expected, output)
-
- def test__get_test_case_features__for_failure(self):
- self.assertRaises(
- ValueError, FrameworkApi.get_test_case_features, 111)
-
- @mock.patch('experimental_framework.common.init')
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.common.get_credentials')
- @mock.patch('experimental_framework.heat_template_generation.'
- 'generates_templates')
- @mock.patch('experimental_framework.benchmarking_unit.BenchmarkingUnit',
- side_effect=DummyBenchmarkingUnit2)
- def test_execute_framework_for_success(self, mock_b_unit, mock_heat,
- mock_credentials, mock_log,
- mock_common_init):
- common.TEMPLATE_DIR = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/generated_templates/')
-
- test_cases = dict()
- iterations = 1
- heat_template = 'VTC_base_single_vm_wait.tmp'
- heat_template_parameters = dict()
- deployment_configuration = ''
- openstack_credentials = dict()
- openstack_credentials['ip_controller'] = ''
- openstack_credentials['heat_url'] = ''
- openstack_credentials['user'] = ''
- openstack_credentials['password'] = ''
- openstack_credentials['auth_uri'] = ''
- openstack_credentials['project'] = ''
- FrameworkApi.execute_framework(
- test_cases, iterations, heat_template,
- heat_template_parameters, deployment_configuration,
- openstack_credentials)
diff --git a/yardstick/vTC/apexlake/tests/base_packet_generator_test.py b/yardstick/vTC/apexlake/tests/base_packet_generator_test.py
deleted file mode 100644
index 153de171d..000000000
--- a/yardstick/vTC/apexlake/tests/base_packet_generator_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-from experimental_framework.packet_generators import base_packet_generator
-
-
-class BasePacketGeneratorTest(unittest.TestCase):
-
- def setUp(self):
- self.mut = base_packet_generator.BasePacketGenerator()
- pass
-
- def tearDown(self):
- pass
-
- def test_send_traffic_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.send_traffic)
diff --git a/yardstick/vTC/apexlake/tests/benchmark_base_class_test.py b/yardstick/vTC/apexlake/tests/benchmark_base_class_test.py
deleted file mode 100644
index 4e5eb9fb0..000000000
--- a/yardstick/vTC/apexlake/tests/benchmark_base_class_test.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-from __future__ import absolute_import
-import unittest
-from experimental_framework.benchmarks import benchmark_base_class as base
-
-
-class DummyBechmarkBaseClass(base.BenchmarkBaseClass):
-
- def get_features(self):
- features = dict()
- features['description'] = '***'
- features['parameters'] = ['A', 'B']
- features['allowed_values'] = dict()
- features['allowed_values']['A'] = ['a']
- features['allowed_values']['B'] = ['b']
- features['default_values'] = dict()
- features['default_values']['A'] = 'a'
- features['default_values']['B'] = 'b'
- return features
-
-
-class TestBenchmarkBaseClass(unittest.TestCase):
-
- def setUp(self):
- self.mut = base.BenchmarkBaseClass('name', dict())
-
- def test_constructor_for_success(self):
- name = 'name'
- params = dict()
- params['A'] = 'a'
- params['B'] = 'b'
- params['C'] = 'c'
- bench_base = DummyBechmarkBaseClass(name, params)
- self.assertEqual(name, bench_base.name)
- self.assertIn('A', list(bench_base.params.keys()))
- self.assertIn('B', list(bench_base.params.keys()))
- self.assertEqual('a', bench_base.params['A'])
- self.assertEqual('b', bench_base.params['B'])
-
- params = dict()
- params['A'] = 'a'
- # params['B'] = 'b'
- bench_base = DummyBechmarkBaseClass(name, params)
- # self.assertEqual(name, bench_base.name)
- # self.assertIn('A', bench_base.params.keys())
- # self.assertIn('B', bench_base.params.keys())
- # self.assertEqual('a', bench_base.params['A'])
- # self.assertEqual('b', bench_base.params['B'])
-
- def test_constructor_for_failure(self):
- name = 'name'
- params = 'params'
- self.assertRaises(ValueError, DummyBechmarkBaseClass, name, params)
-
- def test_constructor_for_failure_2(self):
- name = 'name'
- params = dict()
- params['A'] = 'a'
- params['B'] = '*'
- self.assertRaises(ValueError, DummyBechmarkBaseClass, name, params)
-
- def test_init_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.init)
-
- def test_finalize_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.finalize)
-
- def test_run_for_failure(self):
- self.assertRaises(NotImplementedError, self.mut.run)
-
- def test_get_name_for_success(self):
- self.assertEqual(self.mut.get_name(), 'name')
diff --git a/yardstick/vTC/apexlake/tests/benchmarking_unit_test.py b/yardstick/vTC/apexlake/tests/benchmarking_unit_test.py
deleted file mode 100644
index 7b33ba693..000000000
--- a/yardstick/vTC/apexlake/tests/benchmarking_unit_test.py
+++ /dev/null
@@ -1,481 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-from __future__ import absolute_import
-import os
-import unittest
-import mock
-
-from experimental_framework import APEX_LAKE_ROOT
-from experimental_framework.benchmarking_unit import BenchmarkingUnit
-# from experimental_framework.data_manager import DataManager
-from experimental_framework.deployment_unit import DeploymentUnit
-import experimental_framework.common as common
-from experimental_framework.benchmarks.rfc2544_throughput_benchmark import \
- RFC2544ThroughputBenchmark
-
-__author__ = 'vmriccox'
-
-
-# class DummyDataManager(DataManager):
-#
-# def __init__(self, experiment_directory):
-# self.experiment_directory = experiment_directory
-# self.experiments = dict()
-# self.new_exp_counter = 0
-# self.add_bench_counter = 0
-# self.close_experiment_1_counter = 0
-# self.close_experiment_2_counter = 0
-# self.generate_csv_counter = 0
-#
-# def create_new_experiment(self, experiment_name, get_counter=None):
-# if not get_counter:
-# self.new_exp_counter += 1
-# else:
-# return self.new_exp_counter
-#
-# def add_benchmark(self, experiment_name, benchmark_name, get_counter=None):
-# if not get_counter:
-# self.add_bench_counter += 1
-# else:
-# return self.add_bench_counter
-#
-# def close_experiment(self, experiment, get_counter=None):
-# if get_counter:
-# return [self.close_experiment_1_counter,
-# self.close_experiment_2_counter]
-# if experiment == 'VTC_base_single_vm_wait_1':
-# self.close_experiment_1_counter += 1
-# if experiment == 'VTC_base_single_vm_wait_2':
-# self.close_experiment_2_counter += 1
-#
-# def generate_result_csv_file(self, get_counter=None):
-# if get_counter:
-# return self.generate_csv_counter
-# else:
-# self.generate_csv_counter += 1
-#
-# def add_metadata(self, experiment_name, metadata):
-# pass
-#
-# def add_configuration(self, experiment_name, configuration):
-# pass
-#
-# def add_data_points(self, experiment_name, benchmark_name, result):
-# pass
-
-
-class Dummy_2544(RFC2544ThroughputBenchmark):
-
- def __init__(self, name, params):
- self.name = name
- self.init_counter = 0
- self.finalize_counter = 0
- self.run_counter = 0
- self.params = params
-
- def init(self, get_counter=None):
- if get_counter:
- return self.init_counter
- else:
- self.init_counter += 1
-
- def finalize(self, get_counter=None):
- if get_counter:
- return self.finalize_counter
- else:
- self.finalize_counter += 1
-
- def run(self, get_counter=None):
- if get_counter:
- return self.run_counter
- else:
- self.run_counter += 1
- return {'throughput': 10}
-
-
-class DummyDeploymentUnit(DeploymentUnit):
-
- def __init__(self, openstack_credentials):
- pass
-
- def deploy_heat_template(self, template_file, stack_name, parameters,
- attempt=0):
- return False
-
-
-class TestBenchmarkingUnit(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.heat.'
- 'get_all_heat_templates')
- def test___init__(self, mock_heat, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/results/'
- common.TEMPLATE_FILE_EXTENSION = '.ext'
- common.RESULT_DIR = 'tests/data/results/'
- heat_template_name = 'name'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = ['bench_1', 'bench_2']
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- self.assertEqual(bu.required_benchmarks, benchmarks)
- bu.heat_template_parameters = heat_template_parameters
- # mock_data_manager.assert_called_once_with('tests/data/results/12345')
- mock_dep_unit.assert_called_once_with(openstack_credentials)
- mock_heat.assert_called_once_with('tests/data/results/', '.ext')
-
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_initialize_for_success(self, mock_heat, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir,
- mock_time, mock_rfc2544):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- self.assertEqual(bu.required_benchmarks, benchmarks)
- bu.heat_template_parameters = heat_template_parameters
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.initialize()
- self.assertTrue(len(bu.benchmarks) == 1)
- self.assertEqual(bu.benchmarks[0].__class__,
- Dummy_2544)
- # self.assertEqual(bu.data_manager.create_new_experiment('', True), 2)
- # self.assertEqual(bu.data_manager.add_benchmark('', '', True), 2)
-
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_finalize_for_success(
- self, mock_heat, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- bu.heat_template_parameters = heat_template_parameters
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.finalize()
- # self.assertEqual(bu.data_manager.close_experiment('', True), [1, 1])
- # self.assertEqual(bu.data_manager.generate_result_csv_file(True), 1)
-
- @mock.patch('experimental_framework.common.push_data_influxdb')
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_run_benchmarks_for_success(self, mock_heat, mock_common_dep_unit,
- mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time,
- mock_rfc2544, mock_log, mock_influx):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/test_templates/')
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
- common.INFLUXDB_IP = 'InfluxIP'
- common.INFLUXDB_PORT = '8086'
- common.INFLUXDB_DB_NAME = 'test_db'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- # bu.data_manager = DummyDataManager('tests/data/results/12345')
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.benchmarks = [Dummy_2544('dummy', {'param1': 'val1'})]
- bu.run_benchmarks()
- self.assertEqual(bu.benchmarks[0].init(True), 2)
- self.assertEqual(bu.benchmarks[0].finalize(True), 2)
- self.assertEqual(bu.benchmarks[0].run(True), 2)
- # expected_metric = \
- # 'throughput,vnic_type=direct,ram=1024,benchmark=dummy,' \
- # 'vcpus=2,experiment_name=VTC_base_single_vm_wait_2,' \
- # 'param1=val1 value=10 12345000000000'
- # mock_influx.assert_called_with(expected_metric)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_run_benchmarks_2_for_success(
- self, mock_heat, mock_common_dep_unit, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544,
- mock_log):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/test_templates/')
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- # bu.data_manager = DummyDataManager('tests/data/results/12345')
- bu.template_files = ['VTC_base_single_vm_wait_1.yaml',
- 'VTC_base_single_vm_wait_2.yaml']
- bu.benchmarks = [Dummy_2544('dummy', dict())]
- common.DEPLOYMENT_UNIT = DummyDeploymentUnit(dict())
- bu.run_benchmarks()
- self.assertEqual(bu.benchmarks[0].init(True), 2)
- self.assertEqual(bu.benchmarks[0].finalize(True), 0)
- self.assertEqual(bu.benchmarks[0].run(True), 0)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_get_benchmark_name_for_success(
- self, mock_heat, mock_common_dep_unit, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544,
- mock_log):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
-
- heat_template_name = 'VTC_base_single_vm_wait_'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit(heat_template_name,
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
-
- expected = 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark_0'
- output = bu.get_benchmark_name(
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark')
- self.assertEqual(expected, output)
-
- expected = 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark_1'
- output = bu.get_benchmark_name(
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark')
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark', side_effect=Dummy_2544)
- @mock.patch('time.time')
- @mock.patch('experimental_framework.common.get_template_dir')
- # @mock.patch('experimental_framework.data_manager.DataManager',
- # side_effect=DummyDataManager)
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit')
- @mock.patch('experimental_framework.benchmarking_unit.'
- 'heat.get_all_heat_templates')
- def test_get_required_benchmarks_for_success(
- self, mock_heat, mock_common_dep_unit, mock_dep_unit,
- # mock_data_manager,
- mock_temp_dir, mock_time, mock_rfc2544,
- mock_log):
- mock_heat.return_value = list()
- mock_time.return_value = '12345'
- mock_temp_dir.return_value = 'tests/data/test_templates/'
- common.TEMPLATE_FILE_EXTENSION = '.yaml'
- common.RESULT_DIR = 'tests/data/results/'
- openstack_credentials = {
- 'name': 'aaa',
- 'surname': 'bbb'
- }
- heat_template_parameters = {
- 'param_1': 'name_1',
- 'param_2': 'name_2'
- }
- iterations = 1
- benchmarks = [
- {
- 'name':
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark',
- 'params': dict()
- }
- ]
- bu = BenchmarkingUnit('',
- openstack_credentials,
- heat_template_parameters,
- iterations,
- benchmarks)
- req_benchs = \
- ['rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark']
- output = bu.get_required_benchmarks(req_benchs)
- self.assertEqual(len(req_benchs), 1)
- self.assertEqual(output[0].__class__, Dummy_2544)
diff --git a/yardstick/vTC/apexlake/tests/common_test.py b/yardstick/vTC/apexlake/tests/common_test.py
deleted file mode 100644
index b8dbfe6b8..000000000
--- a/yardstick/vTC/apexlake/tests/common_test.py
+++ /dev/null
@@ -1,665 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import mock
-import os
-import logging
-import six.moves.configparser
-import experimental_framework.common as common
-import experimental_framework.constants.conf_file_sections as cf
-from experimental_framework import APEX_LAKE_ROOT
-
-__author__ = 'vmricco'
-
-
-def reset_common():
- common.LOG = None
- common.CONF_FILE = None
- common.DEPLOYMENT_UNIT = None
- common.ITERATIONS = None
- common.BASE_DIR = None
- common.RESULT_DIR = None
- common.TEMPLATE_DIR = None
- common.TEMPLATE_NAME = None
- common.TEMPLATE_FILE_EXTENSION = None
- common.PKTGEN = None
- common.PKTGEN_DIR = None
- common.PKTGEN_DPDK_DIRECTORY = None
- common.PKTGEN_PROGRAM = None
- common.PKTGEN_COREMASK = None
- common.PKTGEN_MEMCHANNEL = None
- common.PKTGEN_BUS_SLOT_NIC_1 = None
- common.PKTGEN_BUS_SLOT_NIC_2 = None
- common.INFLUXDB_IP = None
- common.INFLUXDB_PORT = None
- common.INFLUXDB_DB_NAME = None
-
-
-class DummyConfigurationFile(common.ConfigurationFile):
-
- def __init__(self, sections, conf_file=''):
- pass
-
- def get_variable(self, section, variable_name):
- return 'vTC.yaml'
-
- def get_variable_list(self, section):
- return ['template_base_name']
-
-
-class DummyConfigurationFile2(common.ConfigurationFile):
-
- def __init__(self, sections):
- self.pktgen_counter = 0
-
- def get_variable(self, section, variable_name):
- if variable_name == cf.CFSG_TEMPLATE_NAME:
- return 'vTC.yaml'
- if variable_name == cf.CFSG_ITERATIONS:
- return '2'
- if variable_name == cf.CFSG_DEBUG:
- return 'True'
- if variable_name == cf.CFSP_PACKET_GENERATOR:
- if self.pktgen_counter == 1:
- return 'non_supported'
- self.pktgen_counter += 1
- return 'dpdk_pktgen'
- if variable_name == cf.CFSP_DPDK_PKTGEN_DIRECTORY:
- return APEX_LAKE_ROOT
- if variable_name == cf.CFSP_DPDK_PROGRAM_NAME:
- return 'program'
- if variable_name == cf.CFSP_DPDK_COREMASK:
- return 'coremask'
- if variable_name == cf.CFSP_DPDK_MEMORY_CHANNEL:
- return 'memchannel'
- if variable_name == cf.CFSP_DPDK_BUS_SLOT_NIC_1:
- return 'bus_slot_nic_1'
- if variable_name == cf.CFSP_DPDK_BUS_SLOT_NIC_2:
- return 'bus_slot_nic_2'
- if variable_name == cf.CFSP_DPDK_DPDK_DIRECTORY:
- return APEX_LAKE_ROOT
-
- def get_variable_list(self, section):
- if section == cf.CFS_PKTGEN:
- return [
- cf.CFSP_DPDK_NAME_IF_2,
- cf.CFSP_DPDK_NAME_IF_1,
- cf.CFSP_DPDK_BUS_SLOT_NIC_1,
- cf.CFSP_DPDK_BUS_SLOT_NIC_2,
- cf.CFSP_DPDK_COREMASK,
- cf.CFSP_DPDK_DPDK_DIRECTORY,
- cf.CFSP_DPDK_PKTGEN_DIRECTORY,
- cf.CFSP_DPDK_MEMORY_CHANNEL,
- cf.CFSP_DPDK_PROGRAM_NAME,
- cf.CFSP_PACKET_GENERATOR
- ]
- else:
- return [
- 'template_base_name',
- 'iterations',
- cf.CFSG_DEBUG
- ]
-
-
-class TestCommonInit(unittest.TestCase):
-
- def setUp(self):
- common.CONF_FILE = DummyConfigurationFile('')
- self.dir = os.path.join(APEX_LAKE_ROOT, 'experimental_framework/')
-
- def tearDown(self):
- reset_common()
- # common.CONF_FILE = None
-
- @mock.patch('os.getcwd')
- @mock.patch('experimental_framework.common.init_conf_file')
- @mock.patch('experimental_framework.common.init_general_vars')
- @mock.patch('experimental_framework.common.init_log')
- @mock.patch('experimental_framework.common.init_pktgen')
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_init_for_success(self, mock_conf_file, init_pkgen, init_log,
- init_general_vars, init_conf_file, mock_getcwd):
- mock_getcwd.return_value = self.dir
- common.init(True)
- if common.CONF_FILE.get_variable_list(cf.CFS_PKTGEN):
- init_pkgen.assert_called_once()
- init_conf_file.assert_called_once()
- init_general_vars.assert_called_once()
- init_log.assert_called_once()
- expected = self.dir.split('experimental_framework/')[0]
- self.assertEqual(common.BASE_DIR, expected)
-
- @mock.patch('experimental_framework.common.InputValidation')
- @mock.patch('os.path.exists')
- @mock.patch('os.makedirs')
- @mock.patch('experimental_framework.common.LOG')
- def test_init_general_vars_for_success(self, mock_log, mock_makedirs,
- mock_path_exists, mock_val_file):
- common.BASE_DIR = APEX_LAKE_ROOT
- mock_path_exists.return_value = False
- mock_val_file.return_value = True
- common.init_general_vars()
- self.assertEqual(common.TEMPLATE_FILE_EXTENSION, '.yaml')
- self.assertEqual(common.TEMPLATE_DIR, '/tmp/apexlake/heat_templates/')
- self.assertEqual(common.TEMPLATE_NAME, 'vTC.yaml')
- self.assertEqual(common.RESULT_DIR, '/tmp/apexlake/results/')
- self.assertEqual(common.ITERATIONS, 1)
- # mock_makedirs.assert_called_once_with('/tmp/apexlake/heat_templates/')
-
-
-class TestCommonInit2(unittest.TestCase):
-
- def setUp(self):
- common.CONF_FILE = DummyConfigurationFile2('')
- self.dir = os.path.join(APEX_LAKE_ROOT, 'experimental_framework')
-
- def tearDown(self):
- reset_common()
- common.CONF_FILE = None
-
- @mock.patch('experimental_framework.common.InputValidation')
- @mock.patch('os.path.exists')
- @mock.patch('os.makedirs')
- @mock.patch('experimental_framework.common.LOG')
- def test_init_general_vars_2_for_success(self, mock_log, mock_makedirs,
- mock_path_exists, mock_val_file):
- common.BASE_DIR = APEX_LAKE_ROOT
- common.init_general_vars()
- self.assertEqual(common.TEMPLATE_FILE_EXTENSION, '.yaml')
- self.assertEqual(common.TEMPLATE_DIR, '/tmp/apexlake/heat_templates/')
- self.assertEqual(common.TEMPLATE_NAME, 'vTC.yaml')
- self.assertEqual(common.RESULT_DIR, '/tmp/apexlake/results/')
- self.assertEqual(common.ITERATIONS, 2)
-
- def test_init_log_2_for_success(self):
- common.init_log()
- self.assertIsInstance(common.LOG, logging.RootLogger)
-
- def test_init_pktgen_for_success(self):
- common.init_pktgen()
- self.assertEqual(common.PKTGEN, 'dpdk_pktgen')
- directory = self.dir.split('experimental_framework')[0]
- self.assertEqual(common.PKTGEN_DIR, directory)
- self.assertEqual(common.PKTGEN_PROGRAM, 'program')
- self.assertEqual(common.PKTGEN_COREMASK, 'coremask')
- self.assertEqual(common.PKTGEN_MEMCHANNEL, 'memchannel')
- self.assertEqual(common.PKTGEN_BUS_SLOT_NIC_1, 'bus_slot_nic_1')
- self.assertEqual(common.PKTGEN_BUS_SLOT_NIC_2, 'bus_slot_nic_2')
- # we always add '/' to end of dirs for some reason
- # probably because we aren't using os.path.join everywhere
- expected_dir = APEX_LAKE_ROOT + '/'
- self.assertEqual(common.PKTGEN_DPDK_DIRECTORY, expected_dir)
-
- def test_init_pktgen_for_failure(self):
- common.CONF_FILE.get_variable('', cf.CFSP_PACKET_GENERATOR)
- self.assertRaises(ValueError, common.init_pktgen)
-
-
-class TestConfFileInitialization(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- reset_common()
-
- @mock.patch('experimental_framework.common.ConfigurationFile',
- side_effect=DummyConfigurationFile)
- def test_init_conf_file_for_success(self, conf_file):
- common.CONF_FILE = None
- common.init_conf_file(False)
- self.assertIsInstance(common.CONF_FILE,
- DummyConfigurationFile)
-
- common.CONF_FILE = None
- common.init_conf_file(True)
- self.assertIsInstance(common.CONF_FILE,
- DummyConfigurationFile)
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_init_log_for_success(self, mock_conf_file):
- mock_conf_file.get_variable_list.return_value = 'value'
- common.init_log()
- self.assertIsInstance(common.LOG, logging.RootLogger)
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_init_influxdb_for_success(self, mock_conf_file):
- mock_conf_file.get_variable.return_value = 'value'
- common.init_influxdb()
- self.assertEqual(common.INFLUXDB_IP, 'value')
- self.assertEqual(common.INFLUXDB_PORT, 'value')
- self.assertEqual(common.INFLUXDB_DB_NAME, 'value')
-
-
-class DummyConfigurationFile3(common.ConfigurationFile):
- counter = 0
-
- def __init__(self, sections, config_file='conf.cfg'):
- common.ConfigurationFile.__init__(self, sections, config_file)
-
- @staticmethod
- def _config_section_map(section, config_file, get_counter=None):
- if get_counter:
- return DummyConfigurationFile3.counter
- else:
- DummyConfigurationFile3.counter += 1
- return dict()
-
-
-class TestConfigFileClass(unittest.TestCase):
-
- def setUp(self):
- self.sections = [
- 'General',
- 'OpenStack',
- 'Experiment-VNF',
- 'PacketGen',
- 'Deployment-parameters',
- 'Testcase-parameters'
- ]
- c_file = os.path.join(APEX_LAKE_ROOT, 'tests/data/common/conf.cfg')
- common.BASE_DIR = APEX_LAKE_ROOT
- self.conf_file = common.ConfigurationFile(self.sections, c_file)
-
- def tearDown(self):
- reset_common()
- common.BASE_DIR = None
-
- @mock.patch('experimental_framework.common.ConfigurationFile.'
- '_config_section_map',
- side_effect=DummyConfigurationFile3._config_section_map)
- def test___init___for_success(self, mock_conf_map):
- sections = ['General', 'OpenStack', 'Experiment-VNF', 'PacketGen',
- 'Deployment-parameters', 'Testcase-parameters']
- c = DummyConfigurationFile3(
- sections, config_file=os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/conf.cfg'))
- self.assertEqual(
- DummyConfigurationFile3._config_section_map('', '', True),
- 6)
- for section in sections:
- self.assertEqual(getattr(c, section), dict())
-
- def test__config_section_map_for_success(self):
- general_section = 'General'
- # openstack_section = 'OpenStack'
- config_file = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/conf.cfg')
- config = six.moves.configparser.ConfigParser()
- config.read(config_file)
-
- expected = {
- 'benchmarks': 'b_marks',
- 'iterations': '1',
- 'template_base_name': 't_name'
- }
- output = common.\
- ConfigurationFile._config_section_map(general_section, config)
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.'
- 'ConfigurationFile.get_variable_list')
- def test_get_variable_for_success(self, mock_get_var_list):
- section = self.sections[0]
- variable_name = 'template_base_name'
- expected = 't_name'
- mock_get_var_list.return_value = [variable_name]
- output = self.conf_file.get_variable(section, variable_name)
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.'
- 'ConfigurationFile.get_variable_list')
- def test_get_variable_for_failure(self, mock_get_var_list):
- section = self.sections[0]
- variable_name = 'something_else'
- self.assertRaises(
- ValueError,
- self.conf_file.get_variable,
- section, variable_name
- )
-
- def test_get_variable_list_for_success(self):
- section = self.sections[0]
- expected = {
- 'benchmarks': 'b_marks',
- 'iterations': '1',
- 'template_base_name': 't_name'
- }
- output = self.conf_file.get_variable_list(section)
- self.assertEqual(expected, output)
-
- def test_get_variable_list_for_failure(self):
- section = 'something_else'
- self.assertRaises(
- ValueError,
- self.conf_file.get_variable_list,
- section)
-
-
-class DummyConfigurationFile4(common.ConfigurationFile):
-
- def get_variable(self, section, variable_name):
- if variable_name == 'vnic2_type':
- return '"value"'
- elif variable_name == cf.CFSG_BENCHMARKS:
- return "BenchmarkClass1, BenchmarkClass2"
- return '@string "value"'
-
- # def get_variable_list(self, section):
- # return list()
-
-
-class TestCommonMethods(unittest.TestCase):
-
- def setUp(self):
- self.sections = [
- 'General',
- 'OpenStack',
- 'Experiment-VNF',
- 'PacketGen',
- 'Deployment-parameters',
- 'Testcase-parameters'
- ]
- config_file = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/conf.cfg')
- common.BASE_DIR = APEX_LAKE_ROOT
- common.CONF_FILE = DummyConfigurationFile4(self.sections, config_file)
-
- def tearDown(self):
- reset_common()
- common.CONF_FILE = None
-
- def test_get_credentials_for_success(self):
- expected = {
- 'ip_controller': '@string "value"',
- 'project': '@string "value"',
- 'auth_uri': '@string "value"',
- 'user': '@string "value"',
- 'heat_url': '@string "value"',
- 'password': '@string "value"'
- }
- output = common.get_credentials()
- self.assertEqual(expected, output)
-
- def test_get_heat_template_params_for_success(self):
- expected = {
- 'param_1': '@string "value"',
- 'param_2': '@string "value"',
- 'param_3': '@string "value"',
- 'param_4': '@string "value"'
- }
- output = common.get_heat_template_params()
- self.assertEqual(expected, output)
-
- def test_get_testcase_params_for_success(self):
- expected = {'test_case_param': '@string "value"'}
- output = common.get_testcase_params()
- self.assertEqual(expected, output)
-
- def test_get_file_first_line_for_success(self):
- file = os.path.join(APEX_LAKE_ROOT, 'tests/data/common/conf.cfg')
- expected = '[General]\n'
- output = common.get_file_first_line(file)
- self.assertEqual(expected, output)
-
- def test_replace_in_file_for_success(self):
- filename = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/common/file_replacement.txt')
- text_to_search = 'replacement of'
- text_to_replace = '***'
- common.replace_in_file(filename, text_to_search, text_to_replace)
- after = open(filename, 'r').readline()
- self.assertEqual(after, 'Test for the *** strings into a file\n')
- text_to_search = '***'
- text_to_replace = 'replacement of'
- common.replace_in_file(filename, text_to_search, text_to_replace)
-
- @mock.patch('os.system')
- @mock.patch('experimental_framework.common.LOG')
- def test_run_command_for_success(self, mock_log, mock_os_system):
- command = 'command to be run'
- common.run_command(command)
- mock_os_system.assert_called_once_with(command)
-
- @mock.patch('experimental_framework.common.run_command')
- def test_push_data_influxdb_for_success(self, mock_run_cmd):
- data = 'string that describes the data'
- expected = "curl -i -XPOST 'http://None:None/write?db=None' " \
- "--data-binary string that describes the data"
- common.push_data_influxdb(data)
- mock_run_cmd.assert_called_once_with(expected)
-
- def test_get_base_dir_for_success(self):
- base_dir = common.BASE_DIR
- common.BASE_DIR = 'base_dir'
- expected = 'base_dir'
- output = common.get_base_dir()
- self.assertEqual(expected, output)
- common.BASE_DIR = base_dir
-
- def test_get_template_dir_for_success(self):
- template_dir = common.TEMPLATE_DIR
- common.TEMPLATE_DIR = 'base_dir'
- expected = 'base_dir'
- output = common.get_template_dir()
- self.assertEqual(expected, output)
- common.TEMPLATE_DIR = template_dir
-
- def test_get_dpdk_pktgen_vars_test(self):
- # Test 1
- common.PKTGEN = 'dpdk_pktgen'
- common.PKTGEN_DIR = 'var'
- common.PKTGEN_PROGRAM = 'var'
- common.PKTGEN_COREMASK = 'var'
- common.PKTGEN_MEMCHANNEL = 'var'
- common.PKTGEN_BUS_SLOT_NIC_1 = 'var'
- common.PKTGEN_BUS_SLOT_NIC_2 = 'var'
- common.PKTGEN_NAME_NIC_1 = 'var'
- common.PKTGEN_NAME_NIC_2 = 'var'
- common.PKTGEN_DPDK_DIRECTORY = 'var'
- expected = {
- 'bus_slot_nic_1': 'var',
- 'bus_slot_nic_2': 'var',
- 'name_if_1': 'var',
- 'name_if_2': 'var',
- 'coremask': 'var',
- 'dpdk_directory': 'var',
- 'memory_channels': 'var',
- 'pktgen_directory': 'var',
- 'program_name': 'var'
- }
- output = common.get_dpdk_pktgen_vars()
- self.assertEqual(expected, output)
-
- # Test 2
- common.PKTGEN = 'something_else'
- common.PKTGEN_DIR = 'var'
- common.PKTGEN_PROGRAM = 'var'
- common.PKTGEN_COREMASK = 'var'
- common.PKTGEN_MEMCHANNEL = 'var'
- common.PKTGEN_BUS_SLOT_NIC_1 = 'var'
- common.PKTGEN_BUS_SLOT_NIC_2 = 'var'
- common.PKTGEN_DPDK_DIRECTORY = 'var'
- expected = {}
- output = common.get_dpdk_pktgen_vars()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.LOG')
- def test_get_deployment_configuration_variables_for_success(self,
- mock_log):
- expected = {
- 'vcpu': ['value'],
- 'vnic1_type': ['value'],
- 'ram': ['value'],
- 'vnic2_type': ['value']
- }
- output = common.get_deployment_configuration_variables_from_conf_file()
- self.assertEqual(expected, output)
-
- def test_get_benchmarks_from_conf_file_for_success(self):
- expected = ['BenchmarkClass1', 'BenchmarkClass2']
- output = common.get_benchmarks_from_conf_file()
- self.assertEqual(expected, output)
-
-
-class TestinputValidation(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- reset_common()
-
- def test_validate_string_for_success(self):
- output = common.InputValidation.validate_string('string', '')
- self.assertTrue(output)
-
- def test_validate_string_for_failure(self):
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_string,
- list(), ''
- )
-
- def test_validate_int_for_success(self):
- output = common.InputValidation.validate_integer(1111, '')
- self.assertTrue(output)
-
- def test_validate_int_for_failure(self):
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_integer,
- list(), ''
- )
-
- def test_validate_dict_for_success(self):
- output = common.InputValidation.validate_dictionary(dict(), '')
- self.assertTrue(output)
-
- def test_validate_dict_for_failure(self):
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_dictionary,
- list(), ''
- )
-
- def test_validate_directory_exist_and_format_for_success(self):
- directory = os.path.join(APEX_LAKE_ROOT, 'tests/data/common/')
- output = common.InputValidation.\
- validate_directory_exist_and_format(directory, '')
- self.assertTrue(output)
-
- def test_validate_directory_exist_and_format_for_failure(self):
- directory = os.path.join(APEX_LAKE_ROOT, 'tests/data/com/')
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_directory_exist_and_format,
- directory, ''
- )
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_validate_configuration_file_parameter_for_success(self,
- mock_conf):
- mock_conf.get_variable_list.return_value = ['param']
- section = ''
- parameter = 'param'
- message = ''
- output = common.InputValidation.\
- validate_configuration_file_parameter(section, parameter, message)
- self.assertTrue(output)
-
- @mock.patch('experimental_framework.common.CONF_FILE')
- def test_validate_configuration_file_parameter_for_failure(
- self, mock_conf_file):
- section = ''
- parameter = 'something_else'
- message = ''
- mock_conf_file.get_variable_list.return_value(['parameter'])
- self.assertRaises(
- ValueError,
- common.InputValidation.
- validate_configuration_file_parameter,
- section, parameter, message
- )
-
- def test_validate_configuration_file_section_for_success(self):
- section = 'General'
- message = ''
- output = common.InputValidation.\
- validate_configuration_file_section(section, message)
- self.assertTrue(output)
-
- def test_validate_configuration_file_section_for_failure(self):
- section = 'Something-Else'
- message = ''
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_configuration_file_section,
- section, message
- )
-
- def test_validate_boolean_for_success(self):
- message = ''
- boolean = True
- output = common.InputValidation.validate_boolean(boolean, message)
- self.assertTrue(output)
-
- boolean = 'True'
- output = common.InputValidation.validate_boolean(boolean, message)
- self.assertTrue(output)
-
- boolean = 'False'
- output = common.InputValidation.validate_boolean(boolean, message)
- self.assertFalse(output)
-
- def test_validate_boolean_for_failure(self):
- message = ''
- boolean = 'string'
- self.assertRaises(
- ValueError,
- common.InputValidation.validate_boolean,
- boolean, message
- )
-
- def test_validate_os_credentials_for_failure(self):
- # Test 1
- credentials = list()
- self.assertRaises(ValueError,
- common.InputValidation.validate_os_credentials,
- credentials)
-
- # Test 2
- credentials = dict()
- credentials['ip_controller'] = ''
- credentials['heat_url'] = ''
- credentials['user'] = ''
- credentials['password'] = ''
- credentials['auth_uri'] = ''
- # credentials['project'] = ''
- self.assertRaises(ValueError,
- common.InputValidation.validate_os_credentials,
- credentials)
-
- def test_validate_os_credentials_for_success(self):
- credentials = dict()
- credentials['ip_controller'] = ''
- credentials['heat_url'] = ''
- credentials['user'] = ''
- credentials['password'] = ''
- credentials['auth_uri'] = ''
- credentials['project'] = ''
- self.assertTrue(
- common.InputValidation.validate_os_credentials(credentials))
diff --git a/yardstick/vTC/apexlake/tests/conf_file_sections_test.py b/yardstick/vTC/apexlake/tests/conf_file_sections_test.py
deleted file mode 100644
index abf4134a5..000000000
--- a/yardstick/vTC/apexlake/tests/conf_file_sections_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-from experimental_framework.constants import conf_file_sections as cfs
-
-__author__ = 'vmriccox'
-
-
-class TestConfFileSection(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def test_get_sections_api_for_success(self):
- expected = ['PacketGen', 'General', 'InfluxDB', 'OpenStack']
- output = cfs.get_sections_api()
- self.assertEqual(expected, output)
diff --git a/yardstick/vTC/apexlake/tests/data/common/conf.cfg b/yardstick/vTC/apexlake/tests/data/common/conf.cfg
deleted file mode 100644
index 9266647e8..000000000
--- a/yardstick/vTC/apexlake/tests/data/common/conf.cfg
+++ /dev/null
@@ -1,43 +0,0 @@
-[General]
-template_base_name = t_name
-benchmarks = b_marks
-iterations = 1
-
-[OpenStack]
-ip_controller =
-heat_url =
-user =
-password =
-auth_uri =
-project =
-
-
-[Experiment-VNF]
-VNIC1_TYPE = @string "normal" "direct" @costs '0', '1'
-VNIC2_TYPE = @string "normal", "direct" @costs '0', '1'
-VCPU = @numeric "4"
-RAM = @numeric "4096"
-
-
-[PacketGen]
-packet_generator = dpdk_pktgen
-pktgen_directory = pktgen_dir
-dpdk_directory = dpdk_dir
-program_name = app/app/x86_64-native-linuxapp-gcc/pktgen
-coremask = 1f
-memory_channels = 3
-bus_slot_nic_1 = 01:00.0
-name_if_1 = enp1s0f0
-bus_slot_nic_2 = 01:00.1
-name_if_2 = enp1s0f2
-
-
-[Deployment-parameters]
-param_1 = val_1
-param_2 = val_2
-param_3 = val_3
-param_4 = val_4
-
-
-[Testcase-parameters]
-test_case_param = 1280
diff --git a/yardstick/vTC/apexlake/tests/data/common/file_replacement.txt b/yardstick/vTC/apexlake/tests/data/common/file_replacement.txt
deleted file mode 100644
index 8122d9a91..000000000
--- a/yardstick/vTC/apexlake/tests/data/common/file_replacement.txt
+++ /dev/null
@@ -1 +0,0 @@
-Test for the replacement of strings into a file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp
deleted file mode 100644
index aa3959fc1..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait.tmp
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: #ram
- vcpus: #vcpus
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs: \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml
deleted file mode 100644
index 20fcb6718..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json
deleted file mode 100644
index 3af9a1cc7..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_1.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "normal", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml
deleted file mode 100644
index 493d81b7a..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json
deleted file mode 100644
index 9f246891d..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/VTC_base_single_vm_wait_2.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "direct", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml
deleted file mode 100644
index 5788980b0..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json
deleted file mode 100644
index 44a8aeb2e..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_1.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"ram": "1024", "vcpus": "2", "vnic_type": "normal"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml
deleted file mode 100644
index 44a81d081..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json b/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json
deleted file mode 100644
index 0a66448b7..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/experiment_2.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"ram": "1024", "vcpus": "2", "vnic_type": "direct"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml b/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml
deleted file mode 100644
index 39dc095c1..000000000
--- a/yardstick/vTC/apexlake/tests/data/generated_templates/vTC.yaml
+++ /dev/null
@@ -1,207 +0,0 @@
-##############################################################################
-# Copyright (c) 2016-2017 Intel Corporation
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: #ram
- vcpus: #vcpus
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs: \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv b/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv
deleted file mode 100644
index f5f2932d0..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/benchmark_1.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-conf_1;conf_3;conf_2;point_4;point_5;point_6;point_1;point_2;point_3
-conf_value_1;conf_value_3;conf_value_2;?;?;?;value_1;value_2;value_3
-conf_value_1;conf_value_3;conf_value_2;value_4;value_5;value_6;?;?;?
diff --git a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json b/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json
deleted file mode 100644
index ff4cebf41..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_experiments/experiment_1/metadata.json
+++ /dev/null
@@ -1 +0,0 @@
-{"location": "tests/data/experiments/experiment_1/metadata.json", "item_2": "value_2", "item_3": "value_3", "item_1": "value_1"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv b/yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv
deleted file mode 100644
index 4662dd2be..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_experiments/results_benchmark_1.csv
+++ /dev/null
@@ -1,5 +0,0 @@
-conf_5;conf_4;conf_6;conf_1;conf_3;conf_2;point_12;point_10;point_11;point_4;point_5;point_6;point_8;point_9;point_7;point_1;point_2;point_3
-?;?;?;conf_value_1;conf_value_3;conf_value_2;?;?;?;?;?;?;?;?;?;value_1;value_2;value_3
-?;?;?;conf_value_1;conf_value_3;conf_value_2;?;?;?;value_4;value_5;value_6;?;?;?;?;?;?
-conf_value_5;conf_value_4;conf_value_6;?;?;?;?;?;?;?;?;?;value_8;value_9;value_7;?;?;?
-conf_value_5;conf_value_4;conf_value_6;?;?;?;value_12;value_10;value_11;?;?;?;?;?;?;?;?;?
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp
deleted file mode 100644
index aa3959fc1..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait.tmp
+++ /dev/null
@@ -1,199 +0,0 @@
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: #vnic_type
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: #ram
- vcpus: #vcpus
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs: \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml
deleted file mode 100644
index 20fcb6718..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json
deleted file mode 100644
index 3af9a1cc7..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_1.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "normal", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml
deleted file mode 100644
index 493d81b7a..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml
+++ /dev/null
@@ -1,212 +0,0 @@
-# Copyright (c) 2016-2017 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.
-heat_template_version: 2014-10-16
-description: HOT template to create a DPI
-
-parameters:
- default_net:
- type: string
- default_subnet:
- type: string
- source_net:
- type: string
- source_subnet:
- type: string
- destination_net:
- type: string
- destination_subnet:
- type: string
- internal_net:
- type: string
- internal_subnet:
- type: string
- node:
- type: string
- default: compB
- name:
- type: string
- default: vtc
- ip_family:
- type: string
- timeout:
- type: number
- description: Timeout for WaitCondition, depends on your image and environment
- default: 1000
-
-resources:
- wait_condition:
- type: OS::Heat::WaitCondition
- properties:
- handle: {get_resource: wait_handle}
- count: 1
- timeout: {get_param: timeout}
-
- wait_handle:
- type: OS::Heat::WaitConditionHandle
-
-
- ### DEFAULT NETWORK FOR MERLIN DATA
- port_1:
- type: OS::Neutron::Port
- properties:
- network: { get_param: default_net }
- binding:vnic_type: normal
- fixed_ips:
- - subnet: { get_param: default_subnet }
-
- ### NETWORK FOR RECEIVING TRAFFIC
- port_2:
- type: OS::Neutron::Port
- properties:
- network: { get_param: source_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: source_subnet }
-
- ### NETWORK FOR SENDING TRAFFIC
- port_3:
- type: OS::Neutron::Port
- properties:
- network: { get_param: destination_net }
- binding:vnic_type: direct
- fixed_ips:
- - subnet: { get_param: destination_subnet }
-
- flavor:
- type: OS::Nova::Flavor
- properties:
- disk: 20
- ram: 1024
- vcpus: 2
- #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
- extra_specs: { node: { get_param: node } }
-
- server:
- type: OS::Nova::Server
- properties:
- name: vTC
- key_name: test
- image: ubuntu1404
- user_data:
- str_replace:
- template: |
- #!/bin/sh
-
- # Creation of a user
- NAME=$name
- echo "Creating custom user..."
- useradd clouduser -g admin -s /bin/bash -m
- echo clouduser:secrete | chpasswd
- echo "Enabling ssh password login..."
- sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
- service ssh restart
- sleep 1
-
- # wake up interfaces
- ifconfig eth1 up
- ifconfig eth2 up
- dhclient eth1
- dhclient eth2
-
- sed -i 's/localhost/localhost vtc/g' /etc/hosts
- ip route del 0/0
- route add default gw 192.168.200.1
-
- AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
- BB=$(echo $AA | awk '{ print $1 }')
-
- # Setup Instrumentation Agent
- rm -rf cimmaron
- mkdir cimmaron
- cd cimmaron
- apt-get install -y zip
- wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
- unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
- ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
- ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
- nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
- cd ..
-
- # Setup for PF_RING and bridge between interfaces
- apt-get update
- apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
-
- # Setup multicast
- echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
- cd /home/clouduser/
- git clone https://github.com/troglobit/smcroute.git
- cd smcroute
- sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
- sed -i 's/automake-1.11/automake/g' ./autogen.sh
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- touch multicast.sh
- echo "#!/bin/bash" > multicast.sh
- echo "while [ true ]" >> multicast.sh
- echo "do" >> multicast.sh
- echo " smcroute -k" >> multicast.sh
- echo " smcroute -d" >> multicast.sh
- echo " sleep 50" >> multicast.sh
- echo "done" >> multicast.sh
- chmod +x multicast.sh
- ./multicast.sh &
-
- # Setup for PF_RING and bridge between interfaces
- # Akis Repository
- #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
- #cd vtc
- #git checkout stable
-
- # Intel Repository
- git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
- cd vtc_master
-
- cd nDPI
- NDPI_DIR=$(pwd)
- echo $NDPI_DIR
- NDPI_INCLUDE=$(pwd)/src/include
- echo $NDPI_INCLUDE
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- cd PF_RING
- make
- cd userland/examples/
- sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
- sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
- make
- cd ../..
- cd ..
- cd ..
- #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
- ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
- wc_notify --data-binary '{"status": "SUCCESS"}'
- params:
- wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
- $name: { get_param: name }
- $IP_FAMILY: { get_param: ip_family }
-
- flavor: { get_resource: flavor }
- networks:
- - port: { get_resource: port_1 }
- - port: { get_resource: port_2 }
- - port: { get_resource: port_3 }
-outputs:
diff --git a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json b/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json
deleted file mode 100644
index 9f246891d..000000000
--- a/yardstick/vTC/apexlake/tests/data/test_templates/VTC_base_single_vm_wait_2.yaml.json
+++ /dev/null
@@ -1 +0,0 @@
-{"vnic_type": "direct", "ram": "1024", "vcpus": "2"} \ No newline at end of file
diff --git a/yardstick/vTC/apexlake/tests/deployment_unit_test.py b/yardstick/vTC/apexlake/tests/deployment_unit_test.py
deleted file mode 100644
index 1ff4225d6..000000000
--- a/yardstick/vTC/apexlake/tests/deployment_unit_test.py
+++ /dev/null
@@ -1,279 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import logging
-import mock
-import experimental_framework.deployment_unit as mut
-import experimental_framework.common as common
-
-__author__ = 'vmriccox'
-
-
-class DummyHeatManager:
-
- def __init__(self, param):
- self.counts = 0
- pass
-
- def validate_heat_template(self, template_file):
- return True
-
- def check_stack_status(self, stack_name):
- # return 'CREATE_COMPLETE'
- self.counts += 1
- if self.counts >= 3:
- return 'CREATE_COMPLETE'
- else:
- return 'CREATE_IN_PROGRESS'
-
- def delete_stack(self, stack_name):
- pass
-
-
-class DummyHeatManagerFailed(DummyHeatManager):
-
- def check_stack_status(self, stack_name):
- return 'CREATE_FAILED'
-
- def create_stack(self, template_file, stack_name, parameters):
- pass
-
-
-class DummyHeatManagerComplete(DummyHeatManager):
-
- def check_stack_status(self, stack_name):
- return 'CREATE_COMPLETE'
-
- def create_stack(self, template_file, stack_name, parameters):
- raise Exception()
-
-
-class DummyHeatManagerFailedException(DummyHeatManagerFailed):
-
- def create_stack(self, template_file, stack_name, parameters):
- raise Exception
-
- def check_stack_status(self, stack_name):
- return ''
-
-
-class DummyHeatManagerDestroy:
-
- def __init__(self, credentials):
- self.delete_stack_counter = 0
- self.check_stack_status_counter = 0
-
- def check_stack_status(self, stack_name):
- if self.check_stack_status_counter < 2:
- self.check_stack_status_counter += 1
- return 'DELETE_IN_PROGRESS'
- else:
- return 'DELETE_COMPLETE'
-
- def create_stack(self, template_file, stack_name, parameters):
- pass
-
- def delete_stack(self, stack_name=None):
- if stack_name == 'stack':
- self.delete_stack_counter += 1
- else:
- return self.delete_stack_counter
-
- def is_stack_deployed(self, stack_name):
- return True
-
-
-class DummyHeatManagerDestroyException(DummyHeatManagerDestroy):
-
- def delete_stack(self, stack_name=None):
- raise Exception
-
-
-class DummyHeatManagerReiteration:
-
- def __init__(self, param):
- self.counts = 0
-
- def validate_heat_template(self, template_file):
- return True
-
- def check_stack_status(self, stack_name):
- return 'CREATE_FAILED'
-
- def delete_stack(self, stack_name):
- pass
-
- def create_stack(self, template_file=None, stack_name=None,
- parameters=None):
- if template_file == 'template_reiteration' and \
- stack_name == 'stack_reiteration' and \
- parameters == 'parameters_reiteration':
- self.counts += 1
-
-
-class DummyDeploymentUnit(mut.DeploymentUnit):
-
- def destroy_heat_template(self, stack_name):
- raise Exception
-
-
-@mock.patch("experimental_framework.deployment_unit.time")
-class TestDeploymentUnit(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManager)
- def test_constructor_for_sanity(self, mock_heat_manager, mock_time):
- du = mut.DeploymentUnit(dict())
- self.assertTrue(isinstance(du.heat_manager, DummyHeatManager))
- mock_heat_manager.assert_called_once_with(dict())
- self.assertEqual(du.deployed_stacks, list())
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManager)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_failure(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = False
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- self.assertRaises(ValueError, du.deploy_heat_template, template_file,
- stack_name, parameters, 0)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManager)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_success(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- common.LOG = logging.getLogger()
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, True)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerComplete)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_2_for_success(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- common.LOG = logging.getLogger()
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, True)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerComplete)
- @mock.patch('os.path.isfile')
- @mock.patch('experimental_framework.deployment_unit.DeploymentUnit',
- side_effect=DummyDeploymentUnit)
- def test_deploy_heat_template_3_for_success(self, mock_dep_unit,
- mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- common.LOG = logging.getLogger()
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, True)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerFailed)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_success_2(self, mock_os_is_file,
- mock_heat_manager, mock_log, mock_time):
- mock_os_is_file.return_value = True
- du = DummyDeploymentUnit(dict())
- template_file = ''
- stack_name = ''
- parameters = ''
- output = du.deploy_heat_template(template_file, stack_name,
- parameters, 0)
- self.assertEqual(output, False)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerDestroy)
- @mock.patch('experimental_framework.common.LOG')
- def test_destroy_heat_template_for_success(self, mock_log,
- mock_heat_manager, mock_time):
- openstack_credentials = dict()
- du = mut.DeploymentUnit(openstack_credentials)
- du.deployed_stacks = ['stack']
- stack_name = 'stack'
- self.assertTrue(du.destroy_heat_template(stack_name))
- self.assertEqual(du.heat_manager.delete_stack(None), 1)
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerDestroyException)
- @mock.patch('experimental_framework.common.LOG')
- def test_destroy_heat_template_for_success_2(self, mock_log,
- mock_heat_manager, mock_time):
- openstack_credentials = dict()
- du = mut.DeploymentUnit(openstack_credentials)
- du.deployed_stacks = ['stack']
- stack_name = 'stack'
- self.assertFalse(du.destroy_heat_template(stack_name))
-
- def test_destroy_all_deployed_stacks_for_success(self, mock_time):
- du = DeploymentUnitDestroy()
- du.destroy_all_deployed_stacks()
- self.assertTrue(du.destroy_heat_template())
-
- @mock.patch('experimental_framework.heat_manager.HeatManager',
- side_effect=DummyHeatManagerReiteration)
- @mock.patch('os.path.isfile')
- def test_deploy_heat_template_for_success_3(self, mock_os_is_file,
- mock_heat_manager, mock_time):
- mock_os_is_file.return_value = True
- du = mut.DeploymentUnit(dict())
- template = 'template_reiteration'
- stack = 'stack_reiteration'
- parameters = 'parameters_reiteration'
- output = du.deploy_heat_template(template, stack, parameters, 0)
- self.assertFalse(output)
- self.assertEqual(du.heat_manager.counts, 4)
-
-
-class DeploymentUnitDestroy(mut.DeploymentUnit):
-
- def __init__(self):
- self.deployed_stacks = ['stack']
- self.heat_manager = DummyHeatManagerDestroy(dict())
- self.destroy_all_deployed_stacks_called_correctly = False
-
- def destroy_heat_template(self, template_name=None):
- if template_name == 'stack':
- self.destroy_all_deployed_stacks_called_correctly = True
- return self.destroy_all_deployed_stacks_called_correctly
diff --git a/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py b/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py
deleted file mode 100644
index 9fa860ab4..000000000
--- a/yardstick/vTC/apexlake/tests/dpdk_packet_generator_test.py
+++ /dev/null
@@ -1,710 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import mock
-from experimental_framework.constants import conf_file_sections as conf_file
-
-
-from experimental_framework.packet_generators \
- import dpdk_packet_generator as mut
-
-
-def dummy_get_dpdk_pktgen_vars():
- vars = dict()
- vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_dir/'
- vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program'
- vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memchannel'
- return vars
-
-
-def dummy_get_base_dir():
- return 'base_dir/'
-
-
-def dummy_dirname(dir):
- if dir == 'pktgen_dir_test':
- return 'pktgen_dir'
- return 'test_directory'
-
-
-class MockChangeVlan():
-
- ret_val = [False, False]
-
- @staticmethod
- def mock_change_vlan(pcap_dir=None, pcap_file=None, vlan=None):
- if not pcap_file and not vlan:
- return MockChangeVlan.ret_val
-
- if pcap_dir == 'base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/' and \
- pcap_file == 'pcap_file_1' and vlan == 'vlan0':
- MockChangeVlan.ret_val[0] = True
- if pcap_dir == 'base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/' and \
- pcap_file == 'pcap_file_2' and vlan == 'vlan1':
- MockChangeVlan.ret_val[1] = True
- return False
-
-
-class TestDpdkPacketGenConstructor(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test_constructor(self):
- obj = mut.DpdkPacketGenerator()
- self.assertEqual(obj.command, '')
- self.assertEqual(obj.directory, '')
- self.assertEqual(obj.dpdk_interfaces, -1)
-
-
-class TestDpdkPacketGenInitialization(unittest.TestCase):
-
- def setUp(self):
- self.mut = mut.DpdkPacketGenerator()
- pass
-
- def tearDown(self):
- pass
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._change_vlan')
- def test_init_dpdk_pktgen_for_success(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_path):
- """
- Tests the initialization of the packet generator
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- mock_path.isfile.return_value = True
- 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 ' \
- '-s 0:base_dir/experimental_framework/packet_generators' \
- '/pcap_files/pcap_file > /dev/null'
- self.mut.init_dpdk_pktgen(dpdk_interfaces=1, lua_script='lua_file',
- pcap_file_0='pcap_file', vlan_0='vlan0')
- self.assertEqual(expected, self.mut.command)
- m_change_vlan.assert_called_once_with('base_dir/'
- 'experimental_framework/'
- 'packet_generators/pcap_files/',
- 'pcap_file', 'vlan0')
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_change_vlan', side_effect=MockChangeVlan.mock_change_vlan)
- def test_init_dpdk_pktgen_2_for_success(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars, mock_path):
- """
- Tests the initialization of the packet generator
- :param common_get_base_dir: mock obj
- :param common_get_dpdk_vars: mock obj
- :param mock_path: mock obj
- :return: None
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- mock_path.isfile.return_value = True
- 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 ' \
- '-s 0:base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/pcap_file_1 ' \
- '-s 1:base_dir/experimental_framework/packet_generators/' \
- 'pcap_files/pcap_file_2 ' \
- '> /dev/null'
- self.mut.init_dpdk_pktgen(dpdk_interfaces=1, lua_script='lua_file',
- pcap_file_0='pcap_file_1',
- pcap_file_1='pcap_file_2', vlan_0='vlan0',
- vlan_1='vlan1')
- self.assertEqual(expected, self.mut.command)
- self.assertEqual(MockChangeVlan.mock_change_vlan(), [True, True])
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._change_vlan')
- def test_init_dpdk_pktgen_for_failure(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_path):
- """
- Tests the initialization of the packet generator
- :param common_get_base_dir: mock obj
- :param common_get_dpdk_vars: mock obj
- :param mock_path: mock obj
- :return: None
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- self.assertRaises(ValueError, self.mut.init_dpdk_pktgen, 1,
- 'lua_file', 'pcap_file')
-
- @mock.patch('os.path')
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_input_validation')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_change_vlan')
- def test_init_dpdk_pktgen_for_failure_2(self, m_change_vlan,
- mock_init_input_validation,
- mock_get_core_nics,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_path):
- """
- Tests the initialization of the packet generator
- :param common_get_base_dir: mock obj
- :param common_get_dpdk_vars: mock obj
- :param mock_path: mock obj
- :return: None
- """
- mock_init_input_validation.return_value = None
- mock_get_core_nics.return_value = "{corenics}"
- self.assertRaises(ValueError, self.mut.init_dpdk_pktgen, 2,
- 'lua_file_1', 'pcap_file_1', 'pcap_file_2',
- 'vlan_0')
-
-
-class DpdkPacketGeneratorDummy(mut.DpdkPacketGenerator):
-
- def __init__(self):
- self.directory = 'self_directory'
- self.dpdk_interfaces = 1
- self.command = 'command'
- self._count = 0
-
- chdir_test = [False, False]
-
- @staticmethod
- def _chdir(directory=None):
- if not directory:
- return DpdkPacketGeneratorDummy.chdir_test
- if directory == 'current_directory':
- DpdkPacketGeneratorDummy.chdir_test[0] = True
- # self._count += 1
- if directory == 'self_directory':
- DpdkPacketGeneratorDummy.chdir_test[1] = True
- # self._count += 1
- return DpdkPacketGeneratorDummy.chdir_test
-
-
-class TestDpdkPacketGenSendTraffic(unittest.TestCase):
-
- def setUp(self):
- self.mut = DpdkPacketGeneratorDummy()
-
- @mock.patch('os.system')
- @mock.patch('os.path')
- @mock.patch('os.path.dirname', side_effect=dummy_dirname)
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars',
- side_effect=dummy_get_dpdk_pktgen_vars)
- @mock.patch('experimental_framework.common.get_base_dir',
- side_effect=dummy_get_base_dir)
- @mock.patch('experimental_framework.common.run_command')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._get_core_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_init_physical_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_finalize_physical_nics')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator._chdir',
- side_effect=DpdkPacketGeneratorDummy._chdir)
- def test_send_traffic_for_success(self, mock_ch_dir,
- mock_finalize_physical_nics,
- mock_init_physical_nics,
- mock_get_core_nics,
- common_run_command,
- common_get_base_dir,
- common_get_dpdk_vars,
- mock_dir_name,
- mock_os_path,
- mock_os_system):
- """
- Calls the packet generator and starts to send traffic
- Blocking call
- """
- mock_get_core_nics.return_value = "{corenics}"
- mock_os_path.realpath.return_value = 'pktgen_dir_test'
- mock_os_path.dirname.return_value = 'current_directory'
- self.mut.send_traffic()
-
- self.assertEqual(DpdkPacketGeneratorDummy._chdir(), [True, True])
- mock_init_physical_nics.\
- assert_called_once_with(1, {'coremask': 'coremask',
- 'program_name': 'program',
- 'memory_channels': 'memchannel',
- 'pktgen_directory': 'pktgen_dir/'})
- mock_finalize_physical_nics.\
- assert_called_once_with(1, {'coremask': 'coremask',
- 'program_name': 'program',
- 'memory_channels': 'memchannel',
- 'pktgen_directory': 'pktgen_dir/'})
- common_run_command.assert_called_once_with('command')
-
-
-class MockRunCommand:
-
- ret_val = [False, False, False, False, False, False]
- ret_val_finalization = [False, False, False, False, False, False]
-
- @staticmethod
- def mock_run_command(command=None):
- if command == 'sudo ifconfig interface_1 down':
- MockRunCommand.ret_val[0] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.0':
- MockRunCommand.ret_val[1] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=igb_uio 1:00.0':
- MockRunCommand.ret_val[2] = True
- if command == 'sudo ifconfig interface_2 down':
- MockRunCommand.ret_val[3] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.1':
- MockRunCommand.ret_val[4] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=igb_uio 1:00.1':
- MockRunCommand.ret_val[5] = True
- else:
- return MockRunCommand.ret_val
-
- @staticmethod
- def mock_run_command_finalization(command=None):
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.0':
- MockRunCommand.ret_val_finalization[0] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=ixgbe 1:00.0':
- MockRunCommand.ret_val_finalization[1] = True
- if command == 'sudo ifconfig interface_1 up':
- MockRunCommand.ret_val_finalization[2] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--unbind 1:00.1':
- MockRunCommand.ret_val_finalization[3] = True
- if command == 'sudo dpdk_directory/tools/dpdk_nic_bind.py ' \
- '--bind=ixgbe 1:00.1':
- MockRunCommand.ret_val_finalization[4] = True
- if command == 'sudo ifconfig interface_2 up':
- MockRunCommand.ret_val_finalization[5] = True
- else:
- return MockRunCommand.ret_val_finalization
-
-
-@mock.patch('experimental_framework.packet_generators.dpdk_packet_generator.time')
-class TestDpdkPacketGenOthers(unittest.TestCase):
-
- def setUp(self):
- self.mut = mut.DpdkPacketGenerator()
-
- def tearDown(self):
- pass
-
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_cores_configuration')
- def test__get_core_nics_for_failure(self, mock_cores_configuration, mock_time):
- mock_cores_configuration.return_value = None
- self.assertRaises(ValueError, mut.DpdkPacketGenerator._get_core_nics,
- '', '')
-
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_cores_configuration')
- def test__get_core_nics_one_nic_for_success(self,
- mock_cores_configuration, mock_time):
- mock_cores_configuration.return_value = 'ret_val'
- expected = 'ret_val'
- output = mut.DpdkPacketGenerator._get_core_nics(1, 'coremask')
- self.assertEqual(expected, output)
- mock_cores_configuration.assert_called_once_with('coremask', 1, 2, 0)
-
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator.'
- '_cores_configuration')
- def test__get_core_nics_two_nics_for_success(self,
- mock_cores_configuration, mock_time):
- mock_cores_configuration.return_value = 'ret_val'
- expected = 'ret_val'
- output = mut.DpdkPacketGenerator._get_core_nics(2, 'coremask')
- self.assertEqual(expected, output)
- mock_cores_configuration.assert_called_once_with('coremask', 1, 2, 2)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_success(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- pcap_directory = 'pcap_directory'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertEqual(mut.DpdkPacketGenerator._init_input_validation(
- pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory,
- variables), None)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- pcap_directory = 'pcap_directory'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- # variables[common.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_2(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = None
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_3(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = 'directory'
- pcap_file_0 = None
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_4(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = None
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile')
- def test__init_input_validation_for_failure_5(self, mock_is_file, mock_time):
- mock_is_file.return_value = True
-
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = None
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile', side_effect=[False])
- def test__init_input_validation_for_failure_6(self, mock_is_file, mock_time):
- # mock_is_file.return_value = False
-
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile', side_effect=[True, False])
- def test__init_input_validation_for_failure_7(self, mock_is_file, mock_time):
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.path.isfile', side_effect=[True, True, False])
- def test__init_input_validation_for_failure_8(self, mock_is_file, mock_time):
- pcap_directory = 'directory'
- pcap_file_0 = 'pcap_file_0'
- pcap_file_1 = 'pcap_file_1'
- lua_script = 'lua_script'
- lua_directory = 'lua_directory'
-
- variables = dict()
- variables[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'directory'
- variables[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- variables[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- variables[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
-
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator.
- _init_input_validation, pcap_file_0, pcap_file_1,
- lua_script, pcap_directory, lua_directory, variables)
-
- @mock.patch('os.chdir')
- def test__chdir_for_success(self, mock_os_chdir, mock_time):
- mut.DpdkPacketGenerator._chdir('directory')
- mock_os_chdir.assert_called_once_with('directory')
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command)
- def test__init_physical_nics_for_success(self, mock_run_command, mock_time):
- dpdk_interfaces = 1
- dpdk_vars = dict()
-
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._init_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command(),
- [True, True, True, False, False, False])
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command)
- def test__init_physical_nics_for_success_2(self, mock_run_command, mock_time):
- dpdk_interfaces = 2
- dpdk_vars = dict()
-
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._init_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command(),
- [True, True, True, True, True, True])
-
- @mock.patch('experimental_framework.common.run_command')
- def test__init_physical_nics_for_failure(self, mock_run_command, mock_time):
- dpdk_interfaces = 3
- dpdk_vars = dict()
- self.assertRaises(ValueError, self.mut._init_physical_nics,
- dpdk_interfaces, dpdk_vars)
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command_finalization)
- def test__finalize_physical_nics_for_success(self, mock_run_command, mock_time):
- dpdk_interfaces = 1
- dpdk_vars = dict()
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._finalize_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command_finalization(),
- [True, True, True, False, False, False])
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=MockRunCommand.mock_run_command_finalization)
- def test__finalize_physical_nics_for_success_2(self, mock_run_command, mock_time):
- dpdk_interfaces = 2
- dpdk_vars = dict()
- dpdk_vars[conf_file.CFSP_DPDK_DPDK_DIRECTORY] = 'dpdk_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PKTGEN_DIRECTORY] = 'pktgen_directory/'
- dpdk_vars[conf_file.CFSP_DPDK_PROGRAM_NAME] = 'program_name'
- dpdk_vars[conf_file.CFSP_DPDK_COREMASK] = 'coremask'
- dpdk_vars[conf_file.CFSP_DPDK_MEMORY_CHANNEL] = 'memory_channels'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_1] = '1:00.0'
- dpdk_vars[conf_file.CFSP_DPDK_BUS_SLOT_NIC_2] = '1:00.1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_1] = 'interface_1'
- dpdk_vars[conf_file.CFSP_DPDK_NAME_IF_2] = 'interface_2'
- self.mut._finalize_physical_nics(dpdk_interfaces, dpdk_vars)
- self.assertEqual(MockRunCommand.mock_run_command_finalization(),
- [True, True, True, True, True, True])
-
- def test__finalize_physical_nics_for_failure(self, mock_time):
- dpdk_interfaces = 0
- dpdk_vars = dict()
- self.assertRaises(ValueError, self.mut._finalize_physical_nics,
- dpdk_interfaces, dpdk_vars)
-
- def test__cores_configuration_for_success(self, mock_time):
- coremask = '1f'
- expected = '[2:1].0,[4:3].1'
- output = mut.DpdkPacketGenerator._cores_configuration(coremask,
- 1, 2, 2)
- self.assertEqual(expected, output)
-
- def test__cores_configuration_for_success_2(self, mock_time):
- coremask = '1f'
- expected = '2.0,[4:3].1'
- output = mut.DpdkPacketGenerator._cores_configuration(coremask,
- 1, 1, 2)
- self.assertEqual(expected, output)
-
- def test__cores_configuration_for_success_3(self, mock_time):
- coremask = '1f'
- expected = '[3:2].0,4.1'
- output = mut.DpdkPacketGenerator._cores_configuration(coremask,
- 1, 2, 1)
- self.assertEqual(expected, output)
-
- def test__cores_configuration_for_failure(self, mock_time):
- coremask = '1'
- self.assertRaises(ValueError,
- mut.DpdkPacketGenerator._cores_configuration,
- coremask, 1, 2, 2)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.common.run_command')
- def test__change_vlan_for_success(self, mock_run_command, mock_log, mock_time):
- mut.DpdkPacketGenerator._change_vlan('/directory/', 'pcap_file', '10')
- expected_param = '/directory/vlan_tag.sh /directory/pcap_file 10'
- mock_run_command.assert_called_with(expected_param)
diff --git a/yardstick/vTC/apexlake/tests/generates_template_test.py b/yardstick/vTC/apexlake/tests/generates_template_test.py
deleted file mode 100644
index cc3e1bf6e..000000000
--- a/yardstick/vTC/apexlake/tests/generates_template_test.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import experimental_framework.heat_template_generation as heat_gen
-import mock
-import os
-import experimental_framework.common as common
-from experimental_framework import APEX_LAKE_ROOT
-
-__author__ = 'gpetralx'
-
-
-def reset_common():
- common.LOG = None
- common.CONF_FILE = None
- common.DEPLOYMENT_UNIT = None
- common.ITERATIONS = None
- common.BASE_DIR = None
- common.RESULT_DIR = None
- common.TEMPLATE_DIR = None
- common.TEMPLATE_NAME = None
- common.TEMPLATE_FILE_EXTENSION = None
- common.PKTGEN = None
- common.PKTGEN_DIR = None
- common.PKTGEN_DPDK_DIRECTORY = None
- common.PKTGEN_PROGRAM = None
- common.PKTGEN_COREMASK = None
- common.PKTGEN_MEMCHANNEL = None
- common.PKTGEN_BUS_SLOT_NIC_1 = None
- common.PKTGEN_BUS_SLOT_NIC_2 = None
- common.INFLUXDB_IP = None
- common.INFLUXDB_PORT = None
- common.INFLUXDB_DB_NAME = None
-
-
-class TestGeneratesTemplate(unittest.TestCase):
-
- def setUp(self):
- self.deployment_configuration = {
- 'vnic_type': ['normal', 'direct'],
- 'ram': ['1024'],
- 'vcpus': ['2']
- }
- self.template_name = 'VTC_base_single_vm_wait.tmp'
- # common.init()
-
- def tearDown(self):
- reset_common()
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.common.get_template_dir')
- def test_generates_template_for_success(self, mock_template_dir,
- mock_log):
- generated_templates_dir = os.path.join(
- APEX_LAKE_ROOT, 'tests/data/generated_templates/')
- mock_template_dir.return_value = generated_templates_dir
- test_templates = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/test_templates/')
- heat_gen.generates_templates(self.template_name,
- self.deployment_configuration)
- for dirname, dirnames, filenames in os.walk(test_templates):
- for filename in filenames:
- with open(test_templates + filename) as test:
- with open(generated_templates_dir + filename) as generated:
- self.assertListEqual(test.readlines(),
- generated.readlines())
-
- self.template_name = os.path.join(
- APEX_LAKE_ROOT,
- 'tests/data/generated_templates/VTC_base_single_vm_wait.tmp')
- heat_gen.generates_templates(self.template_name,
- self.deployment_configuration)
- for dirname, dirnames, filenames in os.walk(test_templates):
- for filename in filenames:
- with open(test_templates + filename) as test:
- with open(generated_templates_dir + filename) as generated:
- self.assertListEqual(test.readlines(),
- generated.readlines())
-
- @mock.patch('experimental_framework.common.get_template_dir')
- def test_get_all_heat_templates_for_success(self, template_dir):
- generated_templates = os.path.join(APEX_LAKE_ROOT,
- 'tests/data/generated_templates/')
- template_dir.return_value = generated_templates
- extension = '.yaml'
- expected = ['experiment_1.yaml', 'experiment_2.yaml']
- result = heat_gen.get_all_heat_templates(generated_templates,
- extension)
- self.assertListEqual(expected, result)
diff --git a/yardstick/vTC/apexlake/tests/heat_manager_test.py b/yardstick/vTC/apexlake/tests/heat_manager_test.py
deleted file mode 100644
index 58bd75560..000000000
--- a/yardstick/vTC/apexlake/tests/heat_manager_test.py
+++ /dev/null
@@ -1,235 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import print_function
-
-from __future__ import absolute_import
-import os
-import unittest
-import logging
-import experimental_framework.common as common
-
-from experimental_framework import heat_manager, APEX_LAKE_ROOT
-import mock
-
-__author__ = 'gpetralx'
-
-
-def get_mock_heat(version, *args, **kwargs):
- return MockHeat()
-
-
-class MockStacks(object):
-
- def __init__(self, stacks):
- self.stacks = stacks
-
- def list(self):
- list_name = list()
- for stack in self.stacks:
- list_name.append(stack.stack_name)
- print(list_name)
- return self.stacks
-
- def validate(self, template=None):
- return False
-
- def delete(self, id):
- for stack in self.stacks:
- if stack.id == id:
- return self.stacks.remove(stack)
-
- def create(self, stack_name=None, files=None, template=None,
- parameters=None):
- print(stack_name)
- self.stacks.append(MockStack(stack_name))
-
-
-class MockStacks_2(object):
-
- def __init__(self, stacks):
- self.stacks = stacks
-
- def list(self):
- raise Exception
-
-
-class MockStack(object):
-
- def __init__(self, stack_name):
- self.name = stack_name
-
- @property
- def stack_status(self):
- return self.stack_name + '_status'
-
- @property
- def stack_name(self):
- return self.name
-
- @property
- def id(self):
- return self.name
-
- def __eq__(self, other):
- return self.name == other
-
-
-class MockHeat(object):
-
- def __init__(self):
- stacks = [MockStack('stack_1'), MockStack('stack_2')]
- self.stacks_list = MockStacks(stacks)
-
- @property
- def stacks(self):
- return self.stacks_list
-
-
-class MockHeat_2(MockHeat):
-
- def __init__(self):
- stacks = [MockStack('stack_1'), MockStack('stack_2')]
- self.stacks_list = MockStacks_2(stacks)
-
-
-class HeatManagerMock(heat_manager.HeatManager):
-
- def init_heat(self):
- if self.heat is None:
- self.heat = MockHeat()
-
-
-class HeatManagerMock_2(heat_manager.HeatManager):
-
- def init_heat(self):
- if self.heat is None:
- self.heat = MockHeat_2()
-
-
-class TestHeatManager(unittest.TestCase):
-
- def setUp(self):
- credentials = dict()
- credentials['ip_controller'] = '1.1.1.1'
- credentials['heat_url'] = 'http://heat_url'
- credentials['user'] = 'user'
- credentials['password'] = 'password'
- credentials['auth_uri'] = 'auth_uri'
- credentials['project'] = 'project'
- self.heat_manager = HeatManagerMock(credentials)
- self.heat_manager.init_heat()
-
- def tearDown(self):
- pass
-
- def test_is_stack_deployed_for_success(self):
- self.assertTrue(self.heat_manager.is_stack_deployed('stack_1'))
- self.assertFalse(self.heat_manager.is_stack_deployed('stack_n'))
-
- def test_check_status_for_success(self):
- self.assertEqual('stack_1_status',
- self.heat_manager.check_stack_status('stack_1'))
- self.assertEqual('NOT_FOUND',
- self.heat_manager.check_stack_status('stack_x'))
-
- def test_validate_template_for_success(self):
- template_file = os.path.join(
- APEX_LAKE_ROOT,
- 'tests/data/test_templates/VTC_base_single_vm_wait_1.yaml')
- with self.assertRaises(ValueError):
- self.heat_manager.validate_heat_template(template_file)
-
- def test_delete_stack_for_success(self):
- self.assertTrue(self.heat_manager.delete_stack('stack_1'))
- self.assertFalse(self.heat_manager.delete_stack('stack_x'))
-
- def test_delete_stack_for_success_2(self):
- self.assertTrue(self.heat_manager.delete_stack('stack_1'))
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('heatclient.common.template_utils.get_template_contents')
- @mock.patch('heatclient.client.Client')
- # @mock.patch('heatclient.client.Client', side_effect=DummyHeatClient)
- def test_create_stack_for_success(self, mock_stack_create,
- mock_get_template_contents,
- mock_log):
- return_value = ({'template': 'template'}, 'template')
- mock_get_template_contents.return_value = return_value
- self.heat_manager.create_stack('template', 'stack_n', 'parameters')
- self.assertTrue(self.heat_manager.is_stack_deployed('stack_n'))
-
-
-class TestHeatManager_2(unittest.TestCase):
-
- def setUp(self):
- credentials = dict()
- credentials['ip_controller'] = '1.1.1.1'
- credentials['heat_url'] = 'http://heat_url'
- credentials['user'] = 'user'
- credentials['password'] = 'password'
- credentials['auth_uri'] = 'auth_uri'
- credentials['project'] = 'project'
- self.heat_manager = HeatManagerMock_2(credentials)
-
- def tearDown(self):
- pass
-
- def test_delete_stack_for_success_2(self):
- common.LOG = logging.getLogger()
- self.assertFalse(self.heat_manager.delete_stack('stack_1'))
-
-
-class ServiceCatalog():
-
- def url_for(self, service_type):
- return 'http://heat_url'
-
-
-class KeystoneMock(object):
-
- @property
- def auth_token(self):
- return 'token'
-
- service_catalog = ServiceCatalog()
-
-
-class TestHeatInit(unittest.TestCase):
-
- def setUp(self):
- credentials = dict()
- credentials['ip_controller'] = '1.1.1.1'
- credentials['heat_url'] = 'http://heat_url'
- credentials['user'] = 'user'
- credentials['password'] = 'password'
- credentials['auth_uri'] = 'auth_uri'
- credentials['project'] = 'project'
- self.heat_manager = heat_manager.HeatManager(credentials)
-
- def tearDown(self):
- pass
-
- @mock.patch('heatclient.client.Client')
- @mock.patch('keystoneclient.v2_0.client.Client')
- def test_heat_init_for_sanity(self, keystone_client, heat_client):
- keystone_client.return_value = KeystoneMock()
- heat_client.return_value = MockHeat()
- self.heat_manager.init_heat()
- keystone_client.assert_called_once_with(username='user',
- tenant_name='project',
- password='password',
- auth_url='auth_uri')
- heat_client.assert_called_once_with('1', endpoint='http://heat_url',
- token='token')
diff --git a/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py b/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py
deleted file mode 100644
index 69c5d745e..000000000
--- a/yardstick/vTC/apexlake/tests/instantiation_validation_bench_test.py
+++ /dev/null
@@ -1,339 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import mock
-import os
-import experimental_framework.constants.conf_file_sections as cfs
-import experimental_framework.common as common
-import experimental_framework.benchmarks.\
- instantiation_validation_benchmark as iv_module
-from experimental_framework.benchmarks.\
- instantiation_validation_benchmark import InstantiationValidationBenchmark
-from six.moves import map
-from six.moves import range
-
-
-kill_counter = [0, 0]
-command_counter = [0, 0, 0, 0, 0]
-replace_counter = [0, 0, 0]
-
-
-def dummy_os_kill(pid, signal, get_counters=None):
- if get_counters:
- return kill_counter
- if pid == 1234:
- kill_counter[0] += 1
- return
- if pid == 4321:
- kill_counter[1] += 1
- return
- raise Exception(pid)
-
-
-def dummy_run_command(command, get_counters=None):
- if get_counters:
- return command_counter
- if command == 'sudo smcroute -k':
- command_counter[0] += 1
- return
- 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 == 'sudo ip link add link interface name interface.' \
- '100 type vlan id 100':
- command_counter[0] += 1
- return
- elif command == 'sudo ifconfig interface.100 10.254.254.254 up' \
- ' netmask 255.255.255.248':
- command_counter[1] += 1
- return
- elif command == "sudo echo 'mgroup from interface.100 group" \
- " 224.192.16.1' > /etc/smcroute.conf":
- command_counter[2] += 1
- return
- elif command == "sudo smcroute -d":
- command_counter[3] += 1
- return
- elif command == "sudo test_sniff interface.100 128 &":
- command_counter[4] += 1
- return
-
-
-def dummy_replace_in_file(file, str_from, str_to, get_couters=None):
- if get_couters:
- return replace_counter
- if file == 'file':
- if str_from == 'local out_file = "result_file"':
- if str_to == 'local out_file = ""':
- replace_counter[0] += 1
- return
- if str_from == 'local traffic_rate = 100':
- if str_to == 'local traffic_rate = 0':
- replace_counter[1] += 1
- return
- if str_from == 'local traffic_delay = 60':
- if str_to == 'local traffic_delay = 0':
- replace_counter[2] += 1
- return
- if str_from == 'local out_file = ""':
- if str_to == 'local out_file = "result_file"':
- replace_counter[3] += 1
- return
- if str_from == 'local traffic_rate = 0':
- if str_to == 'local traffic_rate = 100':
- replace_counter[4] += 1
- return
- if str_from == 'local traffic_delay = 0':
- if str_to == 'local traffic_delay = 60':
- replace_counter[5] += 1
- return
- raise Exception(file + ' ' + str_from + ' ' + str_to)
-
-
-class DummyDpdkPacketGenerator():
-
- counter = 0
-
- def __init__(self):
- DummyDpdkPacketGenerator.counter = [0, 0]
-
- def init_dpdk_pktgen(self, dpdk_interfaces, lua_script, pcap_file_0,
- pcap_file_1, vlan_0, vlan_1):
- if dpdk_interfaces == 1:
- if lua_script == 'constant_traffic.lua':
- if pcap_file_0 == 'packet_512.pcap':
- if pcap_file_1 == 'igmp.pcap':
- if vlan_0 == '-1':
- if vlan_1 == '-1':
- DummyDpdkPacketGenerator.counter[0] += 1
-
- def send_traffic(self):
- DummyDpdkPacketGenerator.counter[1] += 1
- return
-
-
-class DummyInstantiaionValidationBenchmark(InstantiationValidationBenchmark):
-
- counter = [0, 0, 0, 0, 0]
-
- def _configure_lua_file(self, traffic_rate_percentage, traffic_time):
- DummyInstantiaionValidationBenchmark.counter[0] += 1
-
- def _init_packet_checker(self):
- DummyInstantiaionValidationBenchmark.counter[1] += 1
-
- def _finalize_packet_checker(self):
- DummyInstantiaionValidationBenchmark.counter[2] += 1
-
- def _reset_lua_file(self, traffic_rate_percentage, traffic_time):
- if traffic_rate_percentage == '1' and traffic_time == '10':
- DummyInstantiaionValidationBenchmark.counter[3] += 1
-
- def _get_results(self):
- DummyInstantiaionValidationBenchmark.counter[4] += 1
- res = {'test': 'result'}
- return res
-
-
-class InstantiationValidationInitTest(unittest.TestCase):
-
- def setUp(self):
- common.BASE_DIR = os.getcwd()
- self.iv = InstantiationValidationBenchmark('InstantiationValidation',
- dict())
-
- def tearDown(self):
- common.BASE_DIR = None
-
- @mock.patch('experimental_framework.common.get_base_dir')
- def test___init___for_success(self, mock_base_dir):
- mock_base_dir.return_value = 'base_dir/'
- iv = InstantiationValidationBenchmark('InstantiationValidation',
- dict())
- self.assertEqual(iv.base_dir,
- 'base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/')
- self.assertEqual(iv.results_file,
- 'base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/packets.res')
- self.assertEqual(iv.lua_file,
- 'base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/constant_traffic.lua')
- self.assertEqual(iv.pkt_checker_command,
- 'base_dir/experimental_framework/'
- 'libraries/packet_checker/test_sniff ')
- self.assertEqual(iv.res_dir, '')
- self.assertEqual(iv.interface_name, '')
-
- def test_init_for_success(self):
- self.iv.init()
-
- def test_finalize_for_success(self):
- self.iv.finalize()
-
- def test_get_features_for_success(self):
-
- expected = dict()
- expected['description'] = 'Instantiation Validation Benchmark'
- expected['parameters'] = [
- iv_module.THROUGHPUT,
- iv_module.VLAN_SENDER,
- iv_module.VLAN_RECEIVER
- ]
- expected['allowed_values'] = dict()
- expected['allowed_values'][iv_module.THROUGHPUT] = \
- list(map(str, list(range(0, 100))))
- expected['allowed_values'][iv_module.VLAN_SENDER] = \
- list(map(str, list(range(-1, 4096))))
- expected['allowed_values'][iv_module.VLAN_RECEIVER] = \
- list(map(str, list(range(-1, 4096))))
- expected['default_values'] = dict()
- expected['default_values'][iv_module.THROUGHPUT] = '1'
- expected['default_values'][iv_module.VLAN_SENDER] = '-1'
- expected['default_values'][iv_module.VLAN_RECEIVER] = '-1'
- output = self.iv.get_features()
- self.assertEqual(expected, output)
-
- @mock.patch('subprocess.check_output')
- def test__get_pids_for_success(self, mock_getoutput):
- expected = [1234]
- mock_getoutput.return_value = '1234'
- output = self.iv._get_pids()
- self.assertEqual(expected, output)
-
- expected = [1234, 4321]
- mock_getoutput.return_value = '1234\n4321'
- output = self.iv._get_pids()
- self.assertEqual(expected, output)
-
- expected = []
- mock_getoutput.return_value = None
- output = self.iv._get_pids()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.run_command',
- side_effect=dummy_run_command)
- @mock.patch('os.kill', side_effect=dummy_os_kill)
- @mock.patch('experimental_framework.benchmarks.'
- 'instantiation_validation_benchmark.'
- 'InstantiationValidationBenchmark._get_pids')
- def test__finalize_packet_checker_for_success(self,
- mock_pids,
- mock_os_kill,
- mock_run_command):
- global command_counter
- global kill_counter
- command_counter = [0, 0, 0, 0, 0]
- kill_counter = [0, 0]
- mock_pids.return_value = [1234, 4321]
- self.iv.interface_name = 'interface'
- self.iv.params[iv_module.VLAN_RECEIVER] = '100'
- self.iv._finalize_packet_checker()
- self.assertEqual(dummy_os_kill('', '', True), [1, 1])
- self.assertEqual(dummy_run_command('', True), [1, 1, 0, 0, 0])
-
- @mock.patch('experimental_framework.benchmarks.instantiation_validation_benchmark.time')
- @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, mock_chdir, mock_time):
- global command_counter
- command_counter = [0, 0, 0, 0, 0]
- mock_pids.return_value = [1234, 4321]
- self.iv.pkt_checker_command = 'test_sniff '
- self.iv.interface_name = 'interface'
- self.iv.params[iv_module.VLAN_RECEIVER] = '100'
- self.iv._init_packet_checker()
- self.assertEqual(dummy_run_command('', True), [1, 1, 1, 1, 1])
-
- @mock.patch('experimental_framework.common.get_file_first_line')
- def test__get_results_for_success(self, mock_get_file):
- self.iv.res_dir = 'directory'
- mock_get_file.side_effect = ['100', '50']
- expected = {'failure': '0'}
- output = self.iv._get_results()
- self.assertEqual(expected, output)
-
- mock_get_file.side_effect = ['10', '50']
- expected = {'failure': '1'}
- output = self.iv._get_results()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.replace_in_file',
- side_effect=dummy_replace_in_file)
- def test__reset_lua_file_for_success(self, mock_replace):
- global replace_counter
- replace_counter = [0, 0, 0, 0, 0, 0]
- traffic_rate_percentage = '100'
- traffic_time = '60'
- self.iv.lua_file = 'file'
- self.iv.results_file = 'result_file'
- self.iv._reset_lua_file(traffic_rate_percentage, traffic_time)
- self.assertEqual(dummy_replace_in_file('', '', '', True),
- [1, 1, 1, 0, 0, 0])
-
- @mock.patch('experimental_framework.common.replace_in_file',
- side_effect=dummy_replace_in_file)
- def test__configure_lua_file_for_success(self, mock_replace):
- global replace_counter
- replace_counter = [0, 0, 0, 0, 0, 0]
- traffic_rate_percentage = '100'
- traffic_time = '60'
- self.iv.lua_file = 'file'
- self.iv.results_file = 'result_file'
- self.iv._configure_lua_file(traffic_rate_percentage, traffic_time)
- self.assertEqual(dummy_replace_in_file('', '', '', True),
- [0, 0, 0, 1, 1, 1])
-
- @mock.patch('experimental_framework.benchmarks.instantiation_validation_benchmark.time')
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.packet_generators.'
- 'dpdk_packet_generator.DpdkPacketGenerator',
- side_effect=DummyDpdkPacketGenerator)
- @mock.patch('experimental_framework.common.get_dpdk_pktgen_vars')
- def test_run_for_success(self, mock_common_get_vars, mock_pktgen,
- mock_log, mock_time):
- rval = dict()
- rval[cfs.CFSP_DPDK_BUS_SLOT_NIC_2] = 'bus_2'
- rval[cfs.CFSP_DPDK_NAME_IF_2] = 'if_2'
- mock_common_get_vars.return_value = rval
- expected = {'test': 'result'}
- iv = DummyInstantiaionValidationBenchmark('InstantiationValidation',
- dict())
- iv.params[iv_module.THROUGHPUT] = '1'
- output = iv.run()
- self.assertEqual(expected, output)
- self.assertEqual(DummyDpdkPacketGenerator.counter,
- [1, 1])
- self.assertEqual(DummyInstantiaionValidationBenchmark.counter,
- [1, 1, 1, 1, 1])
diff --git a/yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py b/yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py
deleted file mode 100644
index f9aa9473f..000000000
--- a/yardstick/vTC/apexlake/tests/instantiation_validation_noisy_bench_test.py
+++ /dev/null
@@ -1,150 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import mock
-
-from six.moves import range
-
-import experimental_framework.common as common
-import experimental_framework.deployment_unit as deploy
-import experimental_framework.benchmarks.\
- instantiation_validation_noisy_neighbors_benchmark as mut
-from experimental_framework import APEX_LAKE_ROOT
-
-
-class InstantiationValidationInitTest(unittest.TestCase):
-
- def setUp(self):
- name = 'instantiation_validation_noisy'
- params = {'param': 'value'}
- openstack_credentials = dict()
- openstack_credentials['ip_controller'] = ''
- openstack_credentials['project'] = ''
- openstack_credentials['auth_uri'] = ''
- openstack_credentials['user'] = ''
- openstack_credentials['heat_url'] = ''
- openstack_credentials['password'] = ''
- common.DEPLOYMENT_UNIT = deploy.DeploymentUnit(openstack_credentials)
- common.BASE_DIR = APEX_LAKE_ROOT
- common.TEMPLATE_DIR = 'tests/data/generated_templates'
- self.iv = mut.\
- InstantiationValidationNoisyNeighborsBenchmark(name, params)
-
- def tearDown(self):
- common.BASE_DIR = None
- common.TEMPLATE_DIR = None
-
- @mock.patch('experimental_framework.benchmarks.'
- 'instantiation_validation_benchmark.'
- 'InstantiationValidationBenchmark')
- @mock.patch('experimental_framework.common.get_template_dir')
- def test___init___for_success(self, mock_get_template_dir,
- mock_instant_validation):
- mock_get_template_dir.return_value = '/directory/'
- name = 'instantiation_validation_noisy'
- params = {'param': 'value'}
- obj = mut.InstantiationValidationNoisyNeighborsBenchmark(name, params)
- self.assertEqual(obj.template_file, '/directory/stress_workload.yaml')
- self.assertEqual(obj.stack_name, 'neighbour')
- self.assertEqual(obj.neighbor_stack_names, list())
-
- def test_get_features_for_success(self):
- expected = dict()
- expected['description'] = 'Instantiation Validation Benchmark with ' \
- 'noisy neghbors'
- expected['parameters'] = list()
- expected['allowed_values'] = dict()
- expected['default_values'] = dict()
- expected['parameters'].append('throughput')
- expected['parameters'].append('vlan_sender')
- expected['parameters'].append('vlan_receiver')
- expected['parameters'].append('network')
- expected['parameters'].append('subnet')
- expected['parameters'].append(mut.NUM_OF_NEIGHBORS)
- expected['parameters'].append(mut.AMOUNT_OF_RAM)
- expected['parameters'].append(mut.NUMBER_OF_CORES)
- expected['allowed_values']['throughput'] = [str(x) for x in range(100)]
- expected['allowed_values']['vlan_sender'] = [str(x) for x in
- range(-1, 4096)]
- expected['allowed_values']['vlan_receiver'] = [str(x) for x in
- range(-1, 4096)]
- expected['allowed_values'][mut.NUM_OF_NEIGHBORS] = \
- ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- expected['allowed_values'][mut.NUMBER_OF_CORES] = \
- ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
- expected['allowed_values'][mut.AMOUNT_OF_RAM] = \
- ['256M', '1G', '2G', '3G', '4G', '5G', '6G', '7G', '8G', '9G',
- '10G']
- expected['default_values']['throughput'] = '1'
- expected['default_values']['vlan_sender'] = '-1'
- expected['default_values']['vlan_receiver'] = '-1'
- expected['default_values']['network'] = ''
- expected['default_values']['subnet'] = ''
- expected['default_values'][mut.NUM_OF_NEIGHBORS] = '1'
- expected['default_values'][mut.NUMBER_OF_CORES] = '1'
- expected['default_values'][mut.AMOUNT_OF_RAM] = '256M'
- output = self.iv.get_features()
- self.assertEqual(expected['description'], output['description'])
-
- for item in output['parameters']:
- self.assertIn(item, expected['parameters'])
- for key in output['allowed_values'].keys():
- self.assertEqual(expected['allowed_values'][key],
- output['allowed_values'][key])
- for key in output['default_values'].keys():
- self.assertEqual(expected['default_values'][key],
- output['default_values'][key])
-
- @mock.patch('experimental_framework.common.replace_in_file')
- @mock.patch('experimental_framework.common.'
- 'DEPLOYMENT_UNIT.deploy_heat_template')
- def test_init_for_success(self, mock_deploy_heat, mock_replace):
- self.iv.lua_file = 'file'
- self.iv.results_file = 'res_file'
- self.iv.params = {'number_of_cores': 1,
- 'amount_of_ram': 1,
- 'network': 1,
- 'subnet': 1,
- 'num_of_neighbours': 1}
- self.iv.template_file = 'template.yaml'
- self.iv.init()
- mock_replace.assert_called_once_with('file',
- 'local out_file = ""',
- 'local out_file = "' +
- 'res_file' + '"')
- mock_deploy_heat.assert_called_once_with('template.yaml',
- 'neighbour0',
- {'cores': 1,
- 'memory': 1,
- 'network': 1,
- 'subnet': 1})
- self.assertEqual(self.iv.neighbor_stack_names, ['neighbour0'])
-
- @mock.patch('experimental_framework.common.replace_in_file')
- @mock.patch('experimental_framework.common.'
- 'DEPLOYMENT_UNIT.destroy_heat_template')
- def test_finalize_for_success(self, mock_heat_destroy, mock_replace):
- self.iv.lua_file = 'file'
- self.iv.results_file = 'res_file'
- self.iv.neighbor_stack_names = ['neighbor0']
- stack_name = 'neighbor0'
- self.iv.finalize()
- mock_heat_destroy.assert_called_once_with(stack_name)
- mock_replace.assert_called_once_with('file',
- 'local out_file = "' +
- 'res_file' + '"',
- 'local out_file = ""')
- self.assertEqual(self.iv.neighbor_stack_names, list())
diff --git a/yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py b/yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py
deleted file mode 100644
index 39b38d7d3..000000000
--- a/yardstick/vTC/apexlake/tests/multi_tenancy_throughput_benchmark_test.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import mock
-import os
-import experimental_framework.common as common
-from experimental_framework.benchmarks \
- import multi_tenancy_throughput_benchmark as bench
-from six.moves import range
-
-__author__ = 'gpetralx'
-
-
-class MockDeploymentUnit(object):
-
- def deploy_heat_template(self, temp_file, stack_name, heat_param):
- pass
-
- def destroy_heat_template(self, stack_name):
- pass
-
-
-def get_deployment_unit():
- return MockDeploymentUnit()
-
-
-class TestMultiTenancyThroughputBenchmark(unittest.TestCase):
-
- def setUp(self):
- name = 'benchmark'
- params = dict()
- common.BASE_DIR = os.getcwd()
- self.benchmark = bench.MultiTenancyThroughputBenchmark(name, params)
-
- def tearDown(self):
- pass
-
- def test_get_features_for_sanity(self):
- output = self.benchmark.get_features()
- self.assertIsInstance(output, dict)
- self.assertIn('parameters', list(output.keys()))
- self.assertIn('allowed_values', list(output.keys()))
- self.assertIn('default_values', list(output.keys()))
- self.assertIsInstance(output['parameters'], list)
- self.assertIsInstance(output['allowed_values'], dict)
- self.assertIsInstance(output['default_values'], dict)
-
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT',
- side_effect=get_deployment_unit)
- @mock.patch('experimental_framework.common.replace_in_file')
- def test_init_for_success(self, replace_in_file, deployment_unit):
- num_of_neighbours = 5
- num_of_cores = '3'
- amount_of_ram = '250M'
-
- self.benchmark.lua_file = 'lua_file'
- self.benchmark.results_file = 'result_file'
- self.benchmark.params['num_of_neighbours'] = str(num_of_neighbours)
- self.benchmark.params['number_of_cores'] = num_of_cores
- self.benchmark.params['amount_of_ram'] = amount_of_ram
- self.benchmark.init()
-
- param_1 = 'lua_file'
- param_2 = 'local out_file = ""'
- param_3 = 'local out_file = "result_file"'
- replace_in_file.assert_called_once_with(param_1, param_2, param_3)
-
- heat_param = dict()
- heat_param['cores'] = num_of_cores
- heat_param['memory'] = amount_of_ram
- heat_param['network'] = ''
- heat_param['subnet'] = ''
- neighbor_stack_names = list()
-
- deployment_unit.\
- deploy_heat_template.assert_called_with(
- self.benchmark.template_file,
- 'neighbour' + str(num_of_neighbours - 1), heat_param)
-
- for i in range(0, num_of_neighbours):
- neighbor_stack_names.append('neighbour' + str(i))
-
- self.assertListEqual(neighbor_stack_names,
- self.benchmark.neighbor_stack_names)
-
- @mock.patch('experimental_framework.common.DEPLOYMENT_UNIT',
- side_effect=get_deployment_unit)
- @mock.patch('experimental_framework.common.replace_in_file')
- def test_finalize_for_success(self, replace_in_file, deployment_unit):
- num_of_neighbours = 5
- self.benchmark.lua_file = 'lua_file'
- self.benchmark.results_file = 'result_file'
- self.benchmark.params['num_of_neighbours'] = str(num_of_neighbours)
- self.benchmark.neighbor_stack_names = list()
- self.benchmark.neighbor_stack_names.append(str(num_of_neighbours - 1))
- self.benchmark.finalize()
-
- param_1 = 'lua_file'
- param_2 = 'local out_file = "result_file"'
- param_3 = 'local out_file = ""'
- replace_in_file.assert_called_once_with(param_1, param_2, param_3)
-
- deployment_unit.\
- destroy_heat_template.\
- assert_called_with(str(num_of_neighbours - 1))
- self.assertListEqual(list(), self.benchmark.neighbor_stack_names)
diff --git a/yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py b/yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py
deleted file mode 100644
index 487de7775..000000000
--- a/yardstick/vTC/apexlake/tests/rfc2544_throughput_benchmark_test.py
+++ /dev/null
@@ -1,162 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-
-from __future__ import absolute_import
-import unittest
-import mock
-import os
-from experimental_framework.benchmarks import rfc2544_throughput_benchmark \
- as mut
-import experimental_framework.common as common
-
-
-class RFC2544ThroughputBenchmarkRunTest(unittest.TestCase):
-
- def setUp(self):
- name = 'benchmark'
- params = dict()
- params[mut.VLAN_SENDER] = '1'
- params[mut.VLAN_RECEIVER] = '2'
- common.BASE_DIR = os.getcwd()
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
-
- def tearDown(self):
- common.BASE_DIR = None
-
- def test_get_features_for_sanity(self):
- output = self.benchmark.get_features()
- self.assertIsInstance(output, dict)
- self.assertIn('parameters', list(output.keys()))
- self.assertIn('allowed_values', list(output.keys()))
- self.assertIn('default_values', list(output.keys()))
- self.assertIsInstance(output['parameters'], list)
- self.assertIsInstance(output['allowed_values'], dict)
- self.assertIsInstance(output['default_values'], dict)
-
- def test_init(self):
- self.assertEqual(self.benchmark.init(), None)
-
- def test_finalize(self):
- self.assertEqual(self.benchmark.finalize(), None)
-
- @mock.patch('experimental_framework.common.LOG')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_reset_lua_file')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_configure_lua_file')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_extract_packet_size_from_params')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.RFC2544ThroughputBenchmark.'
- '_get_results')
- @mock.patch('experimental_framework.benchmarks.'
- 'rfc2544_throughput_benchmark.dpdk.DpdkPacketGenerator')
- def test_run_for_success(self, mock_dpdk, mock_get_results,
- mock_extract_size, conf_lua_file_mock,
- reset_lua_file_mock, mock_common_log):
- expected = {'results': 0}
- mock_extract_size.return_value = '1'
- mock_get_results.return_value = {'results': 0}
- output = self.benchmark.run()
- self.assertEqual(expected, output)
- conf_lua_file_mock.assert_called_once()
- dpdk_instance = mock_dpdk()
- dpdk_instance.init_dpdk_pktgen.assert_called_once_with(
- dpdk_interfaces=2, pcap_file_0='packet_1.pcap',
- pcap_file_1='igmp.pcap', lua_script='rfc2544.lua',
- vlan_0='1', vlan_1='2')
- dpdk_instance.send_traffic.assert_called_once_with()
-
-
-class RFC2544ThroughputBenchmarkOthers(unittest.TestCase):
-
- def setUp(self):
- name = 'benchmark'
- params = {'packet_size': '128'}
- common.BASE_DIR = os.getcwd()
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
-
- def tearDown(self):
- common.BASE_DIR = None
-
- def test__extract_packet_size_from_params_for_success(self):
- expected = '128'
- output = self.benchmark._extract_packet_size_from_params()
- self.assertEqual(expected, output)
-
- @mock.patch('experimental_framework.common.replace_in_file')
- def test__configure_lua_file(self, mock_common_replace_in_file):
- self.benchmark.lua_file = 'lua_file'
- self.benchmark.results_file = 'result_file'
- self.benchmark._configure_lua_file()
- mock_common_replace_in_file.\
- assert_called_once_with('lua_file', 'local out_file = ""',
- 'local out_file = "result_file"')
-
- @mock.patch('experimental_framework.common.replace_in_file')
- def test__reset_lua_file(self, mock_common_replace_in_file):
- self.benchmark.lua_file = 'lua_file'
- self.benchmark.results_file = 'result_file'
- self.benchmark._reset_lua_file()
- mock_common_replace_in_file.\
- assert_called_once_with('lua_file',
- 'local out_file = "result_file"',
- 'local out_file = ""')
-
-
-class RFC2544ThroughputBenchmarkGetResultsTest(unittest.TestCase):
-
- def setUp(self):
- common.BASE_DIR = os.getcwd()
-
- def tearDown(self):
- common.BASE_DIR = None
-
- @mock.patch('experimental_framework.common.get_file_first_line')
- def test__get_results_for_success(self, mock_common_file_line):
- name = 'benchmark'
- params = {'packet_size': '128'}
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
- self.benchmark.results_file = 'base_dir/experimental_framework/' \
- 'packet_generators/dpdk_pktgen/' \
- 'experiment.res'
- mock_common_file_line.return_value = '10'
- expected = {'throughput': 10}
- output = self.benchmark._get_results()
- self.assertEqual(expected, output)
- mock_common_file_line.\
- assert_called_once_with('base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/'
- 'experiment.res')
-
- @mock.patch('experimental_framework.common.get_file_first_line')
- def test__get_results_for_success_2(self, mock_common_file_line):
- name = 'benchmark'
- params = {'packet_size': '128'}
- self.benchmark = mut.RFC2544ThroughputBenchmark(name, params)
- self.benchmark.results_file = 'base_dir/experimental_framework/' \
- 'packet_generators/dpdk_pktgen/' \
- 'experiment.res'
- mock_common_file_line.return_value = '1XXX0'
- expected = {'throughput': 0}
- output = self.benchmark._get_results()
- self.assertEqual(expected, output)
- mock_common_file_line.\
- assert_called_once_with('base_dir/experimental_framework/'
- 'packet_generators/dpdk_pktgen/'
- 'experiment.res')
diff --git a/yardstick/vTC/apexlake/tests/tree_node_test.py b/yardstick/vTC/apexlake/tests/tree_node_test.py
deleted file mode 100644
index fb38b69bd..000000000
--- a/yardstick/vTC/apexlake/tests/tree_node_test.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
-#
-# 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.
-
-from __future__ import absolute_import
-import unittest
-import experimental_framework.heat_template_generation as heat_gen
-
-__author__ = 'gpetralx'
-
-
-class TestTreeNode(unittest.TestCase):
-
- def setUp(self):
- self.tree = heat_gen.TreeNode()
-
- def tearDown(self):
- pass
-
- def test_add_child_for_success(self):
- child = heat_gen.TreeNode()
- self.tree.add_child(child)
- self.assertIn(child, self.tree.down)
-
- def test_get_parent_for_success(self):
- self.assertIsNone(self.tree.get_parent())
- child = heat_gen.TreeNode()
- self.tree.add_child(child)
- self.assertEqual(self.tree, child.get_parent())
-
- def test_get_children_for_success(self):
- self.assertListEqual(list(), self.tree.get_children())
- child = heat_gen.TreeNode()
- self.tree.add_child(child)
- children = [child]
- self.assertListEqual(children, self.tree.get_children())
-
- def test_variable_name_for_success(self):
- self.assertEqual('', self.tree.get_variable_name())
- variable_name = 'test'
- self.tree.set_variable_name(variable_name)
- self.assertEqual(variable_name, self.tree.get_variable_name())
-
- def test_variable_value_for_success(self):
- self.assertEqual(0, self.tree.get_variable_value())
- variable_value = 1
- self.tree.set_variable_value(variable_value)
- self.assertEqual(variable_value, self.tree.get_variable_value())
-
- def test_get_path_for_success(self):
- child_1 = heat_gen.TreeNode()
- self.tree.add_child(child_1)
- child_2 = heat_gen.TreeNode()
- child_1.add_child(child_2)
- child_3 = heat_gen.TreeNode()
- child_2.add_child(child_3)
-
- path = [self.tree, child_1, child_2, child_3]
-
- self.assertListEqual(path, child_3.get_path())
-
- def test_str_for_success(self):
- name = 'name'
- value = 0
- self.tree.set_variable_name(name)
- self.tree.set_variable_value(value)
- self.assertEqual(name + " --> " + str(value), str(self.tree))
-
- def test_repr_for_success(self):
- name = 'name'
- value = 0
- self.tree.set_variable_name(name)
- self.tree.set_variable_value(value)
- self.assertEqual(name + " = " + str(value), repr(self.tree))
-
- def test_get_leaves_for_success(self):
- child_1 = heat_gen.TreeNode()
- self.tree.add_child(child_1)
- child_2 = heat_gen.TreeNode()
- child_1.add_child(child_2)
- child_3 = heat_gen.TreeNode()
- child_2.add_child(child_3)
- child_4 = heat_gen.TreeNode()
- child_2.add_child(child_4)
- child_5 = heat_gen.TreeNode()
- child_2.add_child(child_5)
- leaves = [child_3, child_4, child_5]
- self.assertListEqual(leaves, heat_gen.TreeNode.get_leaves(self.tree))