diff options
Diffstat (limited to 'ansible')
99 files changed, 2995 insertions, 1843 deletions
diff --git a/ansible/build_yardstick_image.yml b/ansible/build_yardstick_image.yml index 025573b4b..35d9da45e 100644 --- a/ansible/build_yardstick_image.yml +++ b/ansible/build_yardstick_image.yml @@ -73,7 +73,6 @@ state: absent # download-common - - name: remove {{ workspace }} file: path: "{{ workspace }}" @@ -85,61 +84,14 @@ sha256url: "{{ sha256sums_url }}" dest: "{{ image_dest }}" -# - get_url: -# url: "{{ sha256sums_url }}" -# force: yes -# dest: "{{ workspace }}/{{ sha256sums_filename }}" - - # must use wget to workaround ubuntu cloud SSL certs checking failures -# - command: "curl -sS -o {{ workspace }}/{{ sha256sums_filename }} {{ sha256sums_url }}" - - -# - command: cat "{{ workspace }}/{{ sha256sums_filename }}" -# register: sha256sum_file -# -# - set_fact: -# image_sha256: "{{ sha256sum_file.stdout|regex_search('^([a-f0-9]+).*' ~ img ~ '$', '\\1', multiline=True) }}" - -# - get_url: -# url: "{{ image_url }}" -# force: yes -# dest: "{{ workspace }}/{{ image_filename }}" -# checksum: "sha256:{{ image_sha256 }}" -# register: fetch_image_status -# timeout: 300 -# retries: 2 -# until: fetch_image_status|succeeded - -# - name: "Fetch {{ image_url }}" -# - command: "curl -sS -o {{ workspace }}/{{ image_filename }} {{ image_url }}" -# register: fetch_image_status -# timeout: 300 -# retries: 2 -# until: fetch_image_status|succeeded - -# - name: Verify sha256sum of downloaded image -# - command: "sha256sum -c --ignore-missing {{ workspace }}/{{ sha256sums_filename }}" - -# - name: create loop devices -# command: "mknod -m 660 /dev/loop{{ item }} b 7 {{ item }}" -# args: -# creates: "/dev/loop{{ item }}" -# with_seq: -# - - - # download non-lxd - - name: convert image to raw command: "qemu-img convert {{ image_dest }} {{ raw_imgfile }}" + - name: resize image to allow for more VNFs + command: "qemu-img resize -f raw {{ raw_imgfile }} +2G" - # setup non-lxd - -# - shell: echo -e "d\\nn\\np\\n1\\n\\n\\nw" | parted -l "{{ raw_imgfile }}" -# - parted: -# device: "{{ raw_imgfile }}" -# number: 1 -# state: present + - name: resize parition to allow for more VNFs + command: "parted -s -a optimal {{ raw_imgfile }} resizepart 1 100%" - name: create mknod devices in chroot command: "mknod -m 0660 /dev/loop{{ item }} b 7 {{ item }}" @@ -148,23 +100,6 @@ with_sequence: start=0 end=9 tags: mknod_devices -# - command: losetup --show --partscan --find "{{ raw_imgfile }}" -# register: loop_device_res -# -# - debug: -# var: loop_device_res -# verbosity: 2 -# -# - set_fact: -# loop_device: "{{ loop_device_res.stdout.strip() }}" -# -# - wait_for: -# path: "{{ loop_device }}" -# state: present -# -# - command: losetup -# - command: dmsetup ls - - name: find first partition device # command: kpartx -l "{{ loop_device }}" command: kpartx -l "{{ raw_imgfile }}" @@ -179,11 +114,9 @@ - name: use kpartx to create device nodes for the raw image loop device # operate on the loop device to avoid /dev namespace missing devices -# command: kpartx -avs "{{ loop_device }}" command: kpartx -avs "{{ raw_imgfile }}" - name: parted dump raw image -# command: parted "{{ loop_device }}" print command: parted "{{ raw_imgfile }}" print register: parted_res @@ -197,9 +130,21 @@ - set_fact: image_fs_type: "{{ blkid_res.stdout.strip() }}" + - fail: + msg: "We only support ext4 image filesystems because we have to resize" + when: image_fs_type != "ext4" + + - name: fsck the image filesystem + command: "e2fsck -y -f {{ image_first_partition_device }}" + + - name: resize filesystem to full partition size + command: resize2fs {{ image_first_partition_device }} + + - name: fsck the image filesystem + command: "e2fsck -y -f {{ image_first_partition_device }}" - name: make tmp disposable fstab - command: mktemp fake_fstab.XXXXXXXXXX + command: mktemp --tmpdir fake_fstab.XXXXXXXXXX register: mktemp_res - set_fact: @@ -211,7 +156,9 @@ name: "{{ mountdir }}" # fstype is required fstype: "{{ image_fs_type }}" - #fstab: "{{ fake_fstab }}" + # !!!!!!! this is required otherwise we add entries to /etc/fstab + # and prevent the system from booting + fstab: "{{ fake_fstab }}" state: mounted - name: mount chroot /proc @@ -219,7 +166,9 @@ src: none name: "{{ mountdir }}/proc" fstype: proc - #fstab: "{{ fake_fstab }}" + # !!!!!!! this is required otherwise we add entries to /etc/fstab + # and prevent the system from booting + fstab: "{{ fake_fstab }}" state: mounted - name: if arm copy qemu-aarch64-static into chroot @@ -228,19 +177,6 @@ dest: "{{ mountdir }}/usr/bin" when: 'YARD_IMG_ARCH == "arm64"' - - # setup lxd -# - file: "path={{ mountdir }} state=directory" -# -# - unarchive: -# src: "{{ image_filename }}" -# dest: "{{ mountdir }}" -# remote_src: yes - - # end setup lxd - - # modify - - name: create ubuntu policy-rc.d workaround copy: content: "{{ '#!/bin/sh\nexit 101\n' }}" diff --git a/ansible/clean_images.yml b/ansible/clean_images.yml index a7a6c2af1..f63489d2d 100644 --- a/ansible/clean_images.yml +++ b/ansible/clean_images.yml @@ -18,5 +18,6 @@ - yardstick_config.yml roles: + - convert_openrc - clean_images - clean_flavors diff --git a/ansible/filter_plugins/networks.py b/ansible/filter_plugins/networks.py index a1573951f..d67615a53 100644 --- a/ansible/filter_plugins/networks.py +++ b/ansible/filter_plugins/networks.py @@ -13,7 +13,10 @@ # limitations under the License. -from urlparse import urlsplit +try: + from urlparse import urlsplit +except ImportError: + from urllib.parse import urlsplit def do_prefix_to_netmask(arg): diff --git a/ansible/gen_scale_out_test.yml b/ansible/gen_scale_out_test.yml new file mode 100644 index 000000000..a76ea0ac2 --- /dev/null +++ b/ansible/gen_scale_out_test.yml @@ -0,0 +1,26 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + vnf_range: + - 2 + - 4 + - 10 + + + tasks: + - include: scale_out_test_templates.yml + with_items: "{{ vnf_range }}" + diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 2690228c3..edd6564d0 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -3,3 +3,4 @@ clone_dest: /opt/tempT release: xenial
target_os: Ubuntu
ubuntu_image_file: /tmp/workspace/yardstick/yardstick-trusty-server.raw
+proxy_env: {}
\ No newline at end of file diff --git a/ansible/install_collectd.yml b/ansible/install_collectd.yml new file mode 100644 index 000000000..637c42d65 --- /dev/null +++ b/ansible/install_collectd.yml @@ -0,0 +1,32 @@ +# 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. +--- +- hosts: all + vars: + clone_dir: /tmp/yardstick-clone + environment: "{{ proxy_env|default({}) }}" + + roles: + # needed for collectd plugins + - increase_open_file_limits + # build shared DPDK for collectd only, required DPDK downloaded already + - role: download_dpdk + - install_dpdk_shared + - install_rabbitmq + - download_intel_cmt_cat + - install_intel_cmt_cat + - download_pmu_tools + - install_pmu_tools + - download_collectd + - install_collectd diff --git a/ansible/install_dependencies.yml b/ansible/install_dependencies.yml index 001418497..1c7d20170 100644 --- a/ansible/install_dependencies.yml +++ b/ansible/install_dependencies.yml @@ -17,4 +17,3 @@ roles: - install_dependencies - diff --git a/ansible/library/find_kernel.py b/ansible/library/find_kernel.py index 4623bce89..c237baaf2 100644 --- a/ansible/library/find_kernel.py +++ b/ansible/library/find_kernel.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os DOCUMENTATION = ''' --- diff --git a/ansible/library/my_make.py b/ansible/library/my_make.py deleted file mode 100644 index 35240851c..000000000 --- a/ansible/library/my_make.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# (c) 2015, Linus Unnebäck <linus@folkdatorn.se> -# -# This file is part of Ansible -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see <http://www.gnu.org/licenses/>. - -from __future__ import absolute_import -DOCUMENTATION = ''' ---- -module: my_make -short_description: Run targets in a Makefile -requirements: [ make ] -version_added: "2.1" -author: Linus Unnebäck (@LinusU) <linus@folkdatorn.se> -description: - - Run targets in a Makefile. -options: - target: - description: - - The target to run - required: false - default: none - params: - description: - - Any extra parameters to pass to make - required: false - default: none - extra_args: - description: - - Any extra options to pass to make - required: false - default: none - chdir: - description: - - cd into this directory before running make - required: true -''' - -EXAMPLES = ''' -# Build the default target -- make: chdir=/home/ubuntu/cool-project - -# Run `install` target as root -- make: chdir=/home/ubuntu/cool-project target=install - become: yes - -# Pass in extra arguments to build -- make: - chdir: /home/ubuntu/cool-project - target: all - params: - NUM_THREADS: 4 - BACKEND: lapack -''' - -# TODO: Disabled the RETURN as it was breaking docs building. Someone needs to -# fix this -RETURN = '''# ''' - - -def format_params(params): - return [k + '=' + str(v) for k, v in params.items()] - - -def push_arguments(cmd, args): - if args['extra_args'] is not None: - cmd.extend(shlex.split(args['extra_args'])) - if args['target'] is not None: - cmd.append(args['target']) - if args['params'] is not None: - cmd.extend(format_params(args['params'])) - return cmd - - -def check_changed(make_path, module, args): - cmd = push_arguments([make_path, '--question'], args) - rc, _, __ = module.run_command(cmd, check_rc=False, cwd=args['chdir']) - return rc != 0 - - -def run_make(make_path, module, args): - cmd = push_arguments([make_path], args) - module.run_command(cmd, check_rc=True, cwd=args['chdir']) - - -def main(): - module = AnsibleModule( - supports_check_mode=True, - argument_spec=dict( - target=dict(required=False, default=None, type='str'), - params=dict(required=False, default=None, type='dict'), - extra_args=dict(required=False, default=None, type='str'), - chdir=dict(required=True, default=None, type='str'), - ), - ) - args = dict( - changed=False, - failed=False, - target=module.params['target'], - params=module.params['params'], - extra_args=module.params['extra_args'], - chdir=module.params['chdir'], - ) - make_path = module.get_bin_path('make', True) - - # Check if target is up to date - args['changed'] = check_changed(make_path, module, args) - - # Check only; don't modify - if module.check_mode: - module.exit_json(changed=args['changed']) - - # Target is already up to date - if not args['changed']: - module.exit_json(**args) - - run_make(make_path, module, args) - module.exit_json(**args) - -from ansible.module_utils.basic import * - -if __name__ == '__main__': - main() diff --git a/ansible/library/my_os_networks_facts.py b/ansible/library/my_os_networks_facts.py deleted file mode 100644 index 1b6ad80f9..000000000 --- a/ansible/library/my_os_networks_facts.py +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see <http://www.gnu.org/licenses/>. - -try: - import shade - HAS_SHADE = True -except ImportError: - HAS_SHADE = False - -DOCUMENTATION = ''' ---- -module: my_os_network_facts -short_description: Retrieve facts about one or more OpenStack networks. -version_added: "2.0" -author: "Davide Agnello (@dagnello)" -description: - - Retrieve facts about one or more networks from OpenStack. -requirements: - - "python >= 2.6" - - "shade" -options: - network: - description: - - Name or ID of the Network - required: false - filters: - description: - - A dictionary of meta data to use for further filtering. Elements of - this dictionary may be additional dictionaries. - required: false -extends_documentation_fragment: openstack -''' - -EXAMPLES = ''' -# Gather facts about previously created networks -- my_os_network_facts: - auth: - auth_url: https://your_api_url.com:9000/v2.0 - username: user - password: password - project_name: someproject -- debug: var=openstack_networks - -# Gather facts about a previously created network by name -- my_os_network_facts: - auth: - auth_url: https://your_api_url.com:9000/v2.0 - username: user - password: password - project_name: someproject - name: network1 -- debug: var=openstack_networks - -# Gather facts about a previously created network with filter (note: name and - filters parameters are Not mutually exclusive) -- my_os_network_facts: - auth: - auth_url: https://your_api_url.com:9000/v2.0 - username: user - password: password - project_name: someproject - filters: - tenant_id: 55e2ce24b2a245b09f181bf025724cbe - subnets: - - 057d4bdf-6d4d-4728-bb0f-5ac45a6f7400 - - 443d4dc0-91d4-4998-b21c-357d10433483 -- debug: var=openstack_networks -''' - -RETURN = ''' -openstack_networks: - description: has all the openstack facts about the networks - returned: always, but can be null - type: complex - contains: - id: - description: Unique UUID. - returned: success - type: string - name: - description: Name given to the network. - returned: success - type: string - status: - description: Network status. - returned: success - type: string - subnets: - description: Subnet(s) included in this network. - returned: success - type: list of strings - tenant_id: - description: Tenant id associated with this network. - returned: success - type: string - shared: - description: Network shared flag. - returned: success - type: boolean -''' - -def main(): - - argument_spec = openstack_full_argument_spec( - network={'required': False, 'default': None}, - filters={'required': False, 'default': None} - ) - module_kwargs = openstack_module_kwargs() - module = AnsibleModule(argument_spec) - - if not HAS_SHADE: - module.fail_json(msg='shade is required for this module') - - network = module.params.pop('network') - filters = module.params.pop('filters') - - try: - cloud = shade.openstack_cloud(**module.params) - networks = cloud.search_networks(network, filters) - module.exit_json(changed=False, ansible_facts={ - 'openstack_networks': networks}) - - except shade.OpenStackCloudException as e: - module.fail_json(msg=str(e)) - -# this is magic, see lib/ansible/module_common.py -from ansible.module_utils.basic import * -from ansible.module_utils.openstack import * -if __name__ == '__main__': - main() diff --git a/ansible/library/my_os_router_facts.py b/ansible/library/my_os_router_facts.py deleted file mode 100644 index ce8d2af25..000000000 --- a/ansible/library/my_os_router_facts.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2016 IBM -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see <http://www.gnu.org/licenses/>. - -try: - import shade - HAS_SHADE = True -except ImportError: - HAS_SHADE = False - -DOCUMENTATION = ''' -module: my_os_router_facts -short_description: Retrieve facts about routers within OpenStack. -version_added: "2.1" -author: "Originally: David Shrewsbury (@Shrews); modified" -description: - - Retrieve facts about routers from OpenStack. -notes: - - Facts are placed in the C(openstack_routers) variable. -requirements: - - "python >= 2.6" - - "shade" -options: - port: - description: - - Unique name or ID of a port. - required: false - default: null - filters: - description: - - A dictionary of meta data to use for further filtering. Elements - of this dictionary will be matched against the returned port - dictionaries. Matching is currently limited to strings within - the port dictionary, or strings within nested dictionaries. - required: false - default: null -extends_documentation_fragment: openstack -''' - -EXAMPLES = ''' -# Gather facts about all routers -- my_os_router_facts: - cloud: mycloud - -# Gather facts about a single port -- my_os_router_facts: - cloud: mycloud - port: 6140317d-e676-31e1-8a4a-b1913814a471 - -# Gather facts about all routers that have device_id set to a specific value -# and with a status of ACTIVE. -- my_os_router_facts: - cloud: mycloud - router: - description: - - Name or ID of the router - required: false - filters: - device_id: 1038a010-3a37-4a9d-82ea-652f1da36597 - status: ACTIVE -''' - -RETURN = ''' -openstack_routers: - description: List of port dictionaries. A subset of the dictionary keys - listed below may be returned, depending on your cloud provider. - returned: always, but can be null - type: complex - contains: -''' - - -def main(): - argument_spec = openstack_full_argument_spec( - router={'required': False, 'default': None}, - filters={'required': False, 'type': 'dict', 'default': None}, - ) - module_kwargs = openstack_module_kwargs() - module = AnsibleModule(argument_spec, **module_kwargs) - - if not HAS_SHADE: - module.fail_json(msg='shade is required for this module') - - name = module.params.pop('name') - filters = module.params.pop('filters') - - try: - cloud = shade.openstack_cloud(**module.params) - routers = cloud.search_routers(name, filters) - module.exit_json(changed=False, ansible_facts=dict( - openstack_routers=routers)) - - except shade.OpenStackCloudException as e: - module.fail_json(msg=str(e)) - -from ansible.module_utils.basic import * -from ansible.module_utils.openstack import * - -if __name__ == '__main__': - main() diff --git a/ansible/library/os_images_facts.py b/ansible/library/os_images_facts.py deleted file mode 100644 index 736403893..000000000 --- a/ansible/library/os_images_facts.py +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see <http://www.gnu.org/licenses/>. - -try: - import shade - HAS_SHADE = True -except ImportError: - HAS_SHADE = False - -DOCUMENTATION = ''' -module: os_images_facts -short_description: Retrieve facts about an image within OpenStack. -version_added: "2.0" -author: "Originally: Davide Agnello (@dagnello); modified" -description: - - Retrieve facts about a image image from OpenStack. -notes: - - Facts are placed in the C(openstack) variable. -requirements: - - "python >= 2.6" - - "shade" -options: - image: - description: - - Name or ID of the image - required: false - filters: - description: - - A dictionary of meta data to use for further filtering. Elements of - this dictionary may be additional dictionaries. - required: false -extends_documentation_fragment: openstack -''' - -EXAMPLES = ''' -# Gather facts about a previously created image named image1 -- os_images_facts: - auth: - auth_url: https://your_api_url.com:9000/v2.0 - username: user - password: password - project_name: someproject - image: image1 -- debug: var=openstack -''' - -RETURN = ''' -openstack_image: - description: has all the openstack facts about the image - returned: always, but can be null - type: complex - contains: - id: - description: Unique UUID. - returned: success - type: string - name: - description: Name given to the image. - returned: success - type: string - status: - description: Image status. - returned: success - type: string - created_at: - description: Image created at timestamp. - returned: success - type: string - deleted: - description: Image deleted flag. - returned: success - type: boolean - container_format: - description: Container format of the image. - returned: success - type: string - min_ram: - description: Min amount of RAM required for this image. - returned: success - type: int - disk_format: - description: Disk format of the image. - returned: success - type: string - updated_at: - description: Image updated at timestamp. - returned: success - type: string - properties: - description: Additional properties associated with the image. - returned: success - type: dict - min_disk: - description: Min amount of disk space required for this image. - returned: success - type: int - protected: - description: Image protected flag. - returned: success - type: boolean - checksum: - description: Checksum for the image. - returned: success - type: string - owner: - description: Owner for the image. - returned: success - type: string - is_public: - description: Is public flag of the image. - returned: success - type: boolean - deleted_at: - description: Image deleted at timestamp. - returned: success - type: string - size: - description: Size of the image. - returned: success - type: int -''' - - -def main(): - - argument_spec = openstack_full_argument_spec( - image={'required': False, 'default': None}, - filters={'required': False, 'default': None}, - ) - module_kwargs = openstack_module_kwargs() - module = AnsibleModule(argument_spec, **module_kwargs) - - if not HAS_SHADE: - module.fail_json(msg='shade is required for this module') - - image = module.params.pop('image') - filters = module.params.pop('filters') - - try: - cloud = shade.openstack_cloud(**module.params) - images = cloud.search_images(image, filters) - module.exit_json(changed=False, ansible_facts={ - 'openstack_images': images}) - - except shade.OpenStackCloudException as e: - module.fail_json(msg=str(e)) - -# this is magic, see lib/ansible/module_common.py -from ansible.module_utils.basic import * -from ansible.module_utils.openstack import * -if __name__ == '__main__': - main() diff --git a/ansible/library/os_router_facts.py b/ansible/library/os_router_facts.py deleted file mode 100644 index b14a362ef..000000000 --- a/ansible/library/os_router_facts.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2016 IBM -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see <http://www.gnu.org/licenses/>. - -try: - import shade - HAS_SHADE = True -except ImportError: - HAS_SHADE = False - -DOCUMENTATION = ''' -module: os_router_facts -short_description: Retrieve facts about routers within OpenStack. -version_added: "2.1" -author: "Originally: David Shrewsbury (@Shrews); modified" -description: - - Retrieve facts about routers from OpenStack. -notes: - - Facts are placed in the C(openstack_routers) variable. -requirements: - - "python >= 2.6" - - "shade" -options: - port: - description: - - Unique name or ID of a port. - required: false - default: null - filters: - description: - - A dictionary of meta data to use for further filtering. Elements - of this dictionary will be matched against the returned port - dictionaries. Matching is currently limited to strings within - the port dictionary, or strings within nested dictionaries. - required: false - default: null -extends_documentation_fragment: openstack -''' - -EXAMPLES = ''' -# Gather facts about all routers -- os_router_facts: - cloud: mycloud - -# Gather facts about a single port -- os_router_facts: - cloud: mycloud - port: 6140317d-e676-31e1-8a4a-b1913814a471 - -# Gather facts about all routers that have device_id set to a specific value -# and with a status of ACTIVE. -- os_router_facts: - cloud: mycloud - router: - description: - - Name or ID of the router - required: false - filters: - device_id: 1038a010-3a37-4a9d-82ea-652f1da36597 - status: ACTIVE -''' - -RETURN = ''' -openstack_routers: - description: List of port dictionaries. A subset of the dictionary keys - listed below may be returned, depending on your cloud provider. - returned: always, but can be null - type: complex - contains: -''' - - -def main(): - argument_spec = openstack_full_argument_spec( - router={'required': False, 'default': None}, - filters={'required': False, 'type': 'dict', 'default': None}, - ) - module_kwargs = openstack_module_kwargs() - module = AnsibleModule(argument_spec, **module_kwargs) - - if not HAS_SHADE: - module.fail_json(msg='shade is required for this module') - - router = module.params.pop('router') - filters = module.params.pop('filters') - - try: - cloud = shade.openstack_cloud(**module.params) - routers = cloud.search_routers(router, filters) - module.exit_json(changed=False, ansible_facts=dict( - openstack_routers=routers)) - - except shade.OpenStackCloudException as e: - module.fail_json(msg=str(e)) - -from ansible.module_utils.basic import * -from ansible.module_utils.openstack import * - -if __name__ == '__main__': - main() diff --git a/ansible/library/os_stack_facts.py b/ansible/library/os_stack_facts.py deleted file mode 100644 index c67947686..000000000 --- a/ansible/library/os_stack_facts.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see <http://www.gnu.org/licenses/>. - -try: - import shade - HAS_SHADE = True -except ImportError: - HAS_SHADE = False - -DOCUMENTATION = ''' -module: os_stack_facts -short_description: Retrieve facts about an stack within OpenStack. -version_added: "2.0" -author: "Originally: Davide Agnello (@dagnello); modified" -description: - - Retrieve facts about a stack from OpenStack. -notes: - - Facts are placed in the C(openstack) variable. -requirements: - - "python >= 2.6" - - "shade" -options: -extends_documentation_fragment: openstack -''' - -EXAMPLES = ''' -# Gather facts about a previously created stack named stack1 -- os_stack_facts: - auth: - auth_url: https://your_api_url.com:9000/v2.0 - username: user - password: password - project_name: someproject -- debug: var=openstack_stacks -''' - -RETURN = ''' -openstack_stack: - description: has all the openstack facts about the stack - returned: always, but can be null - type: complex -''' - - -def main(): - - argument_spec = openstack_full_argument_spec( - ) - module_kwargs = openstack_module_kwargs() - module = AnsibleModule(argument_spec, **module_kwargs) - - if not HAS_SHADE: - module.fail_json(msg='shade is required for this module') - - - try: - cloud = shade.openstack_cloud(**module.params) - stacks = cloud.list_stacks() - module.exit_json(changed=False, ansible_facts={ - 'openstack_stacks': stacks}) - - except shade.OpenStackCloudException as e: - module.fail_json(msg=str(e)) - -# this is magic, see lib/ansible/module_common.py -from ansible.module_utils.basic import * -from ansible.module_utils.openstack import * -if __name__ == '__main__': - main() diff --git a/ansible/library/parted.py b/ansible/library/parted.py deleted file mode 100755 index af9c80f7e..000000000 --- a/ansible/library/parted.py +++ /dev/null @@ -1,705 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# (c) 2016, Fabrizio Colonna <colofabrix@tin.it> -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -ANSIBLE_METADATA = {'metadata_version': '1.0', - 'status': ['preview'], - 'supported_by': 'curated'} - - -DOCUMENTATION = ''' ---- -author: - - "Fabrizio Colonna (@ColOfAbRiX)" -module: parted -short_description: Configure block device partitions -version_added: "2.3" -description: - - This module allows configuring block device partition using the C(parted) - command line tool. For a full description of the fields and the options - check the GNU parted manual. -notes: - - When fetching information about a new disk and when the version of parted - installed on the system is before version 3.1, the module queries the kernel - through C(/sys/) to obtain disk information. In this case the units CHS and - CYL are not supported. -requirements: - - This module requires parted version 1.8.3 and above. - - If the version of parted is below 3.1, it requires a Linux version running - the sysfs file system C(/sys/). -options: - device: - description: The block device (disk) where to operate. - required: True - align: - description: Set alignment for newly created partitions. - choices: ['none', 'cylinder', 'minimal', 'optimal'] - default: optimal - number: - description: - - The number of the partition to work with or the number of the partition - that will be created. Required when performing any action on the disk, - except fetching information. - unit: - description: - - Selects the current default unit that Parted will use to display - locations and capacities on the disk and to interpret those given by the - user if they are not suffixed by an unit. When fetching information about - a disk, it is always recommended to specify a unit. - choices: [ - 's', 'B', 'KB', 'KiB', 'MB', 'MiB', 'GB', 'GiB', 'TB', 'TiB', '%', 'cyl', - 'chs', 'compact' - ] - default: KiB - label: - description: Creates a new disk label. - choices: [ - 'aix', 'amiga', 'bsd', 'dvh', 'gpt', 'loop', 'mac', 'msdos', 'pc98', - 'sun', '' - ] - default: msdos - part_type: - description: - - Is one of 'primary', 'extended' or 'logical' and may be specified only - with 'msdos' or 'dvh' partition tables. A name must be specified for a - 'gpt' partition table. Neither part-type nor name may be used with a - 'sun' partition table. - choices: ['primary', 'extended', 'logical'] - part_start: - description: - - Where the partition will start as offset from the beginning of the disk, - that is, the "distance" from the start of the disk. The distance can be - specified with all the units supported by parted (except compat) and - it is case sensitive. E.g. C(10GiB), C(15%). - default: 0% - part_end : - description: - - Where the partition will end as offset from the beginning of the disk, - that is, the "distance" from the start of the disk. The distance can be - specified with all the units supported by parted (except compat) and - it is case sensitive. E.g. C(10GiB), C(15%). - default: 100% - name: - description: - - Sets the name for the partition number (GPT, Mac, MIPS and PC98 only). - flags: - description: A list of the flags that has to be set on the partition. - state: - description: - - If to create or delete a partition. If set to C(info) the module will - only return the device information. - choices: ['present', 'absent', 'info'] - default: info -''' - -RETURN = ''' -partition_info: - description: Current partition information - returned: success - type: dict - contains: - device: - description: Generic device information. - type: dict - partitions: - description: List of device partitions. - type: list - sample: > - { - "disk": { - "dev": "/dev/sdb", - "logical_block": 512, - "model": "VMware Virtual disk", - "physical_block": 512, - "size": 5.0, - "table": "msdos", - "unit": "gib" - }, - "partitions": [{ - "begin": 0.0, - "end": 1.0, - "flags": ["boot", "lvm"], - "fstype": null, - "num": 1, - "size": 1.0 - }, { - "begin": 1.0, - "end": 5.0, - "flags": [], - "fstype": null, - "num": 2, - "size": 4.0 - }] - } -''' - -EXAMPLES = """ -# Create a new primary partition -- parted: - device: /dev/sdb - number: 1 - state: present - -# Remove partition number 1 -- parted: - device: /dev/sdb - number: 1 - state: absent - -# Create a new primary partition with a size of 1GiB -- parted: - device: /dev/sdb - number: 1 - state: present - part_end: 1gib - -# Create a new primary partition for LVM -- parted: - device: /dev/sdb - number: 2 - flags: [ lvm ] - state: present - part_start: 1gib - -# Read device information (always use unit when probing) -- parted: device=/dev/sdb unit=MiB - register: sdb_info - -# Remove all partitions from disk -- parted: - device: /dev/sdb - number: "{{ item.num }}" - state: absent - with_items: - - "{{ sdb_info.partitions }}" -""" - - -from ansible.module_utils.basic import AnsibleModule -import locale -import math -import re -import os - - -# Reference prefixes (International System of Units and IEC) -units_si = ['B', 'KB', 'MB', 'GB', 'TB'] -units_iec = ['B', 'KiB', 'MiB', 'GiB', 'TiB'] -parted_units = units_si + units_iec + ['s', '%', 'cyl', 'chs', 'compact'] - - -def parse_unit(size_str, unit=''): - """ - Parses a string containing a size of information - """ - matches = re.search(r'^([\d.]+)([\w%]+)?$', size_str) - if matches is None: - # "<cylinder>,<head>,<sector>" format - matches = re.search(r'^(\d+),(\d+),(\d+)$', size_str) - if matches is None: - module.fail_json( - msg="Error interpreting parted size output: '%s'" % size_str - ) - - size = { - 'cylinder': int(matches.group(1)), - 'head': int(matches.group(2)), - 'sector': int(matches.group(3)) - } - unit = 'chs' - - else: - # Normal format: "<number>[<unit>]" - if matches.group(2) is not None: - unit = matches.group(2) - - size = float(matches.group(1)) - - return size, unit - - -def parse_partition_info(parted_output, unit): - """ - Parses the output of parted and transforms the data into - a dictionary. - - Parted Machine Parseable Output: - See: https://lists.alioth.debian.org/pipermail/parted-devel/2006-December/00 - 0573.html - - All lines end with a semicolon (;) - - The first line indicates the units in which the output is expressed. - CHS, CYL and BYT stands for CHS, Cylinder and Bytes respectively. - - The second line is made of disk information in the following format: - "path":"size":"transport-type":"logical-sector-size":"physical-sector-siz - e":"partition-table-type":"model-name"; - - If the first line was either CYL or CHS, the next line will contain - information on no. of cylinders, heads, sectors and cylinder size. - - Partition information begins from the next line. This is of the format: - (for BYT) - "number":"begin":"end":"size":"filesystem-type":"partition-name":"flags-s - et"; - (for CHS/CYL) - "number":"begin":"end":"filesystem-type":"partition-name":"flags-set"; - """ - lines = [x for x in parted_output.split('\n') if x.strip() != ''] - - # Generic device info - generic_params = lines[1].rstrip(';').split(':') - - # The unit is read once, because parted always returns the same unit - size, unit = parse_unit(generic_params[1], unit) - - generic = { - 'dev': generic_params[0], - 'size': size, - 'unit': unit.lower(), - 'table': generic_params[5], - 'model': generic_params[6], - 'logical_block': int(generic_params[3]), - 'physical_block': int(generic_params[4]) - } - - # CYL and CHS have an additional line in the output - if unit in ['cyl', 'chs']: - chs_info = lines[2].rstrip(';').split(':') - cyl_size, cyl_unit = parse_unit(chs_info[3]) - generic['chs_info'] = { - 'cylinders': int(chs_info[0]), - 'heads': int(chs_info[1]), - 'sectors': int(chs_info[2]), - 'cyl_size': cyl_size, - 'cyl_size_unit': cyl_unit.lower() - } - lines = lines[1:] - - parts = [] - for line in lines[2:]: - part_params = line.rstrip(';').split(':') - - # CHS use a different format than BYT, but contrary to what stated by - # the author, CYL is the same as BYT. I've tested this undocumented - # behaviour down to parted version 1.8.3, which is the first version - # that supports the machine parseable output. - if unit != 'chs': - size = parse_unit(part_params[3])[0] - fstype = part_params[4] - flags = part_params[5] - else: - size = "" - fstype = part_params[3] - flags = part_params[4] - - parts.append({ - 'num': int(part_params[0]), - 'begin': parse_unit(part_params[1])[0], - 'end': parse_unit(part_params[2])[0], - 'size': size, - 'fstype': fstype, - 'flags': [f.strip() for f in flags.split(', ') if f != ''], - 'unit': unit.lower(), - }) - - return {'generic': generic, 'partitions': parts} - - -def format_disk_size(size_bytes, unit): - """ - Formats a size in bytes into a different unit, like parted does. It doesn't - manage CYL and CHS formats, though. - This function has been adapted from https://github.com/Distrotech/parted/blo - b/279d9d869ff472c52b9ec2e180d568f0c99e30b0/libparted/unit.c - """ - global units_si, units_iec - - unit = unit.lower() - - # Shortcut - if size_bytes == 0: - return 0.0 - - # Cases where we default to 'compact' - if unit in ['', 'compact', 'cyl', 'chs']: - index = max(0, int( - (math.log10(size_bytes) - 1.0) / 3.0 - )) - unit = 'b' - if index < len(units_si): - unit = units_si[index] - - # Find the appropriate multiplier - multiplier = 1.0 - if unit in units_si: - multiplier = 1000.0 ** units_si.index(unit) - elif unit in units_iec: - multiplier = 1024.0 ** units_iec.index(unit) - - output = size_bytes / multiplier * (1 + 1E-16) - - # Corrections to round up as per IEEE754 standard - if output < 10: - w = output + 0.005 - elif output < 100: - w = output + 0.05 - else: - w = output + 0.5 - - if w < 10: - precision = 2 - elif w < 100: - precision = 1 - else: - precision = 0 - - # Round and return - return round(output, precision), unit - - -def get_unlabeled_device_info(device, unit): - """ - Fetches device information directly from the kernel and it is used when - parted cannot work because of a missing label. It always returns a 'unknown' - label. - """ - device_name = os.path.basename(device) - base = "/sys/block/%s" % device_name - - vendor = read_record(base + "/device/vendor", "Unknown") - model = read_record(base + "/device/model", "model") - logic_block = int(read_record(base + "/queue/logical_block_size", 0)) - phys_block = int(read_record(base + "/queue/physical_block_size", 0)) - size_bytes = int(read_record(base + "/size", 0)) * logic_block - - size, unit = format_disk_size(size_bytes, unit) - - return { - 'generic': { - 'dev': device, - 'table': "unknown", - 'size': size, - 'unit': unit, - 'logical_block': logic_block, - 'physical_block': phys_block, - 'model': "%s %s" % (vendor, model), - }, - 'partitions': [] - } - - -def get_device_info(device, unit): - """ - Fetches information about a disk and its partitions and it returns a - dictionary. - """ - global module - - # If parted complains about missing labels, it means there are no partitions. - # In this case only, use a custom function to fetch information and emulate - # parted formats for the unit. - label_needed = check_parted_label(device) - if label_needed: - return get_unlabeled_device_info(device, unit) - - command = "parted -s -m %s -- unit '%s' print" % (device, unit) - rc, out, err = module.run_command(command) - if rc != 0 and 'unrecognised disk label' not in err: - module.fail_json(msg=( - "Error while getting device information with parted " - "script: '%s'" % command), - rc=rc, out=out, err=err - ) - - return parse_partition_info(out, unit) - - -def check_parted_label(device): - """ - Determines if parted needs a label to complete its duties. Versions prior - to 3.1 don't return data when there is no label. For more information see: - http://upstream.rosalinux.ru/changelogs/libparted/3.1/changelog.html - """ - # Check the version - parted_major, parted_minor, _ = parted_version() - if (parted_major == 3 and parted_minor >= 1) or parted_major > 3: - return False - - # Older parted versions return a message in the stdout and RC > 0. - rc, out, err = module.run_command("parted -s -m %s print" % device) - if rc != 0 and 'unrecognised disk label' in out.lower(): - return True - - return False - - -def parted_version(): - """ - Returns the major and minor version of parted installed on the system. - """ - global module - - rc, out, err = module.run_command("parted --version") - if rc != 0: - module.fail_json( - msg="Failed to get parted version.", rc=rc, out=out, err=err - ) - - lines = [x for x in out.split('\n') if x.strip() != ''] - if len(lines) == 0: - module.fail_json(msg="Failed to get parted version.", rc=0, out=out) - - matches = re.search(r'^parted.+(\d+)\.(\d+)(?:\.(\d+))?$', lines[0]) - if matches is None: - module.fail_json(msg="Failed to get parted version.", rc=0, out=out) - - # Convert version to numbers - major = int(matches.group(1)) - minor = int(matches.group(2)) - rev = 0 - if matches.group(3) is not None: - rev = int(matches.group(3)) - - return major, minor, rev - - -def parted(script, device, align): - """ - Runs a parted script. - """ - global module - - if script and not module.check_mode: - command = "parted -s -m -a %s %s -- %s" % (align, device, script) - rc, out, err = module.run_command(command) - - if rc != 0: - module.fail_json( - msg="Error while running parted script: %s" % command.strip(), - rc=rc, out=out, err=err - ) - - -def read_record(file_path, default=None): - """ - Reads the first line of a file and returns it. - """ - try: - f = open(file_path, 'r') - try: - return f.readline().strip() - finally: - f.close() - except IOError: - return default - - -def part_exists(partitions, attribute, number): - """ - Looks if a partition that has a specific value for a specific attribute - actually exists. - """ - return any( - part[attribute] and - part[attribute] == number for part in partitions - ) - - -def check_size_format(size_str): - """ - Checks if the input string is an allowed size - """ - size, unit = parse_unit(size_str) - return unit in parted_units - - -def main(): - global module, units_si, units_iec - - changed = False - output_script = "" - script = "" - module = AnsibleModule( - argument_spec={ - 'device': {'required': True, 'type': 'str'}, - 'align': { - 'default': 'optimal', - 'choices': ['none', 'cylinder', 'minimal', 'optimal'], - 'type': 'str' - }, - 'number': {'default': None, 'type': 'int'}, - - # unit <unit> command - 'unit': { - 'default': 'KiB', - 'choices': parted_units, - 'type': 'str' - }, - - # mklabel <label-type> command - 'label': { - 'choices': [ - 'aix', 'amiga', 'bsd', 'dvh', 'gpt', 'loop', 'mac', 'msdos', - 'pc98', 'sun', '' - ], - 'type': 'str' - }, - - # mkpart <part-type> [<fs-type>] <start> <end> command - 'part_type': { - 'default': 'primary', - 'choices': ['primary', 'extended', 'logical'], - 'type': 'str' - }, - 'part_start': {'default': '0%', 'type': 'str'}, - 'part_end': {'default': '100%', 'type': 'str'}, - - # name <partition> <name> command - 'name': {'type': 'str'}, - - # set <partition> <flag> <state> command - 'flags': {'type': 'list'}, - - # rm/mkpart command - 'state': { - 'choices': ['present', 'absent', 'info'], - 'default': 'info', - 'type': 'str' - } - }, - supports_check_mode=True, - ) - - # Data extraction - device = module.params['device'] - align = module.params['align'] - number = module.params['number'] - unit = module.params['unit'] - label = module.params['label'] - part_type = module.params['part_type'] - part_start = module.params['part_start'] - part_end = module.params['part_end'] - name = module.params['name'] - state = module.params['state'] - flags = module.params['flags'] - - # Conditioning - if number and number < 0: - module.fail_json(msg="The partition number must be non negative.") - if not check_size_format(part_start): - module.fail_json( - msg="The argument 'part_start' doesn't respect required format." - "The size unit is case sensitive.", - err=parse_unit(part_start) - ) - if not check_size_format(part_end): - module.fail_json( - msg="The argument 'part_end' doesn't respect required format." - "The size unit is case sensitive.", - err=parse_unit(part_end) - ) - - # Read the current disk information - current_device = get_device_info(device, unit) - current_parts = current_device['partitions'] - - if state == 'present': - # Default value for the label - if not current_device['generic']['table'] or \ - current_device['generic']['table'] == 'unknown' and \ - not label: - label = 'msdos' - - # Assign label if required - if label: - script += "mklabel %s " % label - - # Create partition if required - if part_type and not part_exists(current_parts, 'num', number): - script += "mkpart %s %s %s " % ( - part_type, - part_start, - part_end - ) - - # Set the unit of the run - if unit and script: - script = "unit %s %s" % (unit, script) - - # Execute the script and update the data structure. - # This will create the partition for the next steps - if script: - output_script += script - parted(script, device, align) - changed = True - script = "" - - current_parts = get_device_info(device, unit)['partitions'] - - if part_exists(current_parts, 'num', number) or module.check_mode: - partition = {'flags': []} # Empty structure for the check-mode - if not module.check_mode: - partition = [p for p in current_parts if p['num'] == number][0] - - # Assign name to the the partition - if name: - script += "name %s %s " % (number, name) - - # Manage flags - if flags: - # Compute only the changes in flags status - flags_off = list(set(partition['flags']) - set(flags)) - flags_on = list(set(flags) - set(partition['flags'])) - - for f in flags_on: - script += "set %s %s on " % (number, f) - - for f in flags_off: - script += "set %s %s off " % (number, f) - - # Set the unit of the run - if unit and script: - script = "unit %s %s" % (unit, script) - - # Execute the script - if script: - output_script += script - changed = True - parted(script, device, align) - - elif state == 'absent': - # Remove the partition - if part_exists(current_parts, 'num', number) or module.check_mode: - script = "rm %s " % number - output_script += script - changed = True - parted(script, device, align) - - elif state == 'info': - output_script = "unit '%s' print " % unit - - # Final status of the device - final_device_status = get_device_info(device, unit) - module.exit_json( - changed=changed, - disk=final_device_status['generic'], - partitions=final_device_status['partitions'], - script=output_script.strip() - ) - - -if __name__ == '__main__': - main() diff --git a/ansible/library/shade_api.py b/ansible/library/shade_api.py new file mode 100644 index 000000000..ad1180832 --- /dev/null +++ b/ansible/library/shade_api.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# 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. + +DOCUMENTATION = ''' +--- +module: shade_api +short_description: directly access shade +description: + - directly access shade API +options: + method: shade method + args: list of ags + kwargs: dict of kwargs + fact_name: name of ansible fact to store result +''' + +try: + import shade +except ImportError: + SHADE_PRESENT = False +else: + SHADE_PRESENT = True + + +def main(): + module = AnsibleModule( + argument_spec={ + 'method': {'required': True, 'type': 'str'}, + 'args': {'required': False, 'type': 'list', 'default': []}, + 'kwargs': {'required': False, 'type': 'dict', 'default': {}}, + 'os_auth': {'required': False, 'type': 'dict', 'default': {}}, + 'fact_name': {'required': True, 'type': 'str'}, + } + ) + + if not SHADE_PRESENT: + module.fail_json(msg="shade not found") + shade.simple_logging(debug=True) + params = module.params + method = params['method'] + args = params['args'] + kwargs = params['kwargs'] + os_auth = params['os_auth'] + fact_name = params['fact_name'] + if os_auth: + os.environ.update(os_auth) + + c = shade.openstack_cloud() + module.debug(args) + module.debug(kwargs) + ret = getattr(c, method)(*args, **kwargs) + if ret: + try: + # convert to regular dict, might not be necessary + ret = ret.toDict() + except AttributeError: + pass + else: + ret = {} + ansible_facts = { + fact_name: ret + } + module.exit_json(ansible_facts=ansible_facts) + + +# <<INCLUDE_ANSIBLE_MODULE_COMMON>> +from ansible.module_utils.basic import * # noqa + +if __name__ == '__main__': + main() diff --git a/ansible/load_images.yml b/ansible/load_images.yml index 7cf34adec..a4c130d46 100644 --- a/ansible/load_images.yml +++ b/ansible/load_images.yml @@ -59,8 +59,7 @@ - include: build_yardstick_image.yml -# TEMP -#- include: image_uploaders/upload_yardstick_image.yml +- include: image_uploaders/upload_yardstick_image.yml # upload cirros # upload vanilla ubuntu cloud_image diff --git a/ansible/multi_port_baremetal_ixia_correlated_test.yaml b/ansible/multi_port_baremetal_ixia_correlated_test.yaml new file mode 100644 index 000000000..ba92b5cd3 --- /dev/null +++ b/ansible/multi_port_baremetal_ixia_correlated_test.yaml @@ -0,0 +1,133 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: "" + password: "" + key_filename: ~ + tg_config: + ixchassis: "1.1.1.127" #ixia chassis ip + tcl_port: "8009" # tcl server port + lib_path: "/opt/ixia/ixos-api/8.01.0.2/lib/ixTcl1.0" + root_dir: "/opt/ixia/ixos-api/8.01.0.2/" + py_bin_path: "/opt/ixia/ixload/8.01.106.3/bin/" + py_lib_path: "/opt/ixia/ixnetwork/8.01.1029.14/lib/PythonApi" + dut_result_dir: "/mnt/results" + version: "8.01.106.3" + pcis: + uplink: + - "2:5" #Card:port + - "2:3" #Card:port + downlink: + - "2:6" #Card:port + - "2:5" #Card:port + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:98:10:64:14:00' + - '00:ac:10:64:14:0' + downlink: + - '00:98:10:28:14:00' + - '00:ac:10:28:14:00' + + # Environment variables + gen_1: + user: "" + password: "" + key_filename: ~ + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + vnf: + ip: "192.168.100.101/24" + user: root + password: "" + key_filename: /root/.ssh/id_rsa + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + tasks: + - include: multi_port_baremetal_ixia_correlated_test_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/multi_port_baremetal_ixia_correlated_test_templates.yml b/ansible/multi_port_baremetal_ixia_correlated_test_templates.yml new file mode 100644 index 000000000..6f73d8c01 --- /dev/null +++ b/ansible/multi_port_baremetal_ixia_correlated_test_templates.yml @@ -0,0 +1,56 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/ixia_template.yaml + dest: /etc/yardstick/nodes/ixia_{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_bm_vnf.yaml + dest: /etc/yardstick/nodes/pod_bm_vnf_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_baremetal_vfw_udp_ixia_correlated_multi_port_template.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_baremetal_vfw_udp_ixia_correlated_multi_port_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-correlated-multi-port.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-correlated-multi-port-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_baremetal_acl_udp_ixia_correlated_multi_port_template.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_baremetal_acl_udp_ixia_correlated_multi_port_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-correlated-multi-port.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-correlated-multi-port-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_baremetal_cgnapt_udp_ixia_correlated_multi_port_template.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_baremetal_cgnapt_udp_ixia_correlated_multi_port_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-correlated-multi-port.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-correlated-multi-port-{{ num_vnfs }}.yaml diff --git a/ansible/multi_port_baremetal_ixia_test.yaml b/ansible/multi_port_baremetal_ixia_test.yaml new file mode 100644 index 000000000..52bc40b43 --- /dev/null +++ b/ansible/multi_port_baremetal_ixia_test.yaml @@ -0,0 +1,104 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: "" + password: "" + key_filename: ~ + tg_config: + ixchassis: "1.1.1.127" #ixia chassis ip + tcl_port: "8009" # tcl server port + lib_path: "/opt/ixia/ixos-api/8.01.0.2/lib/ixTcl1.0" + root_dir: "/opt/ixia/ixos-api/8.01.0.2/" + py_bin_path: "/opt/ixia/ixload/8.01.106.3/bin/" + py_lib_path: "/opt/ixia/ixnetwork/8.01.1029.14/lib/PythonApi" + dut_result_dir: "/mnt/results" + version: "8.01.106.3" + pcis: + uplink: + - "2:5" #Card:port + - "2:3" #Card:port + downlink: + - "2:6" #Card:port + - "2:5" #Card:port + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:98:10:64:14:00' + - '00:ac:10:64:14:0' + downlink: + - '00:98:10:28:14:00' + - '00:ac:10:28:14:00' + + vnf: + ip: "192.168.100.101/24" + user: root + password: "" + key_filename: /root/.ssh/id_rsa + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + tasks: + - include: multi_port_baremetal_ixia_test_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/multi_port_baremetal_ixia_test_templates.yml b/ansible/multi_port_baremetal_ixia_test_templates.yml new file mode 100644 index 000000000..f2e04a2d1 --- /dev/null +++ b/ansible/multi_port_baremetal_ixia_test_templates.yml @@ -0,0 +1,60 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/ixia_template.yaml + dest: /etc/yardstick/nodes/ixia_{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_bm_vnf.yaml + dest: /etc/yardstick/nodes/pod_bm_vnf_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_baremetal_vfw_rfc2544_template.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_baremetal_vfw_rfc2544_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-multi-port.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-multi-port-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_baremetal_acl_rfc2544_ixia_template.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_baremetal_acl_rfc2544_ixia_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-multi-port.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-multi-port-ixia-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_baremetal_cgnapt_rfc2544_ixia_template.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_baremetal_cgnapt_rfc2544_ixia_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-multi-port.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-multi-port-ixia-{{ num_vnfs }}.yaml diff --git a/ansible/multi_port_baremetal_test.yaml b/ansible/multi_port_baremetal_test.yaml new file mode 100644 index 000000000..fb12b1c64 --- /dev/null +++ b/ansible/multi_port_baremetal_test.yaml @@ -0,0 +1,95 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: root + password: "" + key_filename: /root/.ssh/id_rsa + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + vnf: + ip: "192.168.100.101/24" + user: root + password: "" + key_filename: /root/.ssh/id_rsa + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + tasks: + - include: multi_port_baremetal_test_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/multi_port_baremetal_test_templates.yml b/ansible/multi_port_baremetal_test_templates.yml new file mode 100644 index 000000000..4b905f8c7 --- /dev/null +++ b/ansible/multi_port_baremetal_test_templates.yml @@ -0,0 +1,60 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/baremetal_trex.yaml + dest: /etc/yardstick/nodes/baremetal_trex_{{num_vnfs}}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_bm_vnf.yaml + dest: /etc/yardstick/nodes/pod_bm_vnf_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_baremetal_vfw_rfc2544_template.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_baremetal_vfw_rfc2544_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-multi-port.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-multi-port-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_baremetal_vfw_rfc2544_template.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_baremetal_vfw_rfc2544_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-multi-port.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-multi-port-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_baremetal_vfw_rfc2544_template.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_baremetal_vfw_rfc2544_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-multi-port.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-multi-port-{{ num_vnfs }}.yaml diff --git a/ansible/nsb_setup.yml b/ansible/nsb_setup.yml new file mode 100644 index 000000000..90fba0b1e --- /dev/null +++ b/ansible/nsb_setup.yml @@ -0,0 +1,60 @@ +# 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. +--- +- include: ubuntu_server_baremetal_deploy_samplevnfs.yml + vars: + YARD_IMG_ARCH: amd64 + +- hosts: localhost + roles: + - install_dependencies + - docker + +- include: build_yardstick_image.yml + vars: + YARD_IMG_ARCH: amd64 + release: xenial + when: openrc_file is defined + +- include: clean_images.yml + when: openrc_file is defined + +- hosts: localhost + post_tasks: + - os_image: + name: yardstick-samplevnfs + is_public: yes + disk_format: qcow2 + container_format: bare + filename: "{{ raw_imgfile }}" + properties: + hw_vif_multiqueue_enabled: true + environment: "{{ openrc }}" + when: openrc_file is defined + + - name: Start yardstick container + docker_container: + name: yardstick + pull: yes + recreate: yes + image: opnfv/yardstick:latest + state: started + restart_policy: always + privileged: yes + interactive: yes + volumes: + - "{{ openrc_file|default('/dev/null') }}:/etc/yardstick/openstack.creds:ro" + - /var/run/docker.sock:/var/run/docker.sock + - /opt:/opt + - /etc/localtime:/etc/localtime:ro diff --git a/ansible/ovs_scale_out_test_ixia_correlated_templates.yml b/ansible/ovs_scale_out_test_ixia_correlated_templates.yml new file mode 100644 index 000000000..c26505342 --- /dev/null +++ b/ansible/ovs_scale_out_test_ixia_correlated_templates.yml @@ -0,0 +1,57 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/ixia_correlated_template.yaml + dest: /etc/yardstick/nodes/ixia_correlated_{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_ovs.yaml + dest: /etc/yardstick/nodes/ovs_host.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_ovs_vfw_udp_ixia_correlated_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_ovs_vfw_udp_ixia_correlated_scale_out_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-correlated-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_ovs_acl_udp_ixia_correlated_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_ovs_acl_udp_ixia_correlated_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-correlated-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_ovs_cgnapt_udp_ixia_correlated_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_ovs_cgnapt_udp_ixia_correlated_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-correlated-scale-out-{{ num_vnfs }}.yaml diff --git a/ansible/ovs_scale_out_test_ixia_templates.yml b/ansible/ovs_scale_out_test_ixia_templates.yml new file mode 100644 index 000000000..736f8623d --- /dev/null +++ b/ansible/ovs_scale_out_test_ixia_templates.yml @@ -0,0 +1,61 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/ixia_template.yaml + dest: /etc/yardstick/nodes/ixia_{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_ovs.yaml + dest: /etc/yardstick/nodes/ovs_host.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_ovs_vfw_udp_ixia_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_ovs_vfw_udp_ixia_scale_out_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-scale-out.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_ovs_acl_udp_ixia_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_ovs_acl_udp_ixia_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-scale-out.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_ovs_cgnapt_udp_ixia_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_ovs_cgnapt_udp_ixia_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-scale-out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-scale-out-{{ num_vnfs }}.yaml diff --git a/ansible/ovs_scale_out_test_templates.yml b/ansible/ovs_scale_out_test_templates.yml new file mode 100644 index 000000000..cffa73342 --- /dev/null +++ b/ansible/ovs_scale_out_test_templates.yml @@ -0,0 +1,60 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/baremetal_trex.yaml + dest: /etc/yardstick/nodes/baremetal_trex_{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_sriov.yaml + dest: /etc/yardstick/nodes/sriov_host.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_ovs_vfw_udp_scale_out.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_ovs_vfw_udp_scale_out_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-scale-out.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_ovs_acl_udp_scale_out.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_ovs_acl_udp_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-scale-out.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_ovs_cgnapt_udp_scale_out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_ovs_cgnapt_udp_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-scale-out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-scale-out-{{ num_vnfs }}.yaml diff --git a/ansible/roles/add_heat_stack_owner_role/tasks/main.yml b/ansible/roles/add_heat_stack_owner_role/tasks/main.yml index d751eb032..dda087998 100644 --- a/ansible/roles/add_heat_stack_owner_role/tasks/main.yml +++ b/ansible/roles/add_heat_stack_owner_role/tasks/main.yml @@ -19,6 +19,6 @@ role: heat_stack_owner project: "{{ item }}" with_items: - - demo +# - demo - admin environment: "{{ openrc }}" diff --git a/ansible/roles/check_openstack_services/tasks/main.yml b/ansible/roles/check_openstack_services/tasks/main.yml index 02e730533..bfd9e1193 100644 --- a/ansible/roles/check_openstack_services/tasks/main.yml +++ b/ansible/roles/check_openstack_services/tasks/main.yml @@ -13,13 +13,19 @@ # limitations under the License. --- - name: Check images - os_images_facts: {} + shade_api: + method: search_images + fact_name: openstack_images + args: + - ~ environment: "{{ openrc }}" - name: Check servers os_server_facts: {} - environment: "{{ openrc }}" +# environment: "{{ openrc }}" - name: Check stacks - os_stack_facts: {} + shade_api: + method: list_stacks + fact_name: openstack_stacks environment: "{{ openrc }}" diff --git a/ansible/roles/clean_images/tasks/main.yml b/ansible/roles/clean_images/tasks/main.yml index 5cbae06d8..1bc3dc4ef 100644 --- a/ansible/roles/clean_images/tasks/main.yml +++ b/ansible/roles/clean_images/tasks/main.yml @@ -13,15 +13,21 @@ # limitations under the License. --- - name: Get all images - os_images_facts: {} + shade_api: + method: search_images + fact_name: openstack_images + args: + - ~ environment: "{{ openrc }}" -- debug: var=openstack_images +- debug: + var: openstack_images - set_fact: images_to_clean: "{{ openstack_images|map(attribute='name')|select('search', 'yardstick|cirros|Ubuntu-14\\.04')|list }}" -- debug: var=images_to_clean +- debug: + var: images_to_clean - name: Cleanup images os_image: diff --git a/ansible/roles/convert_openrc/defaults/main.yml b/ansible/roles/convert_openrc/defaults/main.yml index dffca1078..24a7129cc 100644 --- a/ansible/roles/convert_openrc/defaults/main.yml +++ b/ansible/roles/convert_openrc/defaults/main.yml @@ -12,6 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -openrc_file: "openrc" cloud_yaml_path: "{{ playbook_dir }}/clouds.yaml" diff --git a/ansible/roles/create_storperf_admin_rc/library/my_os_project_facts.py b/ansible/roles/create_storperf_admin_rc/library/my_os_project_facts.py deleted file mode 100644 index debb8dd5b..000000000 --- a/ansible/roles/create_storperf_admin_rc/library/my_os_project_facts.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/python -# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation -# -# This module is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This software is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this software. If not, see <http://www.gnu.org/licenses/>. - -import sys - -try: - import shade - HAS_SHADE = True -except ImportError: - HAS_SHADE = False - -DOCUMENTATION = ''' ---- -module: os_project_facts -short_description: Retrieve facts about one or more OpenStack projects -extends_documentation_fragment: openstack -version_added: "2.1" -author: "Ricardo Carrillo Cruz (@rcarrillocruz)" -description: - - Retrieve facts about a one or more OpenStack projects -requirements: - - "python >= 2.6" - - "shade" -options: - name: - description: - - Name or ID of the project - required: true - domain: - description: - - Name or ID of the domain containing the project if the cloud supports domains - required: false - default: None - filters: - description: - - A dictionary of meta data to use for further filtering. Elements of - this dictionary may be additional dictionaries. - required: false - default: None -''' - -EXAMPLES = ''' -# Gather facts about previously created projects -- my_os_project_facts: - cloud: awesomecloud -- debug: var=openstack_projects - -# Gather facts about a previously created project by name -- my_os_project_facts: - cloud: awesomecloud - name: demoproject -- debug: var=openstack_projects - -# Gather facts about a previously created project in a specific domain -- my_os_project_facts - cloud: awesomecloud - name: demoproject - domain: admindomain -- debug: var=openstack_projects - -# Gather facts about a previously created project in a specific domain - with filter -- my_os_project_facts - cloud: awesomecloud - name: demoproject - domain: admindomain - filters: - enabled: False -- debug: var=openstack_projects -''' - - -RETURN = ''' -openstack_projects: - description: has all the OpenStack facts about projects - returned: always, but can be null - type: complex - contains: - id: - description: Unique UUID. - returned: success - type: string - name: - description: Name given to the project. - returned: success - type: string - description: - description: Description of the project - returned: success - type: string - enabled: - description: Flag to indicate if the project is enabled - returned: success - type: bool - domain_id: - description: Domain ID containing the project (keystone v3 clouds only) - returned: success - type: bool -''' - -def main(): - - argument_spec = openstack_full_argument_spec( - name=dict(required=False, default=None), - domain=dict(required=False, default=None), - filters=dict(required=False, type='dict', default=None), - ) - - module = AnsibleModule(argument_spec) - - if not HAS_SHADE: - module.fail_json(msg='shade is required for this module') - - try: - name = module.params['name'] - domain = module.params['domain'] - filters = module.params['filters'] - - opcloud = shade.operator_cloud(**module.params) - # module.exit_json(changed=False, ansible_facts=dict( - # openstack_prjects=opcloud.cloud_config.get_auth_args())) - - if domain: - try: - # We assume admin is passing domain id - dom = opcloud.get_domain(domain)['id'] - domain = dom - except: - # If we fail, maybe admin is passing a domain name. - # Note that domains have unique names, just like id. - dom = opcloud.search_domains(filters={'name': domain}) - if dom: - domain = dom[0]['id'] - else: - module.fail_json(msg='Domain name or ID does not exist') - - if not filters: - filters = {} - - filters['domain_id'] = domain - - # projects = opcloud.search_projects(name, filters) - projects = opcloud.list_projects(name, filters) - module.exit_json(changed=False, ansible_facts=dict( - openstack_projects=projects)) - - except shade.OpenStackCloudException as e: - module.fail_json(msg=str(e)) - -from ansible.module_utils.basic import * -from ansible.module_utils.openstack import * - -if __name__ == '__main__': - main() diff --git a/ansible/roles/docker/defaults/main.yml b/ansible/roles/docker/defaults/main.yml new file mode 100644 index 000000000..e961969a4 --- /dev/null +++ b/ansible/roles/docker/defaults/main.yml @@ -0,0 +1,15 @@ +# 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. +--- +ubuntu_docker_url: https://apt.dockerproject.org/repo diff --git a/ansible/roles/docker/handlers/main.yml b/ansible/roles/docker/handlers/main.yml new file mode 100644 index 000000000..5e6556031 --- /dev/null +++ b/ansible/roles/docker/handlers/main.yml @@ -0,0 +1,20 @@ +# 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. +--- + - name: systemd daemon reload + command: systemctl daemon-reload + + - name: restart docker + service: name=docker state=restarted + diff --git a/ansible/roles/docker/tasks/Debian.yml b/ansible/roles/docker/tasks/Debian.yml new file mode 100644 index 000000000..cf4128774 --- /dev/null +++ b/ansible/roles/docker/tasks/Debian.yml @@ -0,0 +1,26 @@ +# 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. +--- + - name: add Ubuntu docker repo + apt_repository: repo='deb [trusted=yes] {{ ubuntu_docker_url }} ubuntu-{{ ansible_distribution_release }} main' state=present + + - name: ensure correct docker version + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" + with_items: "{{ docker_packages[ansible_os_family] }}" + + - name: remove Ubuntu docker repo + apt_repository: + repo: 'deb [trusted=yes] {{ ubuntu_docker_url }} ubuntu-{{ ansible_distribution_release }} main' + state: absent + update_cache: no diff --git a/ansible/roles/docker/tasks/RedHat.yml b/ansible/roles/docker/tasks/RedHat.yml new file mode 100644 index 000000000..2261da3de --- /dev/null +++ b/ansible/roles/docker/tasks/RedHat.yml @@ -0,0 +1,20 @@ +# 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. +--- + - name: bootstrap docker project repos + template: "src={{ ansible_os_family }}-repos.j2 dest=/etc/yum.repos.d/docker.repo" + + - name: ensure correct docker version + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: "{{ docker_packages[ansible_os_family] }}" diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml new file mode 100644 index 000000000..bbec371a8 --- /dev/null +++ b/ansible/roles/docker/tasks/main.yml @@ -0,0 +1,31 @@ +# 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. +--- + - name: Install docker + include: "{{ ansible_os_family }}.yml" + + - name: create docker service config dir + file: path=/etc/systemd/system/docker.service.d state=directory + + - name: create docker proxy config + template: src=http-proxy-conf.j2 dest=/etc/systemd/system/docker.service.d/http-proxy.conf owner=root mode=0644 + when: 'proxy_env is defined and "http_proxy" in proxy_env or "https_proxy" in proxy_env' + notify: + - systemd daemon reload + - restart docker + + - name: start docker service + service: name=docker state=started enabled=yes + + - meta: flush_handlers diff --git a/ansible/roles/docker/templates/RedHat-repos.j2 b/ansible/roles/docker/templates/RedHat-repos.j2 new file mode 100644 index 000000000..6d367408c --- /dev/null +++ b/ansible/roles/docker/templates/RedHat-repos.j2 @@ -0,0 +1,7 @@ +[dockerrepo] +name=Docker Repository +# $releasever for RHEL 7 is '7Server' so we can't use $releasever +baseurl={{ docker_project_url }}/repo/main/{{ ansible_distribution|lower|regex_replace('redhat', 'centos') }}/{{ ansible_distribution_major_version }}/ +enabled=1 +gpgcheck=1 +gpgkey={{ docker_project_url }}/gpg diff --git a/ansible/roles/docker/templates/http-proxy-conf.j2 b/ansible/roles/docker/templates/http-proxy-conf.j2 new file mode 100644 index 000000000..854ddfe09 --- /dev/null +++ b/ansible/roles/docker/templates/http-proxy-conf.j2 @@ -0,0 +1,2 @@ +[Service] +Environment={% if "http_proxy" in proxy_env %}"HTTP_PROXY={{ proxy_env.http_proxy }}" {% endif %} {% if "https_proxy" in proxy_env %} "HTTPS_PROXY={{ proxy_env.https_proxy }}" {% endif %} {% if "http_proxy" in proxy_env or "https_proxy" in proxy_env %} "NO_PROXY=localhost,127.0.0.0/8" {% endif %} diff --git a/ansible/roles/docker/vars/main.yml b/ansible/roles/docker/vars/main.yml new file mode 100644 index 000000000..8b5077490 --- /dev/null +++ b/ansible/roles/docker/vars/main.yml @@ -0,0 +1,20 @@ +# 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. +--- +docker_project_url: https://yum.dockerproject.org +docker_packages: + "RedHat": + - docker-engine-1.13.1 + "Debian": + - docker-engine=1.13.1* diff --git a/ansible/roles/download_civetweb/defaults/main.yml b/ansible/roles/download_civetweb/defaults/main.yml new file mode 100644 index 000000000..5efc9bb56 --- /dev/null +++ b/ansible/roles/download_civetweb/defaults/main.yml @@ -0,0 +1,18 @@ +# 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. +--- +civetweb_url: https://sourceforge.net/projects/civetweb/files/1.9/CivetWeb_V1.9.zip +civetweb_file: "{{ civetweb_url|basename }}" +civetweb_dest: "{{ clone_dest }}/civetweb" +civetweb_sha256s: "sha256:947a546bfccd733c79dff9565227fa74f4d17750650ff49312ef4b2d032fa8c8" diff --git a/ansible/roles/download_civetweb/tasks/main.yml b/ansible/roles/download_civetweb/tasks/main.yml new file mode 100644 index 000000000..03dd3ccd3 --- /dev/null +++ b/ansible/roles/download_civetweb/tasks/main.yml @@ -0,0 +1,40 @@ +# 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. +--- +- name: fetch civetweb + get_url: + url: "{{ civetweb_url }}" + dest: "{{ clone_dest }}/" + validate_certs: False + checksum: "{{ civetweb_sha256s }}" + +- name: unarchive civetweb + unarchive: + src: "{{ clone_dest }}/{{ civetweb_file }}" + dest: "{{ clone_dest }}/" + copy: no + +- file: + path: "{{ civetweb_dest }}" + state: absent + +- name: "move civetweb to {{ civetweb_dest }} path" + shell: "mv {{ clone_dest }}/civetweb-master {{ civetweb_dest }}" + args: + executable: /bin/bash + +- name: cleanup zip file to save space + file: + path: "{{ clone_dest }}/{{ civetweb_file }}" + state: absent diff --git a/ansible/roles/download_collectd/defaults/main.yml b/ansible/roles/download_collectd/defaults/main.yml new file mode 100644 index 000000000..9beaeb897 --- /dev/null +++ b/ansible/roles/download_collectd/defaults/main.yml @@ -0,0 +1,4 @@ +--- +collectd_url: "https://github.com/collectd/collectd.git" +collectd_dest: "{{ clone_dest }}/collectd" +collectd_version: "c870991a2d614e51c03c0da76e9aef997343551b" diff --git a/ansible/roles/download_collectd/tasks/main.yml b/ansible/roles/download_collectd/tasks/main.yml new file mode 100644 index 000000000..785cb3af5 --- /dev/null +++ b/ansible/roles/download_collectd/tasks/main.yml @@ -0,0 +1,29 @@ +# 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. +--- +#- debug: +# var: collectd_version +# verbosity: 2 + +- name: fetch collectd + git: + repo: "{{ collectd_url }}" + dest: "{{ collectd_dest }}" + version: "{{ collectd_version }}" + accept_hostkey: yes + recursive: no + force: yes + +- set_fact: + collectd_path: "{{ collectd_dest }}" diff --git a/ansible/roles/download_intel_cmt_cat/defaults/main.yml b/ansible/roles/download_intel_cmt_cat/defaults/main.yml new file mode 100644 index 000000000..0c26770b9 --- /dev/null +++ b/ansible/roles/download_intel_cmt_cat/defaults/main.yml @@ -0,0 +1,4 @@ +--- +intel_cmt_cat_url: "https://github.com/01org/intel-cmt-cat.git" +intel_cmt_cat_dest: "{{ clone_dest }}/intel-cmt-cat" +intel_cmt_cat_version: "v1.1.0" diff --git a/ansible/roles/download_intel_cmt_cat/tasks/main.yml b/ansible/roles/download_intel_cmt_cat/tasks/main.yml new file mode 100644 index 000000000..c1b6f7922 --- /dev/null +++ b/ansible/roles/download_intel_cmt_cat/tasks/main.yml @@ -0,0 +1,29 @@ +# 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. +--- +#- debug: +# var: intel_cmt_cat_version +# verbosity: 2 + +- name: fetch intel-cmt-cat + git: + repo: "{{ intel_cmt_cat_url }}" + dest: "{{ intel_cmt_cat_dest }}" + version: "{{ intel_cmt_cat_version }}" + accept_hostkey: yes + recursive: no + force: yes + +- set_fact: + intel_cmt_cat_path: "{{ intel_cmt_cat_dest }}" diff --git a/ansible/roles/download_pmu_tools/defaults/main.yml b/ansible/roles/download_pmu_tools/defaults/main.yml new file mode 100644 index 000000000..3b164d1f9 --- /dev/null +++ b/ansible/roles/download_pmu_tools/defaults/main.yml @@ -0,0 +1,5 @@ +--- +pmu_tools_url: "https://github.com/andikleen/pmu-tools.git" +pmu_tools_dest: "{{ clone_dest }}/pmu-tools" +pmu_tools_version: "8a0417a90c3ec9a09264ae9364519f499e8975c1" +perfmon_url: "https://download.01.org/perfmon/" diff --git a/ansible/roles/download_pmu_tools/tasks/main.yml b/ansible/roles/download_pmu_tools/tasks/main.yml new file mode 100644 index 000000000..37375b668 --- /dev/null +++ b/ansible/roles/download_pmu_tools/tasks/main.yml @@ -0,0 +1,36 @@ +# 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. +--- +#- debug: +# var: pmu_tools_version +# verbosity: 2 + +- name: fetch pmu_tools + git: + repo: "{{ pmu_tools_url }}" + dest: "{{ pmu_tools_dest }}" + version: "{{ pmu_tools_version }}" + accept_hostkey: yes + recursive: no + force: yes + +- set_fact: + pmu_tools_path: "{{ pmu_tools_dest }}" + +- name: Create perfmon local mirror + command: "wget -mkEpnp {{ perfmon_url }} -P {{ INSTALL_BIN_PATH }}/pmu_local_mirror" + ignore_errors: yes + failed_when: false #some of the links while creating mirror are not found, results in failure + no_log: True + diff --git a/ansible/roles/download_samplevnfs/defaults/main.yml b/ansible/roles/download_samplevnfs/defaults/main.yml index 5f565a415..e40eb67c0 100644 --- a/ansible/roles/download_samplevnfs/defaults/main.yml +++ b/ansible/roles/download_samplevnfs/defaults/main.yml @@ -1,4 +1,4 @@ --- samplevnf_url: "https://git.opnfv.org/samplevnf" samplevnf_dest: "{{ clone_dest }}/samplevnf" -samplevnf_version: "master" +samplevnf_version: "stable/euphrates" diff --git a/ansible/roles/enable_hugepages_on_boot/defaults/main.yml b/ansible/roles/enable_hugepages_on_boot/defaults/main.yml index 015e01bab..cc89ea346 100644 --- a/ansible/roles/enable_hugepages_on_boot/defaults/main.yml +++ b/ansible/roles/enable_hugepages_on_boot/defaults/main.yml @@ -1,3 +1,10 @@ --- num_hugepages: auto -huge_pagesize_mb: 1024
\ No newline at end of file +huge_pagesize_mb: 1024 +# disable EFI for chroot +efi: + stat: + exists: False +update_grub: + Debian: "grub-mkconfig -o {% if efi.stat.exists %}/boot/efi/EFI/{{ ansible_distribution|lower }}/grub.cfg{% else %}/boot/grub/grub.cfg{% endif %}" + RedHat: "grub2-mkconfig -o {% if efi.stat.exists %}/boot/efi/EFI/{{ ansible_distribution|lower }}/grub.cfg{% else %}/boot/grub2/grub.cfg{% endif %}" diff --git a/ansible/roles/enable_hugepages_on_boot/tasks/main.yml b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml index be4a328a2..29432d2e4 100755 --- a/ansible/roles/enable_hugepages_on_boot/tasks/main.yml +++ b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml @@ -17,6 +17,11 @@ register: is_mine_huge ignore_errors: True +# won't work in chroot +#- name: Detect EFI +# stat: path="/sys/firmware/efi" +# register: efi + - name: check if hugepages are set by someone else command: "grep -o 'default_hugepagesz=' /etc/default/grub" register: is_huge @@ -28,7 +33,7 @@ - name: use 16 for auto num_hugepages and 1G size set_fact: - num_hugepages: 16 + num_hugepages: 8 when: num_hugepages|default("auto") == "auto" - name: set hugepages in grub @@ -53,3 +58,7 @@ - service: name: procps enabled: yes + +- include: manual_modify_grub.yml + # only tested on Ubuntu, kernel line is probably different on other distros + when: ansible_distribution == "Ubuntu" diff --git a/ansible/roles/enable_hugepages_on_boot/tasks/manual_modify_grub.yml b/ansible/roles/enable_hugepages_on_boot/tasks/manual_modify_grub.yml new file mode 100644 index 000000000..cac10e80e --- /dev/null +++ b/ansible/roles/enable_hugepages_on_boot/tasks/manual_modify_grub.yml @@ -0,0 +1,35 @@ +# 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. +--- +- name: find boot grub.cfg + find: + paths: /boot + file_type: file + patterns: 'grub*.cfg' + recurse: yes + register: grub_files + + +- name: added hugepages to grub manually because we can't run update-grub in chroot + replace: + dest: "{{ item.path }}" + # console= should end the line + regexp: '(linux\s+/boot/vmlinuz.*console=\S+$)' + # default_hugepagesz=1G hugepagesz=1G hugepages=8 + replace: '\1 default_hugepagesz={{ huge_pagesize_short[huge_pagesize_mb] }} hugepagesz={{ huge_pagesize_short[huge_pagesize_mb] }} hugepages={{ num_hugepages }}' + with_items: "{{ grub_files.files }}" + + + + diff --git a/ansible/roles/increase_open_file_limits/defaults/main.yml b/ansible/roles/increase_open_file_limits/defaults/main.yml new file mode 100644 index 000000000..02cb12461 --- /dev/null +++ b/ansible/roles/increase_open_file_limits/defaults/main.yml @@ -0,0 +1,15 @@ +# 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. +--- +open_file_limit: 500000 diff --git a/ansible/roles/increase_open_file_limits/tasks/main.yml b/ansible/roles/increase_open_file_limits/tasks/main.yml new file mode 100644 index 000000000..4ef5e6f23 --- /dev/null +++ b/ansible/roles/increase_open_file_limits/tasks/main.yml @@ -0,0 +1,20 @@ +# 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. +--- + - name: increase open file limits for control + pam_limits: "domain={{ item[0] }} limit_type={{ item[1] }} limit_item=nofile value={{ open_file_limit }}" + with_nested: + - [ '*', 'root' ] + - [ 'soft', 'hard' ] + diff --git a/ansible/roles/install_L4Replay/tasks/main.yml b/ansible/roles/install_L4Replay/tasks/main.yml deleted file mode 100644 index 1401d1b13..000000000 --- a/ansible/roles/install_L4Replay/tasks/main.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# there is no clean for L4Replay -#- my_make: chdir="{{ vnf_build_dir }}/L4Replay" target=clean extra_args="-j {{ ansible_processor_vcpus }}" - -- name: Building L4Replay VNF - my_make: chdir="{{ NSB_INSTALL_DIR }}/L4Replay" params="RTE_SDK={{ dpdk_path }}" extra_args="-j {{ ansible_processor_vcpus }}" - -- command: cp "{{ NSB_INSTALL_DIR }}/L4Replay/build/L4replay" "{{ INSTALL_BIN_PATH }}/" - diff --git a/ansible/roles/install_civetweb/defaults/main.yml b/ansible/roles/install_civetweb/defaults/main.yml new file mode 100644 index 000000000..2235fe172 --- /dev/null +++ b/ansible/roles/install_civetweb/defaults/main.yml @@ -0,0 +1,21 @@ +# 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. +--- +civetweb_dest: "{{ clone_dest }}/civetweb" +civetweb_build_dependencies: + Debian: + - libjson0 + - libjson0-dev + - libssl-dev + RedHat: diff --git a/ansible/roles/install_civetweb/tasks/main.yml b/ansible/roles/install_civetweb/tasks/main.yml new file mode 100644 index 000000000..67a910b83 --- /dev/null +++ b/ansible/roles/install_civetweb/tasks/main.yml @@ -0,0 +1,22 @@ +# 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. +--- +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: "{{ civetweb_build_dependencies.get(ansible_os_family, []) }}" + +- name: Build civetweb lib + make: + chdir: "{{ civetweb_dest }}" + target: lib diff --git a/ansible/roles/install_collectd/tasks/main.yml b/ansible/roles/install_collectd/tasks/main.yml new file mode 100644 index 000000000..e3b655ffe --- /dev/null +++ b/ansible/roles/install_collectd/tasks/main.yml @@ -0,0 +1,38 @@ +# 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. +--- +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present update_cache=yes" + with_items: "{{ collectd_build_dependencies[ansible_os_family] }}" + +- name: prepare autotools + command: ./build.sh + args: + chdir: "{{ collectd_path }}" + +- name: build collectd + shell: "./configure --with-libpqos=/usr/ --with-libdpdk={{ dpdk_shared_path }} --with-libyajl=/usr/ --with-libjevents=/usr/local --enable-debug --enable-dpdkstat --enable-virt --enable-ovs_stats --enable-intel_pmu --prefix={{ INSTALL_BIN_PATH }}/collectd |& tee collectd-configure.txt" + args: + executable: /bin/bash + chdir: "{{ collectd_path }}" + +- fetch: + src: "{{ collectd_path }}/collectd-configure.txt" + dest: /tmp + +- name: "make collectd install" + make: + chdir: "{{ collectd_path }}" + target: install + diff --git a/ansible/roles/install_collectd/vars/main.yml b/ansible/roles/install_collectd/vars/main.yml new file mode 100644 index 000000000..b1b3dc5db --- /dev/null +++ b/ansible/roles/install_collectd/vars/main.yml @@ -0,0 +1,40 @@ +# 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. +--- +collectd_build_dependencies: + Debian: + - flex + - bison + - build-essential + - pkg-config + - automake + - autotools-dev + - libltdl-dev + - librabbitmq-dev + - rabbitmq-server + - cmake + - libvirt-dev + - libyajl-dev + RedHat: + - flex + - bison + - pkgconfig + - automake + - cmake + - rabbitmq-server + - librabbitmq-devel + - libtool-ltdl-devel + - libvirt-devel + - yajl-devel + diff --git a/ansible/roles/install_dependencies/tasks/Debian.yml b/ansible/roles/install_dependencies/tasks/Debian.yml index 0047a5e3b..bba6fb13c 100755 --- a/ansible/roles/install_dependencies/tasks/Debian.yml +++ b/ansible/roles/install_dependencies/tasks/Debian.yml @@ -47,4 +47,4 @@ - uwsgi-plugin-python - supervisor - python-setuptools - + - lsof diff --git a/ansible/roles/install_dpdk/tasks/Debian.yml b/ansible/roles/install_dpdk/tasks/Debian.yml index c77e4f96a..4f0c3c881 100755 --- a/ansible/roles/install_dpdk/tasks/Debian.yml +++ b/ansible/roles/install_dpdk/tasks/Debian.yml @@ -16,6 +16,7 @@ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: - libpcap-dev + - pciutils - name: Install kernel headers action: "{{ ansible_pkg_mgr }} name=linux-headers-{{ dpdk_kernel }} state=present" diff --git a/ansible/roles/install_dpdk/tasks/main.yml b/ansible/roles/install_dpdk/tasks/main.yml index cab093ad5..01ad4baf1 100644 --- a/ansible/roles/install_dpdk/tasks/main.yml +++ b/ansible/roles/install_dpdk/tasks/main.yml @@ -36,13 +36,9 @@ set_fact: RTE_KERNELDIR: "/lib/modules/{{ dpdk_kernel }}/build" -- my_make: +- command: make -j {{ ansible_processor_vcpus }} config T={{ dpdk_make_arch }} O={{ dpdk_make_arch }} + args: chdir: "{{ dpdk_path }}" - target: config - params: - T: "{{ dpdk_make_arch }}" - O: "{{ dpdk_make_arch }}" - extra_args: "-j {{ ansible_processor_vcpus }}" environment: RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" @@ -70,12 +66,38 @@ regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n' line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y' -- my_make: +# This is requied for collectd? but it breaks PROX? +#- name: enable CONFIG_RTE_BUILD_SHARED_LIB +# lineinfile: +# dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" +# regexp: '^CONFIG_RTE_BUILD_SHARED_LIB=n' +# line: 'CONFIG_RTE_BUILD_SHARED_LIB=y' +# +#- name: enable DPDK CONFIG_RTE_EAL_PMD_PATH +# lineinfile: +# dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" +# regexp: '^CONFIG_RTE_EAL_PMD_PATH=""' +# line: 'CONFIG_RTE_EAL_PMD_PATH="{{ dpdk_pmd_path }}"' + +# TODO: disable ASLR + +- name: make dpdk + command: make -j {{ ansible_processor_vcpus }} + args: chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}" - extra_args: "-j {{ ansible_processor_vcpus }}" environment: RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" +#- name: make install DPDK into /usr for collectd and other programs +# make: +# chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}" +# target: install +# params: "T={{ RTE_TARGET }}" +## params: "prefix={{ usr_prefix }}" +# environment: +# RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" +# become: yes + - file: path: "{{ dpdk_module_dir}}" state: directory diff --git a/ansible/roles/install_dpdk/vars/main.yml b/ansible/roles/install_dpdk/vars/main.yml index 1cc4f1583..45bcc339b 100644 --- a/ansible/roles/install_dpdk/vars/main.yml +++ b/ansible/roles/install_dpdk/vars/main.yml @@ -6,3 +6,4 @@ dpdk_devbind: "16.07": "{{ dpdk_path }}/tools/dpdk-devbind.py" "17.02": "{{ dpdk_path }}/usertools/dpdk-devbind.py" "17.04": "{{ dpdk_path }}/usertools/dpdk-devbind.py" +dpdk_pmd_path: /usr/lib/dpdk-pmd/ diff --git a/ansible/roles/install_dpdk_shared/defaults/main.yml b/ansible/roles/install_dpdk_shared/defaults/main.yml new file mode 100644 index 000000000..fe2172401 --- /dev/null +++ b/ansible/roles/install_dpdk_shared/defaults/main.yml @@ -0,0 +1,2 @@ +--- +INSTALL_BIN_PATH: "/opt/nsb_bin"
\ No newline at end of file diff --git a/ansible/roles/install_dpdk_shared/tasks/Debian.yml b/ansible/roles/install_dpdk_shared/tasks/Debian.yml new file mode 100755 index 000000000..c77e4f96a --- /dev/null +++ b/ansible/roles/install_dpdk_shared/tasks/Debian.yml @@ -0,0 +1,22 @@ +# 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. +--- +- name: Install DPDK build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - libpcap-dev + +- name: Install kernel headers + action: "{{ ansible_pkg_mgr }} name=linux-headers-{{ dpdk_kernel }} state=present" + diff --git a/ansible/roles/install_dpdk_shared/tasks/RedHat.yml b/ansible/roles/install_dpdk_shared/tasks/RedHat.yml new file mode 100644 index 000000000..ae66faa04 --- /dev/null +++ b/ansible/roles/install_dpdk_shared/tasks/RedHat.yml @@ -0,0 +1,29 @@ +# 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. +--- +- name: Install DPDK build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - libpcap-devel + +# Do this before installing kernel headers +# example: +# kernel-headers-3.10.0-514.2.2.el7.x86_64 for kernel 3.10.0-514.el7.x86_64 +- name: Adjust dpdk_kernel to be match an RPM, remove el7.x86_64 + set_fact: + rpm_kernel: "{{ dpdk_kernel|regex_replace('[.]el\\d+\\.x86_64', '') }}" + +- name: Install kernel headers +# use rpm wildcard + action: "{{ ansible_pkg_mgr }} name=kernel-headers-{{ rpm_kernel }}* state=present" diff --git a/ansible/roles/install_dpdk_shared/tasks/main.yml b/ansible/roles/install_dpdk_shared/tasks/main.yml new file mode 100644 index 000000000..65954be04 --- /dev/null +++ b/ansible/roles/install_dpdk_shared/tasks/main.yml @@ -0,0 +1,114 @@ +# 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. +--- +#- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=0 +# with_fileglob: +# - "{{ local_nsb_path }}/patches/dpdk_custom_patch/rte_pipeline.patch" +# +#- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=1 +# with_fileglob: +# - "{{ local_nsb_path }}/patches/dpdk_custom_patch/0*.patch" + +- name: set DPDK shared dir + set_fact: + dpdk_shared_path: "{{ dpdk_path }}-shared" + +- command: "cp -a {{ dpdk_path }} {{ dpdk_shared_path }}" + +- name: find kernel for image, (including chroot) + find_kernel: + kernel: "{{ ansible_kernel }}" + register: found_kernel + +# Do this before installing kernel headers +- name: Set dpdk_kernel to be the kernel we found + set_fact: + dpdk_kernel: "{{ found_kernel.kernel }}" + +- include: "{{ ansible_os_family }}.yml" + +- name: set RTE_KERNELDIR to point to found kernel + set_fact: + RTE_KERNELDIR: "/lib/modules/{{ dpdk_kernel }}/build" + +- command: make -j {{ ansible_processor_vcpus }} config T={{ dpdk_make_arch }} O={{ dpdk_make_arch }} + args: + chdir: "{{ dpdk_shared_path }}" + environment: + RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" + +- name: enable RTE_PORT_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PORT_STATS_COLLECT=n' + line: 'CONFIG_RTE_PORT_STATS_COLLECT=y' + +- name: enable DPDK RTE_PORT_PCAP + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PORT_PCAP=n' + line: 'CONFIG_RTE_PORT_PCAP=y' + +- name: enable DPDK RTE_TABLE_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_TABLE_STATS_COLLECT=n' + line: 'CONFIG_RTE_TABLE_STATS_COLLECT=y' + +- name: enable DPDK RTE_PIPELINE_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n' + line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y' + +# This is requied for collectd but VNFs can't use shared DPDK +- name: enable CONFIG_RTE_BUILD_SHARED_LIB + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_BUILD_SHARED_LIB=n' + line: 'CONFIG_RTE_BUILD_SHARED_LIB=y' + +- name: enable DPDK CONFIG_RTE_EAL_PMD_PATH + lineinfile: + dest: "{{ dpdk_shared_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_EAL_PMD_PATH=""' + line: 'CONFIG_RTE_EAL_PMD_PATH="{{ dpdk_pmd_path }}"' + + # no T= target for clean +- command: make -j {{ ansible_processor_vcpus }} clean O={{ dpdk_make_arch }} + args: + chdir: "{{ dpdk_shared_path }}" + environment: + RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" + +# TODO: disable ASLR + +- command: make -j {{ ansible_processor_vcpus }} + args: + chdir: "{{ dpdk_shared_path }}/{{ dpdk_make_arch}}" + environment: + RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" + +#- name: make install DPDK into /usr for collectd and other programs +# make: +# chdir: "{{ dpdk_shared_path }}/{{ dpdk_make_arch}}" +# target: install +# params: "T={{ RTE_TARGET }}" +## params: "prefix={{ usr_prefix }}" +# environment: +# RTE_KERNELDIR: "{{ RTE_KERNELDIR }}" +# become: yes + +# don't install module or copy dpdk-devbind + diff --git a/ansible/roles/install_dpdk_shared/vars/main.yml b/ansible/roles/install_dpdk_shared/vars/main.yml new file mode 100644 index 000000000..45bcc339b --- /dev/null +++ b/ansible/roles/install_dpdk_shared/vars/main.yml @@ -0,0 +1,9 @@ +--- +dpdk_make_arch: x86_64-native-linuxapp-gcc +dpdk_module_dir: "/lib/modules/{{ dpdk_kernel }}/extra" +hugetable_mount: /mnt/huge +dpdk_devbind: + "16.07": "{{ dpdk_path }}/tools/dpdk-devbind.py" + "17.02": "{{ dpdk_path }}/usertools/dpdk-devbind.py" + "17.04": "{{ dpdk_path }}/usertools/dpdk-devbind.py" +dpdk_pmd_path: /usr/lib/dpdk-pmd/ diff --git a/ansible/roles/install_image_dependencies/defaults/main.yml b/ansible/roles/install_image_dependencies/defaults/main.yml index b1695e278..362fa351b 100644 --- a/ansible/roles/install_image_dependencies/defaults/main.yml +++ b/ansible/roles/install_image_dependencies/defaults/main.yml @@ -13,9 +13,7 @@ install_dependencies: - iproute2 - linux-tools-common - linux-tools-generic - - lmbench - make - - netperf - patch - perl - rt-tests @@ -24,6 +22,9 @@ install_dependencies: - unzip # for Trex - libpython2.7-dev + # for IxLoad + - libxft-dev + - libxss-dev RedHat: - bc - fio diff --git a/ansible/roles/install_image_dependencies/tasks/main.yml b/ansible/roles/install_image_dependencies/tasks/main.yml index f3a3151c5..ffd30f33e 100644 --- a/ansible/roles/install_image_dependencies/tasks/main.yml +++ b/ansible/roles/install_image_dependencies/tasks/main.yml @@ -16,7 +16,7 @@ include: "{{ ansible_os_family }}.yml" - name: Install core packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest" + action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" register: pkg_mgr_results retries: "{{ pkg_mgr_retries }}" until: pkg_mgr_results|success diff --git a/ansible/roles/install_intel_cmt_cat/tasks/main.yml b/ansible/roles/install_intel_cmt_cat/tasks/main.yml new file mode 100644 index 000000000..609e98024 --- /dev/null +++ b/ansible/roles/install_intel_cmt_cat/tasks/main.yml @@ -0,0 +1,25 @@ +# 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. +--- + +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: "{{ intel_cmt_cat_build_dependencies[ansible_os_family] }}" + +- name: "make intel-cmt-cat" + make: + chdir: "{{ intel_cmt_cat_path }}" + target: install + params: + PREFIX: "/usr" diff --git a/ansible/roles/install_intel_cmt_cat/vars/main.yml b/ansible/roles/install_intel_cmt_cat/vars/main.yml new file mode 100644 index 000000000..20bc1c69c --- /dev/null +++ b/ansible/roles/install_intel_cmt_cat/vars/main.yml @@ -0,0 +1,38 @@ +# 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. +--- +intel_cmt_cat_build_dependencies: + Debian: + - flex + - bison + - build-essential + - pkg-config + - automake + - autotools-dev + - libltdl-dev + - librabbitmq-dev + - rabbitmq-server + - cmake + - libvirt-dev + RedHat: + - flex + - bison + - pkgconfig + - automake + - cmake + - rabbitmq-server + - librabbitmq-devel + - libtool-ltdl-devel + - libvirt-devel + diff --git a/ansible/roles/install_pmu_tools/tasks/main.yml b/ansible/roles/install_pmu_tools/tasks/main.yml new file mode 100644 index 000000000..026fb67ea --- /dev/null +++ b/ansible/roles/install_pmu_tools/tasks/main.yml @@ -0,0 +1,36 @@ +# 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. +--- + +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: "{{ pmu_tools_build_dependencies[ansible_os_family] }}" + +- name: fix pmu-tools CFLAGS to include -fPIC + replace: + path: "{{ pmu_tools_path }}/jevents/Makefile" + regexp: "CFLAGS := -g -Wall -O2 -Wno-unused-result" + replace: "CFLAGS := -g -Wall -O2 -Wno-unused-result -fPIC" + backup: yes + +- name: "make jevents" + make: + chdir: "{{ pmu_tools_path }}/jevents" + +- name: "make install jevents" + make: + chdir: "{{ pmu_tools_path }}/jevents" + target: install + become: yes + diff --git a/ansible/roles/install_pmu_tools/vars/main.yml b/ansible/roles/install_pmu_tools/vars/main.yml new file mode 100644 index 000000000..10660f61b --- /dev/null +++ b/ansible/roles/install_pmu_tools/vars/main.yml @@ -0,0 +1,38 @@ +# 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. +--- +pmu_tools_build_dependencies: + Debian: + - flex + - bison + - build-essential + - pkg-config + - automake + - autotools-dev + - libltdl-dev + - librabbitmq-dev + - rabbitmq-server + - cmake + - libvirt-dev + RedHat: + - flex + - bison + - pkgconfig + - automake + - cmake + - rabbitmq-server + - librabbitmq-devel + - libtool-ltdl-devel + - libvirt-devel + diff --git a/ansible/roles/install_rabbitmq/tasks/main.yml b/ansible/roles/install_rabbitmq/tasks/main.yml new file mode 100644 index 000000000..16195c49d --- /dev/null +++ b/ansible/roles/install_rabbitmq/tasks/main.yml @@ -0,0 +1,22 @@ +# 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. +--- +- name: bootstrap rabbitmq project repos + template: "src={{ ansible_os_family }}-repos.j2 dest=/etc/yum.repos.d/rabbitmq_rabbitmq-server.repo" + when: ansible_os_family == 'RedHat' + +- name: Install extra build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest update_cache=yes" + with_items: "{{ rabbitmq_packages[ansible_os_family] }}" + diff --git a/ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 b/ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 new file mode 100644 index 000000000..09c997ce1 --- /dev/null +++ b/ansible/roles/install_rabbitmq/templates/RedHat-repos.j2 @@ -0,0 +1,21 @@ +[rabbitmq_rabbitmq-server] +name=rabbitmq_rabbitmq-server +baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_distribution_major_version }}/$basearch +repo_gpgcheck=0 +gpgcheck=0 +enabled=1 +gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey +sslverify=0 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt +metadata_expire=300 + +[rabbitmq_rabbitmq-server-source] +name=rabbitmq_rabbitmq-server-source +baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_distribution_major_version }}/SRPMS +repo_gpgcheck=0 +gpgcheck=0 +enabled=1 +gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey +sslverify=0 +sslcacert=/etc/pki/tls/certs/ca-bundle.crt +metadata_expire=300
\ No newline at end of file diff --git a/ansible/roles/install_rabbitmq/vars/main.yml b/ansible/roles/install_rabbitmq/vars/main.yml new file mode 100644 index 000000000..d49607dbf --- /dev/null +++ b/ansible/roles/install_rabbitmq/vars/main.yml @@ -0,0 +1,22 @@ +# 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. +--- +rabbitmq_packages: + Debian: + - librabbitmq-dev + - rabbitmq-server + RedHat: + - rabbitmq-server + - librabbitmq-devel + diff --git a/ansible/roles/install_samplevnf/tasks/main.yml b/ansible/roles/install_samplevnf/tasks/main.yml index d332c88bc..b5d33f668 100644 --- a/ansible/roles/install_samplevnf/tasks/main.yml +++ b/ansible/roles/install_samplevnf/tasks/main.yml @@ -22,7 +22,6 @@ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: "{{ vnf_build_dependencies.get(vnf_name, {}).get(ansible_os_family, []) }}" - - name: set build env vars set_fact: build_env_vars: @@ -30,17 +29,21 @@ RTE_TARGET: "{{ RTE_TARGET }}" VNF_CORE: "{{ samplevnf_path }}" -- name: set soft CRC for PROX when building in VM +- name: set soft CRC and GEN_DECAP_IPV6_TO_IPV4_CKSUM for PROX when building in VM set_fact: - build_env_vars: "{{ build_env_vars|combine({'crc': 'soft'}) }}" + build_env_vars: "{{ build_env_vars|combine({'crc': 'soft'})|combine({'GEN_DECAP_IPV6_TO_IPV4_CKSUM':'y'}) }}" when: vnf_name == "PROX" and image_type is defined and image_type == "vm" - name: "make {{ vnf_name }} clean" - my_make: chdir="{{ vnf_build_dir }}" target=clean extra_args="-j {{ ansible_processor_vcpus }}" + command: make -j {{ ansible_processor_vcpus }} clean + args: + chdir: "{{ vnf_build_dir }}" environment: "{{ build_env_vars }}" - name: "make {{ vnf_name }}" - my_make: chdir="{{ vnf_build_dir }}" extra_args="-j {{ ansible_processor_vcpus }}" + command: make -j {{ ansible_processor_vcpus }} + args: + chdir: "{{ vnf_build_dir }}" environment: "{{ build_env_vars }}" #- command: cp "{{ vnf_build_dir }}/{{ vnf_name }}/build/ip_pipeline" "{{ INSTALL_BIN_PATH }}/vACL_vnf" diff --git a/ansible/roles/install_samplevnf/vars/main.yml b/ansible/roles/install_samplevnf/vars/main.yml index 6f2c44a84..45cea6820 100644 --- a/ansible/roles/install_samplevnf/vars/main.yml +++ b/ansible/roles/install_samplevnf/vars/main.yml @@ -15,6 +15,23 @@ vnf_build_dependencies: PROX: Debian: + - build-essential + - git + - unzip + - libpcap0.8-dev + - gcc + - make + - libc6 + - libc6-dev + - g++-multilib + - libzmq3-dev + - libcurl4-openssl-dev + - net-tools + - wget + - libpcap-dev + - libncurses-dev + - libedit-dev + - pciutils - pkg-config - liblua5.2-dev - libncurses5 diff --git a/ansible/roles/package_clean/tasks/Debian.yml b/ansible/roles/package_clean/tasks/Debian.yml new file mode 100755 index 000000000..abc280076 --- /dev/null +++ b/ansible/roles/package_clean/tasks/Debian.yml @@ -0,0 +1,16 @@ +# 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. +--- +- name: Purge apt cache + command: apt-get clean diff --git a/ansible/roles/package_clean/tasks/RedHat.yml b/ansible/roles/package_clean/tasks/RedHat.yml new file mode 100644 index 000000000..c6ed62b35 --- /dev/null +++ b/ansible/roles/package_clean/tasks/RedHat.yml @@ -0,0 +1,17 @@ +# 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. +--- +- name: Clean yum cache + command: "{{ ansible_pkg_mgr }} clean all + diff --git a/ansible/roles/package_clean/tasks/main.yml b/ansible/roles/package_clean/tasks/main.yml new file mode 100644 index 000000000..27660c3ca --- /dev/null +++ b/ansible/roles/package_clean/tasks/main.yml @@ -0,0 +1,15 @@ +# 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. +--- +- include: "{{ ansible_os_family }}.yml" diff --git a/ansible/roles/set_package_installer_proxy/tasks/Debian.yml b/ansible/roles/set_package_installer_proxy/tasks/Debian.yml index 11117e5ed..d3891ab18 100644 --- a/ansible/roles/set_package_installer_proxy/tasks/Debian.yml +++ b/ansible/roles/set_package_installer_proxy/tasks/Debian.yml @@ -1,27 +1,16 @@ -# Copyright (c) 2016, Intel Corporation. +# Copyright (c) 2016-2017 Intel Corporation # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# 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 # -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. +# http://www.apache.org/licenses/LICENSE-2.0 # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 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. --- - name: Create apt.conf.d/ proxy config template: @@ -29,7 +18,7 @@ dest: "/etc/apt/apt.conf.d/20proxy" - name: Test proxy connection -# async: "{{ connection_timeout }}" + async: "{{ connection_timeout }}" action: "{{ ansible_pkg_mgr }} name=tar state=latest update_cache=yes" -# poll: 0 + poll: 0 register: test_proxy_job_id diff --git a/ansible/roles/set_package_installer_proxy/tasks/RedHat.yml b/ansible/roles/set_package_installer_proxy/tasks/RedHat.yml index 809e43a60..1c3e9fb0f 100644 --- a/ansible/roles/set_package_installer_proxy/tasks/RedHat.yml +++ b/ansible/roles/set_package_installer_proxy/tasks/RedHat.yml @@ -1,27 +1,16 @@ -# Copyright (c) 2016, Intel Corporation. +# Copyright (c) 2016-2017 Intel Corporation # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# 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 # -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. +# http://www.apache.org/licenses/LICENSE-2.0 # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 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. --- # must do this before setting yum proxy - name: find yum/dnf config @@ -48,10 +37,14 @@ with_items: "{{ packager_conf_stat.results }}" register: yum_proxy_lines -# - name: Test proxy connection -# # try workaround call makecache directly -# # yum module was failing for some reason -# async: "{{ connection_timeout }}" -# command: "{{ ansible_pkg_mgr }} -d2 -y makecache" -# poll: 0 -# register: test_proxy_job_id + - name: yum disable fastest mirrors + include: yum_disable_fastestmirrors.yml + when: ansible_pkg_mgr == 'yum' + + - name: Test proxy connection + # try workaround call makecache directly + # yum module was failing for some reason + async: "{{ connection_timeout }}" + command: "{{ ansible_pkg_mgr }} -d2 -y makecache" + poll: 0 + register: test_proxy_job_id diff --git a/ansible/roles/set_package_installer_proxy/tasks/main.yml b/ansible/roles/set_package_installer_proxy/tasks/main.yml index 9838cd489..fea424bf3 100644 --- a/ansible/roles/set_package_installer_proxy/tasks/main.yml +++ b/ansible/roles/set_package_installer_proxy/tasks/main.yml @@ -1,40 +1,29 @@ -# Copyright (c) 2016, Intel Corporation. +# Copyright (c) 2016-2017 Intel Corporation # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# 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 # -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of Intel Corporation nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. +# http://www.apache.org/licenses/LICENSE-2.0 # -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# 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. --- - name: Configure package manager proxy include: "{{ ansible_os_family }}.yml" -# - async_status: jid={{ test_proxy_job_id.ansible_job_id }} -# register: test_proxy_result -# until: test_proxy_result.finished -# retries: 60 -# delay: 10 -# -# - debug: var=hostvars[item]['test_proxy_result'] -# with_items: "{{ hostvars }}" -# -# - name: Verify proxy test -# fail: msg="proxy test timeout" -# when: "{{ test_proxy_result.get('finished', 0) == 0 }}" + - async_status: jid={{ test_proxy_job_id.ansible_job_id }} + register: test_proxy_result + until: test_proxy_result.finished + retries: 60 + delay: 10 + + - debug: var=hostvars[item]['test_proxy_result'] + with_items: "{{ hostvars }}" + + - name: Verify proxy test + fail: msg="proxy test timeout" + when: "test_proxy_result.get('finished', 0) == 0" diff --git a/ansible/roles/set_package_installer_proxy/tasks/yum_disable_fastestmirrors.yml b/ansible/roles/set_package_installer_proxy/tasks/yum_disable_fastestmirrors.yml new file mode 100644 index 000000000..42388bcd9 --- /dev/null +++ b/ansible/roles/set_package_installer_proxy/tasks/yum_disable_fastestmirrors.yml @@ -0,0 +1,11 @@ +--- + - name: yum disable fastest mirrors + lineinfile: + dest: "/etc/yum/pluginconf.d/fastestmirror.conf" + regexp: "^enabled=1" + line: "enabled=0" + ignore_errors: true + + - name: yum clean all + command: yum clean all + diff --git a/ansible/scale_out_test_templates.yml b/ansible/scale_out_test_templates.yml new file mode 100644 index 000000000..487319f2a --- /dev/null +++ b/ansible/scale_out_test_templates.yml @@ -0,0 +1,52 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput_cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_correlated_traffic_scale_out.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_correlated_traffic_scale_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-3node-scale-out.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-3node-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_correlated_scale_out.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex_correlated_scale_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-3node-scale-out.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-3node-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_heat_rfc2544_ipv4_1flow_64B_trex_correlated_scale_out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_heat_rfc2544_ipv4_1flow_64B_trex_correlated_scale_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-vnf-topology-3node-scale-out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-vnf-topology-3node-{{ num_vnfs }}.yaml diff --git a/ansible/sriov_scale_out_test_ixia_correlated_templates.yml b/ansible/sriov_scale_out_test_ixia_correlated_templates.yml new file mode 100644 index 000000000..626030712 --- /dev/null +++ b/ansible/sriov_scale_out_test_ixia_correlated_templates.yml @@ -0,0 +1,61 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/ixia_correlated_template.yaml + dest: /etc/yardstick/nodes/ixia_correlated_{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_sriov.yaml + dest: /etc/yardstick/nodes/sriov_host.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_sriov_vfw_udp_ixia_correlated_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_sriov_vfw_udp_ixia_correlated_scale_out_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-correlated-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_sriov_acl_udp_ixia_correlated_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_sriov_acl_udp_ixia_correlated_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-correlated-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_sriov_cgnapt_udp_ixia_correlated_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_sriov_cgnapt_udp_ixia_correlated_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-correlated-scale-out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-correlated-scale-out-{{ num_vnfs }}.yaml diff --git a/ansible/sriov_scale_out_test_ixia_templates.yml b/ansible/sriov_scale_out_test_ixia_templates.yml new file mode 100644 index 000000000..45c6f3d05 --- /dev/null +++ b/ansible/sriov_scale_out_test_ixia_templates.yml @@ -0,0 +1,61 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-ixia-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/ixia_template.yaml + dest: /etc/yardstick/nodes/ixia_{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_sriov.yaml + dest: /etc/yardstick/nodes/sriov_host.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_sriov_vfw_udp_ixia_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_sriov_vfw_udp_ixia_scale_out_{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-scale-out.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-ixia-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_sriov_acl_udp_ixia_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_sriov_acl_udp_ixia_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-scale-out.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-ixia-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-ixia-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_sriov_cgnapt_udp_ixia_scale_out_template.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_sriov_cgnapt_udp_ixia_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-scale-out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-ixia-scale-out-{{ num_vnfs }}.yaml diff --git a/ansible/sriov_scale_out_test_templates.yml b/ansible/sriov_scale_out_test_templates.yml new file mode 100644 index 000000000..33ecfad47 --- /dev/null +++ b/ansible/sriov_scale_out_test_templates.yml @@ -0,0 +1,61 @@ +# 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. +--- + +- set_fact: + num_vnfs: "{{ item }}" + +- debug: + var: num_vnfs + verbosity: 2 + + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-{{ num_vnfs }}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/baremetal_trex.yaml + dest: /etc/yardstick/nodes/baremetal_trex_{{num_vnfs}}.yaml + +- template: + src: ../etc/yardstick/nodes/standalone/pod_sriov.yaml + dest: /etc/yardstick/nodes/sriov_host.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/tc_sriov_vfw_udp_scale_out.yaml + dest: ../samples/vnf_samples/nsut/vfw/tc_sriov_vfw_udp_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-scale-out.yaml + dest: ../samples/vnf_samples/nsut/vfw/vfw-tg-topology-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/tc_sriov_acl_udp_scale_out.yaml + dest: ../samples/vnf_samples/nsut/acl/tc_sriov_acl_udp_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/acl/acl-tg-topology-scale-out.yaml + dest: ../samples/vnf_samples/nsut/acl/acl-tg-topology-scale-out-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-scale-out.yaml + dest: ../samples/vnf_samples/traffic_profiles/ipv4_throughput-cgnapt-{{ num_vnfs }}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/tc_sriov_cgnapt_udp_scale_out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/tc_sriov_cgnapt_udp_scale_out_{{num_vnfs}}.yaml + +- template: + src: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-scale-out.yaml + dest: ../samples/vnf_samples/nsut/cgnapt/cgnapt-tg-topology-scale-out-{{ num_vnfs }}.yaml diff --git a/ansible/standalone_ovs_scale_out_ixia_correlated_test.yaml b/ansible/standalone_ovs_scale_out_ixia_correlated_test.yaml new file mode 100644 index 000000000..516676576 --- /dev/null +++ b/ansible/standalone_ovs_scale_out_ixia_correlated_test.yaml @@ -0,0 +1,147 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + ovs_properties: + ovs: 2.6.0 + dpdk: 16.07.1 + vpath: "/usr/local" + queues: 4 + pmd_threads: 2 + ram: + socket_0: 2048 + socket_1: 2048 + flavor: + ram: 4096 + image: "/var/lib/libvirt/images/ubuntu.qcow2" + extra_specs: + cpu_sockets: 1 + cpu_cores: 6 + cpu_threads: 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + # Environment variables + gen: + user: "" + password: "" + key_filename: ~ + tg_config: + ixchassis: "1.1.1.127" #ixia chassis ip + tcl_port: "8009" # tcl server port + lib_path: "/opt/ixia/ixos-api/8.01.0.2/lib/ixTcl1.0" + root_dir: "/opt/ixia/ixos-api/8.01.0.2/" + py_bin_path: "/opt/ixia/ixload/8.01.106.3/bin/" + py_lib_path: "/opt/ixia/ixnetwork/8.01.1029.14/lib/PythonApi" + dut_result_dir: "/mnt/results" + version: "8.01.106.3" + pcis: + uplink: + - "2:5" #Card:port + - "2:3" #Card:port + downlink: + - "2:6" #Card:port + - "2:5" #Card:port + ip: + mgmt: + - '1.1.1.138/24' # ixia network machine ip + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:98:10:64:14:00' + - '00:ac:10:64:14:0' + downlink: + - '00:98:10:28:14:00' + - '00:ac:10:28:14:00' + + # Environment variables + gen_1: + user: "" + password: "" + key_filename: /""/.ssh/id_rsa + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + host: + ip: "192.168.100.101/24" + user: "" + password: "" + key_filename: ~ + + vnf: + user: "" + password: "" + key_filename: ~ + pcis: + uplink: + - "0000:07:00.0" + - "0000:07:00.2" + downlink: + - "0000:07:00.1" + - "0000:07:00.3" + ip: + mgmt: + - '1.1.1.1/24' + - '1.1.1.7/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + + tasks: + - include: ovs_scale_out_test_ixia_correlated_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/standalone_ovs_scale_out_ixia_test.yaml b/ansible/standalone_ovs_scale_out_ixia_test.yaml new file mode 100644 index 000000000..ff665377f --- /dev/null +++ b/ansible/standalone_ovs_scale_out_ixia_test.yaml @@ -0,0 +1,120 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + ovs_properties: + ovs: 2.6.0 + dpdk: 16.07.1 + vpath: "/usr/local" + queues: 4 + pmd_threads: 2 + ram: + socket_0: 2048 + socket_1: 2048 + flavor: + user: root + password: "" + ram: 4096 + image: "/var/lib/libvirt/images/ubuntu.qcow2" + extra_specs: + cpu_sockets: 1 + cpu_cores: 6 + cpu_threads: 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: "" + password: "" + key_filename: ~ + tg_config: + ixchassis: "1.1.1.127" #ixia chassis ip + tcl_port: "8009" # tcl server port + lib_path: "/opt/ixia/ixos-api/8.01.0.2/lib/ixTcl1.0" + root_dir: "/opt/ixia/ixos-api/8.01.0.2/" + py_bin_path: "/opt/ixia/ixload/8.01.106.3/bin/" + py_lib_path: "/opt/ixia/ixnetwork/8.01.1029.14/lib/PythonApi" + dut_result_dir: "/mnt/results" + version: "8.01.106.3" + pcis: + uplink: + - "2:5" #Card:port + - "2:3" #Card:port + downlink: + - "2:6" #Card:port + - "2:5" #Card:port + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:98:10:64:14:00' + - '00:ac:10:64:14:0' + downlink: + - '00:98:10:28:14:00' + - '00:ac:10:28:14:00' + + host: + ip: "192.168.100.101/24" + user: "" + password: "" + key_filename: ~ + + vnf: + user: "" + password: "" + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + - '1.2.1.6/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + + tasks: + - include: ovs_scale_out_test_ixia_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/standalone_ovs_scale_out_test.yaml b/ansible/standalone_ovs_scale_out_test.yaml new file mode 100644 index 000000000..996fc0f50 --- /dev/null +++ b/ansible/standalone_ovs_scale_out_test.yaml @@ -0,0 +1,109 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + ovs_properties: + ovs: 2.6.0 + dpdk: 16.07.1 + vpath: "/usr/local" + queues: 4 + pmd_threads: 2 + ram: + socket_0: 2048 + socket_1: 2048 + flavor: + user: root + password: "" + ram: 4096 + image: "/var/lib/libvirt/images/ubuntu.qcow2" + extra_specs: + cpu_sockets: 1 + cpu_cores: 6 + cpu_threads: 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: "" + password: "" + key_filename: ~ + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + host: + ip: "192.168.100.101/24" + user: "" + password: "" + key_filename: ~ + + vnf: + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + - '1.2.1.6/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + + tasks: + - include: ovs_scale_out_test_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/standalone_sriov_scale_out_ixia_correlated_test.yaml b/ansible/standalone_sriov_scale_out_ixia_correlated_test.yaml new file mode 100644 index 000000000..45a4a498b --- /dev/null +++ b/ansible/standalone_sriov_scale_out_ixia_correlated_test.yaml @@ -0,0 +1,139 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + flavor: + ram: 4096 + image: "/var/lib/libvirt/images/ubuntu.qcow2" + extra_specs: + cpu_sockets: 1 + cpu_cores: 6 + cpu_threads: 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: "" + password: "" + key_filename: ~ + tg_config: + ixchassis: "1.1.1.127" #ixia chassis ip + tcl_port: "8009" # tcl server port + lib_path: "/opt/ixia/ixos-api/8.01.0.2/lib/ixTcl1.0" + root_dir: "/opt/ixia/ixos-api/8.01.0.2/" + py_bin_path: "/opt/ixia/ixload/8.01.106.3/bin/" + py_lib_path: "/opt/ixia/ixnetwork/8.01.1029.14/lib/PythonApi" + dut_result_dir: "/mnt/results" + version: "8.01.106.3" + pcis: + uplink: + - "2:5" #Card:port + - "2:3" #Card:port + downlink: + - "2:6" #Card:port + - "2:5" #Card:port + ip: + mgmt: + - '1.1.1.138/24' # ixia network machine ip + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:98:10:64:14:00' + - '00:ac:10:64:14:0' + downlink: + - '00:98:10:28:14:00' + - '00:ac:10:28:14:00' + + # Environment variables + gen_1: + user: "" + password: "" + key_filename: "~" + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + host: + ip: "192.168.100.101/24" + user: "" + password: "" + key_filename: ~ + + vnf: + user: "" + password: "" + key_filename: ~ + pcis: + uplink: + - "0000:07:00.0" + - "0000:07:00.2" + downlink: + - "0000:07:00.1" + - "0000:07:00.3" + ip: + mgmt: + - '1.1.1.1/24' + - '1.1.1.7/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + + tasks: + - include: sriov_scale_out_test_ixia_correlated_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/standalone_sriov_scale_out_ixia_test.yaml b/ansible/standalone_sriov_scale_out_ixia_test.yaml new file mode 100644 index 000000000..659dbef07 --- /dev/null +++ b/ansible/standalone_sriov_scale_out_ixia_test.yaml @@ -0,0 +1,110 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + flavor: + ram: 4096 + image: "/var/lib/libvirt/images/ubuntu.qcow2" + extra_specs: + cpu_sockets: 1 + cpu_cores: 6 + cpu_threads: 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: "" + password: "" + key_filename: ~ + tg_config: + ixchassis: "1.1.1.127" #ixia chassis ip + tcl_port: "8009" # tcl server port + lib_path: "/opt/ixia/ixos-api/8.01.0.2/lib/ixTcl1.0" + root_dir: "/opt/ixia/ixos-api/8.01.0.2/" + py_bin_path: "/opt/ixia/ixload/8.01.106.3/bin/" + py_lib_path: "/opt/ixia/ixnetwork/8.01.1029.14/lib/PythonApi" + dut_result_dir: "/mnt/results" + version: "8.01.106.3" + pcis: + uplink: + - "2:5" #Card:port + - "2:3" #Card:port + downlink: + - "2:6" #Card:port + - "2:5" #Card:port + ip: + mgmt: + - '1.1.1.138/24' # ixia network machine ip + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:98:10:64:14:00' + - '00:ac:10:64:14:0' + downlink: + - '00:98:10:28:14:00' + - '00:ac:10:28:14:00' + + host: + ip: "192.168.100.101/24" + user: "" + password: "" + key_filename: "~" + + vnf: + user: "" + password: "" + key_filename: ~ + pcis: + uplink: + - "0000:07:00.0" + - "0000:07:00.2" + downlink: + - "0000:07:00.1" + - "0000:07:00.3" + ip: + mgmt: + - '1.1.1.1/24' + - '1.1.1.7/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + + tasks: + - include: sriov_scale_out_test_ixia_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/standalone_sriov_scale_out_test.yaml b/ansible/standalone_sriov_scale_out_test.yaml new file mode 100644 index 000000000..fe6989d54 --- /dev/null +++ b/ansible/standalone_sriov_scale_out_test.yaml @@ -0,0 +1,100 @@ +# 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. +--- +- hosts: localhost + connection: local + vars: + scale_out: + - 1 + - 2 + flavor: + user: root + password: "" + ram: 4096 + image: "/var/lib/libvirt/images/ubuntu.qcow2" + extra_specs: + cpu_sockets: 1 + cpu_cores: 6 + cpu_threads: 2 + flow: + traffic_type: 4 + pkt_size: + uplink: {64B: 100} + downlink: {64B: 100} + count: 10 + rfc2544: + allowed_drop_rate: 0.0001 - 0.0001 + vnf_config: + lb_config: 'SW' + lb_count: 1 + worker_config: '1C/1T' + worker_threads: 1 + + # Environment variables + gen: + user: root + password: "" + key_filename: '~' + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + uplink: + - '152.16.100.20/24' + - '172.16.100.20/24' + downlink: + - '152.16.40.20/24' + - '172.16.40.20/24' + mac: + uplink: + - '00:00:00:9e:00:f8' + - '00:00:00:9e:00:fa' + downlink: + - '00:00:00:9e:00:f9' + - '00:00:00:9e:00:fb' + + host: + ip: "192.168.100.101/24" + user: root + password: "" + key_filename: '~' + + vnf: + pcis: + uplink: + - "0000:05:00.0" + - "0000:05:00.2" + downlink: + - "0000:05:00.1" + - "0000:05:00.3" + ip: + mgmt: + - '1.2.1.6/24' + - '1.2.1.6/24' + uplink: + - '152.16.100.10/24' + - '172.16.100.10/24' + downlink: + - '152.16.40.10/24' + - '172.16.40.10/24' + + tasks: + - include: sriov_scale_out_test_templates.yml + with_items: "{{ scale_out }}" + diff --git a/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml b/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml index 3a1fbd08f..42a7b2d08 100644 --- a/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml +++ b/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml @@ -23,12 +23,16 @@ when: proxy_env is defined and proxy_env # can't update grub in chroot/docker - enable_hugepages_on_boot + # needed for collectd plugins + - increase_open_file_limits - install_image_dependencies - role: download_dpdk # dpdk_version: "17.02" - install_dpdk - download_trex - install_trex + - download_civetweb + - install_civetweb - download_samplevnfs - role: install_samplevnf vnf_name: PROX @@ -40,4 +44,12 @@ vnf_name: FW - role: install_samplevnf vnf_name: CGNATP - + # build shared DPDK for collectd only, required DPDK downloaded already + - install_dpdk_shared + - install_rabbitmq + - download_intel_cmt_cat + - install_intel_cmt_cat + - download_pmu_tools + - install_pmu_tools + - download_collectd + - install_collectd diff --git a/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml b/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml index 2700b810f..dff7f976a 100644 --- a/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml +++ b/ansible/ubuntu_server_cloudimg_modify_samplevnfs.yml @@ -31,6 +31,8 @@ when: proxy_env is defined and proxy_env # can't update grub in chroot/docker - enable_hugepages_on_boot + # needed for collectd plugins + - increase_open_file_limits - modify_cloud_config - install_image_dependencies - role: download_dpdk @@ -38,6 +40,8 @@ - install_dpdk - download_trex - install_trex + - download_civetweb + - install_civetweb - download_samplevnfs - role: install_samplevnf vnf_name: PROX @@ -49,4 +53,12 @@ vnf_name: FW - role: install_samplevnf vnf_name: CGNATP - + # build shared DPDK for collectd only, required DPDK downloaded already + - install_dpdk_shared + - install_rabbitmq + - download_intel_cmt_cat + - install_intel_cmt_cat + - download_pmu_tools + - install_pmu_tools + - download_collectd + - install_collectd diff --git a/ansible/yardstick-install-inventory.ini b/ansible/yardstick-install-inventory.ini new file mode 100644 index 000000000..e2647b033 --- /dev/null +++ b/ansible/yardstick-install-inventory.ini @@ -0,0 +1,4 @@ +# the group of systems on which to install yardstick +# by default just localhost +[yardstick] +localhost ansible_connection=local |