aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/csit/template.sh
blob: 106167c02e9b7e20714cee2d3b783753eaae82a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash

set -x
#################################################
# Store arguments values
# verify, log, cleanup actions gets first two arguments

action=$1           #action: [setup, run, verify, cleanup]
node=$2             #node: [0 - dut1 node, 1 - dut2 node]
ifname=$3           #dut1 interface name when node is 0 /dut2 interface name when node is 1
dut1_if_ip=$4       #dut1 interface ip
dut2_if_ip=$5       #dut2 interface ip

#################################################
# Get path details

RUN_DIR=`dirname $(readlink -f $0)`
CSIT_SCRIPT_DIR=$RUN_DIR/..
ROOTDIR=$CSIT_SCRIPT_DIR/../../../
APP_DIR=${ROOTDIR}/dmm/config/app_test
LIB_PATH=${ROOTDIR}/dmm/release/lib64
DMM_SCRIPT_DIR=$ROOTDIR/dmm/scripts

#################################################
# Setup preparation

if [ "x$action" == "xsetup" ]; then
   #Handle setup preparation here
   echo "performing setup"
fi

#################################################
# Execution

if [ "x$action" == "xrun" ]; then
    # Call your executables here to run the test case
    if [ "x$node" == "x0" ]; then
    #call server executable
    echo "server execution "
    elif [ "x$node" == "x1" ]; then
    #call client executable
    echo "client execution"
    fi
fi

#################################################
# Verification

if [ "x$action" == "xverify" ]; then
  if [ "x$node" == "x1" ]; then
    #Handle client verification
    if [ $? == 0 ]; then
      echo "DMM_CSIT_TEST_PASSED" #must echo this
    else
      echo "DMM_CSIT_TEST_FAILED"
    fi
  elif [ "x$node" == "x0" ]; then
    #Handle server verification
    if [ $? == 0 ]; then
      echo "DMM_CSIT_TEST_PASSED" #must echo this
    else
      echo "DMM_CSIT_TEST_FAILED"
    fi
  fi
fi

#################################################
# Print Log

if [ "x$action" == "xlog" ]; then
 #Handle print log
 echo "DMM logs"
fi

#################################################
# Cleanup

if [ "x$action" == "xcleanup"  ]; then
  #Handle cleanup
  echo "performing cleanup"
fi

exit 0