CSIT-562 HC Test: Persistence suite rework, part1
[csit.git] / resources / libraries / bash / dut_setup.sh
1 #!/bin/bash
2 # Copyright (c) 2016 Cisco and/or its affiliates.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 function cmd {
16     echo "[Command_start_exec] '$1'"
17     echo -n "[Command_outputs] "
18     eval ${@}
19     echo "[Command_done_exec] '$1'"
20     echo
21 }
22
23 echo
24 echo "[Command_desc] Starting ${0}"
25
26 if [ -f "/etc/redhat-release" ]; then
27     cmd 'rpm -qai vpp*'
28 else
29     cmd 'dpkg -l vpp\*'
30 fi
31
32 cmd 'ps aux | grep vpp'
33
34 cmd 'cat /etc/vpp/startup.conf'
35
36 cmd 'sudo -S service vpp restart'
37
38 echo "[Command_desc] SLEEP for three seconds, so that VPP is up for sure"
39 cmd 'sleep 3'
40
41 cmd 'cat /proc/meminfo'
42
43 cmd 'free -m'
44
45 cmd 'ps aux | grep vpp'
46
47 cmd 'sudo dmidecode | grep UUID'
48
49 cmd 'lspci -Dnn'
50
51 if [ -f "/etc/redhat-release" ]; then
52     cmd 'tail -n 100 /var/log/messages'
53 else
54     cmd 'tail -n 100 /var/log/syslog'
55 fi
56
57 echo "[Command_desc] Adding dpdk-input trace"
58 cmd 'sudo vpp_api_test <<< "exec trace add dpdk-input 100"'
59
60 echo "[Command_desc] Adding vhost-user-input trace"
61 cmd 'sudo vpp_api_test <<< "exec trace add vhost-user-input 100"'