diff options
Diffstat (limited to 'resources/tools')
13 files changed, 94 insertions, 64 deletions
diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml index 40d7544476..062f3af10e 100644 --- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml +++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/group_vars/all.yaml @@ -37,10 +37,15 @@ docker_daemon_environment_https: - 'NO_PROXY={{ proxy_env.no_proxy }}' # Kubernetes settings. -kubernetes_channel: 'main' -kubernetes_version: '1.11.0-00' -kubernetes_repository: 'deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_channel }}' -kubernetes_apt_package_name: '{{ kubernetes_version }}' +kubernetes: + version: '1.11.0-00' + repository: 'deb http://apt.kubernetes.io/ kubernetes-xenial main' + +# TRex settings. +trex: + target_dir: '/opt' + version: '2.61' + url: 'https://github.com/cisco-system-traffic-generator/trex-core/archive' # DPDK settings. dpdk: diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml index 27beaf5225..0f4effa650 100644 --- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml +++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.44.yaml @@ -10,7 +10,7 @@ sysctl: kernel: watchdog_cpumask: "0,28,56,84" vm: - nr_hugepages: 36864 + nr_hugepages: 65536 max_map_count: 20000 inventory_ipmi_hostname: '10.30.50.41' diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml index e462460b23..9564e45fc9 100644 --- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml +++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.54.yaml @@ -10,7 +10,7 @@ sysctl: kernel: watchdog_cpumask: "0,28,56,84" vm: - nr_hugepages: 36864 + nr_hugepages: 65536 max_map_count: 20000 inventory_ipmi_hostname: '10.30.50.51' diff --git a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml index b5131a310a..1458017f50 100644 --- a/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml +++ b/resources/tools/testbed-setup/ansible/inventories/lf_inventory/host_vars/10.30.51.56.yaml @@ -10,7 +10,7 @@ sysctl: kernel: watchdog_cpumask: "0,28,56,84" vm: - nr_hugepages: 36864 + nr_hugepages: 65536 max_map_count: 20000 inventory_ipmi_hostname: '10.30.50.53' diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml index 5f8a0590bf..4f7800b249 100644 --- a/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml +++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml @@ -1,7 +1,7 @@ --- # file: roles/common/tasks/kernel_install.yaml -- name: Kernel VM: Backup remote initramfs modules +- name: Kernel VM - Backup remote initramfs modules copy: src: '/etc/initramfs-tools/modules' dest: '/tmp/initramfs_modules.bkp' @@ -10,7 +10,7 @@ register: __initramfs_modules_backuped tags: install-kernel-image -- name: Kernel VM: Backup remote initramfs resume config +- name: Kernel VM - Backup remote initramfs resume config copy: src: '/etc/initramfs-tools/conf.d/resume' dest: '/tmp/initramfs-resume.bkp' @@ -19,59 +19,61 @@ register: __initramfs_resume_backuped tags: install-kernel-image -- name: Kernel VM: Update remote initramfs modules +- name: Kernel VM - Update remote initramfs modules copy: src: '../files/initramfs_modules' dest: '/etc/initramfs-tools/modules' tags: install-kernel-image -- name: Kernel VM: Update remote initramfs resume config +- name: Kernel VM - Update remote initramfs resume config copy: src: '../files/initramfs_resume' dest: '/etc/initramfs-tools/conf.d/resume' tags: install-kernel-image -- name: Kernel VM: Create target kernel dir +- name: Kernel VM - Create target kernel dir file: path: '/opt/boot' state: 'directory' tags: install-kernel-image -- name: Kernel VM: Build initrd image +- name: Kernel VM - Build initrd image shell: 'update-initramfs -k {{ ansible_kernel }} -c -b /opt/boot' tags: install-kernel-image -- name: Kernel VM: Copy corresponding kernel img +- name: Kernel VM - Copy corresponding kernel img copy: src: '/boot/vmlinuz-{{ ansible_kernel }}' dest: '/opt/boot/vmlinuz-{{ ansible_kernel }}' remote_src: yes tags: install-kernel-image -- name: Kernel VM: Restore remote initramfs modules +- name: Kernel VM - Restore remote initramfs modules copy: src: '/tmp/initramfs_modules.bkp' dest: '/etc/initramfs-tools/modules' remote_src: yes + ignore_errors: yes when: __initramfs_modules_backuped tags: install-kernel-image -- name: Kernel VM: Remove remote backup initramfs modules +- name: Kernel VM - Remove remote backup initramfs modules file: path: '/tmp/initramfs_modules.bkp' state: 'absent' when: __initramfs_modules_backuped tags: install-kernel-image -- name: Kernel VM: Restore remote initramfs resume config +- name: Kernel VM - Restore remote initramfs resume config copy: src: '/tmp/initramfs-resume.bkp' dest: '/etc/initramfs-tools/conf.d/resume' remote_src: yes + ignore_errors: yes when: __initramfs_resume_backuped tags: install-kernel-image -- name: Kernel VM: Remove remote backup initramfs resume config +- name: Kernel VM - Remove remote backup initramfs resume config file: path: '/tmp/initramfs-resume.bkp' state: 'absent' diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml index 96e3f83e1b..fb0d77d18c 100644 --- a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml @@ -56,6 +56,7 @@ - name: Install distribution - release - machine prerequisites include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' + tags: [ install-csit-dependencies, copy-apt-sources ] - name: Set sudoers admin lineinfile: diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml index 24f433f9b9..0b32002545 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml @@ -3,7 +3,12 @@ - name: Install distribution - release - machine prerequisites include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' + tags: install-csit-dependencies - name: Install WRK include_tasks: 'wrk.yaml' tags: install-wrk + +- name: Install TRex + include_tasks: 'trex.yaml' + tags: install-trex diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/trex.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/trex.yaml new file mode 100644 index 0000000000..3cfcbea825 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/trex.yaml @@ -0,0 +1,40 @@ +--- +# file: roles/tg/tasks/trex.yaml + +- name: Download TRex release archive + get_url: + url: '{{ trex.url }}/v{{ trex.version }}.tar.gz' + dest: '{{ trex.target_dir }}/trex-core-{{ trex.version }}.tar.gz' + mode: 0644 + register: 'linux__trex_downloaded' + tags: install-trex + +- name: Ensure TRex directory exists + file: + path: '{{ trex.target_dir }}/trex-core-{{ trex.version }}' + state: 'directory' + register: 'linux__trex_dir_created' + tags: install-trex + +- name: Extract TRex release archive + become: yes + unarchive: + src: '{{ trex.target_dir }}/trex-core-{{ trex.version }}.tar.gz' + dest: '{{ trex.target_dir }}/' + creates: '{{ trex.target_dir }}/trex-core-{{ trex.version }}/linux_dpdk' + remote_src: yes + when: 'linux__trex_dir_created' + register: 'linux__trex_extracted' + tags: install-trex + +- name: Compile TRex release I + become: yes + shell: 'cd {{ trex.target_dir }}/trex-core-{{ trex.version }}/linux_dpdk/; ./b configure; ./b build' + when: 'linux__trex_extracted' + tags: install-trex + +- name: Compile TRex release II + become: yes + shell: 'cd {{ trex.target_dir }}/trex-core-{{ trex.version }}/scripts/ko/src; make; make install' + when: 'linux__trex_extracted' + tags: install-trex diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml index 95a47b0917..d56c843158 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_bionic.yaml @@ -5,6 +5,7 @@ apt: name: - 'unzip' + - 'zlib1g-dev' - 'libssl-dev' state: 'present' install_recommends: False diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml index 1da45fb4b4..e7d22e1aa1 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/wrk.yaml @@ -9,13 +9,21 @@ register: 'linux__wrk_downloaded' tags: install-wrk +- name: Ensure WRK directory exists + file: + path: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}' + state: 'directory' + register: 'linux__wrk_dir_created' + tags: install-wrk + - name: Extract WRK release archive become: yes unarchive: src: '{{ wrk.target_dir }}/{{ wrk.version }}.tar.gz' - dest: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}' + dest: '{{ wrk.target_dir }}/' + creates: '{{ wrk.target_dir }}/wrk-{{ wrk.version }}/src' remote_src: yes - when: 'linux__wrk_downloaded' + when: 'linux__wrk_dir_created' register: 'linux__wrk_extracted' tags: install-wrk diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml index f586e871c7..7f74beec51 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml @@ -3,13 +3,16 @@ - name: Install distribution - release - machine prerequisites include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' + tags: [ install-csit-dependencies, install-docker, install-kubernetes ] - name: Machine specifics include_tasks: '{{ ansible_machine }}.yaml' + tags: [ disable-turbo-boost, set-grub, install-pip ] - name: Skylake specific import_tasks: skylake.yaml when: cpu_microarchitecture == "skylake" + tags: [ install-msr, disable-turbo-boost ] - name: Copy netplan network config file template: diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml index 67c6c17220..6e8dee6cf1 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_bionic.yaml @@ -45,6 +45,7 @@ file: path: '/etc/systemd/system/docker.service.d' state: 'directory' + tags: install-docker - name: Setup Docker http proxy template: @@ -55,7 +56,7 @@ mode: '0644' register: docker_register_systemd_service when: proxy_env is defined and proxy_env.http_proxy is defined - tags: copy-docker + tags: install-docker - name: Setup Docker https proxy template: @@ -66,14 +67,14 @@ mode: '0644' register: docker_register_systemd_service when: proxy_env is defined and proxy_env.https_proxy is defined - tags: copy-docker + tags: install-docker - name: Reload systemd daemon command: 'systemctl daemon-reload' notify: ['Restart Docker'] when: (docker_register_systemd_service and docker_register_systemd_service is changed) - tags: restart-docker + tags: install-docker - name: Set specific users to docker group user: @@ -82,7 +83,7 @@ append: True with_items: '{{ docker_users }}' when: docker_users - tags: set-docker + tags: install-docker - name: Add an Apt signing key, for Kubernetes repository apt_key: @@ -92,7 +93,7 @@ - name: Install kubernetes APT repository apt_repository: - repo: '{{ kubernetes_repository }}' + repo: '{{ kubernetes.repository }}' state: 'present' update_cache: True tags: install-kubernetes @@ -101,9 +102,9 @@ apt: name: - 'kubernetes-cni=0.6.0-00' - - 'kubeadm={{ kubernetes_apt_package_name }}' - - 'kubectl={{ kubernetes_apt_package_name }}' - - 'kubelet={{ kubernetes_apt_package_name }}' + - 'kubeadm={{ kubernetes.version }}' + - 'kubectl={{ kubernetes.version }}' + - 'kubelet={{ kubernetes.version }}' state: 'present' force: yes tags: install-kubernetes diff --git a/resources/tools/trex/trex_installer.sh b/resources/tools/trex/trex_installer.sh deleted file mode 100755 index c0012a18cf..0000000000 --- a/resources/tools/trex/trex_installer.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -TREX_VERSION=$1 - -TREX_DOWNLOAD_REPO="https://github.com/cisco-system-traffic-generator/trex-core/archive/" -TREX_DOWNLOAD_PACKAGE="v${TREX_VERSION}.zip" -TREX_PACKAGE_URL="${TREX_DOWNLOAD_REPO}${TREX_DOWNLOAD_PACKAGE}" -TARGET_DIR="/opt/" -TREX_DIR="trex-core-${TREX_VERSION}/" -TREX_INSTALL_DIR="${TARGET_DIR}${TREX_DIR}" - -if test "$(id -u)" -ne 0 -then - echo "Please use root or sudo to be able to access target installation directory: ${TARGET_DIR}" - exit 1 -fi - -WORKING_DIR=$(mktemp -d) -test $? -eq 0 || exit 1 - -cleanup () { - rm -r ${WORKING_DIR} -} - -trap cleanup EXIT - -test -d ${TREX_INSTALL_DIR} && echo "T-REX aleready installed: ${TREX_INSTALL_DIR}" && exit 0 - -wget -P ${WORKING_DIR} ${TREX_PACKAGE_URL} -test $? -eq 0 || exit 1 - -unzip ${WORKING_DIR}/${TREX_DOWNLOAD_PACKAGE} -d ${TARGET_DIR} -test $? -eq 0 || exit 1 - -cd ${TREX_INSTALL_DIR}/linux_dpdk/ && ./b configure && ./b build || exit 1 -cd ${TREX_INSTALL_DIR}/scripts/ko/src && make && make install || exit 1 |