From b44e5f78dabc49ce45c68cedb0fcb78dca164aea Mon Sep 17 00:00:00 2001 From: pmikus Date: Wed, 18 Nov 2020 09:55:11 +0000 Subject: [PATCH] T-Rex: 2.86 Signed-off-by: pmikus Change-Id: Id56b87ab868f2897a6563914b0beca2acc25e706 --- GPL/tools/trex/trex_astf_assert.py | 2 +- GPL/tools/trex/trex_astf_profile.py | 2 +- GPL/tools/trex/trex_astf_stop.py | 2 +- GPL/tools/trex/trex_stl_assert.py | 2 +- GPL/tools/trex/trex_stl_profile.py | 2 +- GPL/tools/trex/trex_stl_stop.py | 2 +- .../trex/profile_trex_astf_base_class.py | 2 +- resources/libraries/python/Constants.py | 2 +- .../ansible/roles/trex/defaults/main.yaml | 6 ++ .../ansible/roles/trex/tasks/deploy_block.yaml | 55 +++++++++++++++ .../ansible/roles/trex/tasks/main.yaml | 79 ++-------------------- resources/tools/testbed-setup/ansible/tg.yaml | 8 +-- resources/tools/testbed-setup/ansible/tg_aws.yaml | 2 + .../tools/testbed-setup/ansible/tg_azure.yaml | 2 + 14 files changed, 81 insertions(+), 87 deletions(-) create mode 100644 resources/tools/testbed-setup/ansible/roles/trex/tasks/deploy_block.yaml diff --git a/GPL/tools/trex/trex_astf_assert.py b/GPL/tools/trex/trex_astf_assert.py index 8d4ee349e3..140253a384 100644 --- a/GPL/tools/trex/trex_astf_assert.py +++ b/GPL/tools/trex/trex_astf_assert.py @@ -37,7 +37,7 @@ Functionality: import sys sys.path.insert( - 0, u"/opt/trex-core-2.82/scripts/automation/trex_control_plane/interactive/" + 0, u"/opt/trex-core-2.86/scripts/automation/trex_control_plane/interactive/" ) from trex.astf.api import * diff --git a/GPL/tools/trex/trex_astf_profile.py b/GPL/tools/trex/trex_astf_profile.py index badc1c51bb..79507eae18 100644 --- a/GPL/tools/trex/trex_astf_profile.py +++ b/GPL/tools/trex/trex_astf_profile.py @@ -33,7 +33,7 @@ import sys import time sys.path.insert( - 0, u"/opt/trex-core-2.82/scripts/automation/trex_control_plane/interactive/" + 0, u"/opt/trex-core-2.86/scripts/automation/trex_control_plane/interactive/" ) from trex.astf.api import * diff --git a/GPL/tools/trex/trex_astf_stop.py b/GPL/tools/trex/trex_astf_stop.py index 21f34b7e34..7c833168f8 100644 --- a/GPL/tools/trex/trex_astf_stop.py +++ b/GPL/tools/trex/trex_astf_stop.py @@ -43,7 +43,7 @@ import sys from collections import OrderedDict # Needed to parse xstats representation. sys.path.insert( - 0, u"/opt/trex-core-2.82/scripts/automation/trex_control_plane/interactive/" + 0, u"/opt/trex-core-2.86/scripts/automation/trex_control_plane/interactive/" ) from trex.astf.api import * diff --git a/GPL/tools/trex/trex_stl_assert.py b/GPL/tools/trex/trex_stl_assert.py index 8eb046015d..7fbb0a3a11 100644 --- a/GPL/tools/trex/trex_stl_assert.py +++ b/GPL/tools/trex/trex_stl_assert.py @@ -37,7 +37,7 @@ Functionality: import sys sys.path.insert( - 0, u"/opt/trex-core-2.82/scripts/automation/trex_control_plane/interactive/" + 0, u"/opt/trex-core-2.86/scripts/automation/trex_control_plane/interactive/" ) from trex.stl.api import * diff --git a/GPL/tools/trex/trex_stl_profile.py b/GPL/tools/trex/trex_stl_profile.py index 98fc4b3553..38b7c26745 100644 --- a/GPL/tools/trex/trex_stl_profile.py +++ b/GPL/tools/trex/trex_stl_profile.py @@ -33,7 +33,7 @@ import sys import time sys.path.insert( - 0, u"/opt/trex-core-2.82/scripts/automation/trex_control_plane/interactive/" + 0, u"/opt/trex-core-2.86/scripts/automation/trex_control_plane/interactive/" ) from trex.stl.api import * diff --git a/GPL/tools/trex/trex_stl_stop.py b/GPL/tools/trex/trex_stl_stop.py index ce264d8c12..206bb9b1ef 100644 --- a/GPL/tools/trex/trex_stl_stop.py +++ b/GPL/tools/trex/trex_stl_stop.py @@ -43,7 +43,7 @@ import sys from collections import OrderedDict # Needed to parse xstats representation. sys.path.insert( - 0, u"/opt/trex-core-2.82/scripts/automation/trex_control_plane/interactive/" + 0, u"/opt/trex-core-2.86/scripts/automation/trex_control_plane/interactive/" ) from trex.stl.api import * diff --git a/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py b/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py index 03dc503cf2..60a7158fce 100644 --- a/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py +++ b/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py @@ -132,7 +132,7 @@ class TrafficProfileBaseClass: """ self.framesize = kwargs[u"framesize"] self._pcap_dir = kwargs.get( - u"pcap_dir",u"/opt/trex-core-2.82/scripts/avl" + u"pcap_dir",u"/opt/trex-core-2.86/scripts/avl" ) return self.create_profile() diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py index c655a179bc..1a548f45d5 100644 --- a/resources/libraries/python/Constants.py +++ b/resources/libraries/python/Constants.py @@ -185,7 +185,7 @@ class Constants: DOCKER_SUT_IMAGE_UBUNTU_ARM = u"csit_sut-ubuntu1804:local" # TRex install directory - TREX_INSTALL_DIR = u"/opt/trex-core-2.82" + TREX_INSTALL_DIR = u"/opt/trex-core-2.86" # TODO: Find the right way how to use it in trex profiles # TRex pcap files directory 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 diff --git a/resources/tools/testbed-setup/ansible/tg.yaml b/resources/tools/testbed-setup/ansible/tg.yaml index 00ecaefe01..fc18038686 100644 --- a/resources/tools/testbed-setup/ansible/tg.yaml +++ b/resources/tools/testbed-setup/ansible/tg.yaml @@ -10,16 +10,18 @@ tags: baremetal - role: common tags: common - - role: tg - tags: tg - role: kernel tags: kernel - role: mellanox tags: mellanox + - role: tg + tags: tg - role: iperf tags: iperf - role: trex tags: trex + - role: ab + tags: ab - role: docker tags: docker - role: performance_tuning @@ -28,5 +30,3 @@ tags: cleanup - role: calibration tags: calibration - - role: ab - tags: ab diff --git a/resources/tools/testbed-setup/ansible/tg_aws.yaml b/resources/tools/testbed-setup/ansible/tg_aws.yaml index 77fde766c9..db0b574d15 100644 --- a/resources/tools/testbed-setup/ansible/tg_aws.yaml +++ b/resources/tools/testbed-setup/ansible/tg_aws.yaml @@ -19,6 +19,8 @@ tags: iperf - role: trex tags: trex + - role: ab + tags: ab - role: docker tags: docker - role: cleanup diff --git a/resources/tools/testbed-setup/ansible/tg_azure.yaml b/resources/tools/testbed-setup/ansible/tg_azure.yaml index 7ecf6d074c..e6940a7c36 100644 --- a/resources/tools/testbed-setup/ansible/tg_azure.yaml +++ b/resources/tools/testbed-setup/ansible/tg_azure.yaml @@ -17,6 +17,8 @@ tags: iperf - role: trex tags: trex + - role: ab + tags: ab - role: docker tags: docker - role: cleanup -- 2.16.6