summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ansible/roles/configure_uwsgi/templates/yardstick.ini.j22
-rw-r--r--ansible/roles/install_dpdk/tasks/main.yml9
-rw-r--r--docker/Dockerfile2
-rw-r--r--docker/Dockerfile.aarch64.patch7
-rw-r--r--samples/vnf_samples/nsut/acl/acl_rules.yaml.sample (renamed from samples/vnf_samples/nsut/acl/acl_rules.yaml)10
-rw-r--r--yardstick/benchmark/contexts/kubernetes.py25
-rw-r--r--yardstick/common/constants.py8
-rw-r--r--yardstick/common/exceptions.py8
-rw-r--r--yardstick/common/httpClient.py4
-rw-r--r--yardstick/tests/unit/benchmark/contexts/test_kubernetes.py8
10 files changed, 60 insertions, 23 deletions
diff --git a/ansible/roles/configure_uwsgi/templates/yardstick.ini.j2 b/ansible/roles/configure_uwsgi/templates/yardstick.ini.j2
index 044f42acb..495febb19 100644
--- a/ansible/roles/configure_uwsgi/templates/yardstick.ini.j2
+++ b/ansible/roles/configure_uwsgi/templates/yardstick.ini.j2
@@ -12,7 +12,7 @@ chmod-socket = 666
callable = app_wrapper
enable-threads = true
close-on-exec = 1
-daemonize = {{ log_dir }}uwsgi.log
+logto = {{ log_dir }}/uwsgi.log
socket = {{ socket_file }}
{# If virtual environment, we need to add:
virtualenv = <virtual_env> #}
diff --git a/ansible/roles/install_dpdk/tasks/main.yml b/ansible/roles/install_dpdk/tasks/main.yml
index 5bcfb50b1..f89a43cae 100644
--- a/ansible/roles/install_dpdk/tasks/main.yml
+++ b/ansible/roles/install_dpdk/tasks/main.yml
@@ -114,9 +114,16 @@
path: "{{ INSTALL_BIN_PATH }}"
state: directory
+- set_fact:
+ major: "{{ dpdk_version.split('.')[0] }}"
+ minor: "{{ dpdk_version.split('.')[1] }}"
+
+- set_fact:
+ major_minor_version: "{{ major }}.{{ minor }}"
+
- name: copy dpdk-devbind.py to correct location
copy:
- src: "{{ dpdk_devbind_usertools if dpdk_version|float >= 17.02 else dpdk_devbind_tools }}"
+ src: "{{ dpdk_devbind_usertools if major_minor_version|float >= 17.02 else dpdk_devbind_tools }}"
dest: "{{ INSTALL_BIN_PATH }}/dpdk-devbind.py"
remote_src: yes
force: yes
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 097bc3c3f..71ce6b584 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -51,6 +51,8 @@ EXPOSE 5000 5672
ADD http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img ${IMAGE_DIR}
ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img ${IMAGE_DIR}
+# For developers: when `docker build ...` is running from YARDSTICK_REPO_DIR, please change
+# path `./exec_tests.sh` -> `./docker/exec_tests.sh``.
COPY ./exec_tests.sh /usr/local/bin/
ENV NSB_DIR="/opt/nsb_bin"
diff --git a/docker/Dockerfile.aarch64.patch b/docker/Dockerfile.aarch64.patch
index ef41cba03..472310f96 100644
--- a/docker/Dockerfile.aarch64.patch
+++ b/docker/Dockerfile.aarch64.patch
@@ -8,7 +8,7 @@ Signed-off-by: ting wu <ting.wu@enea.com>
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
-index 62ea0d0..f2f41771 100644
+index 71ce6b58..952d0f78 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -7,9 +7,9 @@
@@ -42,6 +42,5 @@ index 62ea0d0..f2f41771 100644
+ADD http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img ${IMAGE_DIR}
+ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-disk1.img ${IMAGE_DIR}
- COPY ./exec_tests.sh /usr/local/bin/
-
-
+ # For developers: when `docker build ...` is running from YARDSTICK_REPO_DIR, please change
+ # path `./exec_tests.sh` -> `./docker/exec_tests.sh``.
diff --git a/samples/vnf_samples/nsut/acl/acl_rules.yaml b/samples/vnf_samples/nsut/acl/acl_rules.yaml.sample
index 49066e924..4c425d44f 100644
--- a/samples/vnf_samples/nsut/acl/acl_rules.yaml
+++ b/samples/vnf_samples/nsut/acl/acl_rules.yaml.sample
@@ -14,7 +14,12 @@
---
access-list-entries:
-
- actions: [drop,count]
+ actions:
+ - count
+ - nat:
+ port: 1
+ - fwd:
+ port: 0
matches:
destination-ipv4-network: 152.16.40.20/24
destination-port-range:
@@ -24,6 +29,9 @@ access-list-entries:
source-port-range:
lower-port: 0
upper-port: 65535
+ protocol-mask: 255
+ protocol: 127
+ priority: 1
rule-name: rule1588
-
actions: [drop,count]
diff --git a/yardstick/benchmark/contexts/kubernetes.py b/yardstick/benchmark/contexts/kubernetes.py
index 52d17df4d..a6b3ebad8 100644
--- a/yardstick/benchmark/contexts/kubernetes.py
+++ b/yardstick/benchmark/contexts/kubernetes.py
@@ -16,6 +16,8 @@ import paramiko
from yardstick.benchmark import contexts
from yardstick.benchmark.contexts.base import Context
from yardstick.orchestrator import kubernetes
+from yardstick.common import constants
+from yardstick.common import exceptions
from yardstick.common import kubernetes_utils as k8s_utils
from yardstick.common import utils
@@ -156,19 +158,26 @@ class KubernetesContext(Context):
def _get_server(self, name):
service_name = '{}-service'.format(name)
- service = k8s_utils.get_service_by_name(service_name).ports[0]
-
- host = {
- 'name': service.name,
+ service = k8s_utils.get_service_by_name(service_name)
+ if not service:
+ raise exceptions.KubernetesServiceObjectNotDefined()
+
+ for sn_port in (sn_port for sn_port in service.ports
+ if sn_port.port == constants.SSH_PORT):
+ node_port = sn_port.node_port
+ break
+ else:
+ raise exceptions.KubernetesSSHPortNotDefined()
+
+ return {
+ 'name': name,
'ip': self._get_node_ip(),
'private_ip': k8s_utils.get_pod_by_name(name).status.pod_ip,
- 'ssh_port': service.node_port,
+ 'ssh_port': node_port,
'user': 'root',
- 'key_filename': self.key_path,
+ 'key_filename': self.key_path
}
- return host
-
def _get_node_ip(self):
return k8s_utils.get_node_list().items[0].status.addresses[0].address
diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py
index 2f14d4bc4..4ed40f8af 100644
--- a/yardstick/common/constants.py
+++ b/yardstick/common/constants.py
@@ -6,7 +6,6 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from __future__ import absolute_import
import errno
import os
@@ -14,11 +13,9 @@ from functools import reduce
import pkg_resources
-# this module must only import other modules that do
-# not require loggers to be created, so this cannot
-# include yardstick.common.utils
from yardstick.common.yaml_loader import yaml_load
+
dirname = os.path.dirname
abspath = os.path.abspath
join = os.path.join
@@ -175,3 +172,6 @@ OS_CLOUD_DEFAULT_CONFIG = {'verify': False}
# Kubernetes
SCOPE_NAMESPACED = 'Namespaced'
SCOPE_CLUSTER = 'Cluster'
+
+# VNF definition
+SSH_PORT = 22
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py
index 641c4e1c4..c25acbaf8 100644
--- a/yardstick/common/exceptions.py
+++ b/yardstick/common/exceptions.py
@@ -223,6 +223,14 @@ class KubernetesTemplateInvalidVolumeType(YardstickException):
message = 'No valid "volume" types present in %(volume)s'
+class KubernetesSSHPortNotDefined(YardstickException):
+ message = 'Port 22 needs to be defined'
+
+
+class KubernetesServiceObjectNotDefined(YardstickException):
+ message = 'ServiceObject is not defined'
+
+
class KubernetesCRDObjectDefinitionError(YardstickException):
message = ('Kubernetes Custom Resource Definition Object error, missing '
'parameters: %(missing_parameters)s')
diff --git a/yardstick/common/httpClient.py b/yardstick/common/httpClient.py
index 54f7be670..5b7831144 100644
--- a/yardstick/common/httpClient.py
+++ b/yardstick/common/httpClient.py
@@ -26,10 +26,11 @@ class HttpClient(object):
while True:
try:
response = requests.post(url, data=data, headers=headers)
+ response.raise_for_status()
result = response.json()
logger.debug('The result is: %s', result)
return result
- except Exception:
+ except Exception: # pylint: disable=broad-except
if time.time() > t_end:
logger.exception('')
raise
@@ -37,4 +38,5 @@ class HttpClient(object):
def get(self, url):
response = requests.get(url)
+ response.raise_for_status()
return response.json()
diff --git a/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py b/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py
index 941d50e82..b070b24a9 100644
--- a/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py
+++ b/yardstick/tests/unit/benchmark/contexts/test_kubernetes.py
@@ -13,6 +13,7 @@ import unittest
from yardstick.benchmark import contexts
from yardstick.benchmark.contexts import base
from yardstick.benchmark.contexts import kubernetes
+from yardstick.common import constants
from yardstick.orchestrator import kubernetes as orchestrator_kubernetes
@@ -118,8 +119,8 @@ class KubernetesTestCase(unittest.TestCase):
mock_get_pod_by_name):
class Service(object):
def __init__(self):
- self.name = 'yardstick'
self.node_port = 30000
+ self.port = constants.SSH_PORT
class Services(object):
def __init__(self):
@@ -136,8 +137,9 @@ class KubernetesTestCase(unittest.TestCase):
mock_get_service_by_name.return_value = Services()
mock_get_pod_by_name.return_value = Pod()
mock_get_node_ip.return_value = '172.16.10.131'
-
- self.assertIsNotNone(self.k8s_context._get_server('server'))
+ server = self.k8s_context._get_server('server_name')
+ self.assertEqual('server_name', server['name'])
+ self.assertEqual(30000, server['ssh_port'])
@mock.patch.object(kubernetes.KubernetesContext, '_create_rc')
def test_create_rcs(self, mock_create_rc):