diff options
121 files changed, 2482 insertions, 2356 deletions
diff --git a/ansible/ubuntu_server_cloudimg_modify.yml b/ansible/ubuntu_server_cloudimg_modify.yml index 950655ec8..099d5803f 100644 --- a/ansible/ubuntu_server_cloudimg_modify.yml +++ b/ansible/ubuntu_server_cloudimg_modify.yml @@ -25,6 +25,8 @@ - reset_resolv_conf - add_custom_repos - modify_cloud_config + - role: set_package_installer_proxy + when: proxy_env is defined and proxy_env - install_image_dependencies - download_unixbench - install_unixbench diff --git a/ansible/ubuntu_server_cloudimg_modify_dpdk.yml b/ansible/ubuntu_server_cloudimg_modify_dpdk.yml index 2a087ce91..6bbb383d8 100644 --- a/ansible/ubuntu_server_cloudimg_modify_dpdk.yml +++ b/ansible/ubuntu_server_cloudimg_modify_dpdk.yml @@ -25,6 +25,8 @@ - add_custom_repos - enable_hugepages_on_boot - modify_cloud_config + - role: set_package_installer_proxy + when: proxy_env is defined and proxy_env - install_image_dependencies - download_unixbench - install_unixbench diff --git a/api/database/v2/handlers.py b/api/database/v2/handlers.py index 1bc32bf0e..e4f1dd668 100644 --- a/api/database/v2/handlers.py +++ b/api/database/v2/handlers.py @@ -87,6 +87,11 @@ class V2ImageHandler(object): raise ValueError return image + def delete_by_uuid(self, uuid): + image = self.get_by_uuid(uuid) + db_session.delete(image) + db_session.commit() + class V2PodHandler(object): diff --git a/api/database/v2/models.py b/api/database/v2/models.py index 1e85559cb..59dab3ebc 100644 --- a/api/database/v2/models.py +++ b/api/database/v2/models.py @@ -48,9 +48,6 @@ class V2Image(Base): name = Column(String(30)) description = Column(Text) environment_id = Column(String(30)) - size = Column(String(30)) - status = Column(String(30)) - time = Column(DateTime) class V2Container(Base): diff --git a/api/resources/v2/environments.py b/api/resources/v2/environments.py index f021a3c5a..158e98be7 100644 --- a/api/resources/v2/environments.py +++ b/api/resources/v2/environments.py @@ -35,6 +35,9 @@ class V2Environments(ApiResource): container_info = e['container_id'] e['container_id'] = jsonutils.loads(container_info) if container_info else {} + image_id = e['image_id'] + e['image_id'] = image_id.split(',') if image_id else [] + data = { 'environments': environments } @@ -78,8 +81,13 @@ class V2Environment(ApiResource): return result_handler(consts.API_ERROR, 'no such environment id') environment = change_obj_to_dict(environment) + container_id = environment['container_id'] environment['container_id'] = jsonutils.loads(container_id) if container_id else {} + + image_id = environment['image_id'] + environment['image_id'] = image_id.split(',') if image_id else [] + return result_handler(consts.API_SUCCESS, {'environment': environment}) def delete(self, environment_id): diff --git a/api/resources/v2/images.py b/api/resources/v2/images.py index 8359e105b..0c36a0a26 100644 --- a/api/resources/v2/images.py +++ b/api/resources/v2/images.py @@ -7,76 +7,361 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## import logging -import subprocess +import os +import uuid import threading +import requests +import datetime from api import ApiResource +from api.database.v2.handlers import V2ImageHandler +from api.database.v2.handlers import V2EnvironmentHandler from yardstick.common.utils import result_handler from yardstick.common.utils import source_env from yardstick.common.utils import change_obj_to_dict from yardstick.common.openstack_utils import get_nova_client +from yardstick.common.openstack_utils import get_glance_client from yardstick.common import constants as consts LOG = logging.getLogger(__name__) LOG.setLevel(logging.DEBUG) +IMAGE_MAP = { + 'yardstick-image': { + 'path': os.path.join(consts.IMAGE_DIR, 'yardstick-image.img'), + 'url': 'http://artifacts.opnfv.org/yardstick/images/yardstick-image.img' + }, + 'Ubuntu-16.04': { + 'path': os.path.join(consts.IMAGE_DIR, 'xenial-server-cloudimg-amd64-disk1.img'), + 'url': 'cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img' + }, + 'cirros-0.3.5': { + 'path': os.path.join(consts.IMAGE_DIR, 'cirros-0.3.5-x86_64-disk.img'), + 'url': 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img' + } +} + class V2Images(ApiResource): def get(self): try: source_env(consts.OPENRC) - except: + except Exception: return result_handler(consts.API_ERROR, 'source openrc error') nova_client = get_nova_client() try: images_list = nova_client.images.list() - except: + except Exception: return result_handler(consts.API_ERROR, 'get images error') else: - images = [self.get_info(change_obj_to_dict(i)) for i in images_list] - status = 1 if all(i['status'] == 'ACTIVE' for i in images) else 0 - if not images: - status = 0 + images = {i.name: self.get_info(change_obj_to_dict(i)) for i in images_list} - return result_handler(consts.API_SUCCESS, {'status': status, 'images': images}) + return result_handler(consts.API_SUCCESS, {'status': 1, 'images': images}) def post(self): return self._dispatch_post() def get_info(self, data): + try: + size = data['OS-EXT-IMG-SIZE:size'] + except KeyError: + size = None + else: + size = float(size) / 1024 / 1024 + result = { 'name': data.get('name', ''), - 'size': data.get('OS-EXT-IMG-SIZE:size', ''), - 'status': data.get('status', ''), - 'time': data.get('updated', '') + 'discription': data.get('description', ''), + 'size': size, + 'status': data.get('status'), + 'time': data.get('updated') } return result def load_image(self, args): - thread = threading.Thread(target=self._load_images) + try: + image_name = args['name'] + except KeyError: + return result_handler(consts.API_ERROR, 'image name must provided') + + if image_name not in IMAGE_MAP: + return result_handler(consts.API_ERROR, 'wrong image name') + + thread = threading.Thread(target=self._do_load_image, args=(image_name,)) thread.start() + return result_handler(consts.API_SUCCESS, {'image': image_name}) + + def upload_image(self, args): + try: + image_file = args['file'] + except KeyError: + return result_handler(consts.API_ERROR, 'file must be provided') + + try: + environment_id = args['environment_id'] + except KeyError: + return result_handler(consts.API_ERROR, 'environment_id must be provided') + + try: + uuid.UUID(environment_id) + except ValueError: + return result_handler(consts.API_ERROR, 'invalid environment id') + + environment_handler = V2EnvironmentHandler() + try: + environment = environment_handler.get_by_uuid(environment_id) + except ValueError: + return result_handler(consts.API_ERROR, 'no such environment') + + file_path = os.path.join(consts.IMAGE_DIR, image_file.filename) + LOG.info('saving file') + image_file.save(file_path) + + LOG.info('loading image') + self._load_image(image_file.filename, file_path) + + LOG.info('creating image in DB') + image_handler = V2ImageHandler() + image_id = str(uuid.uuid4()) + image_init_data = { + 'uuid': image_id, + 'name': image_file.filename, + 'environment_id': environment_id + } + image_handler.insert(image_init_data) + + LOG.info('update image in environment') + if environment.image_id: + image_list = environment.image_id.split(',') + image_list.append(image_id) + new_image_id = ','.join(image_list) + else: + new_image_id = image_id + + environment_handler.update_attr(environment_id, {'image_id': new_image_id}) + + return result_handler(consts.API_SUCCESS, {'uuid': image_id}) + + def upload_image_by_url(self, args): + try: + url = args['url'] + except KeyError: + return result_handler(consts.API_ERROR, 'url must be provided') + + try: + environment_id = args['environment_id'] + except KeyError: + return result_handler(consts.API_ERROR, 'environment_id must be provided') + + try: + uuid.UUID(environment_id) + except ValueError: + return result_handler(consts.API_ERROR, 'invalid environment id') + + environment_handler = V2EnvironmentHandler() + try: + environment = environment_handler.get_by_uuid(environment_id) + except ValueError: + return result_handler(consts.API_ERROR, 'no such environment') + + thread = threading.Thread(target=self._do_upload_image_by_url, args=(url,)) + thread.start() + + file_name = url.split('/')[-1] + + LOG.info('creating image in DB') + image_handler = V2ImageHandler() + image_id = str(uuid.uuid4()) + image_init_data = { + 'uuid': image_id, + 'name': file_name, + 'environment_id': environment_id + } + image_handler.insert(image_init_data) + + LOG.info('update image in environment') + if environment.image_id: + image_list = environment.image_id.split(',') + image_list.append(image_id) + new_image_id = ','.join(image_list) + else: + new_image_id = image_id + + environment_handler.update_attr(environment_id, {'image_id': new_image_id}) + + return result_handler(consts.API_SUCCESS, {'uuid': image_id}) + + def delete_image(self, args): + try: + image_name = args['name'] + except KeyError: + return result_handler(consts.API_ERROR, 'image name must provided') + + if image_name not in IMAGE_MAP: + return result_handler(consts.API_ERROR, 'wrong image name') + + glance_client = get_glance_client() + try: + image = next((i for i in glance_client.images.list() if i.name == image_name)) + except StopIteration: + return result_handler(consts.API_ERROR, 'can not find image') + + glance_client.images.delete(image.id) + return result_handler(consts.API_SUCCESS, {}) - def _load_images(self): + def _do_upload_image_by_url(self, url): + file_name = url.split('/')[-1] + path = os.path.join(consts.IMAGE_DIR, file_name) + + LOG.info('download image') + self._download_image(url, path) + + LOG.info('loading image') + self._load_image(file_name, path) + + def _do_load_image(self, image_name): + if not os.path.exists(IMAGE_MAP[image_name]['path']): + self._download_image(IMAGE_MAP[image_name]['url'], + IMAGE_MAP[image_name]['path']) + + self._load_image(image_name, IMAGE_MAP[image_name]['path']) + + def _load_image(self, image_name, image_path): LOG.info('source openrc') source_env(consts.OPENRC) - LOG.info('clean images') - cmd = [consts.CLEAN_IMAGES_SCRIPT] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, - cwd=consts.REPOS_DIR) - _, err = p.communicate() - if p.returncode != 0: - LOG.error('clean image failed: %s', err) - - LOG.info('load images') - cmd = [consts.LOAD_IMAGES_SCRIPT] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, - cwd=consts.REPOS_DIR) - _, err = p.communicate() - if p.returncode != 0: - LOG.error('load image failed: %s', err) + LOG.info('load image') + glance_client = get_glance_client() + image = glance_client.images.create(name=image_name, + visibility='public', + disk_format='qcow2', + container_format='bare') + with open(image_path, 'rb') as f: + glance_client.images.upload(image.id, f) LOG.info('Done') + + def _download_image(self, url, path): + start = datetime.datetime.now().replace(microsecond=0) + + LOG.info('download image from: %s', url) + self._download_file(url, path) + + end = datetime.datetime.now().replace(microsecond=0) + LOG.info('download image success, total: %s s', end - start) + + def _download_handler(self, start, end, url, filename): + + headers = {'Range': 'bytes=%d-%d' % (start, end)} + r = requests.get(url, headers=headers, stream=True) + + with open(filename, "r+b") as fp: + fp.seek(start) + fp.tell() + fp.write(r.content) + + def _download_file(self, url, path, num_thread=5): + + r = requests.head(url) + try: + file_size = int(r.headers['content-length']) + except Exception: + return + + with open(path, 'wb') as f: + f.truncate(file_size) + + thread_list = [] + part = file_size // num_thread + for i in range(num_thread): + start = part * i + end = start + part if i != num_thread - 1 else file_size + + kwargs = {'start': start, 'end': end, 'url': url, 'filename': path} + t = threading.Thread(target=self._download_handler, kwargs=kwargs) + t.setDaemon(True) + t.start() + thread_list.append(t) + + for t in thread_list: + t.join() + + +class V2Image(ApiResource): + def get(self, image_id): + try: + uuid.UUID(image_id) + except ValueError: + return result_handler(consts.API_ERROR, 'invalid image id') + + image_handler = V2ImageHandler() + try: + image = image_handler.get_by_uuid(image_id) + except ValueError: + return result_handler(consts.API_ERROR, 'no such image id') + + nova_client = get_nova_client() + images = nova_client.images.list() + try: + image = next((i for i in images if i.name == image.name)) + except StopIteration: + pass + + return_image = self.get_info(change_obj_to_dict(image)) + return_image['id'] = image_id + + return result_handler(consts.API_SUCCESS, {'image': return_image}) + + def delete(self, image_id): + try: + uuid.UUID(image_id) + except ValueError: + return result_handler(consts.API_ERROR, 'invalid image id') + + image_handler = V2ImageHandler() + try: + image = image_handler.get_by_uuid(image_id) + except ValueError: + return result_handler(consts.API_ERROR, 'no such image id') + + LOG.info('delete image in openstack') + glance_client = get_glance_client() + try: + image_o = next((i for i in glance_client.images.list() if i.name == image.name)) + except StopIteration: + return result_handler(consts.API_ERROR, 'can not find image') + + glance_client.images.delete(image_o.id) + + LOG.info('delete image in environment') + environment_id = image.environment_id + environment_handler = V2EnvironmentHandler() + environment = environment_handler.get_by_uuid(environment_id) + image_list = environment.image_id.split(',') + image_list.remove(image_id) + environment_handler.update_attr(environment_id, {'image_id': ','.join(image_list)}) + + LOG.info('delete image in DB') + image_handler.delete_by_uuid(image_id) + + return result_handler(consts.API_SUCCESS, {'image': image_id}) + + def get_info(self, data): + try: + size = data['OS-EXT-IMG-SIZE:size'] + except KeyError: + size = None + else: + size = float(size) / 1024 / 1024 + + result = { + 'name': data.get('name', ''), + 'description': data.get('description', ''), + 'size': size, + 'status': data.get('status'), + 'time': data.get('updated') + } + return result diff --git a/api/server.py b/api/server.py index 158b8a508..37a1ab6a6 100644 --- a/api/server.py +++ b/api/server.py @@ -35,6 +35,7 @@ except ImportError: LOG = logging.getLogger(__name__) app = Flask(__name__) +app.config['MAX_CONTENT_LENGTH'] = 2 * 1024 * 1024 * 1024 Swagger(app) diff --git a/api/urls.py b/api/urls.py index 83cf4daf9..9b0040b6c 100644 --- a/api/urls.py +++ b/api/urls.py @@ -36,6 +36,7 @@ urlpatterns = [ Url('/api/v2/yardstick/images', 'v2_images'), Url('/api/v2/yardstick/images/action', 'v2_images'), + Url('/api/v2/yardstick/images/<image_id>', 'v2_image'), Url('/api/v2/yardstick/containers', 'v2_containers'), Url('/api/v2/yardstick/containers/action', 'v2_containers'), diff --git a/docker/nginx.sh b/docker/nginx.sh index 74009f5bd..1ac1d3f42 100755 --- a/docker/nginx.sh +++ b/docker/nginx.sh @@ -20,6 +20,7 @@ server { index index.htm index.html; location / { include uwsgi_params; + client_max_body_size 2000m; uwsgi_pass unix:///var/run/yardstick.sock; } diff --git a/docs/testing/user/userguide/14-nsb_installation.rst b/docs/testing/user/userguide/14-nsb_installation.rst index 3eb17bbca..7c5327964 100644 --- a/docs/testing/user/userguide/14-nsb_installation.rst +++ b/docs/testing/user/userguide/14-nsb_installation.rst @@ -103,7 +103,7 @@ Config yardstick conf cp ./etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf vi /etc/yardstick/yardstick.conf -Add trex_path and bin_path in 'nsb' section. +Add trex_path, trex_client_lib and bin_path in 'nsb' section. :: @@ -121,6 +121,7 @@ Add trex_path and bin_path in 'nsb' section. [nsb] trex_path=/opt/nsb_bin/trex/scripts bin_path=/opt/nsb_bin + trex_client_lib=/opt/nsb_bin/trex_client/stl Config pod.yaml describing Topology diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc057.rst b/docs/testing/user/userguide/opnfv_yardstick_tc057.rst new file mode 100644 index 000000000..2a4ce40c0 --- /dev/null +++ b/docs/testing/user/userguide/opnfv_yardstick_tc057.rst @@ -0,0 +1,165 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International +.. License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) OPNFV, Yin Kanglin and others. +.. 14_ykl@tongji.edu.cn + +************************************* +Yardstick Test Case Description TC057 +************************************* + ++-----------------------------------------------------------------------------+ +|OpenStack Controller Cluster Management Service High Availability | ++==============+==============================================================+ +|test case id | | ++--------------+--------------------------------------------------------------+ +|test purpose | This test case will verify the quorum configuration of the | +| | cluster manager(pacemaker) on controller nodes. When a | +| | controller node , which holds all active application | +| | resources, failed to communicate with other cluster nodes | +| | (via corosync), the test case will check whether the standby | +| | application resources will take place of those active | +| | application resources which should be regarded to be down in | +| | the cluster manager. | ++--------------+--------------------------------------------------------------+ +|test method | This test case kills the processes of cluster messaging | +| | service(corosync) on a selected controller node(the node | +| | holds the active application resources), then checks whether | +| | active application resources are switched to other | +| | controller nodes and whether the Openstack commands are OK. | ++--------------+--------------------------------------------------------------+ +|attackers | In this test case, an attacker called "kill-process" is | +| | needed. This attacker includes three parameters: | +| | 1) fault_type: which is used for finding the attacker's | +| | scripts. It should be always set to "kill-process" in this | +| | test case. | +| | 2) process_name: which is the process name of the load | +| | balance service. If there are multiple processes use the | +| | same name on the host, all of them are killed by this | +| | attacker. | +| | 3) host: which is the name of a control node being attacked. | +| | | +| | In this case, this process name should set to "corosync" , | +| | for example | +| | -fault_type: "kill-process" | +| | -process_name: "corosync" | +| | -host: node1 | ++--------------+--------------------------------------------------------------+ +|monitors | In this test case, a kind of monitor is needed: | +| | 1. the "openstack-cmd" monitor constantly request a specific | +| | Openstack command, which needs two parameters: | +| | 1) monitor_type: which is used for finding the monitor class | +| | and related scripts. It should be always set to | +| | "openstack-cmd" for this monitor. | +| | 2) command_name: which is the command name used for request | +| | | +| | In this case, the command_name of monitor1 should be services| +| | that are managed by the cluster manager. (Since rabbitmq and | +| | haproxy are managed by pacemaker, most Openstack Services | +| | can be used to check high availability in this case) | +| | | +| | (e.g.) | +| | monitor1: | +| | -monitor_type: "openstack-cmd" | +| | -command_name: "nova image-list" | +| | monitor2: | +| | -monitor_type: "openstack-cmd" | +| | -command_name: "neutron router-list" | +| | monitor3: | +| | -monitor_type: "openstack-cmd" | +| | -command_name: "heat stack-list" | +| | monitor4: | +| | -monitor_type: "openstack-cmd" | +| | -command_name: "cinder list" | +| | | ++--------------+--------------------------------------------------------------+ +|checkers | In this test case, a checker is needed, the checker will | +| | the status of application resources in pacemaker and the | +| | checker have three parameters: | +| | 1) checker_type: which is used for finding the result | +| | checker class and related scripts. In this case the checker | +| | type will be "pacemaker-check-resource" | +| | 2) resource_name: the application resource name | +| | 3) resource_status: the expected status of the resource | +| | 4) expectedValue: the expected value for the output of the | +| | checker script, in the case the expected value will be the | +| | identifier in the cluster manager | +| | 3) condition: whether the expected value is in the output of | +| | checker script or is totally same with the output. | +| | (note: pcs is required to installed on controller node in | +| | order to run this checker) | +| | | +| | (e.g.) | +| | checker1: | +| | -checker_type: "pacemaker-check-resource" | +| | -resource_name: "p_rabbitmq-server" | +| | -resource_status: "Stopped" | +| | -expectedValue: "node-1" | +| | -condition: "in" | +| | checker2: | +| | -checker_type: "pacemaker-check-resource" | +| | -resource_name: "p_rabbitmq-server" | +| | -resource_status: "Master" | +| | -expectedValue: "node-2" | +| | -condition: "in" | ++--------------+--------------------------------------------------------------+ +|metrics | In this test case, there are two metrics: | +| | 1)service_outage_time: which indicates the maximum outage | +| | time (seconds) of the specified Openstack command request. | ++--------------+--------------------------------------------------------------+ +|test tool | None. Self-developed. | ++--------------+--------------------------------------------------------------+ +|references | ETSI NFV REL001 | ++--------------+--------------------------------------------------------------+ +|configuration | This test case needs two configuration files: | +| | 1) test case file: opnfv_yardstick_tc057.yaml | +| | -Attackers: see above "attackers" description | +| | -Monitors: see above "monitors" description | +| | -Checkers: see above "checkers" description | +| | -Steps: the test case execution step, see "test sequence" | +| | description below | +| | | +| | 2)POD file: pod.yaml | +| | The POD configuration should record on pod.yaml first. | +| | the "host" item in this test case will use the node name in | +| | the pod.yaml. | ++--------------+------+----------------------------------+--------------------+ +|test sequence | description and expected result | +| | | ++--------------+--------------------------------------------------------------+ +|step 1 | start monitors: | +| | each monitor will run with independently process | +| | | +| | Result: The monitor info will be collected. | +| | | ++--------------+--------------------------------------------------------------+ +|step 2 | do attacker: connect the host through SSH, and then execute | +| | the kill process script with param value specified by | +| | "process_name" | +| | | +| | Result: Process will be killed. | +| | | ++--------------+--------------------------------------------------------------+ +|step 3 | do checker: check whether the status of application | +| | resources on different nodes are updated | +| | | ++--------------+--------------------------------------------------------------+ +|step 4 | stop monitors after a period of time specified by | +| | "waiting_time" | +| | | +| | Result: The monitor info will be aggregated. | +| | | ++--------------+--------------------------------------------------------------+ +|step 5 | verify the SLA | +| | | +| | Result: The test case is passed or not. | +| | | ++--------------+------+----------------------------------+--------------------+ +|post-action | It is the action when the test cases exist. It will check the| +| | status of the cluster messaging process(corosync) on the | +| | host, and restart the process if it is not running for next | +| | test cases | ++--------------+------+----------------------------------+--------------------+ +|test verdict | Fails only if SLA is not passed, or if there is a test case | +| | execution problem. | ++--------------+--------------------------------------------------------------+ diff --git a/etc/yardstick/yardstick.conf.sample b/etc/yardstick/yardstick.conf.sample index 227aded2d..5675cc3bd 100644 --- a/etc/yardstick/yardstick.conf.sample +++ b/etc/yardstick/yardstick.conf.sample @@ -31,3 +31,4 @@ password = root [nsb] trex_path=/opt/nsb_bin/trex/scripts bin_path=/opt/nsb_bin +trex_client_lib=/opt/nsb_bin/trex_client/stl diff --git a/gui/app/scripts/controllers/image.controller.js b/gui/app/scripts/controllers/image.controller.js index f6c91592f..d7a7edfa9 100644 --- a/gui/app/scripts/controllers/image.controller.js +++ b/gui/app/scripts/controllers/image.controller.js @@ -1,150 +1,235 @@ 'use strict'; angular.module('yardStickGui2App') - .controller('ImageController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', '$location', '$interval', - function($scope, $state, $stateParams, mainFactory, Upload, toaster, $location, $interval) { + .controller('ImageController', ['$scope', '$state', '$stateParams', 'mainFactory', 'Upload', 'toaster', '$location', '$interval', 'ngDialog', + function($scope, $state, $stateParams, mainFactory, Upload, toaster, $location, $interval, ngDialog) { init(); - $scope.showloading = false; - $scope.ifshowStatus = 0; function init() { + $scope.showloading = false; + $scope.ifshowStatus = 0; + + $scope.yardstickImage = [ + { + 'name': 'yardstick-image', + 'description': '', + 'size': 'N/A', + 'status': 'N/A', + 'time': 'N/A' + }, + { + 'name': 'Ubuntu-16.04', + 'description': '', + 'size': 'N/A', + 'status': 'N/A', + 'time': 'N/A' + }, + { + 'name': 'cirros-0.3.5', + 'description': '', + 'size': 'N/A', + 'status': 'N/A', + 'time': 'N/A' + } + ]; + $scope.customImage = []; $scope.uuid = $stateParams.uuid; - $scope.uploadImage = uploadImage; - getItemIdDetail(); - getImageListSimple(); + $scope.showloading = false; + $scope.url = null; + $scope.environmentInfo = null; + + getYardstickImageList(); + getCustomImageList(function(image, image_id){}); } - function getItemIdDetail() { + function getYardstickImageList(){ + mainFactory.ImageList().get({}).$promise.then(function(response){ + if(response.status == 1){ + angular.forEach($scope.yardstickImage, function(ele, index){ + if(typeof(response.result.images[ele.name]) != 'undefined'){ + $scope.yardstickImage[index] = response.result.images[ele.name]; + } + }); + }else{ + mainFactory.errorHandler1(response); + } + }, function(response){ + mainFactory.errorHandler2(response); + }); + } + + function getCustomImageList(func){ mainFactory.ItemDetail().get({ 'envId': $stateParams.uuid }).$promise.then(function(response) { - if (response.status == 1) { - $scope.baseElementInfo = response.result.environment; - - - } else { - toaster.pop({ - type: 'error', - title: 'fail', - body: response.error_msg, - timeout: 3000 + if(response.status == 1){ + $scope.environmentInfo = response.result.environment; + $scope.customImage = []; + angular.forEach(response.result.environment.image_id, function(ele){ + mainFactory.getImage().get({'imageId': ele}).$promise.then(function(responseData){ + if(responseData.status == 1){ + $scope.customImage.push(responseData.result.image); + func(responseData.result.image, ele); + }else{ + mainFactory.errorHandler1(responseData); + } + }, function(errorData){ + mainFactory.errorHandler2(errorData); + }); }); + }else{ + mainFactory.errorHandler1(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'fail', - body: 'unknow error', - timeout: 3000 - }); - }) + }, function(response){ + mainFactory.errorHandler2(response); + }); } - function getImageListSimple() { - - mainFactory.ImageList().get({}).$promise.then(function(response) { - if (response.status == 1) { - $scope.imageListData = response.result.images; - // $scope.imageStatus = response.result.status; - - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); - } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + $scope.loadYardstickImage = function(image_name){ + + var updateImageTask = $interval(updateYardstickImage, 10000); + + function updateYardstickImage(){ + mainFactory.ImageList().get({}).$promise.then(function(responseData){ + if(responseData.status == 1){ + if(typeof(responseData.result.images[image_name]) != 'undefined' && responseData.result.images[image_name].status == 'ACTIVE'){ + angular.forEach($scope.yardstickImage, function(ele, index){ + if(ele.name == image_name){ + $scope.yardstickImage[index] = responseData.result.images[ele.name]; + } + }); + $interval.cancel(updateImageTask); + } + }else{ + mainFactory.errorHandler1(responseData); + } + },function(errorData){ + mainFactory.errorHandler2(errorData); }); - }) - } + } + mainFactory.uploadImage().post({'action': 'load_image', 'args': {'name': image_name}}).$promise.then(function(response){ + },function(response){ + mainFactory.errorHandler2(response); + }); + } - function getImageList() { - if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); - } - mainFactory.ImageList().get({}).$promise.then(function(response) { - if (response.status == 1) { - $scope.imageListData = response.result.images; - $scope.imageStatus = response.result.status; - - if ($scope.imageStatus == 0) { - $scope.intervalImgae = $interval(function() { - getImageList(); - }, 5000); - } else if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); + $scope.deleteYardstickImage = function(image_name){ + + var updateImageTask = $interval(updateYardstickImage, 10000); + + function updateYardstickImage(){ + mainFactory.ImageList().get({}).$promise.then(function(response){ + if(response.status == 1){ + if(typeof(response.result.images[image_name]) == 'undefined'){ + angular.forEach($scope.yardstickImage, function(ele, index){ + if(ele.name == image_name){ + $scope.yardstickImage[index].size = 'N/A'; + $scope.yardstickImage[index].status = 'N/A'; + $scope.yardstickImage[index].time = 'N/A'; + } + }); + $interval.cancel(updateImageTask); + } + }else{ + mainFactory.errorHandler1(response); } + },function(response){ + mainFactory.errorHandler2(response); + }); + } - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + mainFactory.uploadImage().post({'action': 'delete_image', 'args': {'name': image_name}}).$promise.then(function(response){ + },function(response){ + mainFactory.errorHandler2(response); + }); + } + + $scope.uploadCustomImageByUrl = function(url){ + mainFactory.uploadImageByUrl().post({ + 'action': 'upload_image_by_url', + 'args': { + 'environment_id': $stateParams.uuid, + 'url': url + } + }).$promise.then(function(response){ + if(response.status == 1){ + var updateImageTask = $interval(getCustomImageList, 30000, 10, true, function(image, image_id){ + if(image_id == response.result.uuid && image.status == 'ACTIVE'){ + $interval.cancel(updateImageTask); + } }); + ngDialog.close(); + }else{ + mainFactory.errorHandler1(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); - }) + }, function(response){ + mainFactory.errorHandler2(response); + }); } - function uploadImage() { - $scope.imageStatus = 0; - $interval.cancel($scope.intervalImgae); - $scope.ifshowStatus = 1; + $scope.uploadCustomImage = function($file, $invalidFiles) { $scope.showloading = true; - mainFactory.uploadImage().post({ - 'action': 'load_image', - 'args': { - 'environment_id': $scope.uuid - } - }).$promise.then(function(response) { + $scope.displayImageFile = $file; + Upload.upload({ + url: Base_URL + '/api/v2/yardstick/images', + data: { file: $file, 'environment_id': $scope.uuid, 'action': 'upload_image' } + }).then(function(response) { + $scope.showloading = false; - if (response.status == 1) { + if (response.data.status == 1) { + toaster.pop({ type: 'success', - title: 'create success', + title: 'upload success', body: 'you can go next step', timeout: 3000 }); - setTimeout(function() { - getImageList(); - }, 10000); - } else { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 + var updateImageTask = $interval(getCustomImageList, 10000, 10, true, function(image, image_id){ + if(image_id == response.data.result.uuid && image.status == 'ACTIVE'){ + $interval.cancel(updateImageTask); + } }); + }else{ + mainFactory.errorHandler1(response); + } + }, function(response) { + $scope.uploadfile = null; + mainFactory.errorHandler2(response); + }) + } + + $scope.deleteCustomImage = function(image_id){ + mainFactory.deleteImage().delete({'imageId': image_id}).$promise.then(function(response){ + if(response.status == 1){ + $interval(getCustomImageList, 10000, 5, true, function(image, image_id){ + }); + }else{ + mainFactory.errorHandler2(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 - }); + }, function(response){ + mainFactory.errorHandler2(response); + }); + } + + $scope.openImageDialog = function(){ + $scope.url = null; + ngDialog.open({ + preCloseCallback: function(value) { + }, + template: 'views/modal/imageDialog.html', + scope: $scope, + className: 'ngdialog-theme-default', + width: 950, + showClose: true, + closeByDocument: false }) } @@ -158,9 +243,5 @@ angular.module('yardStickGui2App') $state.go('app.podUpload', { uuid: $scope.uuid }); } - - - - } ]); diff --git a/gui/app/scripts/controllers/main.js b/gui/app/scripts/controllers/main.js index ab76bf0f2..ceec83fa9 100644 --- a/gui/app/scripts/controllers/main.js +++ b/gui/app/scripts/controllers/main.js @@ -15,7 +15,7 @@ angular.module('yardStickGui2App') $scope.showImage = null; $scope.showContainer = null; $scope.showNextOpenRc = null; - $scope.showNextPod = null; + $scope.showNextPod = 1; $scope.displayContainerInfo = []; $scope.containerList = [{ value: 'create_influxdb', name: "InfluxDB" }, { value: 'create_grafana', name: "Grafana" }] @@ -51,7 +51,6 @@ angular.module('yardStickGui2App') $scope.chooseResult = chooseResult; getEnvironmentList(); - // getImageList(); } @@ -85,7 +84,7 @@ angular.module('yardStickGui2App') } $scope.goToImage = function goToImage() { - getImageListSimple(); + getImageList(); $scope.showImage = 1; } $scope.goToPod = function goToPod() { @@ -290,7 +289,7 @@ angular.module('yardStickGui2App') $scope.showImage = null; $scope.showContainer = null; $scope.showNextOpenRc = null; - $scope.showNextPod = null; + $scope.showNextPod = 1; $scope.displayContainerInfo = []; $scope.displayPodFile = null; @@ -308,7 +307,6 @@ angular.module('yardStickGui2App') ngDialog.open({ preCloseCallback: function(value) { getEnvironmentList(); - // getImageList(); }, template: 'views/modal/environmentDialog.html', scope: $scope, @@ -479,106 +477,97 @@ angular.module('yardStickGui2App') }) } - $scope.uploadImage = function uploadImage() { - $scope.imageStatus = 0; - $scope.showImageStatus = 1; - $scope.showloading = true; - mainFactory.uploadImage().post({ - 'action': 'load_image', - 'args': { - 'environment_id': $scope.uuid + $scope.yardstickImage = { + 'yardstick-image': { + 'name': 'yardstick-image', + 'description': '', + 'status': 'N/A' + }, + 'Ubuntu-16.04': { + 'name': 'Ubuntu-16.04', + 'description': '', + 'status': 'N/A' + }, + 'cirros-0.3.5': { + 'name': 'cirros-0.3.5', + 'description': '', + 'status': 'N/A' + } + }; - } - }).$promise.then(function(response) { - $scope.showloading = false; - if (response.status == 1) { - toaster.pop({ - type: 'success', - title: 'create success', - body: 'you can go next step', - timeout: 3000 - }); - setTimeout(function() { - getImageList(); - }, 10000); - $scope.showNextPod = 1; + $scope.selectImageList = []; - } else { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 - }); + $scope.selectImage = function(name){ + $scope.selectImageList.push(name); + } - } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'failed', - body: 'something wrong', - timeout: 3000 - }); - }) + $scope.unselectImage = function(name){ + var index = $scope.selectImageList.indexOf(name); + $scope.selectImageList.splice(index, 1); } - function getImageList() { - if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); - } - mainFactory.ImageList().get({}).$promise.then(function(response) { - if (response.status == 1) { - $scope.imageListData = response.result.images; - $scope.imageStatus = response.result.status; + $scope.uploadImage = function() { + $scope.imageStatus = 0; + $scope.showImageStatus = 1; + $scope.showloading = true; - if ($scope.imageStatus == 0) { - $scope.intervalImgae = $interval(function() { - getImageList(); - }, 5000); - } else if ($scope.intervalImgae != undefined) { - $interval.cancel($scope.intervalImgae); + var updateImageTask = $interval(function(){ + mainFactory.ImageList().get({}).$promise.then(function(response){ + if(response.status == 1){ + var isOk = true; + angular.forEach($scope.selectImageList, function(ele){ + if(typeof(response.result.images[ele]) != 'undefined' && response.result.images[ele].status == 'ACTIVE'){ + $scope.yardstickImage[ele] = response.result.images[ele]; + }else{ + isOk = false; + } + }); + if(isOk){ + $interval.cancel(updateImageTask); + $scope.imageStatus = 1; + } + }else{ + mainFactory.errorHandler1(response); } - - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); - } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + }, function(response){ + mainFactory.errorHandler2(response); }); - }) + }, 10000); + + angular.forEach($scope.selectImageList, function(ele){ + mainFactory.uploadImage().post({ + 'action': 'load_image', + 'args': { + 'name': ele + } + }).$promise.then(function(response) { + if(response.status == 1){ + $scope.showloading = false; + $scope.showNextPod = 1; + }else{ + mainFactory.errorHandler1(response); + } + }, function(response) { + mainFactory.errorHandler2(response); + }) + }); } - function getImageListSimple() { + function getImageList() { mainFactory.ImageList().get({}).$promise.then(function(response) { if (response.status == 1) { - $scope.imageListData = response.result.images; - $scope.imageStatus = response.result.status; - - } else { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 + angular.forEach($scope.yardstickImage, function(value, key){ + if(typeof(response.result.images[key]) != 'undefined'){ + $scope.yardstickImage[key] = response.result.images[key]; + } }); + $scope.imageStatus = response.result.status; + }else{ + mainFactory.errorHandler1(response); } - }, function(error) { - toaster.pop({ - type: 'error', - title: 'get data failed', - body: 'please retry', - timeout: 3000 - }); + }, function(response) { + mainFactory.errorHandler2(response); }) } diff --git a/gui/app/scripts/controllers/projectDetail.controller.js b/gui/app/scripts/controllers/projectDetail.controller.js index 843f66c57..e8468045d 100644 --- a/gui/app/scripts/controllers/projectDetail.controller.js +++ b/gui/app/scripts/controllers/projectDetail.controller.js @@ -672,7 +672,7 @@ angular.module('yardStickGui2App') } $scope.gotoLog = function gotoLog(task_id) { - $state.go('app2.taskLog', { taskId: task_id }); + $state.go('app.taskLog', { taskId: task_id }); } } ]); diff --git a/gui/app/scripts/factory/main.factory.js b/gui/app/scripts/factory/main.factory.js index 44fbeb39f..7637a9ff3 100644 --- a/gui/app/scripts/factory/main.factory.js +++ b/gui/app/scripts/factory/main.factory.js @@ -9,7 +9,7 @@ var Base_URL; var Grafana_URL; angular.module('yardStickGui2App') - .factory('mainFactory', ['$resource','$rootScope','$http', '$location',function($resource, $rootScope,$http,$location) { + .factory('mainFactory', ['$resource','$rootScope','$http', '$location', 'toaster',function($resource, $rootScope ,$http ,$location, toaster) { Base_URL = 'http://' + $location.host() + ':' + $location.port(); Grafana_URL = 'http://' + $location.host(); @@ -86,6 +86,20 @@ angular.module('yardStickGui2App') } }) }, + getImage: function(){ + return $resource(Base_URL + '/api/v2/yardstick/images/:imageId', {imageId: "@imageId"}, { + 'get': { + method: 'GET' + } + }) + }, + deleteImage: function() { + return $resource(Base_URL + '/api/v2/yardstick/images/:imageId', { imageId: '@imageId' }, { + 'delete': { + method: 'DELETE' + } + }) + }, uploadImage: function() { return $resource(Base_URL + '/api/v2/yardstick/images', {}, { 'post': { @@ -93,6 +107,13 @@ angular.module('yardStickGui2App') } }) }, + uploadImageByUrl: function() { + return $resource(Base_URL + '/api/v2/yardstick/images', {}, { + 'post': { + method: 'POST' + } + }) + }, getPodDetail: function() { return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: "@podId" }, { 'get': { @@ -249,6 +270,22 @@ angular.module('yardStickGui2App') method: 'DELETE' } }) + }, + errorHandler1: function(response){ + toaster.pop({ + 'type': 'error', + 'title': 'error', + 'body': response.result, + 'showCloseButton': true + }); + }, + errorHandler2: function(response){ + toaster.pop({ + 'type': 'error', + 'title': response.status, + 'body': response.statusText, + 'showCloseButton': true + }); } }; diff --git a/gui/app/views/modal/environmentDialog.html b/gui/app/views/modal/environmentDialog.html index 389de8340..4c539fc33 100644 --- a/gui/app/views/modal/environmentDialog.html +++ b/gui/app/views/modal/environmentDialog.html @@ -133,16 +133,17 @@ <table class="table table-striped"> <tr> + <th>choose</th> <th>name</th> - <th>size</th> + <th>description</th> <th>status</th> - <th>time</th> </tr> - <tr ng-repeat="image in imageListData"> - <td>{{image.name}}</td> - <td>{{image.size/1024}} mb</td> - <td>{{image.status}}</td> - <td>{{image.time}}</td> + <tr ng-repeat="(name, value) in yardstickImage"> + <td ng-if="selectImageList.indexOf(name) > -1"><img src="images/checkyes.png" style="height:12px;cursor:pointer" ng-click="unselectImage(name)" /></td> + <td ng-if="selectImageList.indexOf(name) == -1"><img src="images/checkno.png" style="height:12px;cursor:pointer" ng-click="selectImage(name)" /></td> + <td>{{name}}</td> + <td>{{value.description}}</td> + <td>{{value.status}}</td> </tr> diff --git a/gui/app/views/modal/imageDialog.html b/gui/app/views/modal/imageDialog.html new file mode 100644 index 000000000..c568f2aba --- /dev/null +++ b/gui/app/views/modal/imageDialog.html @@ -0,0 +1,19 @@ +<div> + + <h4>Enter Remote Image Url</h4> + <input type="text" ng-model="url" /> + + <div style="text-align:center;margin-top:20px;"> + <button class="btn btn-default" ng-disabled=" url==null || url==''" ng-click="uploadCustomImageByUrl(url)">Upload</button> + </div> + +</div> + + +<style> + input { + border-radius: 10px; + border: 1px solid #eeeeee; + width: 100%; + } +</style> diff --git a/gui/app/views/podupload.html b/gui/app/views/podupload.html index 99e83aca2..d6d7c0c6e 100644 --- a/gui/app/views/podupload.html +++ b/gui/app/views/podupload.html @@ -13,7 +13,7 @@ <hr/> - <button class="btn btn-default" ngf-select="uploadFiles($file, $invalidFiles)" ngf-max-size="5MB"> + <button class="btn btn-default" ngf-select="uploadFiles($file, $invalidFiles)" ngf-max-size="1024MB"> <div ng-show="!loadingOPENrc">Upload</div> <img src="images/loading2.gif" width="25" height="25" ng-if="loadingOPENrc" /> </button> diff --git a/gui/app/views/uploadImage.html b/gui/app/views/uploadImage.html index 17ccfdb8b..0c337feeb 100644 --- a/gui/app/views/uploadImage.html +++ b/gui/app/views/uploadImage.html @@ -4,56 +4,86 @@ <div style="display:flex;flex-direction:row;"> <div style="width:750px;"> - <h3>{{baseElementInfo.name}} -- Image + <h3>{{environmentInfo.name}} -- Image <button class="btn btn-default" style="float:right" ng-click="goNext()">Next</button> </h3> <!--<p>In this process, you can input your define openrc config or upload a openrc file</p>--> - <hr/> - <button class="btn btn-default" ng-click="uploadImage()"> - <div ng-if="!showloading">Load Image</div> - <img src="images/loading2.gif" width="25" height="25" ng-if="showloading" /> - </button> - <i class="fa fa-check" aria-hidden="true" style="margin-top:34px;margin-left:5px;color: #2ecc71;" ng-show="imageStatus==1&&ifshowStatus==1">done</i> - <i class="fa fa-spinner" aria-hidden="true" style="margin-top:34px;margin-left:5px;color: #2ecc71;" ng-show="imageStatus==0&&ifshowStatus==1">loading</i> - <i class="fa fa-exclamation-triangle" aria-hidden="true" style="margin-top:34px;margin-left:5px;color: red;" ng-show="imageStatus==2&&ifshowStatus==1">error</i> - <hr> - <h4>Current Images</h4> - + <h4>Alternative Images</h4> <div> <table class="table table-striped"> <tr> <th>name</th> + <th>description</th> <th>size</th> <th>status</th> <th>time</th> + <th>action</th> </tr> - <tr ng-repeat="image in imageListData"> + <tr ng-repeat="image in yardstickImage"> <td>{{image.name}}</td> - <td>{{image.size/1024}} MB</td> + <td>{{image.description}}</td> + <td>{{image.size | number:2}} MB</td> <td>{{image.status}}</td> <td>{{image.time}}</td> - + <td> + <div class="btn-group" uib-dropdown> + <button id="single-button" type="button" class="btn btn-default btn-sm" uib-dropdown-toggle> + action<span class="caret"></span> + </button> + <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button"> + <li role="menuitem" ng-show="image.status == 'N/A'"><a ng-click="loadYardstickImage(image.name)">load</a></li> + <li role="menuitem" ng-show="image.status != 'N/A'"><a ng-click="deleteYardstickImage(image.name)">delete</a></li> + </ul> + </div> + </td> </tr> - - - </table> </div> + <hr> + <h4 style="display:inline">Custom Images</h4> + <div class="btn-group button-margin" style="float:right;margin-top:-10px;margin-bottom:5px"> + <button class="btn btn-default" style="width:60px" ngf-select="uploadCustomImage($file, $invalidFiles)" ngf-max-size="2048MB"> + <div ng-show="!showloading">Local</div> + <img src="images/loading2.gif" width="25" height="25" ng-if="showloading" /> + </button> + <button class="btn btn-default" style="width:60px" ng-click="openImageDialog()">Url</button> + </div> + <div> + <table class="table table-striped"> - - - - - - + <tr> + <th>name</th> + <th>description</th> + <th>size</th> + <th>status</th> + <th>time</th> + <th>action</th> + </tr> + <tr ng-repeat="image in customImage"> + <td>{{image.name}}</td> + <td>{{image.description}}</td> + <td>{{image.size | number:2}} MB</td> + <td>{{image.status}}</td> + <td>{{image.time}}</td> + <td> + <div class="btn-group" uib-dropdown> + <button id="single-button" type="button" class="btn btn-default btn-sm" uib-dropdown-toggle> + action<span class="caret"></span> + </button> + <ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="single-button"> + <li role="menuitem" ><a ng-click="deleteCustomImage(image.id)">delete</a></li> + </ul> + </div> + </td> + </tr> + </table> + </div> </div> - - </div> </div> diff --git a/nsb_setup.sh b/nsb_setup.sh index cc2542989..c11dc1038 100755 --- a/nsb_setup.sh +++ b/nsb_setup.sh @@ -83,7 +83,7 @@ install_trex() { TREX_DIR=$INSTALL_BIN_PATH/trex/scripts if [ -d "$TREX_DIR" ]; then - echo "Trex v2.20 already installed. Make sure it contains PYTHONPATH which is required to run TRex" + echo "Trex $TREX_VERSION already installed." else echo "Build TRex and installing Trex TG in $INSTALL_BIN_PATH/trex" rm -rf ${TREX_DOWNLOAD##*/} @@ -99,9 +99,7 @@ install_trex() cd trex/scripts/ko/src/ make make install - # workaround trex module issue - touch "$REPO_DIR/trex/scripts/automation/trex_control_plane/stl/__init__.py" - cp "$REPO_DIR/trex/scripts/dpdk_nic_bind.py" "$INSTALL_BIN_PATH" + ln -s $TREX_DIR/automation/trex_control_plane $INSTALL_BIN_PATH/trex_client popd fi echo "Done." diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml index cf2dbfc33..85ed2450f 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 vnf__1: rules: acl_1rule.yaml diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml index 477bd8fbf..1b3377388 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets.yaml" - imix: "../../traffic_profiles/imix_voice.yaml" ixia_profile: ../../traffic_profiles/acl/acl_ipv4_profile_1flows.ixncfg context: type: Node diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml index 695768194..9a16466bf 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml @@ -21,20 +21,24 @@ scenarios: nodes: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick - tc_options: + options: + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 + traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 - vnf_options: - acl: + vnf__1: rules: acl_1rule.yaml - cfg: acl_config + vnf_config: {lb_config: 'SW', lb_count: 1, worker_config: '1C/1T', worker_threads: 1} runner: - type: Duration - duration: 400 + type: Iteration + iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml index 8d7fe3cb2..95fad73dc 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml index 6b21ba576..397f352f1 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml @@ -23,7 +23,13 @@ scenarios: vnf__1: vnf.yardstick tg__2: trafficgen_2.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -35,9 +41,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml index df7a909a1..1fa0b5b3d 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml @@ -23,7 +23,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -34,9 +40,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml {% endfor %} context: type: Node diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_worstcaserules_1flow_64B_packetsize.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_worstcaserules_1flow_64B_packetsize.yaml deleted file mode 100644 index 96b3f687c..000000000 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_worstcaserules_1flow_64B_packetsize.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2016 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. - ---- -schema: yardstick:task:0.1 -scenarios: -- type: NSPerf - traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml - topology: acl-tg-topology.yaml - nodes: - tg__1: trafficgen_1.yardstick - vnf__1: vnf.yardstick - tc_options: - rfc2544: - allowed_drop_rate: 0.0001 - 0.0001 - vnf_options: - acl: - rules: acl_worstcaserules.yaml - cfg: acl_config - runner: - type: Duration - duration: 400 - interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml -context: - type: Node - name: yardstick - nfvi_type: baremetal - file: /etc/yardstick/nodes/pod.yaml diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_worstcaserules_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_worstcaserules_1flow_64B_trex.yaml index 8d7fe3cb2..95fad73dc 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_worstcaserules_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_ipv4_worstcaserules_1flow_64B_trex.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml index ab688a23f..3ba22ff1c 100644 --- a/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/acl/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml @@ -21,23 +21,24 @@ scenarios: nodes: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick - tc_options: + options: + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 + traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 - latency: true - vnf_options: - acl: + vnf__1: rules: acl_1rule.yaml - cfg: acl_config - options: - packetsize: 64 + vnf_config: {lb_config: 'SW', lb_count: 1, worker_config: '1C/1T', worker_threads: 1} runner: type: Iteration iterations: 28 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml b/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml index 10eba4c3c..6fe826642 100644 --- a/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml +++ b/samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,23 +39,19 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: # put node context first, so we don't HEAT deploy if node has errors name: yardstick - flavor: yardstick-dpdk-flavor -# flavor: -# name: yardstick-dpdk-flavor -# vcpus: 10 -# ram: 20480 -# disk: 4 -# extra_specs: -# hw:cpu_sockets: 1 -# hw:cpu_cores: 10 -# hw:cpu_threads: 1 -# # hw:mem_page_size: large + image: yardstick-samplevnfs + flavor: + name: yardstick-dpdk-flavor + vcpus: 10 + ram: 20480 + disk: 4 + extra_specs: + hw:cpu_sockets: 1 + hw:cpu_cores: 10 + hw:cpu_threads: 1 user: ubuntu placement_groups: pgrp1: @@ -66,17 +68,18 @@ context: networks: mgmt: cidr: '10.0.1.0/24' - external_network: "yardstick-public" xe0: cidr: '10.0.2.0/24' - vld_id: public + vld_id: public_1 + gateway_ip: 'null' # port_security_enabled: False allowed_address_pairs: - ip_address: '0.0.0.0/0' xe1: cidr: '10.0.3.0/24' - vld_id: private + vld_id: private_1 + gateway_ip: 'null' # port_security_enabled: False allowed_address_pairs: - ip_address: diff --git a/samples/vnf_samples/nsut/acl/tc_heat_trex_external_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml b/samples/vnf_samples/nsut/acl/tc_heat_trex_external_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml index 3344a1de1..5e8b03916 100644 --- a/samples/vnf_samples/nsut/acl/tc_heat_trex_external_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml +++ b/samples/vnf_samples/nsut/acl/tc_heat_trex_external_rfc2544_ipv4_1rule_1flow_64B_packetsize.yaml @@ -21,20 +21,24 @@ scenarios: nodes: tg__1: trafficgen_1.baremetal vnf__1: vnf.yardstick - tc_options: + options: + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 + traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 - vnf_options: - acl: + vnf__1: rules: acl_1rule.yaml - cfg: acl_config + vnf_config: {lb_config: 'SW', lb_count: 1, worker_config: '1C/1T', worker_threads: 1} runner: - type: Duration - duration: 400 + type: Iteration + iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml contexts: # put node context first, so we don't HEAT deploy if node has errors - name: baremetal diff --git a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml index 7e9a589ad..fc1c3e9b8 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml @@ -22,7 +22,9 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 diff --git a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml index 5203e8d0a..6160ca090 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml @@ -22,7 +22,14 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + publicip: ["152.16.40.10"] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -32,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets.yaml" - imix: "../../traffic_profiles/imix_voice.yaml" ixia_profile: ../../traffic_profiles/cgnapt/cgnat_ipv4_profile_1flows.ixncfg context: type: Node diff --git a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml index feeacf5b0..15365b01a 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml @@ -22,7 +22,14 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + publicip: ["152.16.40.10"] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -32,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml index b5548d5ba..c1f5f2162 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml @@ -23,7 +23,13 @@ scenarios: vnf__1: vnf.yardstick tg__2: trafficgen_2.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__2': 'xe0'} + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -35,9 +41,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_scale_up.yaml b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_scale_up.yaml index 7d746f0de..1bf7df875 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_scale_up.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_scale_up.yaml @@ -23,7 +23,14 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + publicip: ["152.16.40.10"] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +40,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml {% endfor %} context: type: Node diff --git a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_with_latency_ipv4_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_with_latency_ipv4_1flow_64B_trex.yaml index 16d0d08cd..e8cac4af9 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_with_latency_ipv4_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_baremetal_rfc2544_with_latency_ipv4_1flow_64B_trex.yaml @@ -22,7 +22,14 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + publicip: ["152.16.40.10"] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +40,6 @@ scenarios: type: Iteration iterations: 28 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/cgnapt/tc_heat_rfc2544_ipv4_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/cgnapt/tc_heat_rfc2544_ipv4_1flow_64B_trex.yaml new file mode 100644 index 000000000..56d26be8b --- /dev/null +++ b/samples/vnf_samples/nsut/cgnapt/tc_heat_rfc2544_ipv4_1flow_64B_trex.yaml @@ -0,0 +1,84 @@ +# 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. + +--- +schema: yardstick:task:0.1 +scenarios: +- type: NSPerf + traffic_profile: ../../traffic_profiles/ipv4_throughput_cgnapt.yaml + topology: cgnapt-vnf-topology.yaml + nodes: + tg__1: trafficgen_1.yardstick + vnf__1: vnf.yardstick + options: + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 + traffic_type: 4 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf__1: + vnf_config: {lb_config: 'SW', lb_count: 1, worker_config: '1C/1T', worker_threads: 1} + runner: + type: Iteration + iterations: 10 + interval: 35 +context: + # put node context first, so we don't HEAT deploy if node has errors + name: yardstick + image: yardstick-samplevnfs + flavor: + name: yardstick-dpdk-flavor + vcpus: 10 + ram: 20480 + disk: 4 + extra_specs: + hw:cpu_sockets: 1 + hw:cpu_cores: 10 + hw:cpu_threads: 1 + user: ubuntu + placement_groups: + pgrp1: + policy: "availability" + servers: + vnf: + floating_ip: true + placement: "pgrp1" + trafficgen_1: + floating_ip: true + placement: "pgrp1" + networks: + mgmt: + cidr: '10.0.1.0/24' + xe0: + cidr: '10.0.2.0/24' + vld_id: public_1 + gateway_ip: 'null' +# port_security_enabled: False + allowed_address_pairs: + - ip_address: + '0.0.0.0/0' + xe1: + cidr: '10.0.3.0/24' + vld_id: private_1 + gateway_ip: 'null' +# port_security_enabled: False + allowed_address_pairs: + - ip_address: + '0.0.0.0/0' + diff --git a/samples/vnf_samples/nsut/udp_replay/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/udp_replay/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml index a2b73b6ec..e80e1fb2d 100644 --- a/samples/vnf_samples/nsut/udp_replay/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/udp_replay/tc_baremetal_rfc2544_ipv4_1flow_64B_trex.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -30,9 +36,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/vfw/acl_1rule.yaml b/samples/vnf_samples/nsut/vfw/acl_1rule.yaml index b184a29e2..6753645ba 100644 --- a/samples/vnf_samples/nsut/vfw/acl_1rule.yaml +++ b/samples/vnf_samples/nsut/vfw/acl_1rule.yaml @@ -20,7 +20,7 @@ access-list1: match-counter: 0 actions: drop,count matches: - destination-ipv4-network: 152.16.40.20/24 + destination-ipv4-network: 152.16.0.0/24 destination-port-range: lower-port: 0 upper-port: 65535 @@ -38,7 +38,7 @@ access-list1: destination-port-range: lower-port: 0 upper-port: 65535 - source-ipv4-network: 152.16.100.20/24 + source-ipv4-network: 152.16.0.0/24 source-port-range: lower-port: 0 upper-port: 65535 diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml index d4a4bb706..e0bd82a30 100644 --- a/samples/vnf_samples/nsut/vfw/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml @@ -22,7 +22,9 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml index 71a803d32..e07f5f9e9 100644 --- a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets.yaml" - imix: "../../traffic_profiles/imix_voice.yaml" ixia_profile: ../../traffic_profiles/vfw/vfw_ipv4_profile_1flows.ixncfg context: type: Node diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml index 3a17abac4..53d4d3d85 100644 --- a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml index a92a91e56..562575b3c 100644 --- a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_corelated_traffic.yaml @@ -21,8 +21,15 @@ scenarios: nodes: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick + tg__2: trafficgen_2.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__2': 'xe0'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -34,11 +41,8 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick nfvi_type: baremetal - file: /etc/yardstick/nodes/pod.yaml + file: /etc/yardstick/nodes/pod_3node.yaml diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml index ab2791c86..db8622122 100644 --- a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_trex_scale_up.yaml @@ -23,7 +23,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -34,9 +40,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml {% endfor %} context: type: Node diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml index 1e6330038..a1381454e 100644 --- a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_with_latency_ipv4_1rule_1flow_64B_trex.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -34,9 +40,6 @@ scenarios: type: Iteration iterations: 28 interval: 35 - traffic_options: - flow: ../../traffic_profiles/ipv4_1flow_Packets.yaml - imix: ../../traffic_profiles/imix_voice.yaml context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml new file mode 100644 index 000000000..2e7ef3d3f --- /dev/null +++ b/samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -0,0 +1,85 @@ +# 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. + +--- +schema: yardstick:task:0.1 +scenarios: +- type: NSPerf + traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml + topology: vfw-tg-topology.yaml + nodes: + tg__1: trafficgen_1.yardstick + vnf__1: vnf.yardstick + options: + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 + traffic_type: 4 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf__1: + rules: acl_1rule.yaml + vnf_config: {lb_config: 'SW', lb_count: 1, worker_config: '1C/1T', worker_threads: 1} + runner: + type: Iteration + iterations: 10 + interval: 35 +context: + # put node context first, so we don't HEAT deploy if node has errors + name: yardstick + image: yardstick-samplevnfs + flavor: + name: yardstick-dpdk-flavor + vcpus: 10 + ram: 20480 + disk: 4 + extra_specs: + hw:cpu_sockets: 1 + hw:cpu_cores: 10 + hw:cpu_threads: 1 + user: ubuntu + placement_groups: + pgrp1: + policy: "availability" + servers: + vnf: + floating_ip: true + placement: "pgrp1" + trafficgen_1: + floating_ip: true + placement: "pgrp1" + networks: + mgmt: + cidr: '10.0.1.0/24' + xe0: + cidr: '10.0.2.0/24' + vld_id: public_1 + gateway_ip: 'null' +# port_security_enabled: False + allowed_address_pairs: + - ip_address: + '0.0.0.0/0' + xe1: + cidr: '10.0.3.0/24' + vld_id: private_1 + gateway_ip: 'null' +# port_security_enabled: False + allowed_address_pairs: + - ip_address: + '0.0.0.0/0' + diff --git a/samples/vnf_samples/nsut/vpe/tc_baremetal_http_ipv4_ixload.yaml b/samples/vnf_samples/nsut/vpe/tc_baremetal_http_ipv4_ixload.yaml index 7b251395b..16996cb5c 100644 --- a/samples/vnf_samples/nsut/vpe/tc_baremetal_http_ipv4_ixload.yaml +++ b/samples/vnf_samples/nsut/vpe/tc_baremetal_http_ipv4_ixload.yaml @@ -22,16 +22,19 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 vnf__1: cfg: vpe_config runner: type: Duration duration: 4 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets_vpe.yaml" - imix: "../../traffic_profiles/imix_voice.yaml" ixia_profile: ../../traffic_profiles/vpe/HTTP-vPE_IPv4_2Ports.rxf # Need vlan update context: type: Node diff --git a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_1518B.yaml b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_1518B.yaml index 4652a62d5..02346d238 100644 --- a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_1518B.yaml +++ b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_1518B.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {1518B: 100} + public: {1518B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -32,9 +38,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets_vpe.yaml" - imix: "../../traffic_profiles/imix_storage.yaml" context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml index bd64a45f3..a50ba380f 100644 --- a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml +++ b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -32,9 +38,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets_vpe.yaml" - imix: "../../traffic_profiles/imix_voice.yaml" context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml index 0257886fb..e0a749301 100644 --- a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml +++ b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_ixia.yaml @@ -22,7 +22,13 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -32,9 +38,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets_vpe.yaml" - imix: "../../traffic_profiles/imix_voice.yaml" ixia_profile: ../../traffic_profiles/vpe/vpe_ipv4_profile_1flows.ixncfg context: type: Node diff --git a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml index 2c48d0ef9..57c512888 100644 --- a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml +++ b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_64B_trex_corelated_traffic.yaml @@ -21,8 +21,15 @@ scenarios: nodes: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick + tg__2: trafficgen_2.yardstick options: - packetsize: 64 + framesize: + private: {64B: 100} + public: {64B: 100} + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__2': 'xe0'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -33,9 +40,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets_vpe.yaml" - imix: "../../traffic_profiles/imix_voice.yaml" context: type: Node name: yardstick diff --git a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_IMIX.yaml b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_IMIX.yaml index 674fa95f4..6b78574eb 100644 --- a/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_IMIX.yaml +++ b/samples/vnf_samples/nsut/vpe/tc_baremetal_rfc2544_ipv4_1flow_IMIX.yaml @@ -22,7 +22,14 @@ scenarios: tg__1: trafficgen_1.yardstick vnf__1: vnf.yardstick options: - packetsize: 64 + framesize: + private: {64B: 5, 128B: 11, 256B: 16, 373B: 10, 570B: 35, 1400B: 10, 1500B: 13} + public: {64B: 5, 128B: 3, 256B: 4, 373B: 6, 570B: 8, 1400B: 36, 1500B: 38} + + flow: + src_ip: [{'tg__1': 'xe0'}] + dst_ip: [{'tg__1': 'xe1'}] + count: 1 traffic_type: 4 rfc2544: allowed_drop_rate: 0.0001 - 0.0001 @@ -32,9 +39,6 @@ scenarios: type: Iteration iterations: 10 interval: 35 - traffic_options: - flow: "../../traffic_profiles/ipv4_1flow_Packets_vpe.yaml" - imix: "../../traffic_profiles/imix_video.yaml" context: type: Node name: yardstick diff --git a/samples/vnf_samples/traffic_profiles/imix_storage.yaml b/samples/vnf_samples/traffic_profiles/imix_storage.yaml deleted file mode 100644 index 8fd10ecbe..000000000 --- a/samples/vnf_samples/traffic_profiles/imix_storage.yaml +++ /dev/null @@ -1,41 +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. - -#imix definition for storage traffic -# -# it is a typical case for testing the synthetic VNF performance. -# -#percentage of the packets can be less than 100% -#the traffic in downstream and upstream direction could be different - -schema: "nsb:imix:0.1" - -imix: - private: - imix_small: 0 #ipv4 case - 72B should be 0 ipv6 case - 84B - imix_128B: 0 - imix_256B: 0 - imix_373B: 0 - imix_570B: 0 - imix_1400B: 0 - imix_1500B: 100 - - public: - imix_small: 0 #ipv4 case - 72B ipv6 - 84B - imix_128B: 0 - imix_256B: 0 - imix_373B: 0 - imix_570B: 0 - imix_1400B: 0 - imix_1500B: 100 diff --git a/samples/vnf_samples/traffic_profiles/imix_video.yaml b/samples/vnf_samples/traffic_profiles/imix_video.yaml deleted file mode 100644 index 36324bfa4..000000000 --- a/samples/vnf_samples/traffic_profiles/imix_video.yaml +++ /dev/null @@ -1,43 +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. - -#imix definition for video traffic -# -# this is a real traffic profile when video/data traffic only is present -# -#percentage of the packets can be less than 100% -#the traffic in downstream and upstream direction could be different -# -#small means ipv4 case - 72B should be 0, ipv6 case - 84B - -schema: "nsb:imix:0.1" - -imix: - private: - imix_small: 5 #ipv4 case - 72B should be 0 ipv6 case - 84B - imix_128B: 11 - imix_256B: 16 - imix_373B: 10 - imix_570B: 35 - imix_1400B: 10 - imix_1500B: 13 - - public: - imix_small: 5 #ipv4 case - 72B ipv6 - 84B - imix_128B: 3 - imix_256B: 4 - imix_373B: 6 - imix_570B: 8 - imix_1400B: 36 - imix_1500B: 38 diff --git a/samples/vnf_samples/traffic_profiles/imix_voice.yaml b/samples/vnf_samples/traffic_profiles/imix_voice.yaml deleted file mode 100644 index b8f8e5358..000000000 --- a/samples/vnf_samples/traffic_profiles/imix_voice.yaml +++ /dev/null @@ -1,41 +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. - -#imix definition for voice traffic -# -# it is a typical case for testing the synthetic VNF performance. -# -#percentage of the packets can be less than 100% -#the traffic in downstream and upstream direction could be different - -schema: "nsb:imix:0.1" - -imix: - private: - imix_small: 100 #ipv4 case - 72B should be 0 ipv6 case - 84B - imix_128B: 0 - imix_256B: 0 - imix_373B: 0 - imix_570B: 0 - imix_1400B: 0 - imix_1500B: 0 - - public: - imix_small: 100 #ipv4 case - 72B ipv6 - 84B - imix_128B: 0 - imix_256B: 0 - imix_373B: 0 - imix_570B: 0 - imix_1400B: 0 - imix_1500B: 0 diff --git a/samples/vnf_samples/traffic_profiles/ipv4_1flow_Packets.yaml b/samples/vnf_samples/traffic_profiles/ipv4_1flow_Packets.yaml deleted file mode 100644 index e713ea858..000000000 --- a/samples/vnf_samples/traffic_profiles/ipv4_1flow_Packets.yaml +++ /dev/null @@ -1,18 +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. - -flow: - srcip4_range: '152.16.100.20' - dstip4_range: '152.40.40.20' - count: 1 diff --git a/samples/vnf_samples/traffic_profiles/ipv4_1flow_Packets_vpe.yaml b/samples/vnf_samples/traffic_profiles/ipv4_1flow_Packets_vpe.yaml deleted file mode 100644 index 8bb913ebf..000000000 --- a/samples/vnf_samples/traffic_profiles/ipv4_1flow_Packets_vpe.yaml +++ /dev/null @@ -1,20 +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. - -flow: - srcip4_range_1: '152.16.0.20' - dstip4_range_1: '152.40.0.20' - srcip4_range_2: '172.16.0.20' - dstip4_range_2: '172.40.0.20' - count: 1 diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml index 2854826e6..98624b108 100644 --- a/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml +++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput.yaml @@ -49,41 +49,49 @@ private_1: ipv4: outer_l2: framesize: - 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}" - 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}" - 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}" - 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}" - 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}" - 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}" - 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}" + 64B: "{{ get(imix, 'imix.private.64B', '0') }}" + 128B: "{{ get(imix, 'imix.private.128B', '0') }}" + 256B: "{{ get(imix, 'imix.private.256B', '0') }}" + 373b: "{{ get(imix, 'imix.private.373B', '0') }}" + 512B: "{{ get(imix, 'imix.private.512B', '0') }}" + 570B: "{{get(imix, 'imix.private.570B', '0') }}" + 1400B: "{{get(imix, 'imix.private.1400B', '0') }}" + 1500B: "{{get(imix, 'imix.private.1500B', '0') }}" + 1518B: "{{get(imix, 'imix.private.1518B', '0') }}" outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.srcip4_range', '1.1.1.1-1.1.255.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range', '90.90.1.1-90.90.255.255') }}" + srcip4: "{{get(flow, 'flow.src_ip0', '1.1.1.1-1.1.255.255') }}" + dstip4: "{{get(flow, 'flow.dst_ip0', '90.90.1.1-90.90.255.255') }}" + count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '1234') }}" - dstport: "{{get(flow, 'flow.dstport_range', '2001') }}" + srcport: "{{get(flow, 'flow.src_port0', '1234-4321') }}" + dstport: "{{get(flow, 'flow.dst_port0', '2001-4001') }}" + count: "{{get(flow, 'flow.count', '1') }}" public_1: ipv4: outer_l2: framesize: - 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}" - 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}" - 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}" - 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}" - 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}" - 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}" - 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}" + 64B: "{{ get(imix, 'imix.public.64B', '0') }}" + 128B: "{{ get(imix, 'imix.public.128B', '0') }}" + 256B: "{{ get(imix, 'imix.public.256B', '0') }}" + 373b: "{{ get(imix, 'imix.public.373B', '0') }}" + 512B: "{{ get(imix, 'imix.public.512B', '0') }}" + 570B: "{{get(imix, 'imix.public.570B', '0') }}" + 1400B: "{{get(imix, 'imix.public.1400B', '0') }}" + 1500B: "{{get(imix, 'imix.public.1500B', '0') }}" + 1518B: "{{get(imix, 'imix.public.1518B', '0') }}" outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.dstip4_range', '90.90.1.1-90.90.255.255') }}" - dstip4: "{{get(flow, 'flow.srcip4_range', '1.1.1.1-1.1.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip0', '90.90.1.1-90.90.255.255') }}" + dstip4: "{{get(flow, 'flow.src_ip0', '1.1.1.1-1.1.255.255') }}" + count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.dstport_range', '1234') }}" - dstport: "{{get(flow, 'flow.srcport_range', '2001') }}" + srcport: "{{get(flow, 'flow.dst_port0', '1234-4321') }}" + dstport: "{{get(flow, 'flow.src_port0', '2001-4001') }}" + count: "{{get(flow, 'flow.count', '1') }}" diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml index 2ea8d3c44..7283b6377 100644 --- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml +++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt.yaml @@ -49,41 +49,49 @@ private_1: ipv4: outer_l2: framesize: - 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}" - 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}" - 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}" - 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}" - 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}" - 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}" - 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}" + 64B: "{{ get(imix, 'imix.private.64B', '0') }}" + 128B: "{{ get(imix, 'imix.private.128B', '0') }}" + 256B: "{{ get(imix, 'imix.private.256B', '0') }}" + 373b: "{{ get(imix, 'imix.private.373B', '0') }}" + 512B: "{{ get(imix, 'imix.private.512B', '0') }}" + 570B: "{{get(imix, 'imix.private.570B', '0') }}" + 1400B: "{{get(imix, 'imix.private.1400B', '0') }}" + 1500B: "{{get(imix, 'imix.private.1500B', '0') }}" + 1518B: "{{get(imix, 'imix.private.1518B', '0') }}" outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.srcip4_range', '10.0.2.1-10.0.2.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range', '10.0.3.1-10.0.3.255') }}" + srcip4: "{{get(flow, 'flow.src_ip0', '10.0.2.1-10.0.2.255') }}" + dstip4: "{{get(flow, 'flow.dst_ip0', '10.0.3.1-10.0.3.255') }}" + count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '1234') }}" - dstport: "{{get(flow, 'flow.dstport_range', '2001') }}" + srcport: "{{get(flow, 'flow.src_port0', '1234-4321') }}" + dstport: "{{get(flow, 'flow.dst_port0', '2001-4001') }}" + count: "{{get(flow, 'flow.count', '1') }}" public_1: ipv4: outer_l2: framesize: - 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}" - 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}" - 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}" - 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}" - 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}" - 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}" - 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}" + 64B: "{{ get(imix, 'imix.public.64B', '0') }}" + 128B: "{{ get(imix, 'imix.public.128B', '0') }}" + 256B: "{{ get(imix, 'imix.public.256B', '0') }}" + 373b: "{{ get(imix, 'imix.public.373B', '0') }}" + 512B: "{{ get(imix, 'imix.public.512B', '0') }}" + 570B: "{{get(imix, 'imix.public.570B', '0') }}" + 1400B: "{{get(imix, 'imix.public.1400B', '0') }}" + 1500B: "{{get(imix, 'imix.public.1500B', '0') }}" + 1518B: "{{get(imix, 'imix.public.1518B', '0') }}" outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.dstip4_range', '10.0.3.1-10.0.3.255') }}" - dstip4: "{{get(flow, 'flow.srcip4_range', '10.0.2.1-10.0.2.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip0', '10.0.3.1-10.0.3.255') }}" + dstip4: "{{get(flow, 'flow.public_ip0', '10.0.2.1-10.0.2.255') }}" + count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.dstport_range', '1234') }}" - dstport: "{{get(flow, 'flow.srcport_range', '2001') }}" + srcport: "{{get(flow, 'flow.dst_port0', '1234-4321') }}" + dstport: "{{get(flow, 'flow.src_port0', '2001-4001') }}" + count: "{{get(flow, 'flow.count', '1') }}" diff --git a/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml b/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml index e935bdbd0..233457eba 100644 --- a/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml +++ b/samples/vnf_samples/traffic_profiles/ipv4_throughput_vpe.yaml @@ -49,13 +49,15 @@ private_1: ipv4: outer_l2: framesize: - 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}" - 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}" - 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}" - 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}" - 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}" - 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}" - 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}" + 64B: "{{ get(imix, 'imix.private.64B', '0') }}" + 128B: "{{ get(imix, 'imix.private.128B', '0') }}" + 256B: "{{ get(imix, 'imix.private.256B', '0') }}" + 373b: "{{ get(imix, 'imix.private.373B', '0') }}" + 512B: "{{ get(imix, 'imix.private.512B', '0') }}" + 570B: "{{get(imix, 'imix.private.570B', '0') }}" + 1400B: "{{get(imix, 'imix.private.1400B', '0') }}" + 1500B: "{{get(imix, 'imix.private.1500B', '0') }}" + 1518B: "{{get(imix, 'imix.private.1518B', '0') }}" QinQ: S-VLAN: @@ -69,14 +71,14 @@ private_1: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.srcip4_range_1', '192.168.0.0-192.168.255.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range_1', '192.16.0.0-192.16.0.31') }}" + srcip4: "{{get(flow, 'flow.src_ip0', '192.168.0.0-192.168.255.255') }}" + dstip4: "{{get(flow, 'flow.dst_ip0', '192.16.0.0-192.16.0.31') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '0') }}" - dstport: "{{get(flow, 'flow.dstport_range', '0') }}" + srcport: "{{get(flow, 'flow.src_port0', '0') }}" + dstport: "{{get(flow, 'flow.dst_port0', '0') }}" public_1: ipv4: outer_l2: @@ -91,25 +93,27 @@ public_1: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.dstip4_range_1', '192.16.0.0-192.16.0.31') }}" - dstip4: "{{get(flow, 'flow.srcip4_range_1', '192.168.0.0-192.168.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip0', '192.16.0.0-192.16.0.31') }}" + dstip4: "{{get(flow, 'flow.src_ip0', '192.168.0.0-192.168.255.255') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.dstport_range', '0') }}" - dstport: "{{get(flow, 'flow.srcport_range', '0') }}" + srcport: "{{get(flow, 'flow.dst_port0', '0') }}" + dstport: "{{get(flow, 'flow.src_port0', '0') }}" private_2: ipv4: outer_l2: framesize: - 64B: "{{ get(imix, 'imix.private.imix_small', '0') }}" - 128B: "{{ get(imix, 'imix.private.imix_128B', '0') }}" - 256B: "{{ get(imix, 'imix.private.imix_256B', '0') }}" - 373b: "{{ get(imix, 'imix.private.imix_373B', '0') }}" - 570B: "{{get(imix, 'imix.private.imix_570B', '0') }}" - 1400B: "{{get(imix, 'imix.private.imix_1400B', '0') }}" - 1518B: "{{get(imix, 'imix.private.imix_1500B', '0') }}" + 64B: "{{ get(imix, 'imix.public.64B', '0') }}" + 128B: "{{ get(imix, 'imix.public.128B', '0') }}" + 256B: "{{ get(imix, 'imix.public.256B', '0') }}" + 373b: "{{ get(imix, 'imix.public.373B', '0') }}" + 512B: "{{ get(imix, 'imix.public.512B', '0') }}" + 570B: "{{get(imix, 'imix.public.570B', '0') }}" + 1400B: "{{get(imix, 'imix.public.1400B', '0') }}" + 1500B: "{{get(imix, 'imix.public.1500B', '0') }}" + 1518B: "{{get(imix, 'imix.public.1518B', '0') }}" QinQ: S-VLAN: @@ -123,14 +127,14 @@ private_2: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.srcip4_range_2', '192.168.0.0-192.168.255.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range_2', '192.16.0.0-192.16.0.31') }}" + srcip4: "{{get(flow, 'flow.src_ip1', '192.168.0.0-192.168.255.255') }}" + dstip4: "{{get(flow, 'flow.dst_ip1', '192.16.0.0-192.16.0.31') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '0') }}" - dstport: "{{get(flow, 'flow.dstport_range', '0') }}" + srcport: "{{get(flow, 'flow.src_port1', '0') }}" + dstport: "{{get(flow, 'flow.dst_port1', '0') }}" public_2: ipv4: outer_l2: @@ -145,11 +149,11 @@ public_2: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.dstip4_range_2', '192.16.0.0-192.16.0.31') }}" - dstip4: "{{get(flow, 'flow.srcip4_range_2', '192.168.0.0-192.168.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip1', '192.16.0.0-192.16.0.31') }}" + dstip4: "{{get(flow, 'flow.src_ip1', '192.168.0.0-192.168.255.255') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.dstport_range', '0') }}" - dstport: "{{get(flow, 'flow.srcport_range', '0') }}" + srcport: "{{get(flow, 'flow.dst_port1', '0') }}" + dstport: "{{get(flow, 'flow.src_port1', '0') }}" diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml index 6b213a54a..d7531fcdb 100644 --- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml +++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml @@ -45,16 +45,15 @@ private_1: outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.srcip4_range', '1.1.1.1-1.15.255.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range', '90.90.1.1-90.105.255.255') }}" + srcip4: "{{get(flow, 'flow.src_ip0', '1.1.1.1-1.15.255.255') }}" + dstip4: "{{get(flow, 'flow.dst_ip0', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '1234') }}" - dstport: "{{get(flow, 'flow.dstport_range', '2001') }}" + srcport: "{{get(flow, 'flow.src_port0', '1234') }}" + dstport: "{{get(flow, 'flow.dst_port0', '2001') }}" count: "{{get(flow, 'flow.count', '1') }}" - public_1: ipv4: outer_l2: @@ -69,14 +68,14 @@ public_1: outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.dstip4_range', '1.1.1.1-1.15.255.255') }}" - dstip4: "{{get(flow, 'flow.srcip4_range', '90.90.1.1-90.105.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip0', '1.1.1.1-1.15.255.255') }}" + dstip4: "{{get(flow, 'flow.src_ip0', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '1234') }}" - dstport: "{{get(flow, 'flow.dstport_range', '2001') }}" + srcport: "{{get(flow, 'flow.src_port0', '1234') }}" + dstport: "{{get(flow, 'flow.dst_port0', '2001') }}" count: "{{get(flow, 'flow.count', '1') }}" private_2: ipv4: @@ -92,14 +91,14 @@ private_2: outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.srcip4_range', '1.1.1.1-1.15.255.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range', '90.90.1.1-90.105.255.255') }}" + srcip4: "{{get(flow, 'flow.src_ip1', '1.1.1.1-1.15.255.255') }}" + dstip4: "{{get(flow, 'flow.dst_ip1', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '1234') }}" - dstport: "{{get(flow, 'flow.dstport_range', '2001') }}" + srcport: "{{get(flow, 'flow.src_port1', '1234') }}" + dstport: "{{get(flow, 'flow.dst_port1', '2001') }}" count: "{{get(flow, 'flow.count', '1') }}" public_2: ipv4: @@ -115,12 +114,12 @@ public_2: outer_l3v4: proto: "udp" - srcip4: "{{get(flow, 'flow.dstip4_range', '1.1.1.1-1.15.255.255') }}" - dstip4: "{{get(flow, 'flow.srcip4_range', '90.90.1.1-90.105.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip1', '1.1.1.1-1.15.255.255') }}" + dstip4: "{{get(flow, 'flow.src_ip1', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 0 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '1234') }}" - dstport: "{{get(flow, 'flow.dstport_range', '2001') }}" + srcport: "{{get(flow, 'flow.dst_port1', '1234') }}" + dstport: "{{get(flow, 'flow.src_port1', '2001') }}" count: "{{get(flow, 'flow.count', '1') }}" diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml index 4a21a4274..7468dbdb1 100644 --- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml +++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml @@ -68,14 +68,16 @@ private_1: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.srcip4_range_1', '192.168.0.0-192.168.255.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range_1', '192.16.0.0-192.16.0.31') }}" + srcip4: "{{get(flow, 'flow.src_ip0', '192.168.0.0-192.168.255.255') }}" + dstip4: "{{get(flow, 'flow.dst_ip0', '192.16.0.0-192.16.0.31') }}" + count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '0') }}" - dstport: "{{get(flow, 'flow.dstport_range', '0') }}" + srcport: "{{get(flow, 'flow.src_port0', '0') }}" + dstport: "{{get(flow, 'flow.dst_port0', '0') }}" + count: "{{get(flow, 'flow.count', '1') }}" public_1: ipv4: outer_l2: @@ -90,14 +92,16 @@ public_1: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.dstip4_range_1', '192.16.0.0-192.16.0.31') }}" - dstip4: "{{get(flow, 'flow.srcip4_range_1', '192.168.0.0-192.168.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip0', '192.16.0.0-192.16.0.31') }}" + dstip4: "{{get(flow, 'flow.src_ip0', '192.168.0.0-192.168.255.255') }}" + count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.dstport_range', '0') }}" - dstport: "{{get(flow, 'flow.srcport_range', '0') }}" + srcport: "{{get(flow, 'flow.dst_port0', '0') }}" + dstport: "{{get(flow, 'flow.src_port0', '0') }}" + count: "{{get(flow, 'flow.count', '1') }}" private_2: ipv4: outer_l2: @@ -122,14 +126,15 @@ private_2: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.srcip4_range_2', '192.168.0.0-192.168.255.255') }}" - dstip4: "{{get(flow, 'flow.dstip4_range_2', '192.16.0.0-192.16.0.31') }}" + srcip4: "{{get(flow, 'flow.srcip1', '192.168.0.0-192.168.255.255') }}" + dstip4: "{{get(flow, 'flow.dstip1', '192.16.0.0-192.16.0.31') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.srcport_range', '0') }}" - dstport: "{{get(flow, 'flow.dstport_range', '0') }}" + srcport: "{{get(flow, 'flow.src_port1', '0') }}" + dstport: "{{get(flow, 'flow.dst_port1', '0') }}" + count: "{{get(flow, 'flow.count', '1') }}" public_2: ipv4: outer_l2: @@ -144,11 +149,13 @@ public_2: outer_l3v4: proto: "tcp" - srcip4: "{{get(flow, 'flow.dstip4_range_2', '192.16.0.0-192.16.0.31') }}" - dstip4: "{{get(flow, 'flow.srcip4_range_2', '192.168.0.0-192.168.255.255') }}" + srcip4: "{{get(flow, 'flow.dst_ip1', '192.16.0.0-192.16.0.31') }}" + dstip4: "{{get(flow, 'flow.src_ip1', '192.168.0.0-192.168.255.255') }}" + count: "{{get(flow, 'flow.count', '1') }}" ttl: 32 dscp: 32 outer_l4: - srcport: "{{get(flow, 'flow.dstport_range', '0') }}" - dstport: "{{get(flow, 'flow.srcport_range', '0') }}" + srcport: "{{get(flow, 'flow.dst_port1', '0') }}" + dstport: "{{get(flow, 'flow.src_port1', '0') }}" + count: "{{get(flow, 'flow.count', '1') }}" diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc057.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc057.yaml new file mode 100644 index 000000000..322e2bd76 --- /dev/null +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc057.yaml @@ -0,0 +1,179 @@ +############################################################################## +# Copyright (c) 2017 14_ykl@tongji.edu.cn 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 +############################################################################## +--- + +schema: "yardstick:task:0.1" +description: > + Test case for TC057 :OpenStack Controller Cluster Management Service High + Availability; + This test case is written by scenario-based HA testing framework. + +{% set file = file or '/etc/yardstick/pod.yaml' %} +{% set vip_mgmt = vip_mgmt or 'vip__management' %} +{% set vip_vrouter = vip_vrouter or 'vip__vrouter' %} +{% set attack_host = attack_host or 'node1' %} +{% set check_host = check_host or 'node2' %} +{% set monitor_time = monitor_time or 10 %} +{% set monitor_number = monitor_number or 3 %} + +scenarios: + - + type: "GeneralHA" + options: + attackers: + - + fault_type: "general-attacker" + host: {{attack_host}} + key: "kill-process" + attack_key: "kill-corosync" + action_parameter: + process_name: "corosync" + + monitors: + - + monitor_type: "openstack-cmd" + key: "check-nova-service" + command_name: "openstack image list" + monitor_time: {{monitor_time}} + monitor_number: {{monitor_number}} + sla: + max_outage_time: 5 + + - + monitor_type: "openstack-cmd" + key: "check-neutron-service" + command_name: "openstack network list" + monitor_time: {{monitor_time}} + monitor_number: {{monitor_number}} + sla: + max_outage_time: 5 + + - + monitor_type: "openstack-cmd" + key: "check-keystone-service" + command_name: "openstack user list" + monitor_time: {{monitor_time}} + monitor_number: {{monitor_number}} + sla: + max_outage_time: 5 + + - + monitor_type: "openstack-cmd" + key: "check-heat-service" + command_name: "openstack stack list" + monitor_time: {{monitor_time}} + monitor_number: {{monitor_number}} + sla: + max_outage_time: 5 + + operations: + - + operation_type: "general-operation" + key: "get-mgmt-vip-host" + operation_key: "get-vip-host" + host: {{check_host}} + action_parameter: + vip_name: {{vip_mgmt}} + return_parameter: + all: "$vip_mgmt_host" + + - + operation_type: "general-operation" + key: "get-router-vip-host" + operation_key: "get-vip-host" + host: {{check_host}} + action_parameter: + vip_name: {{vip_vrouter}} + return_parameter: + all: "$vip_router_host" + + resultCheckers: + - + checker_type: "general-result-checker" + key: "check-rabbitmq-master" + checker_key: "pacemaker-resource-checker" + host: {{check_host}} + parameter: + resource_name: "p_rabbitmq-server" + resource_host: "$vip_mgmt_host" + expectedValue: "Masters" + condition: "in" + + - + checker_type: "general-result-checker" + key: "check-conntrackd-master" + checker_key: "pacemaker-resource-checker" + host: {{check_host}} + parameter: + resource_name: "p_conntrackd" + resource_host: "$vip_router_host" + expectedValue: "Masters" + condition: "in" + + steps: + - + actionKey: "kill-process" + actionType: "attacker" + index: 1 + + - + actionKey: "check-nova-service" + actionType: "monitor" + index: 2 + + - + actionKey: "check-neutron-service" + actionType: "monitor" + index: 3 + + - + actionKey: "check-keystone-service" + actionType: "monitor" + index: 4 + + - + actionKey: "check-heat-service" + actionType: "monitor" + index: 5 + + - + actionKey: "get-mgmt-vip-host" + actionType: "operation" + index: 6 + + - + actionKey: "check-rabbitmq-master" + actionType: "resultchecker" + index: 7 + + - + actionKey: "get-router-vip-host" + actionType: "operation" + index: 8 + + - + actionKey: "check-conntrackd-master" + actionType: "resultchecker" + index: 9 + + + nodes: + {{attack_host}}: {{attack_host}}.LF + {{check_host}}: {{check_host}}.LF + runner: + type: Duration + duration: 1 + sla: + outage_time: 5 + action: monitor + +context: + type: Node + name: LF + file: {{file}} diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index e69de29bb..a468b272b 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -0,0 +1,76 @@ +# Copyright (c) 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.
+
+from __future__ import absolute_import
+import mock
+
+
+STL_MOCKS = {
+ 'trex_stl_lib': mock.MagicMock(),
+ 'trex_stl_lib.base64': mock.MagicMock(),
+ 'trex_stl_lib.binascii': mock.MagicMock(),
+ 'trex_stl_lib.collections': mock.MagicMock(),
+ 'trex_stl_lib.copy': mock.MagicMock(),
+ 'trex_stl_lib.datetime': mock.MagicMock(),
+ 'trex_stl_lib.functools': mock.MagicMock(),
+ 'trex_stl_lib.imp': mock.MagicMock(),
+ 'trex_stl_lib.inspect': mock.MagicMock(),
+ 'trex_stl_lib.json': mock.MagicMock(),
+ 'trex_stl_lib.linecache': mock.MagicMock(),
+ 'trex_stl_lib.math': mock.MagicMock(),
+ 'trex_stl_lib.os': mock.MagicMock(),
+ 'trex_stl_lib.platform': mock.MagicMock(),
+ 'trex_stl_lib.pprint': mock.MagicMock(),
+ 'trex_stl_lib.random': mock.MagicMock(),
+ 'trex_stl_lib.re': mock.MagicMock(),
+ 'trex_stl_lib.scapy': mock.MagicMock(),
+ 'trex_stl_lib.socket': mock.MagicMock(),
+ 'trex_stl_lib.string': mock.MagicMock(),
+ 'trex_stl_lib.struct': mock.MagicMock(),
+ 'trex_stl_lib.sys': mock.MagicMock(),
+ 'trex_stl_lib.threading': mock.MagicMock(),
+ 'trex_stl_lib.time': mock.MagicMock(),
+ 'trex_stl_lib.traceback': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_async_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_exceptions': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_ext': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_port': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_stats': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_streams': mock.MagicMock(),
+ 'trex_stl_lib.trex_stl_types': mock.MagicMock(),
+ 'trex_stl_lib.types': mock.MagicMock(),
+ 'trex_stl_lib.utils': mock.MagicMock(),
+ 'trex_stl_lib.utils.argparse': mock.MagicMock(),
+ 'trex_stl_lib.utils.collections': mock.MagicMock(),
+ 'trex_stl_lib.utils.common': mock.MagicMock(),
+ 'trex_stl_lib.utils.json': mock.MagicMock(),
+ 'trex_stl_lib.utils.os': mock.MagicMock(),
+ 'trex_stl_lib.utils.parsing_opts': mock.MagicMock(),
+ 'trex_stl_lib.utils.pwd': mock.MagicMock(),
+ 'trex_stl_lib.utils.random': mock.MagicMock(),
+ 'trex_stl_lib.utils.re': mock.MagicMock(),
+ 'trex_stl_lib.utils.string': mock.MagicMock(),
+ 'trex_stl_lib.utils.sys': mock.MagicMock(),
+ 'trex_stl_lib.utils.text_opts': mock.MagicMock(),
+ 'trex_stl_lib.utils.text_tables': mock.MagicMock(),
+ 'trex_stl_lib.utils.texttable': mock.MagicMock(),
+ 'trex_stl_lib.warnings': mock.MagicMock(),
+ 'trex_stl_lib.yaml': mock.MagicMock(),
+ 'trex_stl_lib.zlib': mock.MagicMock(),
+ 'trex_stl_lib.zmq': mock.MagicMock(),
+}
diff --git a/tests/unit/benchmark/runner/test_search.py b/tests/unit/benchmark/runner/test_search.py index 9cfe6e154..8fab5a71f 100644 --- a/tests/unit/benchmark/runner/test_search.py +++ b/tests/unit/benchmark/runner/test_search.py @@ -14,70 +14,11 @@ # from __future__ import absolute_import -import unittest -from contextlib import contextmanager +import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py b/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py new file mode 100644 index 000000000..7592c8070 --- /dev/null +++ b/tests/unit/benchmark/scenarios/lib/test_delete_floating_ip.py @@ -0,0 +1,36 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 +############################################################################## +import unittest +import mock +import paramiko + +from yardstick.benchmark.scenarios.lib.delete_floating_ip import DeleteFloatingIp + + +class DeleteFloatingIpTestCase(unittest.TestCase): + + @mock.patch('yardstick.common.openstack_utils.get_nova_client') + @mock.patch('yardstick.common.openstack_utils.delete_floating_ip') + def test_delete_floating_ip(self, mock_get_nova_client, mock_delete_floating_ip): + options = { + 'floating_ip_id': '123-123-123' + } + args = {"options": options} + obj = DeleteFloatingIp(args, {}) + obj.run({}) + self.assertTrue(mock_get_nova_client.called) + self.assertTrue(mock_delete_floating_ip.called) + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_keypair.py b/tests/unit/benchmark/scenarios/lib/test_delete_keypair.py new file mode 100644 index 000000000..9663fe9fb --- /dev/null +++ b/tests/unit/benchmark/scenarios/lib/test_delete_keypair.py @@ -0,0 +1,36 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 +############################################################################## +import unittest +import mock +import paramiko + +from yardstick.benchmark.scenarios.lib.delete_keypair import DeleteKeypair + + +class DeleteKeypairTestCase(unittest.TestCase): + + @mock.patch('yardstick.common.openstack_utils.get_nova_client') + @mock.patch('yardstick.common.openstack_utils.delete_keypair') + def test_detach_volume(self, mock_get_nova_client, mock_delete_keypair): + options = { + 'key_name': 'yardstick_key' + } + args = {"options": options} + obj = DeleteKeypair(args, {}) + obj.run({}) + self.assertTrue(mock_get_nova_client.called) + self.assertTrue(mock_delete_keypair.called) + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_volume.py b/tests/unit/benchmark/scenarios/lib/test_delete_volume.py new file mode 100644 index 000000000..a11d0121b --- /dev/null +++ b/tests/unit/benchmark/scenarios/lib/test_delete_volume.py @@ -0,0 +1,36 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 +############################################################################## +import unittest +import mock +import paramiko + +from yardstick.benchmark.scenarios.lib.delete_volume import DeleteVolume + + +class DeleteVolumeTestCase(unittest.TestCase): + + @mock.patch('yardstick.common.openstack_utils.get_cinder_client') + @mock.patch('yardstick.common.openstack_utils.delete_volume') + def test_delete_volume(self, mock_get_cinder_client, mock_delete_volume): + options = { + 'volume_id': '123-123-123' + } + args = {"options": options} + obj = DeleteVolume(args, {}) + obj.run({}) + self.assertTrue(mock_get_cinder_client.called) + self.assertTrue(mock_delete_volume.called) + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() diff --git a/tests/unit/benchmark/scenarios/lib/test_detach_volume.py b/tests/unit/benchmark/scenarios/lib/test_detach_volume.py new file mode 100644 index 000000000..0cffcba15 --- /dev/null +++ b/tests/unit/benchmark/scenarios/lib/test_detach_volume.py @@ -0,0 +1,35 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 +############################################################################## +import unittest +import mock +import paramiko + +from yardstick.benchmark.scenarios.lib.detach_volume import DetachVolume + + +class DetachVolumeTestCase(unittest.TestCase): + + @mock.patch('yardstick.common.openstack_utils.detach_volume') + def test_detach_volume(self, mock_detach_volume): + options = { + 'server_id': '321-321-321', + 'volume_id': '123-123-123' + } + args = {"options": options} + obj = DetachVolume(args, {}) + obj.run({}) + self.assertTrue(mock_detach_volume.called) + + +def main(): + unittest.main() + + +if __name__ == '__main__': + main() diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen.py b/tests/unit/benchmark/scenarios/networking/test_pktgen.py index 32ba255b2..0ca31d484 100644 --- a/tests/unit/benchmark/scenarios/networking/test_pktgen.py +++ b/tests/unit/benchmark/scenarios/networking/test_pktgen.py @@ -132,7 +132,7 @@ class PktgenTestCase(unittest.TestCase): p._iptables_get_result = mock_iptables_result sample_output = '{"packets_per_second": 9753, "errors": 0, \ - "packets_sent": 149776, "packetsize": 60, "flows": 110}' + "packets_sent": 149776, "packetsize": 60, "flows": 110, "ppm": 3179}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') p.run(result) @@ -159,7 +159,7 @@ class PktgenTestCase(unittest.TestCase): p._iptables_get_result = mock_iptables_result sample_output = '{"packets_per_second": 9753, "errors": 0, \ - "packets_sent": 149776, "packetsize": 60, "flows": 110}' + "packets_sent": 149776, "packetsize": 60, "flows": 110, "ppm": 3179}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') p.run(result) @@ -648,7 +648,7 @@ class PktgenTestCase(unittest.TestCase): p._iptables_get_result = mock_iptables_result sample_output = '{"packets_per_second": 9753, "errors": 0, \ - "packets_sent": 149300, "flows": 110}' + "packets_sent": 149300, "flows": 110, "ppm": 0}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') p.run(result) @@ -693,7 +693,7 @@ class PktgenTestCase(unittest.TestCase): p._iptables_get_result = mock_iptables_result sample_output = '{"packets_per_second": 9753, "errors": 0, \ - "packets_sent": 149300, "flows": 110}' + "packets_sent": 149300, "flows": 110, "ppm": 0}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') p.run(result) @@ -730,7 +730,7 @@ class PktgenTestCase(unittest.TestCase): p._iptables_get_result = mock_iptables_result sample_output = '{"packets_per_second": 9753, "errors": 0, \ - "packets_sent": 149300, "flows": 110}' + "packets_sent": 149300, "flows": 110, "ppm": 0}' mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '') p.run(result) diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py index 651614d3e..df5047a0d 100644 --- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py +++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py @@ -24,6 +24,7 @@ import errno import unittest import mock +from tests.unit import STL_MOCKS from yardstick.benchmark.scenarios.networking.vnf_generic import \ SshManager, NetworkServiceTestCase, IncorrectConfig, \ open_relative_file @@ -31,65 +32,6 @@ from yardstick.network_services.collector.subscriber import Collector from yardstick.network_services.vnf_generic.vnf.base import \ GenericTrafficGen, GenericVNF -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} COMPLETE_TREX_VNFD = { 'vnfd:vnfd-catalog': { @@ -375,6 +317,9 @@ class TestNetworkServiceTestCase(unittest.TestCase): 'allowed_drop_rate': '0.8 - 1', }, }, + 'options': { + 'framesize': {'64B': 100} + }, 'runner': { 'object': 'NetworkServiceTestCase', 'interval': 35, @@ -414,17 +359,40 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test___init__(self): assert self.topology + def test__get_ip_flow_range(self): + self.scenario_cfg["traffic_options"]["flow"] = \ + self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") + result = '152.16.100.1-152.16.100.254' + self.assertEqual(result, self.s._get_ip_flow_range({"tg__1": 'xe0'})) + def test___get_traffic_flow(self): self.scenario_cfg["traffic_options"]["flow"] = \ self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") - result = {'flow': {'dstip4_range': '152.40.0.20', - 'srcip4_range': '152.16.0.20', 'count': 1}} + self.scenario_cfg["options"] = {} + self.scenario_cfg['options'] = { + 'flow': { + 'src_ip': [ + { + 'tg__1': 'xe0', + }, + ], + 'dst_ip': [ + { + 'tg__1': 'xe1', + }, + ], + 'public_ip': ['1.1.1.1'], + }, + } + result = {'flow': {'dst_ip0': '152.16.40.1-152.16.40.254', + 'src_ip0': '152.16.100.1-152.16.100.254'}} + self.assertEqual(result, self.s._get_traffic_flow()) def test___get_traffic_flow_error(self): self.scenario_cfg["traffic_options"]["flow"] = \ "ipv4_1flow_Packets_vpe.yaml1" - self.assertEqual({}, self.s._get_traffic_flow()) + self.assertEqual({'flow': {}}, self.s._get_traffic_flow()) def test_get_vnf_imp(self): vnfd = COMPLETE_TREX_VNFD['vnfd:vnfd-catalog']['vnfd'][0]['class-name'] @@ -586,7 +554,7 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test___get_traffic_imix_exception(self): with mock.patch.dict(self.scenario_cfg["traffic_options"], {'imix': ''}): - self.assertEqual({}, self.s._get_traffic_imix()) + self.assertEqual({'imix': {'64B': 100}}, self.s._get_traffic_imix()) def test__fill_traffic_profile(self): with mock.patch.dict("sys.modules", STL_MOCKS): diff --git a/tests/unit/network_services/helpers/test_samplevnf_helper.py b/tests/unit/network_services/helpers/test_samplevnf_helper.py index b89668577..608f31747 100644 --- a/tests/unit/network_services/helpers/test_samplevnf_helper.py +++ b/tests/unit/network_services/helpers/test_samplevnf_helper.py @@ -198,6 +198,8 @@ class TestMultiPortConfig(unittest.TestCase): opnfv_vnf.get_ports_gateway6 = mock.Mock(return_value=u'1.1.1.1') opnfv_vnf.get_netmask_gateway6 = mock.Mock(return_value=u'255.255.255.0') opnfv_vnf.txrx_pipeline = '' + opnfv_vnf.vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] + opnfv_vnf.interfaces = opnfv_vnf.vnfd['vdu'][0]['external-interface'] opnfv_vnf.rules = '' self.assertIsNotNone(opnfv_vnf.generate_rule_config()) opnfv_vnf.rules = 'new' diff --git a/tests/unit/network_services/traffic_profile/test_fixed.py b/tests/unit/network_services/traffic_profile/test_fixed.py index 8b44719a1..84843178e 100644 --- a/tests/unit/network_services/traffic_profile/test_fixed.py +++ b/tests/unit/network_services/traffic_profile/test_fixed.py @@ -16,68 +16,11 @@ # from __future__ import absolute_import + import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py index 6dba64af9..b2cb9dfea 100644 --- a/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py +++ b/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py @@ -20,65 +20,7 @@ from __future__ import division import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/traffic_profile/test_prox_acl.py b/tests/unit/network_services/traffic_profile/test_prox_acl.py index 252c655da..be172f26b 100644 --- a/tests/unit/network_services/traffic_profile/test_prox_acl.py +++ b/tests/unit/network_services/traffic_profile/test_prox_acl.py @@ -14,69 +14,11 @@ # from __future__ import absolute_import -import unittest +import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py index 74e6121a7..72b86709c 100644 --- a/tests/unit/network_services/traffic_profile/test_prox_binsearch.py +++ b/tests/unit/network_services/traffic_profile/test_prox_binsearch.py @@ -14,69 +14,11 @@ # from __future__ import absolute_import -import unittest +import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/traffic_profile/test_prox_profile.py b/tests/unit/network_services/traffic_profile/test_prox_profile.py index a2ad0333f..14223da0f 100644 --- a/tests/unit/network_services/traffic_profile/test_prox_profile.py +++ b/tests/unit/network_services/traffic_profile/test_prox_profile.py @@ -14,69 +14,11 @@ # from __future__ import absolute_import -import unittest +import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/traffic_profile/test_prox_ramp.py b/tests/unit/network_services/traffic_profile/test_prox_ramp.py index 19e6ff8cb..357298759 100644 --- a/tests/unit/network_services/traffic_profile/test_prox_ramp.py +++ b/tests/unit/network_services/traffic_profile/test_prox_ramp.py @@ -14,69 +14,11 @@ # from __future__ import absolute_import -import unittest +import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/traffic_profile/test_rfc2544.py b/tests/unit/network_services/traffic_profile/test_rfc2544.py index dcaf43dc5..aef0b93de 100644 --- a/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -17,68 +17,12 @@ from __future__ import absolute_import from __future__ import division + import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) @@ -115,9 +59,9 @@ class TestRFC2544Profile(unittest.TestCase): 'outer_l3v4': {'dstip4': '1.1.1.1-1.15.255.255', 'proto': 'udp', 'srcip4': '90.90.1.1-90.105.255.255', - 'dscp': 0, 'ttl': 32}, + 'dscp': 0, 'ttl': 32, 'count': 1}, 'outer_l4': {'srcport': '2001', - 'dsrport': '1234'}}}, + 'dsrport': '1234', 'count': 1}}}, 'private_1': {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', @@ -127,9 +71,9 @@ class TestRFC2544Profile(unittest.TestCase): 'outer_l3v4': {'dstip4': '9.9.1.1-90.105.255.255', 'proto': 'udp', 'srcip4': '1.1.1.1-1.15.255.255', - 'dscp': 0, 'ttl': 32}, + 'dscp': 0, 'ttl': 32, 'count': 1}, 'outer_l4': {'dstport': '2001', - 'srcport': '1234'}}}, + 'srcport': '1234', 'count': 1}}}, 'schema': 'isb:traffic_profile:0.1'} def test___init__(self): diff --git a/tests/unit/network_services/traffic_profile/test_traffic_profile.py b/tests/unit/network_services/traffic_profile/test_traffic_profile.py index fd769e6e0..9a78c36a3 100644 --- a/tests/unit/network_services/traffic_profile/test_traffic_profile.py +++ b/tests/unit/network_services/traffic_profile/test_traffic_profile.py @@ -16,69 +16,12 @@ # from __future__ import absolute_import -import unittest +import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) @@ -117,9 +60,11 @@ class TestTrexProfile(unittest.TestCase): 'outer_l3v4': {'dstip4': '1.1.1.1-1.1.2.2', 'proto': 'udp', 'srcip4': '9.9.1.1-90.1.2.2', - 'dscp': 0, 'ttl': 32}, + 'dscp': 0, 'ttl': 32, + 'count': 1}, 'outer_l4': {'srcport': '2001', - 'dsrport': '1234'}}}, + 'dsrport': '1234', + 'count': 1}}}, 'private': {'ipv4': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', @@ -131,9 +76,10 @@ class TestTrexProfile(unittest.TestCase): 'outer_l3v4': {'dstip4': '9.9.1.1-90.105.255.255', 'proto': 'udp', 'srcip4': '1.1.1.1-1.15.255.255', - 'dscp': 0, 'ttl': 32}, + 'dscp': 0, 'ttl': 32, 'count': 1}, 'outer_l4': {'dstport': '2001', - 'srcport': '1234'}}}, + 'srcport': '1234', + 'count': 1}}}, 'schema': 'isb:traffic_profile:0.1'} PROFILE_v6 = {'description': 'Traffic profile to run RFC2544 latency', 'name': 'rfc2544', @@ -149,9 +95,11 @@ class TestTrexProfile(unittest.TestCase): 'outer_l3v4': {'dstip6': '0064:ff9b:0:0:0:0:9810:6414-0064:ff9b:0:0:0:0:9810:6420', 'proto': 'udp', 'srcip6': '0064:ff9b:0:0:0:0:9810:2814-0064:ff9b:0:0:0:0:9810:2820', - 'dscp': 0, 'ttl': 32}, + 'dscp': 0, 'ttl': 32, + 'count': 1}, 'outer_l4': {'srcport': '2001', - 'dsrport': '1234'}}}, + 'dsrport': '1234', + 'count': 1}}}, 'private': {'ipv6': {'outer_l2': {'framesize': {'64B': '100', '1518B': '0', @@ -163,9 +111,11 @@ class TestTrexProfile(unittest.TestCase): 'outer_l3v4': {'dstip6': '0064:ff9b:0:0:0:0:9810:2814-0064:ff9b:0:0:0:0:9810:2820', 'proto': 'udp', 'srcip6': '0064:ff9b:0:0:0:0:9810:6414-0064:ff9b:0:0:0:0:9810:6420', - 'dscp': 0, 'ttl': 32}, + 'dscp': 0, 'ttl': 32, + 'count': 1}, 'outer_l4': {'dstport': '2001', - 'srcport': '1234'}}}, + 'srcport': '1234', + 'count': 1}}}, 'schema': 'isb:traffic_profile:0.1'} def test___init__(self): diff --git a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py index a63a59d48..7570067b9 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_acl_vnf.py @@ -16,70 +16,13 @@ # from __future__ import absolute_import + import unittest import mock import os +from tests.unit import STL_MOCKS -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py index bf226d2c8..f214d66f6 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_cgnapt_vnf.py @@ -19,68 +19,10 @@ from __future__ import absolute_import import os import unittest - import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py b/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py index 53481ddd0..b74e5d9fd 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_iniparser.py @@ -14,70 +14,13 @@ # from __future__ import absolute_import + import unittest from contextlib import contextmanager - import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py index 90ec3f374..98eccae4f 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_helpers.py @@ -23,69 +23,10 @@ import unittest from collections import OrderedDict from itertools import repeat, chain from contextlib import contextmanager - import mock +from tests.unit import STL_MOCKS -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py index 453100b90..c727cb7fb 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_prox_vnf.py @@ -19,71 +19,13 @@ from __future__ import absolute_import import os import unittest - import mock from copy import deepcopy -SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' +from tests.unit import STL_MOCKS -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} + +SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py index 07a862a8e..455e44ec9 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py @@ -18,11 +18,13 @@ # Unittest for yardstick.network_services.vnf_generic.vnf.sample_vnf from __future__ import absolute_import + import unittest import mock from copy import deepcopy from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh +from tests.unit import STL_MOCKS from yardstick.benchmark.contexts.base import Context from yardstick.network_services.nfvi.resource import ResourceProfile from yardstick.network_services.traffic_profile.base import TrafficProfile @@ -34,66 +36,6 @@ class MockError(BaseException): pass -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} - STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) stl_patch.start() diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py index cda44127e..5c81aa886 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py @@ -16,69 +16,13 @@ # from __future__ import absolute_import + import unittest import mock import subprocess -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py index 949bfb3d4..45bbfaea3 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py @@ -16,74 +16,16 @@ # from __future__ import absolute_import + import unittest import mock from multiprocessing import Queue from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh +from tests.unit import STL_MOCKS SSH_HELPER = "yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper" -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} - STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) stl_patch.start() diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py index 1a01b9e15..12abadf98 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_prox.py @@ -14,76 +14,17 @@ # from __future__ import absolute_import + import unittest import mock from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh +from tests.unit import STL_MOCKS SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' NAME = 'vnf__1' - -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} - STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) stl_patch.start() diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py index 8f7f05772..ca8150cb2 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py @@ -16,68 +16,13 @@ # from __future__ import absolute_import + import os import unittest import mock -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} + +from tests.unit import STL_MOCKS + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py index 7dc303852..3dcb02f02 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_trex.py @@ -16,70 +16,14 @@ # from __future__ import absolute_import + import unittest import mock -SSH_HELPER = "yardstick.ssh.SSH" +from tests.unit import STL_MOCKS -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} + +SSH_HELPER = "yardstick.ssh.SSH" STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py index 6fb5d080f..65370dfa5 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_trex.py @@ -16,74 +16,16 @@ # from __future__ import absolute_import + import unittest import mock from tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh +from tests.unit import STL_MOCKS NAME = 'vnf_1' -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} - STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) stl_patch.start() diff --git a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py index 08bf06b74..f0d75d57b 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py @@ -16,70 +16,13 @@ # from __future__ import absolute_import + import unittest import mock import os +from tests.unit import STL_MOCKS -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py index d817b164c..7dae89f40 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_vfw_vnf.py @@ -16,69 +16,13 @@ # from __future__ import absolute_import + import unittest import mock import os -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +from tests.unit import STL_MOCKS + STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py index 80b4a5108..5e66390e3 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_vpe_vnf.py @@ -16,77 +16,18 @@ # from __future__ import absolute_import +import six.moves.configparser as configparser import os import unittest - -import six.moves.configparser as configparser import mock from multiprocessing import Process, Queue +from tests.unit import STL_MOCKS from yardstick.network_services.vnf_generic.vnf.base import QueueFileWrapper -SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' -STL_MOCKS = { - 'stl': mock.MagicMock(), - 'stl.trex_stl_lib': mock.MagicMock(), - 'stl.trex_stl_lib.base64': mock.MagicMock(), - 'stl.trex_stl_lib.binascii': mock.MagicMock(), - 'stl.trex_stl_lib.collections': mock.MagicMock(), - 'stl.trex_stl_lib.copy': mock.MagicMock(), - 'stl.trex_stl_lib.datetime': mock.MagicMock(), - 'stl.trex_stl_lib.functools': mock.MagicMock(), - 'stl.trex_stl_lib.imp': mock.MagicMock(), - 'stl.trex_stl_lib.inspect': mock.MagicMock(), - 'stl.trex_stl_lib.json': mock.MagicMock(), - 'stl.trex_stl_lib.linecache': mock.MagicMock(), - 'stl.trex_stl_lib.math': mock.MagicMock(), - 'stl.trex_stl_lib.os': mock.MagicMock(), - 'stl.trex_stl_lib.platform': mock.MagicMock(), - 'stl.trex_stl_lib.pprint': mock.MagicMock(), - 'stl.trex_stl_lib.random': mock.MagicMock(), - 'stl.trex_stl_lib.re': mock.MagicMock(), - 'stl.trex_stl_lib.scapy': mock.MagicMock(), - 'stl.trex_stl_lib.socket': mock.MagicMock(), - 'stl.trex_stl_lib.string': mock.MagicMock(), - 'stl.trex_stl_lib.struct': mock.MagicMock(), - 'stl.trex_stl_lib.sys': mock.MagicMock(), - 'stl.trex_stl_lib.threading': mock.MagicMock(), - 'stl.trex_stl_lib.time': mock.MagicMock(), - 'stl.trex_stl_lib.traceback': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_async_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_exceptions': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_ext': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_jsonrpc_client': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_interface': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_packet_builder_scapy': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_port': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_stats': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_streams': mock.MagicMock(), - 'stl.trex_stl_lib.trex_stl_types': mock.MagicMock(), - 'stl.trex_stl_lib.types': mock.MagicMock(), - 'stl.trex_stl_lib.utils': mock.MagicMock(), - 'stl.trex_stl_lib.utils.argparse': mock.MagicMock(), - 'stl.trex_stl_lib.utils.collections': mock.MagicMock(), - 'stl.trex_stl_lib.utils.common': mock.MagicMock(), - 'stl.trex_stl_lib.utils.json': mock.MagicMock(), - 'stl.trex_stl_lib.utils.os': mock.MagicMock(), - 'stl.trex_stl_lib.utils.parsing_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.pwd': mock.MagicMock(), - 'stl.trex_stl_lib.utils.random': mock.MagicMock(), - 'stl.trex_stl_lib.utils.re': mock.MagicMock(), - 'stl.trex_stl_lib.utils.string': mock.MagicMock(), - 'stl.trex_stl_lib.utils.sys': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_opts': mock.MagicMock(), - 'stl.trex_stl_lib.utils.text_tables': mock.MagicMock(), - 'stl.trex_stl_lib.utils.texttable': mock.MagicMock(), - 'stl.trex_stl_lib.warnings': mock.MagicMock(), - 'stl.trex_stl_lib.yaml': mock.MagicMock(), - 'stl.trex_stl_lib.zlib': mock.MagicMock(), - 'stl.trex_stl_lib.zmq': mock.MagicMock(), -} +SSH_HELPER = 'yardstick.network_services.vnf_generic.vnf.sample_vnf.VnfSshHelper' STLClient = mock.MagicMock() stl_patch = mock.patch.dict("sys.modules", STL_MOCKS) diff --git a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml index aa144ab50..ee7ea7d83 100644 --- a/yardstick/benchmark/scenarios/availability/attacker_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/attacker_conf.yaml @@ -40,3 +40,7 @@ stress-cpu: block-io: inject_script: ha_tools/disk/block_io.bash recovery_script: ha_tools/disk/recovery_disk_io.bash + +kill-corosync: + inject_script: ha_tools/fault_process_kill.bash + recovery_script: ha_tools/node/reboot_node.bash
\ No newline at end of file diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/node/reboot_node.bash b/yardstick/benchmark/scenarios/availability/ha_tools/node/reboot_node.bash new file mode 100644 index 000000000..1ee8c9c2f --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/node/reboot_node.bash @@ -0,0 +1,14 @@ +#!/bin/bash + +############################################################################## +# (c) OPNFV, Yin Kanglin and others. +# 14_ykl@tongji.edu.cn +# 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 +############################################################################## + +# reboot node + +reboot
\ No newline at end of file diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_resource_status.bash b/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_resource_status.bash new file mode 100644 index 000000000..68707cf4f --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_resource_status.bash @@ -0,0 +1,14 @@ +#!/bin/bash + +############################################################################## +# (c) OPNFV, Yin Kanglin and others. +# 14_ykl@tongji.edu.cn +# 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 +############################################################################## + +# get pacemaker resource status + +pcs resource show
\ No newline at end of file diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_resource_status_host.bash b/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_resource_status_host.bash new file mode 100644 index 000000000..7a02ccf29 --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_resource_status_host.bash @@ -0,0 +1,15 @@ +#!/bin/bash + +############################################################################## +# (c) OPNFV, Yin Kanglin and others. +# 14_ykl@tongji.edu.cn +# 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 +############################################################################## + +# get pacemaker resource status of hosts +# parameter: $1 - resource name $2 status + +pcs resource show | grep $1 -A 3 | grep $2
\ No newline at end of file diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_vip_host.bash b/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_vip_host.bash new file mode 100644 index 000000000..f4870fdae --- /dev/null +++ b/yardstick/benchmark/scenarios/availability/ha_tools/pacemaker/get_vip_host.bash @@ -0,0 +1,15 @@ +#!/bin/bash + +############################################################################## +# (c) OPNFV, Yin Kanglin and others. +# 14_ykl@tongji.edu.cn +# 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 +############################################################################## + +# get vip host in pacemaker +# parameter: $1 - virtual ip name + +pcs resource show| grep -w $1 | awk '{print $4}'
\ No newline at end of file diff --git a/yardstick/benchmark/scenarios/availability/operation_conf.yaml b/yardstick/benchmark/scenarios/availability/operation_conf.yaml index 50664d087..dc5169196 100644 --- a/yardstick/benchmark/scenarios/availability/operation_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/operation_conf.yaml @@ -30,3 +30,8 @@ nova-create-flavor: get-floatingip: action_script: ha_tools/nova/get_server_floatingip.bash rollback_script: ha_tools/nova/list_servers.bash + +get-vip-host: + action_script: ha_tools/pacemaker/get_vip_host.bash + rollback_script: ha_tools/pacemaker/get_resource_status.bash + diff --git a/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml b/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml index 0494a71a7..451cc0f11 100644 --- a/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml +++ b/yardstick/benchmark/scenarios/availability/result_checker_conf.yaml @@ -18,4 +18,6 @@ service-checker: nova-instance-checker: verify_script: ha_tools/nova/show_instances.bash nova-flavor-checker: - verify_script: ha_tools/nova/show_flavors.bash
\ No newline at end of file + verify_script: ha_tools/nova/show_flavors.bash +pacemaker-resource-checker: + verify_script: ha_tools/pacemaker/get_resource_status_host.bash
\ No newline at end of file diff --git a/yardstick/benchmark/scenarios/availability/util.py b/yardstick/benchmark/scenarios/availability/util.py index 6fef622bd..d288fcbc1 100644 --- a/yardstick/benchmark/scenarios/availability/util.py +++ b/yardstick/benchmark/scenarios/availability/util.py @@ -51,6 +51,8 @@ def build_shell_command(param_config, remote=True, intermediate_variables=None): def read_stdout_item(stdout, key): + if key == "all": + return stdout for item in stdout.splitlines(): if key in item: attributes = item.split("|") diff --git a/yardstick/benchmark/scenarios/lib/delete_floating_ip.py b/yardstick/benchmark/scenarios/lib/delete_floating_ip.py new file mode 100644 index 000000000..4314952fb --- /dev/null +++ b/yardstick/benchmark/scenarios/lib/delete_floating_ip.py @@ -0,0 +1,54 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 print_function +from __future__ import absolute_import + +import logging + +from yardstick.benchmark.scenarios import base +import yardstick.common.openstack_utils as op_utils + +LOG = logging.getLogger(__name__) + + +class DeleteFloatingIp(base.Scenario): + """Delete an OpenStack floating ip """ + + __scenario_type__ = "DeleteFloatingIp" + + def __init__(self, scenario_cfg, context_cfg): + self.scenario_cfg = scenario_cfg + self.context_cfg = context_cfg + self.options = self.scenario_cfg['options'] + + self.floating_ip_id = self.options.get("floating_ip_id", None) + + self.nova_client = op_utils.get_nova_client() + self.setup_done = False + + def setup(self): + """scenario setup""" + + self.setup_done = True + + def run(self, result): + """execute the test""" + + if not self.setup_done: + self.setup() + + status = op_utils.delete_floating_ip(nova_client=self.nova_client, + floatingip_id=self.floating_ip_id) + if status: + result.update({"delete_floating_ip": 1}) + LOG.info("Delete floating ip successful!") + else: + result.update({"delete_floating_ip": 0}) + LOG.error("Delete floating ip failed!") diff --git a/yardstick/benchmark/scenarios/lib/delete_keypair.py b/yardstick/benchmark/scenarios/lib/delete_keypair.py new file mode 100644 index 000000000..135139959 --- /dev/null +++ b/yardstick/benchmark/scenarios/lib/delete_keypair.py @@ -0,0 +1,56 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 print_function +from __future__ import absolute_import + +import logging + +from yardstick.benchmark.scenarios import base +import yardstick.common.openstack_utils as op_utils + +LOG = logging.getLogger(__name__) + + +class DeleteKeypair(base.Scenario): + """Delete an OpenStack keypair""" + + __scenario_type__ = "DeleteKeypair" + + def __init__(self, scenario_cfg, context_cfg): + self.scenario_cfg = scenario_cfg + self.context_cfg = context_cfg + self.options = self.scenario_cfg['options'] + + self.key_name = self.options.get("key_name", "yardstick_key") + + self.nova_client = op_utils.get_nova_client() + + self.setup_done = False + + def setup(self): + """scenario setup""" + + self.setup_done = True + + def run(self, result): + """execute the test""" + + if not self.setup_done: + self.setup() + + status = op_utils.delete_keypair(self.nova_client, + self.key_name) + + if status: + result.update({"delete_keypair": 1}) + LOG.info("Delete keypair successful!") + else: + result.update({"delete_keypair": 0}) + LOG.info("Delete keypair failed!") diff --git a/yardstick/benchmark/scenarios/lib/delete_volume.py b/yardstick/benchmark/scenarios/lib/delete_volume.py new file mode 100644 index 000000000..ea2b85812 --- /dev/null +++ b/yardstick/benchmark/scenarios/lib/delete_volume.py @@ -0,0 +1,55 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 print_function +from __future__ import absolute_import + +import logging + +from yardstick.benchmark.scenarios import base +import yardstick.common.openstack_utils as op_utils + +LOG = logging.getLogger(__name__) + + +class DeleteVolume(base.Scenario): + """Delete an OpenStack volume""" + + __scenario_type__ = "DeleteVolume" + + def __init__(self, scenario_cfg, context_cfg): + self.scenario_cfg = scenario_cfg + self.context_cfg = context_cfg + self.options = self.scenario_cfg['options'] + + self.volume_id = self.options.get("volume_id", None) + + self.cinder_client = op_utils.get_cinder_client() + + self.setup_done = False + + def setup(self): + """scenario setup""" + + self.setup_done = True + + def run(self, result): + """execute the test""" + + if not self.setup_done: + self.setup() + + status = op_utils.delete_volume(self.cinder_client, self.volume_id) + + if status: + result.update({"delete_volume": 1}) + LOG.info("Delete volume successful!") + else: + result.update({"delete_volume": 0}) + LOG.info("Delete volume failed!") diff --git a/yardstick/benchmark/scenarios/lib/detach_volume.py b/yardstick/benchmark/scenarios/lib/detach_volume.py new file mode 100644 index 000000000..0b02a3a81 --- /dev/null +++ b/yardstick/benchmark/scenarios/lib/detach_volume.py @@ -0,0 +1,54 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 print_function +from __future__ import absolute_import + +import logging + +from yardstick.benchmark.scenarios import base +import yardstick.common.openstack_utils as op_utils + +LOG = logging.getLogger(__name__) + + +class DetachVolume(base.Scenario): + """Detach a volume from an instance""" + + __scenario_type__ = "DetachVolume" + + def __init__(self, scenario_cfg, context_cfg): + self.scenario_cfg = scenario_cfg + self.context_cfg = context_cfg + self.options = self.scenario_cfg['options'] + + self.server_id = self.options.get("server_id", "TestServer") + self.volume_id = self.options.get("volume_id", None) + + self.setup_done = False + + def setup(self): + """scenario setup""" + + self.setup_done = True + + def run(self, result): + """execute the test""" + + if not self.setup_done: + self.setup() + + status = op_utils.detach_volume(self.server_id, self.volume_id) + + if status: + result.update({"detach_volume": 1}) + LOG.info("Detach volume from server successful!") + else: + result.update({"detach_volume": 0}) + LOG.info("Detach volume from server failed!") diff --git a/yardstick/benchmark/scenarios/networking/pktgen.py b/yardstick/benchmark/scenarios/networking/pktgen.py index 1e0a5fcbb..a9e7aa6a3 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen.py +++ b/yardstick/benchmark/scenarios/networking/pktgen.py @@ -11,6 +11,7 @@ from __future__ import print_function import os import logging +import math import pkg_resources from oslo_serialization import jsonutils @@ -357,15 +358,15 @@ class Pktgen(base.Scenario): result.update(jsonutils.loads(stdout)) - result['packets_received'] = self._iptables_get_result() + received = result['packets_received'] = self._iptables_get_result() + sent = result['packets_sent'] result['packetsize'] = packetsize + # compatible with python3 / + ppm = math.ceil(1000000.0 * (sent - received) / sent) + + result['ppm'] = ppm if "sla" in self.scenario_cfg: - sent = result['packets_sent'] - received = result['packets_received'] - ppm = 1000000 * (sent - received) / sent - # if ppm is 1, then 11 out of 10 million is no pass - ppm += (sent - received) % sent > 0 LOG.debug("Lost packets %d - Lost ppm %d", (sent - received), ppm) sla_max_ppm = int(self.scenario_cfg["sla"]["max_ppm"]) assert ppm <= sla_max_ppm, "ppm %d > sla_max_ppm %d; " \ diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index dcc372b8d..aecc228bc 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -14,13 +14,17 @@ """ NSPerf specific scenario definition """ from __future__ import absolute_import -import logging +import logging import errno -import os +import ipaddress +import os +import sys import re from itertools import chain + +import six from operator import itemgetter from collections import defaultdict @@ -31,8 +35,10 @@ from yardstick.network_services.collector.subscriber import Collector from yardstick.network_services.vnf_generic import vnfdgen from yardstick.network_services.vnf_generic.vnf.base import GenericVNF from yardstick.network_services.traffic_profile.base import TrafficProfile +from yardstick.network_services.utils import get_nsb_option from yardstick import ssh + LOG = logging.getLogger(__name__) @@ -126,19 +132,50 @@ class NetworkServiceTestCase(base.Scenario): self.collector = None self.traffic_profile = None + def _get_ip_flow_range(self, ip_start_range): + + node_name, range_or_interface = next(iter(ip_start_range.items()), (None, '0.0.0.0')) + if node_name is not None: + node = self.context_cfg["nodes"].get(node_name, {}) + try: + # the ip_range is the interface name + interface = node.get("interfaces", {})[range_or_interface] + except KeyError: + ip = "0.0.0.0" + mask = "255.255.255.0" + else: + ip = interface["local_ip"] + # we can't default these values, they must both exist to be valid + mask = interface["netmask"] + + ipaddr = ipaddress.ip_network(six.text_type('{}/{}'.format(ip, mask)), strict=False) + hosts = list(ipaddr.hosts()) + ip_addr_range = "{}-{}".format(hosts[0], hosts[-1]) + else: + # we are manually specifying the range + ip_addr_range = range_or_interface + return ip_addr_range + def _get_traffic_flow(self): + flow = {} try: - with open(self.scenario_cfg["traffic_options"]["flow"]) as fflow: - flow = yaml_load(fflow) - except (KeyError, IOError, OSError): + fflow = self.scenario_cfg["options"]["flow"] + for index, src in enumerate(fflow.get("src_ip", [])): + flow["src_ip{}".format(index)] = self._get_ip_flow_range(src) + + for index, dst in enumerate(fflow.get("dst_ip", [])): + flow["dst_ip{}".format(index)] = self._get_ip_flow_range(dst) + + for index, publicip in enumerate(fflow.get("publicip", [])): + flow["public_ip{}".format(index)] = publicip + except KeyError: flow = {} - return flow + return {"flow": flow} def _get_traffic_imix(self): try: - with open(self.scenario_cfg["traffic_options"]["imix"]) as fimix: - imix = yaml_load(fimix) - except (KeyError, IOError, OSError): + imix = {"imix": self.scenario_cfg['options']['framesize']} + except KeyError: imix = {} return imix @@ -404,6 +441,9 @@ printf "%s/driver:" $1 ; basename $(readlink -s $1/device/driver); } \ :param context_cfg: :return: """ + trex_lib_path = get_nsb_option('trex_client_lib') + sys.path[:] = list(chain([trex_lib_path], (x for x in sys.path if x != trex_lib_path))) + if scenario_cfg is None: scenario_cfg = self.scenario_cfg diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py index fe394fd4d..ec683e94b 100644 --- a/yardstick/common/constants.py +++ b/yardstick/common/constants.py @@ -59,6 +59,7 @@ if not SERVER_IP: # dir CONF_DIR = get_param('dir.conf', '/etc/yardstick') +IMAGE_DIR = get_param('dir.images', '/home/opnfv/images/') REPOS_DIR = get_param('dir.repos', '/home/opnfv/repos/yardstick') RELENG_DIR = get_param('dir.releng', '/home/opnfv/repos/releng') LOG_DIR = get_param('dir.log', '/tmp/yardstick/') diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py index 76acc9508..c862a6ba2 100644 --- a/yardstick/common/openstack_utils.py +++ b/yardstick/common/openstack_utils.py @@ -11,6 +11,7 @@ from __future__ import absolute_import import os import time +import sys import logging from keystoneauth1 import loading @@ -423,6 +424,15 @@ def delete_flavor(flavor_id): # pragma: no cover return True +def delete_keypair(nova_client, key): # pragma: no cover + try: + nova_client.keypairs.delete(key=key) + return True + except Exception: + log.exception("Error [delete_keypair(nova_client)]") + return False + + # ********************************************* # NEUTRON # ********************************************* @@ -479,6 +489,15 @@ def create_floating_ip(neutron_client, extnet_id): # pragma: no cover return {'fip_addr': fip_addr, 'fip_id': fip_id} +def delete_floating_ip(nova_client, floatingip_id): # pragma: no cover + try: + nova_client.floating_ips.delete(floatingip_id) + return True + except Exception: + log.error("Error [delete_floating_ip(nova_client, '%s')]" % floatingip_id) + return False + + def get_security_groups(neutron_client): # pragma: no cover try: security_groups = neutron_client.list_security_groups()[ @@ -667,3 +686,33 @@ def create_volume(cinder_client, volume_name, volume_size, log.exception("Error [create_volume(cinder_client, %s)]", (volume_name, volume_size)) return None + + +def delete_volume(cinder_client, volume_id, forced=False): # pragma: no cover + try: + if forced: + try: + cinder_client.volumes.detach(volume_id) + except: + log.error(sys.exc_info()[0]) + cinder_client.volumes.force_delete(volume_id) + else: + while True: + volume = get_cinder_client().volumes.get(volume_id) + if volume.status.lower() == 'available': + break + cinder_client.volumes.delete(volume_id) + return True + except Exception: + log.exception("Error [delete_volume(cinder_client, '%s')]" % volume_id) + return False + + +def detach_volume(server_id, volume_id): # pragma: no cover + try: + get_nova_client().volumes.delete_server_volume(server_id, volume_id) + return True + except Exception: + log.exception("Error [detach_server_volume(nova_client, '%s', '%s')]", + server_id, volume_id) + return False diff --git a/yardstick/network_services/helpers/cpu.py b/yardstick/network_services/helpers/cpu.py index a5ba6c31e..8c21754ff 100644 --- a/yardstick/network_services/helpers/cpu.py +++ b/yardstick/network_services/helpers/cpu.py @@ -13,6 +13,9 @@ # limitations under the License. +import io + + class CpuSysCores(object): def __init__(self, connection=""): @@ -20,8 +23,9 @@ class CpuSysCores(object): self.connection = connection def _open_cpuinfo(self): - lines = [] - lines = self.connection.execute("cat /proc/cpuinfo")[1].split(u'\n') + cpuinfo = io.BytesIO() + self.connection.get_file_obj("/proc/cpuinfo", cpuinfo) + lines = cpuinfo.getvalue().decode('utf-8').splitlines() return lines def _get_core_details(self, lines): diff --git a/yardstick/network_services/helpers/samplevnf_helper.py b/yardstick/network_services/helpers/samplevnf_helper.py index dbaa47c19..870409e31 100644 --- a/yardstick/network_services/helpers/samplevnf_helper.py +++ b/yardstick/network_services/helpers/samplevnf_helper.py @@ -87,9 +87,18 @@ class MultiPortConfig(object): return default @staticmethod - def make_ip_addr(ip, mask_len): + def make_ip_addr(ip, mask): + """ + :param ip: ip adddress + :type ip: str + :param mask: /24 prefix of 255.255.255.0 netmask + :type mask: str + :return: interface + :rtype: IPv4Interface + """ + try: - return ipaddress.ip_interface(six.text_type('/'.join([ip, mask_len]))) + return ipaddress.ip_interface(six.text_type('/'.join([ip, mask]))) except (TypeError, ValueError): # None so we can skip later return None @@ -213,7 +222,7 @@ class MultiPortConfig(object): return try: - self.start_core = 'h{}'.format(int(self.start_core)) + self.start_core = '{}h'.format(int(self.start_core)) except ValueError: self.start_core = int(self.start_core[:-1]) + 1 @@ -279,18 +288,19 @@ class MultiPortConfig(object): for port in port_pair: port_num = int(port[-1]) interface = self.interfaces[port_num] - # port0_ip = ipaddress.ip_interface(six.text_type( - # "%s/%s" % (interface["virtual-interface"]["local_ip"], - # interface["virtual-interface"]["netmask"]))) + # We must use the dst because we are on the VNF and we need to + # reach the TG. dst_port0_ip = \ ipaddress.ip_interface(six.text_type( "%s/%s" % (interface["virtual-interface"]["dst_ip"], interface["virtual-interface"]["netmask"]))) arp_vars = { - "port0_dst_ip_hex": ip_to_hex(dst_port0_ip.ip.exploded), + "port0_dst_ip_hex": ip_to_hex(dst_port0_ip.network.network_address.exploded), "port0_netmask_hex": ip_to_hex(dst_port0_ip.network.netmask.exploded), + # this is the port num that contains port0 subnet and next_hop_ip_hex "port_num": port_num, # next hop is dst in this case + # must be within subnet "next_hop_ip_hex": ip_to_hex(dst_port0_ip.ip.exploded), } arp_config.append(arp_route_tbl_tmpl.format(**arp_vars)) @@ -302,20 +312,25 @@ class MultiPortConfig(object): self.swq += self.lb_count swq_out_str = self.make_range_str('SWQ{}', self.swq, offset=self.lb_count) self.swq += self.lb_count - mac_iter = (self.interfaces[int(x[-1])]['virtual-interface']['local_mac'] - for port_pair in self.port_pair_list for x in port_pair) + # ports_mac_list is disabled for some reason + # mac_iter = (self.interfaces[int(x[-1])]['virtual-interface']['local_mac'] + # for port_pair in self.port_pair_list for x in port_pair) pktq_in_iter = ('RXQ{}'.format(float(x[0][-1])) for x in self.port_pair_list) arpicmp_data = { 'core': self.gen_core(self.start_core), 'pktq_in': swq_in_str, 'pktq_out': swq_out_str, - 'ports_mac_list': ' '.join(mac_iter), + # we need to disable ports_mac_list? + # it looks like ports_mac_list is no longer required + # 'ports_mac_list': ' '.join(mac_iter), 'pktq_in_prv': ' '.join(pktq_in_iter), 'prv_to_pub_map': self.set_priv_to_pub_mapping(), 'arp_route_tbl': self.generate_arp_route_tbl(), - # can't use empty string, defaul to () - 'nd_route_tbl': "()", + # nd_route_tbl must be set or we get segault on random OpenStack IPv6 traffic + # 'nd_route_tbl': "(0064:ff9b:0:0:0:0:9810:6414,120,0,0064:ff9b:0:0:0:0:9810:6414)" + # safe default? route discard prefix to localhost + 'nd_route_tbl': "(0100::,64,0,::1)" } self.pktq_out_os = swq_out_str.split(' ') # why? @@ -520,12 +535,13 @@ class MultiPortConfig(object): arp_config = [] for port_pair in self.port_pair_list: for port in port_pair: - gateway = self.get_ports_gateway(port) - # omit entries with no gateway - if not gateway: - continue + # ignore gateway, always use TG IP + # gateway = self.get_ports_gateway(port) dst_mac = self.interfaces[int(port[-1])]["virtual-interface"]["dst_mac"] - arp_config.append((port[-1], gateway, dst_mac, self.txrx_pipeline)) + dst_ip = self.interfaces[int(port[-1])]["virtual-interface"]["dst_ip"] + # arp_config.append((port[-1], gateway, dst_mac, self.txrx_pipeline)) + # so dst_mac is the TG dest mac, so we need TG dest IP. + arp_config.append((port[-1], dst_ip, dst_mac, self.txrx_pipeline)) return '\n'.join(('p {3} arpadd {0} {1} {2}'.format(*values) for values in arp_config)) @@ -533,12 +549,12 @@ class MultiPortConfig(object): arp_config6 = [] for port_pair in self.port_pair_list: for port in port_pair: - gateway6 = self.get_ports_gateway6(port) - # omit entries with no gateway - if not gateway6: - continue + # ignore gateway, always use TG IP + # gateway6 = self.get_ports_gateway6(port) dst_mac6 = self.interfaces[int(port[-1])]["virtual-interface"]["dst_mac"] - arp_config6.append((port[-1], gateway6, dst_mac6, self.txrx_pipeline)) + dst_ip6 = self.interfaces[int(port[-1])]["virtual-interface"]["dst_ip"] + # arp_config6.append((port[-1], gateway6, dst_mac6, self.txrx_pipeline)) + arp_config6.append((port[-1], dst_ip6, dst_mac6, self.txrx_pipeline)) return '\n'.join(('p {3} arpadd {0} {1} {2}'.format(*values) for values in arp_config6)) @@ -556,13 +572,17 @@ class MultiPortConfig(object): return ''.join((template.format(port) for port in port_list)) def get_ip_from_port(self, port): - return self.make_ip_addr(self.get_ports_gateway(port), self.get_netmask_gateway(port)) + # we can't use gateway because in OpenStack gateways interfer with floating ip routing + # return self.make_ip_addr(self.get_ports_gateway(port), self.get_netmask_gateway(port)) + ip = self.interfaces[port]["virtual-interface"]["local_ip"] + netmask = self.interfaces[port]["virtual-interface"]["netmask"] + return self.make_ip_addr(ip, netmask) - def get_ip_and_prefixlen_from_ip_of_port(self, port): + def get_network_and_prefixlen_from_ip_of_port(self, port): ip_addr = self.get_ip_from_port(port) # handle cases with no gateway if ip_addr: - return ip_addr.ip.exploded, ip_addr.network.prefixlen + return ip_addr.network.network_address.exploded, ip_addr.network.prefixlen else: return None, None @@ -576,25 +596,25 @@ class MultiPortConfig(object): src_port = int(port_pair[0][-1]) dst_port = int(port_pair[1][-1]) - src_ip, src_prefix_len = self.get_ip_and_prefixlen_from_ip_of_port(port_pair[0]) - dst_ip, dst_prefix_len = self.get_ip_and_prefixlen_from_ip_of_port(port_pair[1]) - # ignore entires with empty values - if all((src_ip, src_prefix_len, dst_ip, dst_prefix_len)): - new_rules.append((cmd, self.txrx_pipeline, src_ip, src_prefix_len, - dst_ip, dst_prefix_len, dst_port)) - new_rules.append((cmd, self.txrx_pipeline, dst_ip, dst_prefix_len, - src_ip, src_prefix_len, src_port)) - - src_ip = self.get_ports_gateway6(port_pair[0]) - src_prefix_len = self.get_netmask_gateway6(port_pair[0]) - dst_ip = self.get_ports_gateway6(port_pair[1]) - dst_prefix_len = self.get_netmask_gateway6(port_pair[0]) + src_net, src_prefix_len = self.get_network_and_prefixlen_from_ip_of_port(src_port) + dst_net, dst_prefix_len = self.get_network_and_prefixlen_from_ip_of_port(dst_port) # ignore entires with empty values - if all((src_ip, src_prefix_len, dst_ip, dst_prefix_len)): - new_ipv6_rules.append((cmd, self.txrx_pipeline, src_ip, src_prefix_len, - dst_ip, dst_prefix_len, dst_port)) - new_ipv6_rules.append((cmd, self.txrx_pipeline, dst_ip, dst_prefix_len, - src_ip, src_prefix_len, src_port)) + if all((src_net, src_prefix_len, dst_net, dst_prefix_len)): + new_rules.append((cmd, self.txrx_pipeline, src_net, src_prefix_len, + dst_net, dst_prefix_len, dst_port)) + new_rules.append((cmd, self.txrx_pipeline, dst_net, dst_prefix_len, + src_net, src_prefix_len, src_port)) + + # src_net = self.get_ports_gateway6(port_pair[0]) + # src_prefix_len = self.get_netmask_gateway6(port_pair[0]) + # dst_net = self.get_ports_gateway6(port_pair[1]) + # dst_prefix_len = self.get_netmask_gateway6(port_pair[0]) + # # ignore entires with empty values + # if all((src_net, src_prefix_len, dst_net, dst_prefix_len)): + # new_ipv6_rules.append((cmd, self.txrx_pipeline, src_net, src_prefix_len, + # dst_net, dst_prefix_len, dst_port)) + # new_ipv6_rules.append((cmd, self.txrx_pipeline, dst_net, dst_prefix_len, + # src_net, src_prefix_len, src_port)) acl_apply = "\np %s applyruleset" % cmd new_rules_config = '\n'.join(pattern.format(*values) for values @@ -607,7 +627,9 @@ class MultiPortConfig(object): script_data = { 'link_config': self.generate_link_config(), 'arp_config': self.generate_arp_config(), - 'arp_config6': self.generate_arp_config6(), + # disable IPv6 for now + # 'arp_config6': self.generate_arp_config6(), + 'arp_config6': "", 'actions': '', 'rules': '', } diff --git a/yardstick/network_services/traffic_profile/fixed.py b/yardstick/network_services/traffic_profile/fixed.py index ebc1e61f2..b7cd03773 100644 --- a/yardstick/network_services/traffic_profile/fixed.py +++ b/yardstick/network_services/traffic_profile/fixed.py @@ -16,10 +16,10 @@ from __future__ import absolute_import from yardstick.network_services.traffic_profile.base import TrafficProfile -from stl.trex_stl_lib.trex_stl_streams import STLTXCont -from stl.trex_stl_lib.trex_stl_client import STLStream -from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder -from stl.trex_stl_lib import api as Pkt +from trex_stl_lib.trex_stl_streams import STLTXCont +from trex_stl_lib.trex_stl_client import STLStream +from trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder +from trex_stl_lib import api as Pkt class FixedProfile(TrafficProfile): diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index b07bc9d5a..a3b803673 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -17,9 +17,9 @@ from __future__ import absolute_import from __future__ import division import logging -from stl.trex_stl_lib.trex_stl_client import STLStream -from stl.trex_stl_lib.trex_stl_streams import STLFlowLatencyStats -from stl.trex_stl_lib.trex_stl_streams import STLTXCont +from trex_stl_lib.trex_stl_client import STLStream +from trex_stl_lib.trex_stl_streams import STLFlowLatencyStats +from trex_stl_lib.trex_stl_streams import STLTXCont from yardstick.network_services.traffic_profile.traffic_profile \ import TrexProfile diff --git a/yardstick/network_services/traffic_profile/traffic_profile.py b/yardstick/network_services/traffic_profile/traffic_profile.py index 3e1f8d89f..7bbe89268 100644 --- a/yardstick/network_services/traffic_profile/traffic_profile.py +++ b/yardstick/network_services/traffic_profile/traffic_profile.py @@ -21,16 +21,17 @@ from random import SystemRandom import six from yardstick.network_services.traffic_profile.base import TrafficProfile -from stl.trex_stl_lib.trex_stl_client import STLStream -from stl.trex_stl_lib.trex_stl_streams import STLFlowLatencyStats -from stl.trex_stl_lib.trex_stl_streams import STLTXCont -from stl.trex_stl_lib.trex_stl_streams import STLProfile -from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLVmWrFlowVar -from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFlowVar -from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder -from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLScVmRaw -from stl.trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFixIpv4 -from stl.trex_stl_lib import api as Pkt +from trex_stl_lib.trex_stl_client import STLStream +from trex_stl_lib.trex_stl_streams import STLFlowLatencyStats +from trex_stl_lib.trex_stl_streams import STLTXCont +from trex_stl_lib.trex_stl_streams import STLProfile +from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmWrFlowVar +from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFlowVarRepeatableRandom +from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFlowVar +from trex_stl_lib.trex_stl_packet_builder_scapy import STLPktBuilder +from trex_stl_lib.trex_stl_packet_builder_scapy import STLScVmRaw +from trex_stl_lib.trex_stl_packet_builder_scapy import STLVmFixIpv4 +from trex_stl_lib import api as Pkt class TrexProfile(TrafficProfile): @@ -132,7 +133,7 @@ class TrexProfile(TrafficProfile): pkt_offset='Ether.dst') self.vm_flow_vars.append(stl_vm_wr_flow_var) - def set_src_ip4(self, src_ip4): + def set_src_ip4(self, src_ip4, count=1): """ set source ipv4 address fields """ src_ips = src_ip4.split('-') min_value = src_ips[0] @@ -141,12 +142,12 @@ class TrexProfile(TrafficProfile): src_ip4 = min_value self._set_ip_fields(src=src_ip4) else: - stl_vm_flow_var = STLVmFlowVar(name="ip4_src", - min_value=min_value, - max_value=max_value, - size=4, - op='random', - step=1) + stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="ip4_src", + min_value=min_value, + max_value=max_value, + size=4, + limit=int(count), + seed=0x1235) self.vm_flow_vars.append(stl_vm_flow_var) stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='ip4_src', pkt_offset='IP.src') @@ -154,7 +155,7 @@ class TrexProfile(TrafficProfile): stl_vm_fix_ipv4 = STLVmFixIpv4(offset="IP") self.vm_flow_vars.append(stl_vm_fix_ipv4) - def set_dst_ip4(self, dst_ip4): + def set_dst_ip4(self, dst_ip4, count=1): """ set destination ipv4 address fields """ dst_ips = dst_ip4.split('-') min_value = dst_ips[0] @@ -163,12 +164,12 @@ class TrexProfile(TrafficProfile): dst_ip4 = min_value self._set_ip_fields(dst=dst_ip4) else: - stl_vm_flow_var = STLVmFlowVar(name="dst_ip4", - min_value=min_value, - max_value=max_value, - size=4, - op='random', - step=1) + stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="dst_ip4", + min_value=min_value, + max_value=max_value, + size=4, + limit=int(count), + seed=0x1235) self.vm_flow_vars.append(stl_vm_flow_var) stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='dst_ip4', pkt_offset='IP.dst') @@ -240,7 +241,7 @@ class TrexProfile(TrafficProfile): pkt_offset='IP.tos') self.vm_flow_vars.append(stl_vm_wr_flow_var) - def set_src_port(self, src_port): + def set_src_port(self, src_port, count=1): """ set packet source port """ src_ports = str(src_port).split('-') min_value = int(src_ports[0]) @@ -250,18 +251,18 @@ class TrexProfile(TrafficProfile): self._set_udp_fields(sport=src_port) else: max_value = int(src_ports[1]) - stl_vm_flow_var = STLVmFlowVar(name="port_src", - min_value=min_value, - max_value=max_value, - size=2, - op='random', - step=1) + stl_vm_flow_var = STLVmFlowVarRepeatableRandom(name="port_src", + min_value=min_value, + max_value=max_value, + size=2, + limit=int(count), + seed=0x1235) self.vm_flow_vars.append(stl_vm_flow_var) stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='port_src', pkt_offset=self.udp_sport) self.vm_flow_vars.append(stl_vm_wr_flow_var) - def set_dst_port(self, dst_port): + def set_dst_port(self, dst_port, count=1): """ set packet destnation port """ dst_ports = str(dst_port).split('-') min_value = int(dst_ports[0]) @@ -271,12 +272,13 @@ class TrexProfile(TrafficProfile): self._set_udp_fields(dport=dst_port) else: max_value = int(dst_ports[1]) - stl_vm_flow_var = STLVmFlowVar(name="port_dst", - min_value=min_value, - max_value=max_value, - size=2, - op='random', - step=1) + stl_vm_flow_var = \ + STLVmFlowVarRepeatableRandom(name="port_dst", + min_value=min_value, + max_value=max_value, + size=2, + limit=int(count), + seed=0x1235) self.vm_flow_vars.append(stl_vm_flow_var) stl_vm_wr_flow_var = STLVmWrFlowVar(fv_name='port_dst', pkt_offset=self.udp_dport) @@ -335,9 +337,9 @@ class TrexProfile(TrafficProfile): if 'dscp' in outer_l3v4: self.set_dscp(outer_l3v4['dscp']) if 'srcip4' in outer_l3v4: - self.set_src_ip4(outer_l3v4['srcip4']) + self.set_src_ip4(outer_l3v4['srcip4'], outer_l3v4['count']) if 'dstip4' in outer_l3v4: - self.set_dst_ip4(outer_l3v4['dstip4']) + self.set_dst_ip4(outer_l3v4['dstip4'], outer_l3v4['count']) def set_outer_l3v6_fields(self, outer_l3v6): """ setup outer l3v6 fields from traffic profile """ @@ -367,9 +369,9 @@ class TrexProfile(TrafficProfile): def set_outer_l4_fields(self, outer_l4): """ setup outer l4 fields from traffic profile """ if 'srcport' in outer_l4: - self.set_src_port(outer_l4['srcport']) + self.set_src_port(outer_l4['srcport'], outer_l4['count']) if 'dstport' in outer_l4: - self.set_dst_port(outer_l4['dstport']) + self.set_dst_port(outer_l4['dstport'], outer_l4['count']) def generate_imix_data(self, packet_definition): """ generate packet size for a given traffic profile """ diff --git a/yardstick/network_services/utils.py b/yardstick/network_services/utils.py index 0264bbc1c..d52e27c15 100644 --- a/yardstick/network_services/utils.py +++ b/yardstick/network_services/utils.py @@ -30,7 +30,10 @@ OPTS = [ help='bin_path for VNFs location.'), cfg.StrOpt('trex_path', default=os.path.join(NSB_ROOT, 'trex/scripts'), - help='trex automation lib pathh.'), + help='trex automation lib path.'), + cfg.StrOpt('trex_client_lib', + default=os.path.join(NSB_ROOT, 'trex_client/stl'), + help='trex python library path.'), ] CONF.register_opts(OPTS, group="nsb") diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index 0434f6aef..7a756837e 100644 --- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py +++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py @@ -37,9 +37,9 @@ from yardstick.network_services.vnf_generic.vnf.base import QueueFileWrapper from yardstick.network_services.vnf_generic.vnf.base import GenericTrafficGen from yardstick.network_services.utils import get_nsb_option -from stl.trex_stl_lib.trex_stl_client import STLClient -from stl.trex_stl_lib.trex_stl_client import LoggerApi -from stl.trex_stl_lib.trex_stl_exceptions import STLError +from trex_stl_lib.trex_stl_client import STLClient +from trex_stl_lib.trex_stl_client import LoggerApi +from trex_stl_lib.trex_stl_exceptions import STLError from yardstick.ssh import AutoConnectSSH diff --git a/yardstick/ssh.py b/yardstick/ssh.py index 8ac3eaa3a..a024cf64a 100644 --- a/yardstick/ssh.py +++ b/yardstick/ssh.py @@ -423,6 +423,12 @@ class SSH(object): if mode is not None: sftp.chmod(remotepath, mode) + def get_file_obj(self, remotepath, file_obj): + client = self._get_client() + + with client.open_sftp() as sftp: + sftp.getfo(remotepath, file_obj) + class AutoConnectSSH(SSH): @@ -471,6 +477,10 @@ class AutoConnectSSH(SSH): self._connect() return super(AutoConnectSSH, self).put_file_obj(file_obj, remote_path, mode) + def get_file_obj(self, remote_path, file_obj): + self._connect() + return super(AutoConnectSSH, self).get_file_obj(remote_path, file_obj) + def provision_tool(self, tool_path, tool_file=None): self._connect() return super(AutoConnectSSH, self).provision_tool(tool_path, tool_file) |