Updates docs for SR1 with final revision
[genesis.git] / fuel / prototypes / auto-deploy / deploy / verify_dha.sh
1 #!/bin/bash -e
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 error_exit()
13 {
14   echo "Error: $@" >&2
15   exit 1
16 }
17
18 if [ $# -ne 2 ]; then
19   echo "Syntax: `basename $0` adaptername dhafile"
20   exit 1
21 fi
22
23 if [ ! -f dha-adapters/${1}.sh ]; then
24     echo "No such adapter file: $1"
25     exit 1
26 elif [ ! -f $2 ]; then
27     echo "No such DHA file: $2"
28     exit 1
29 fi
30
31 . dha-adapters/${1}.sh $2
32
33
34 err=1
35 echo "Verifying that expected functions are present..."
36 for function in \
37     dha_getApiVersion  \
38     dha_getAdapterName  \
39     dha_getAllNodeIds \
40     dha_getFuelNodeId \
41     dha_getNodeProperty \
42     dha_getNodePxeMac \
43     dha_useFuelCustomInstall \
44     dha_fuelCustomInstall \
45     dha_getPowerOnStrategy \
46     dha_nodePowerOn \
47     dha_nodePowerOff \
48     dha_nodeReset \
49     dha_nodeCanSetBootOrderLive \
50     dha_nodeSetBootOrder \
51     dha_nodeCanSetIso \
52     dha_nodeCanHandeIsoLive \
53     dha_nodeInsertIso \
54     dha_nodeEjectIso \
55     dha_waitForIsoBoot \
56     dha_nodeCanZeroMBR \
57     dha_nodeZeroMBR \
58     dha
59 do
60     if type $function &>/dev/null; then
61         echo "$function: OK"
62     else
63         echo "$function: Missing!"
64         err=0
65     fi
66 done
67
68
69 echo "Adapter API version: `dha getApiVersion`"
70 echo "Adapter name: `dha getAdapterName`"
71
72 echo "All PXE MAC addresses:"
73 for id in `(dha getAllNodeIds) | sort`
74 do
75     if [ "`dha getAdapterName`" == "libvirt" ]; then
76         libvirtName=`dha getNodeProperty $id libvirtName`
77     else
78         libvirtName=""
79     fi
80
81     if [ $id == "`dha getFuelNodeId`" ]; then
82         echo "$id: `dha getNodeProperty $id pxeMac` $libvirtName  <--- Fuel master"
83     else
84         echo "$id: `dha getNodeProperty $id pxeMac` $libvirtName"
85     fi
86 done
87
88
89 echo -n "Using Fuel custom install: "
90 if dha useFuelCustomInstall; then
91   echo "yes"
92 else
93   echo "no"
94 fi
95
96
97 echo -n "Can set boot order live: "
98 if dha nodeCanSetBootOrderLive; then
99   echo "yes"
100 else
101   echo "no"
102 fi
103
104 echo -n "Can operate on ISO media: "
105 if dha nodeCanSetIso; then
106   echo "yes"
107 else
108   echo "no"
109 fi
110
111 echo -n "Can insert/eject ISO without power toggle: "
112 if dha nodeCanHandeIsoLive; then
113   echo "yes"
114 else
115   echo "no"
116 fi
117
118 echo -n "Can erase the boot disk MBR: "
119 if dha nodeCanZeroMBR; then
120   echo "yes"
121 else
122   echo "no"
123 fi
124
125 echo "Done"