FIX: VPP version file name based on OS
[csit.git] / resources / libraries / bash / function / common.sh
index 5836a86..a387801 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (c) 2020 Cisco and/or its affiliates.
-# Copyright (c) 2020 PANTHEON.tech and/or its affiliates.
+# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2021 PANTHEON.tech and/or its affiliates.
 # 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:
@@ -723,23 +723,23 @@ function select_arch_os () {
 
     set -exuo pipefail
 
-    os_id=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') || {
-        die "Get OS release failed."
-    }
+    source /etc/os-release || die "Get OS release failed."
 
-    case "${os_id}" in
+    case "${ID}" in
         "ubuntu"*)
-            IMAGE_VER_FILE="VPP_DEVICE_IMAGE_UBUNTU"
-            VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_BIONIC"
-            PKG_SUFFIX="deb"
-            ;;
-        "centos"*)
-            IMAGE_VER_FILE="VPP_DEVICE_IMAGE_CENTOS"
-            VPP_VER_FILE="VPP_STABLE_VER_CENTOS"
-            PKG_SUFFIX="rpm"
+            case "${VERSION}" in
+                *"LTS (Focal Fossa)"*)
+                    IMAGE_VER_FILE="VPP_DEVICE_IMAGE_UBUNTU"
+                    VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_FOCAL"
+                    PKG_SUFFIX="deb"
+                    ;;
+                *)
+                    die "Unsupported Ubuntu version!"
+                    ;;
+            esac
             ;;
         *)
-            die "Unable to identify distro or os from ${os_id}"
+            die "Unsupported distro or OS!"
             ;;
     esac
 
@@ -887,7 +887,7 @@ function select_tags () {
     # TODO: Add missing reasons here (if general) or where used (if specific).
     case "${TEST_CODE}" in
         *"2n-skx"*)
-            test_tag_array+=("!ipsec")
+            test_tag_array+=("!ipsechw")
             ;;
         *"3n-skx"*)
             test_tag_array+=("!ipsechw")
@@ -895,10 +895,10 @@ function select_tags () {
             test_tag_array+=("!3_node_double_link_topoANDnic_intel-xxv710")
             ;;
         *"2n-clx"*)
-            test_tag_array+=("!ipsec")
+            test_tag_array+=("!ipsechw")
             ;;
         *"2n-zn2"*)
-            test_tag_array+=("!ipsec")
+            test_tag_array+=("!ipsechw")
             ;;
         *"2n-dnv"*)
             test_tag_array+=("!ipsechw")