Add support for aarch64 container images 97/20697/4
authorjuraj.linkes <juraj.linkes@pantheon.tech>
Wed, 17 Jul 2019 12:28:30 +0000 (14:28 +0200)
committerPeter Mikus <pmikus@cisco.com>
Tue, 23 Jul 2019 08:39:28 +0000 (08:39 +0000)
Change-Id: I84f13d7139a6e5f7004426018c2d27425c5fa97e
Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
VPP_DEVICE_IMAGE_UBUNTU_ARM [new file with mode: 0644]
resources/libraries/bash/entry/bootstrap_verify_perf.sh
resources/libraries/bash/entry/bootstrap_vpp_device.sh
resources/libraries/bash/entry/per_patch_device.sh
resources/libraries/bash/entry/per_patch_perf.sh
resources/libraries/bash/function/common.sh
resources/libraries/python/Constants.py
resources/libraries/python/ContainerUtils.py

diff --git a/VPP_DEVICE_IMAGE_UBUNTU_ARM b/VPP_DEVICE_IMAGE_UBUNTU_ARM
new file mode 100644 (file)
index 0000000..c35e84d
--- /dev/null
@@ -0,0 +1 @@
+snergster/csit-sut-arm-ubuntu18:latest
index b9299b1..bf7fa35 100644 (file)
@@ -36,7 +36,7 @@ common_dirs || die
 get_test_code "${1-}" || die
 get_test_tag_string || die
 select_topology || die
-select_os || die
+select_arch_os || die
 gather_build || die
 check_download_dir || die
 activate_virtualenv || die
index 209943f..4ac73e7 100755 (executable)
@@ -35,7 +35,7 @@ common_dirs || die
 get_test_code "${1-}" || die
 get_test_tag_string || die
 select_topology || die
-select_os || die
+select_arch_os || die
 gather_build || die
 check_download_dir || die
 activate_virtualenv || die
index ac2c4a4..6624047 100644 (file)
@@ -45,7 +45,7 @@ get_test_code "${1-}" || die
 get_test_tag_string || die
 set_perpatch_dut || die
 select_topology || die
-select_os || die
+select_arch_os || die
 select_build "build_current" || die
 check_download_dir || die
 activate_virtualenv "${VPP_DIR}" || die
index 195d1a7..ef75ea9 100644 (file)
@@ -52,7 +52,7 @@ get_test_code "${1-}" || die
 get_test_tag_string || die
 set_perpatch_dut || die
 select_topology || die
-select_os || die
+select_arch_os || die
 activate_virtualenv "${VPP_DIR}" || die
 generate_tests || die
 archive_tests || die
index 696fc71..e576f99 100644 (file)
@@ -648,7 +648,7 @@ function run_pybot () {
 }
 
 
-function select_os () {
+function select_arch_os () {
 
     # Populate variables related to local operating system.
     #
@@ -678,7 +678,19 @@ function select_os () {
             PKG_SUFFIX="rpm"
             ;;
         *)
-            die "Unable to identify distro or os from ${OS}"
+            die "Unable to identify distro or os from ${os_id}"
+            ;;
+    esac
+
+    arch=$(uname -m) || {
+        die "Get CPU architecture failed."
+    }
+
+    case "${arch}" in
+        "aarch64")
+            IMAGE_VER_FILE="${IMAGE_VER_FILE}_ARM"
+            ;;
+        *)
             ;;
     esac
 }
index ddff2b1..0a25268 100644 (file)
@@ -73,6 +73,9 @@ class Constants(object):
     # Docker container SUT image
     DOCKER_SUT_IMAGE_UBUNTU = 'snergster/csit-sut:latest'
 
+    # Docker container arm SUT image
+    DOCKER_SUT_IMAGE_UBUNTU_ARM = 'snergster/csit-sut-arm-ubuntu18:latest'
+
     # TRex install version
     TREX_INSTALL_VERSION = '2.54'
 
index a324465..363411c 100644 (file)
@@ -593,8 +593,12 @@ class LXC(ContainerEngine):
             else:
                 return
 
+        target_arch = 'arm64' \
+            if Topology.get_node_arch(self.container.node) == 'aarch64' \
+            else 'amd64'
+
         image = self.container.image if self.container.image else\
-            "-d ubuntu -r bionic -a amd64"
+            "-d ubuntu -r bionic -a {arch}".format(arch=target_arch)
 
         cmd = 'lxc-create -t download --name {c.name} -- {image} '\
             '--no-validate'.format(c=self.container, image=image)
@@ -786,8 +790,10 @@ class Docker(ContainerEngine):
                 return
 
         if not self.container.image:
-            setattr(self.container, 'image',
-                    Constants.DOCKER_SUT_IMAGE_UBUNTU)
+            img = Constants.DOCKER_SUT_IMAGE_UBUNTU_ARM \
+                if Topology.get_node_arch(self.container.node) == 'aarch64' \
+                else Constants.DOCKER_SUT_IMAGE_UBUNTU
+            setattr(self.container, 'image', img)
 
         cmd = 'docker pull {image}'.format(image=self.container.image)
 
@@ -795,6 +801,7 @@ class Docker(ContainerEngine):
         if int(ret) != 0:
             raise RuntimeError('Failed to create container {c.name}.'
                                .format(c=self.container))
+
         if self.container.cpuset_cpus:
             self._configure_cgroup('docker')