aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/trex
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-01-05 09:25:39 +0000
committerpmikus <pmikus@cisco.com>2021-01-05 09:25:39 +0000
commit85bafb70d413d16972665c0377c3d7b4982b4270 (patch)
tree1fe86f088dbfc3ed4c69be49a038b436e16a5d85 /resources/tools/testbed-setup/ansible/roles/trex
parentfba165d39ede81a510796af2e2954b67d65aaede (diff)
Infra: Ansible sync
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: Ie987d5c6ce43ce925418f61c4b14dced602b4a3b
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles/trex')
-rw-r--r--resources/tools/testbed-setup/ansible/roles/trex/defaults/main.yaml6
-rw-r--r--resources/tools/testbed-setup/ansible/roles/trex/tasks/deploy_block.yaml55
-rw-r--r--resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml79
3 files changed, 65 insertions, 75 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/trex/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/trex/defaults/main.yaml
index 77d0aaa08a..c3caf52d76 100644
--- a/resources/tools/testbed-setup/ansible/roles/trex/defaults/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/trex/defaults/main.yaml
@@ -28,6 +28,12 @@ packages_by_arch:
trex_target_dir: "/opt"
trex_url: "https://github.com/cisco-system-traffic-generator/trex-core/archive/"
trex_version:
+ # rls1908
- "2.54"
+ # rls2001
+ # rls2005
- "2.73"
+ # rls2009
- "2.82"
+ # rls2101
+ - "2.86"
diff --git a/resources/tools/testbed-setup/ansible/roles/trex/tasks/deploy_block.yaml b/resources/tools/testbed-setup/ansible/roles/trex/tasks/deploy_block.yaml
new file mode 100644
index 0000000000..1513a0a617
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/trex/tasks/deploy_block.yaml
@@ -0,0 +1,55 @@
+---
+# file: roles/trex/tasks/deploy_block.yaml
+
+- name: "Get Release {{ item }}"
+ get_url:
+ url: "{{ trex_url }}/v{{ item }}.tar.gz"
+ dest: "{{ trex_target_dir }}/trex-core-{{ item }}.tar.gz"
+ validate_certs: False
+ mode: 0644
+ register: trex_downloaded
+
+- name: "Create Directory {{ item }}"
+ file:
+ path: "{{ trex_target_dir }}/trex-core-{{ item }}"
+ state: "directory"
+
+- name: "Extract Release {{ item }}"
+ unarchive:
+ remote_src: true
+ src: "{{ trex_target_dir }}/trex-core-{{ item }}.tar.gz"
+ dest: "{{ trex_target_dir }}/"
+ creates: "{{ trex_target_dir }}/trex-core-{{ item }}/linux_dpdk/"
+ register: trex_extracted
+
+- name: Patch Azure
+ patch:
+ src: "files/t-rex.patch"
+ basedir: "{{ trex_target_dir }}/trex-core-{{ item }}"
+ strip: 1
+ when:
+ - azure is defined and item == "2.73"
+
+- name: "Compile Release {{ item }} Part I"
+ command: "./b configure"
+ args:
+ chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/linux_dpdk/"
+ when: trex_extracted.changed
+
+- name: "Compile Release {{ item }} Part II"
+ command: "./b build"
+ args:
+ chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/linux_dpdk/"
+ when: trex_extracted.changed
+
+- name: "Compile Release {{ item }} Part III"
+ command: "make -j 16"
+ args:
+ chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/scripts/ko/src"
+ when: trex_extracted.changed
+
+- name: "Compile Release {{ item }} Part IV"
+ command: "make install"
+ args:
+ chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/scripts/ko/src"
+ when: trex_extracted.changed \ No newline at end of file
diff --git a/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml
index 4e6715152b..019a27f79d 100644
--- a/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/trex/tasks/main.yaml
@@ -1,7 +1,7 @@
---
# file: roles/trex/tasks/main.yaml
-- name: T-Rex - Distribution - Release - Machine Prerequisites
+- name: Install Distribution - Release - Machine Prerequisites
package:
name: "{{ packages | flatten(levels=1) }}"
state: latest
@@ -9,79 +9,8 @@
tags:
- install-dependencies
-- name: T-Rex - Get Release Archive
- get_url:
- url: "{{ trex_url }}/v{{ item }}.tar.gz"
- dest: "{{ trex_target_dir }}/trex-core-{{ item }}.tar.gz"
- validate_certs: False
- mode: 0644
+- name: Deploy Multiple T-Rex Versions
+ include_tasks: deploy_block.yaml
loop: "{{ trex_version }}"
- register: trex_downloaded
tags:
- - install-trex
-
-- name: T-Rex - Ensure Directory Exists
- file:
- path: "{{ trex_target_dir }}/trex-core-{{ item }}"
- state: "directory"
- loop: "{{ trex_version }}"
- tags:
- - install-trex
-
-- name: T-Rex - Extract Release Archive
- unarchive:
- remote_src: true
- src: "{{ trex_target_dir }}/trex-core-{{ item }}.tar.gz"
- dest: "{{ trex_target_dir }}/"
- creates: "{{ trex_target_dir }}/trex-core-{{ item }}/linux_dpdk/"
- loop: "{{ trex_version }}"
- register: trex_extracted
- tags:
- - install-trex
-
-- name: T-Rex - Azure patch I
- patch:
- src: "files/t-rex.patch"
- basedir: "{{ trex_target_dir }}/trex-core-{{ item }}"
- strip: 1
- loop: "{{ trex_version }}"
- when:
- - azure is defined and "{{ item }}" == "2.73"
- tags:
- - install-trex
-
-- name: T-Rex - Compile Release I
- command: "./b configure"
- args:
- chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/linux_dpdk/"
- loop: "{{ trex_version }}"
- when: trex_extracted
- tags:
- - install-trex
-
-- name: T-Rex - Compile Release II
- command: "./b build"
- args:
- chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/linux_dpdk/"
- loop: "{{ trex_version }}"
- when: trex_extracted
- tags:
- - install-trex
-
-- name: T-Rex - Compile Release III
- command: "make -j 16"
- args:
- chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/scripts/ko/src"
- loop: "{{ trex_version }}"
- when: trex_extracted
- tags:
- - install-trex
-
-- name: T-Rex - Compile Release IV
- command: "make install"
- args:
- chdir: "{{ trex_target_dir }}/trex-core-{{ item }}/scripts/ko/src"
- loop: "{{ trex_version }}"
- when: trex_extracted
- tags:
- - install-trex
+ - install-trex \ No newline at end of file