aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/roles/cpu_pin_local_teardown/tasks/main.yaml (renamed from ansible/roles/cpu_pin_local_teardowm/tasks/main.yaml)0
-rw-r--r--ansible/roles/vcpu_pin_set_setup/tasks/main.yaml2
-rwxr-xr-xapi/api-prepare.sh3
-rw-r--r--docker/Dockerfile5
-rwxr-xr-xinstall.sh4
-rw-r--r--requirements.txt3
-rw-r--r--tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml3
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py7
-rw-r--r--tests/unit/benchmark/contexts/test_model.py25
-rw-r--r--tests/unit/orchestrator/__init__.py0
-rw-r--r--tests/unit/orchestrator/test_heat.py59
-rw-r--r--yardstick/benchmark/contexts/heat.py7
-rw-r--r--yardstick/benchmark/contexts/model.py5
-rw-r--r--yardstick/benchmark/runners/iteration.py8
-rw-r--r--yardstick/benchmark/scenarios/compute/cyclictest.py6
-rw-r--r--yardstick/common/constants.py2
-rw-r--r--yardstick/orchestrator/heat.py31
17 files changed, 148 insertions, 22 deletions
diff --git a/ansible/roles/cpu_pin_local_teardowm/tasks/main.yaml b/ansible/roles/cpu_pin_local_teardown/tasks/main.yaml
index 29475421d..29475421d 100644
--- a/ansible/roles/cpu_pin_local_teardowm/tasks/main.yaml
+++ b/ansible/roles/cpu_pin_local_teardown/tasks/main.yaml
diff --git a/ansible/roles/vcpu_pin_set_setup/tasks/main.yaml b/ansible/roles/vcpu_pin_set_setup/tasks/main.yaml
index 2a456ab9a..2278525eb 100644
--- a/ansible/roles/vcpu_pin_set_setup/tasks/main.yaml
+++ b/ansible/roles/vcpu_pin_set_setup/tasks/main.yaml
@@ -18,4 +18,4 @@
lineinfile:
dest: /etc/nova/nova.conf
insertafter: 'DEFAULT'
- line: 'vcpu_pin_set={{cpu_set}}
+ line: 'vcpu_pin_set={{cpu_set}}'
diff --git a/api/api-prepare.sh b/api/api-prepare.sh
index f2be48909..7632d9da9 100755
--- a/api/api-prepare.sh
+++ b/api/api-prepare.sh
@@ -33,6 +33,9 @@ close-on-exec = 1
daemonize= /var/log/yardstick/uwsgi.log
socket = /var/run/yardstick.sock
EOF
+ if [[ "${YARDSTICK_VENV}" ]];then
+ echo "virtualenv = ${YARDSTICK_VENV}" >> "${uwsgi_config}"
+ fi
fi
# nginx config
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 52a15df1b..96a5d774d 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -23,7 +23,10 @@ ENV IMAGE_DIR /home/opnfv/images/
ENV YARDSTICK_REPO_DIR ${REPOS_DIR}/yardstick
ENV RELENG_REPO_DIR ${REPOS_DIR}/releng
-RUN apt-get update && apt-get install -y git
+RUN apt-get update && apt-get install -y git python-setuptools python-pip
+RUN easy_install -U setuptools==30.0.0
+RUN pip install appdirs==1.4.0
+
RUN mkdir -p ${REPOS_DIR}
RUN git config --global http.sslVerify false
diff --git a/install.sh b/install.sh
index 25a4f5960..dc2663628 100755
--- a/install.sh
+++ b/install.sh
@@ -47,9 +47,7 @@ apt-get update && apt-get install -y \
uwsgi-plugin-python \
supervisor \
python-pip \
- vim \
- python-setuptools && \
- easy_install -U setuptools==30.0.0
+ vim
apt-get -y autoremove && apt-get clean
diff --git a/requirements.txt b/requirements.txt
index 22ce1d35f..b22bce3be 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,7 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-appdirs==1.4.0
+ansible==2.2.0.0
Babel==2.3.4
backport-ipaddress==0.1
chainmap==1.0.2
@@ -71,6 +71,7 @@ PyYAML==3.11
requests==2.10.0
requestsexceptions==1.1.3
scp==0.10.2
+shade==1.17.0
simplejson==3.8.2
six==1.10.0
stevedore==1.17.1
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml
index a9802346b..4c7fdab90 100644
--- a/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml
+++ b/tests/opnfv/test_cases/opnfv_yardstick_tc008.yaml
@@ -65,3 +65,6 @@ context:
networks:
test:
cidr: '10.0.1.0/24'
+ #test-sriov:
+ #cidr: '10.0.1.0/24'
+ #provider: "sriov"
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index 8f4852ca8..b56d0c86d 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -21,6 +21,7 @@ import uuid
import mock
from yardstick.benchmark.contexts import heat
+from yardstick.benchmark.contexts import model
LOG = logging.getLogger(__name__)
@@ -102,12 +103,18 @@ class HeatContextTestCase(unittest.TestCase):
self.test_context.keypair_name = "foo-key"
self.test_context.secgroup_name = "foo-secgroup"
self.test_context.key_uuid = "2f2e4997-0a8e-4eb7-9fa4-f3f8fbbc393b"
+ netattrs = {'cidr': '10.0.0.0/24', 'provider': None, 'external_network': 'ext_net'}
+ self.mock_context.name = 'bar'
+ self.test_context.networks = [model.Network("fool-network", self.mock_context, netattrs)]
self.test_context._add_resources_to_template(mock_template)
mock_template.add_keypair.assert_called_with(
"foo-key",
"2f2e4997-0a8e-4eb7-9fa4-f3f8fbbc393b")
mock_template.add_security_group.assert_called_with("foo-secgroup")
+ mock_template.add_network.assert_called_with("bar-fool-network", 'physnet1', None)
+ mock_template.add_router.assert_called_with("bar-fool-network-router", netattrs["external_network"], "bar-fool-network-subnet")
+ mock_template.add_router_interface.assert_called_with("bar-fool-network-router-if0", "bar-fool-network-router", "bar-fool-network-subnet")
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_deploy(self, mock_template):
diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py
index 6ae4e6dac..4a10761f7 100644
--- a/tests/unit/benchmark/contexts/test_model.py
+++ b/tests/unit/benchmark/contexts/test_model.py
@@ -170,6 +170,9 @@ class ServerTestCase(unittest.TestCase):
self.mock_context.keypair_name = 'some-keys'
self.mock_context.secgroup_name = 'some-secgroup'
self.mock_context.user = "some-user"
+ netattrs = {'cidr': '10.0.0.0/24', 'provider': None, 'external_network': 'ext_net'}
+ self.mock_context.networks = [model.Network("some-network", self.mock_context, netattrs)]
+
def test_construct_defaults(self):
@@ -208,13 +211,16 @@ class ServerTestCase(unittest.TestCase):
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test__add_instance(self, mock_template):
- attrs = {'image': 'some-image', 'flavor': 'some-flavor'}
+ attrs = {'image': 'some-image', 'flavor': 'some-flavor', 'floating_ip': '192.168.1.10', 'floating_ip_assoc': 'some-vm'}
test_server = model.Server('foo', self.mock_context, attrs)
mock_network = mock.Mock()
mock_network.name = 'some-network'
mock_network.stack_name = 'some-network-stack'
mock_network.subnet_stack_name = 'some-network-stack-subnet'
+ mock_network.provider = 'sriov'
+ mock_network.external_network = 'ext_net'
+ mock_network.router = model.Router('some-router', 'some-network', self.mock_context, 'ext_net')
test_server._add_instance(mock_template, 'some-server',
[mock_network], 'hints')
@@ -223,7 +229,22 @@ class ServerTestCase(unittest.TestCase):
'some-server-some-network-port',
mock_network.stack_name,
mock_network.subnet_stack_name,
- sec_group_id=self.mock_context.secgroup_name)
+ sec_group_id=self.mock_context.secgroup_name,
+ provider=mock_network.provider)
+
+ mock_template.add_floating_ip.assert_called_with(
+ 'some-server-fip',
+ mock_network.external_network,
+ 'some-server-some-network-port',
+ 'bar-some-network-some-router-if0',
+ 'some-secgroup'
+ )
+
+ mock_template.add_floating_ip_association.assert_called_with(
+ 'some-server-fip-assoc',
+ 'some-server-fip',
+ 'some-server-some-network-port'
+ )
mock_template.add_server.assert_called_with(
'some-server', 'some-image', 'some-flavor',
diff --git a/tests/unit/orchestrator/__init__.py b/tests/unit/orchestrator/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/unit/orchestrator/__init__.py
diff --git a/tests/unit/orchestrator/test_heat.py b/tests/unit/orchestrator/test_heat.py
index 97314c275..2f9c800aa 100644
--- a/tests/unit/orchestrator/test_heat.py
+++ b/tests/unit/orchestrator/test_heat.py
@@ -13,6 +13,7 @@
import unittest
import uuid
+import mock
from yardstick.orchestrator import heat
@@ -24,3 +25,61 @@ class HeatContextTestCase(unittest.TestCase):
k = heat.get_short_key_uuid(u)
self.assertEqual(heat.HEAT_KEY_UUID_LENGTH, len(k))
self.assertIn(k, str(u))
+
+class HeatTemplateTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.template = heat.HeatTemplate('test')
+
+ def test_add_tenant_network(self):
+ self.template.add_network('some-network')
+
+ self.assertEqual(self.template.resources['some-network']['type'], 'OS::Neutron::Net')
+
+ def test_add_provider_network(self):
+ self.template.add_network('some-network', 'physnet2', 'sriov')
+
+ self.assertEqual(self.template.resources['some-network']['type'], 'OS::Neutron::ProviderNet')
+ self.assertEqual(self.template.resources['some-network']['properties']['physical_network'], 'physnet2')
+
+ def test_add_subnet(self):
+ netattrs = {'cidr': '10.0.0.0/24', 'provider': None, 'external_network': 'ext_net'}
+ self.template.add_subnet('some-subnet', "some-network", netattrs['cidr'])
+
+ self.assertEqual(self.template.resources['some-subnet']['type'], 'OS::Neutron::Subnet')
+ self.assertEqual(self.template.resources['some-subnet']['properties']['cidr'], '10.0.0.0/24')
+
+ def test_add_router(self):
+ self.template.add_router('some-router', 'ext-net', 'some-subnet')
+
+ self.assertEqual(self.template.resources['some-router']['type'], 'OS::Neutron::Router')
+ self.assertIn('some-subnet', self.template.resources['some-router']['depends_on'])
+
+ def test_add_router_interface(self):
+ self.template.add_router_interface('some-router-if', 'some-router', 'some-subnet')
+
+ self.assertEqual(self.template.resources['some-router-if']['type'], 'OS::Neutron::RouterInterface')
+ self.assertIn('some-subnet', self.template.resources['some-router-if']['depends_on'])
+
+ def test_add_servergroup(self):
+ self.template.add_servergroup('some-server-group', 'anti-affinity')
+
+ self.assertEqual(self.template.resources['some-server-group']['type'], 'OS::Nova::ServerGroup')
+ self.assertEqual(self.template.resources['some-server-group']['properties']['policies'], ['anti-affinity'])
+
+class HeatStackTestCase(unittest.TestCase):
+
+ def test_delete_calls__delete_multiple_times(self):
+ stack = heat.HeatStack('test')
+ stack.uuid = 1
+ with mock.patch.object(stack, "_delete") as delete_mock:
+ stack.delete()
+ # call once and then call again if uuid is not none
+ self.assertGreater(delete_mock.call_count, 1)
+
+ def test_delete_all_calls_delete(self):
+ stack = heat.HeatStack('test')
+ stack.uuid = 1
+ with mock.patch.object(stack, "delete") as delete_mock:
+ stack.delete_all()
+ self.assertGreater(delete_mock.call_count, 0)
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py
index 604df80d1..d5dccd2a2 100644
--- a/yardstick/benchmark/contexts/heat.py
+++ b/yardstick/benchmark/contexts/heat.py
@@ -133,8 +133,11 @@ class HeatContext(Context):
template.add_security_group(self.secgroup_name)
for network in self.networks:
- template.add_network(network.stack_name)
- template.add_subnet(network.subnet_stack_name, network.stack_name,
+ template.add_network(network.stack_name,
+ network.physical_network,
+ network.provider)
+ template.add_subnet(network.subnet_stack_name,
+ network.stack_name,
network.subnet_cidr)
if network.router:
diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py
index 4873afde3..71ee1f3c2 100644
--- a/yardstick/benchmark/contexts/model.py
+++ b/yardstick/benchmark/contexts/model.py
@@ -105,6 +105,8 @@ class Network(Object):
self.subnet_stack_name = self.stack_name + "-subnet"
self.subnet_cidr = attrs.get('cidr', '10.0.1.0/24')
self.router = None
+ self.physical_network = attrs.get('physical_network', 'physnet1')
+ self.provider = attrs.get('provider', None)
if "external_network" in attrs:
self.router = Router("router", self.name,
@@ -226,7 +228,8 @@ class Server(Object): # pragma: no cover
self.ports[network.name] = {"stack_name": port_name}
template.add_port(port_name, network.stack_name,
network.subnet_stack_name,
- sec_group_id=self.secgroup_name)
+ sec_group_id=self.secgroup_name,
+ provider=network.provider)
port_name_list.append(port_name)
if self.floating_ip:
diff --git a/yardstick/benchmark/runners/iteration.py b/yardstick/benchmark/runners/iteration.py
index c2376af48..29daa0d42 100644
--- a/yardstick/benchmark/runners/iteration.py
+++ b/yardstick/benchmark/runners/iteration.py
@@ -41,6 +41,10 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
interval = runner_cfg.get("interval", 1)
iterations = runner_cfg.get("iterations", 1)
run_step = runner_cfg.get("run_step", "setup,run,teardown")
+ delta = runner_cfg.get("delta", 2)
+ options_cfg = scenario_cfg['options']
+ initial_rate = options_cfg.get("rate", 100)
+ scenario_cfg['options']['rate'] = initial_rate
LOG.info("worker START, iterations %d times, class %s", iterations, cls)
runner_cfg['runner_id'] = os.getpid()
@@ -77,6 +81,10 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
elif sla_action == "monitor":
LOG.warning("SLA validation failed: %s", assertion.args)
errors = assertion.args
+ elif sla_action == "rate-control":
+ scenario_cfg['options']['rate'] -= delta
+ sequence = 1
+ continue
except Exception as e:
errors = traceback.format_exc()
LOG.exception(e)
diff --git a/yardstick/benchmark/scenarios/compute/cyclictest.py b/yardstick/benchmark/scenarios/compute/cyclictest.py
index 37d8472ef..594c6091e 100644
--- a/yardstick/benchmark/scenarios/compute/cyclictest.py
+++ b/yardstick/benchmark/scenarios/compute/cyclictest.py
@@ -165,14 +165,15 @@ class Cyclictest(base.Scenario):
options = self.scenario_cfg["options"]
affinity = options.get("affinity", 1)
+ breaktrace = options.get("breaktrace", 1000)
interval = options.get("interval", 1000)
priority = options.get("priority", 99)
loops = options.get("loops", 1000)
threads = options.get("threads", 1)
histogram = options.get("histogram", 90)
- cmd_args = "-a %s -i %s -p %s -l %s -t %s -h %s %s" \
- % (affinity, interval, priority, loops,
+ cmd_args = "-a %s -b %s -i %s -p %s -l %s -t %s -h %s %s" \
+ % (affinity, breaktrace, interval, priority, loops,
threads, histogram, default_args)
cmd = "bash cyclictest_benchmark.sh %s" % (cmd_args)
LOG.debug("Executing command: %s", cmd)
@@ -214,6 +215,7 @@ def _test(): # pragma: no cover
options = {
"affinity": 2,
+ "breaktrace": 1000,
"interval": 100,
"priority": 88,
"loops": 10000,
diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py
index 33266e233..cb98c356d 100644
--- a/yardstick/common/constants.py
+++ b/yardstick/common/constants.py
@@ -41,7 +41,7 @@ TESTCASE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_cases/')
TESTSUITE_DIR = join(YARDSTICK_ROOT_PATH, 'tests/opnfv/test_suites/')
# file
-OPENRC = get_param('file.openrc', '/etc/yardstick/yardstick.conf')
+OPENRC = get_param('file.openrc', '/etc/yardstick/openstack.creds')
CONF_FILE = join(CONF_DIR, 'yardstick.conf')
CONF_SAMPLE_FILE = join(CONF_SAMPLE_DIR, 'yardstick.conf.sample')
FETCH_SCRIPT = get_param('file.fetch_script', 'utils/fetch_os_creds.sh')
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index 49126f661..fa2da5e11 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -31,6 +31,8 @@ log = logging.getLogger(__name__)
HEAT_KEY_UUID_LENGTH = 8
+PROVIDER_SRIOV = "sriov"
+
def get_short_key_uuid(uuid):
return str(uuid)[:HEAT_KEY_UUID_LENGTH]
@@ -188,13 +190,23 @@ class HeatTemplate(HeatObject):
log.debug("template object '%s' created", name)
- def add_network(self, name):
+ def add_network(self, name, physical_network='physnet1', provider=None):
"""add to the template a Neutron Net"""
log.debug("adding Neutron::Net '%s'", name)
- self.resources[name] = {
- 'type': 'OS::Neutron::Net',
- 'properties': {'name': name}
- }
+ if provider is None:
+ self.resources[name] = {
+ 'type': 'OS::Neutron::Net',
+ 'properties': {'name': name}
+ }
+ else:
+ self.resources[name] = {
+ 'type': 'OS::Neutron::ProviderNet',
+ 'properties': {
+ 'name': name,
+ 'network_type': 'vlan',
+ 'physical_network': physical_network
+ }
+ }
def add_server_group(self, name, policies): # pragma: no cover
"""add to the template a ServerGroup"""
@@ -228,7 +240,6 @@ class HeatTemplate(HeatObject):
def add_router(self, name, ext_gw_net, subnet_name):
"""add to the template a Neutron Router and interface"""
log.debug("adding Neutron::Router:'%s', gw-net:'%s'", name, ext_gw_net)
-
self.resources[name] = {
'type': 'OS::Neutron::Router',
'depends_on': [subnet_name],
@@ -244,7 +255,6 @@ class HeatTemplate(HeatObject):
"""add to the template a Neutron RouterInterface and interface"""
log.debug("adding Neutron::RouterInterface '%s' router:'%s', "
"subnet:'%s'", name, router_name, subnet_name)
-
self.resources[name] = {
'type': 'OS::Neutron::RouterInterface',
'depends_on': [router_name, subnet_name],
@@ -254,7 +264,8 @@ class HeatTemplate(HeatObject):
}
}
- def add_port(self, name, network_name, subnet_name, sec_group_id=None):
+ def add_port(self, name, network_name, subnet_name, sec_group_id=None,
+ provider=None):
"""add to the template a named Neutron Port"""
log.debug("adding Neutron::Port '%s', network:'%s', subnet:'%s', "
"secgroup:%s", name, network_name, subnet_name, sec_group_id)
@@ -269,6 +280,10 @@ class HeatTemplate(HeatObject):
}
}
+ if provider == PROVIDER_SRIOV:
+ self.resources[name]['properties']['binding:vnic_type'] = \
+ 'direct'
+
if sec_group_id:
self.resources[name]['depends_on'].append(sec_group_id)
self.resources[name]['properties']['security_groups'] = \