From dc37b07f1870f9733dc9dde60522bcb2a16fb99b Mon Sep 17 00:00:00 2001
From: "Auke L. Klazema" <klazema@astron.nl>
Date: Mon, 21 Sep 2020 14:30:08 +0000
Subject: [PATCH] Merge branch 'SW-931-fix-cobalt-tests' into 'master'

Resolve SW-931 "Fix cobalt tests"

Closes SW-931

See merge request ro/lofar!221

(cherry picked from commit e3d892d6149aafed24871b5774279fa0b2d5034e)

b8a772cc Fixed typo (missing quote)
892aea24 Merge branch 'master' of https://git.astron.nl/ro/lofar
d1dcd2d3 Merge branch 'master' of https://git.astron.nl/ro/lofar
c9754522 Merge branch 'master' of https://git.astron.nl/ro/lofar
bd75c484 SW-931: Support tuned.service not being installed when confirming its inactive
7816a56d SW-931: Fix MTU test in presence of VLANs
---
 .../validation/cobalt/network/interface_mtu_settings.test      | 3 ++-
 SubSystems/Online_Cobalt/validation/cobalt/system/tuned.test   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/SubSystems/Online_Cobalt/validation/cobalt/network/interface_mtu_settings.test b/SubSystems/Online_Cobalt/validation/cobalt/network/interface_mtu_settings.test
index 792f895ef85..5ad51de7d86 100755
--- a/SubSystems/Online_Cobalt/validation/cobalt/network/interface_mtu_settings.test
+++ b/SubSystems/Online_Cobalt/validation/cobalt/network/interface_mtu_settings.test
@@ -10,7 +10,8 @@ for i in {201..213} ; do
     # the following interfaces need to be connected
     # 10GB03 and 10GB07 are spares and do not need to connected at this moment
     for INTERFACE in 10GB01 10GB02 10GB04 10GB05 10GB06 ; do
-        RESULT=$(ssh $NODE netstat -i | grep $INTERFACE | awk '{ print $2 }')
+        # Avoid grepping VLANs by not accepting interfaces followed by a . (f.e. 10GB06.2201)
+        RESULT=$(ssh $NODE netstat -i | grep "$INTERFACE[^.]" | awk '{ print $2 }')
         if [ $? -eq 0 ] && [ "$RESULT" -eq "9000" ] ; then
             echo "$NODE : interface $INTERFACE has correct MTU of $RESULT"
         else
diff --git a/SubSystems/Online_Cobalt/validation/cobalt/system/tuned.test b/SubSystems/Online_Cobalt/validation/cobalt/system/tuned.test
index ac26530105b..97dc42a9dea 100755
--- a/SubSystems/Online_Cobalt/validation/cobalt/system/tuned.test
+++ b/SubSystems/Online_Cobalt/validation/cobalt/system/tuned.test
@@ -3,7 +3,8 @@
 # Our own hostname must be resolvable
 
 for i in {201..213} ; do
-  ssh cbm$i systemctl status tuned.service | grep "Active: inactive" || exit 1
+  # check for tuned.service to be NOT active, as we then also catch the case in which it is not installed in the first place
+  ssh cbm$i systemctl status tuned.service | grep "Active: active" && exit 1
 done
 
 exit 0
-- 
GitLab