Updating AGL LAVA Lab setup page
[AGL/documentation.git] / docs / 07_How_To_Contribute / 10_Setup_AGL_LAVA_Lab.md
1 ---
2 title: Setting AGL LAVA Lab
3 ---
4
5 ## Overview
6
7 LAVA (Linaro Automated Validation Architecture) Lab is an open source automated testing framework. LAVA is a continuous integration system for deploying operating systems onto physical and virtual hardware for running tests. Tests can be simple boot testing, bootloader testing and system level testing, although extra hardware may be required for some system tests. Results are tracked over time and data can be exported for further analysis. For more information refer [AGL LAVA site](https://lava.automotivelinux.org/)
8
9 ## Prerequisites ##
10
11 As well as the packages docker, docker-compose and pyyaml mentioned in the top
12
13 level README, you will need the following:
14
15
16
17 1) The following ports are forwarded to docker and therefore need to be kept free
18
19 on the host machine:
20
21 - 69/UDP: proxyfied to the slave for TFTP
22
23 - 80: proxyfied to the slave for TODO (transfer overlay)
24
25 - 5500: proxyfied to the slave for Notification
26
27 - 55950-56000: proxyfied to the slave for NBD
28
29 2) You will need a remote power switch to remotely power the DUTs on and off.
30
31 3) You need to have an account with lava.automotivelinux.org. Please contact the
32
33 agl-dev-community mailing list if you would like an account, and include that you would
34
35 like to create your own lab in the email so that the relevant user permissions
36
37 can be set.
38
39
40
41 ## Steps to create your own LAVA lab ##
42
43
44
45 1) Clone AGL lava-docker image:
46
47 ```
48
49 git clone https://git.automotivelinux.org/AGL/lava-docker.git
50
51 cd lava-docker
52
53 ```
54
55
56
57 2) On the LAVA master web GUI, create a new API token:
58
59 https://lava.automotivelinux.org/api/tokens/
60
61
62
63 3) Connect all the DUTs' serial to usb and ethernet connections to the host.
64
65
66 4) Edit the boards.yaml file:
67
68 - Copy the API token you created in step 2 in the place of <generated_lab_token>.
69
70 - Add details of each board connected to the lab. See the top level README for
71
72 instructions. You will need the following:
73
74 - any custom options you require in the kernel args
75
76 - uart idvendor, idproduct, devpath
77
78 - power on, off and reset commads for the power switch
79
80
81
82 To get the uart idvendor and idproduct, unplug and re-plugin the USB cable of the
83
84 device in question and then find the details in the latest output of:
85
86 ```
87
88 sudo dmesg | grep idvendor
89
90 ```
91
92
93
94 To get the uart devpath, run the command:
95
96 ```
97
98 udevadm info -a -n /dev/ttyUSB1 |grep devpath | head -n1
99
100 ```
101
102
103
104 NOTE: Make sure you have at least one "board" included. (It is easiest to keep
105
106 qemu).
107
108
109
110 5) Run the automated setup script:
111
112 ```
113
114 ./start.sh slave
115
116 ```
117
118
119
120 7) Check the web GUI to see if the lab has successfully connected to the LAVA
121
122 master: https://lava.automotivelinux.org/scheduler/allworkers. If it isn't, run the
123
124 following command for debugging:
125
126 ```
127
128 docker-exec -it <name_of_docker_container> cat /var/log/lava-dispatcher/lava-slave.log
129
130 ```
131
132 To identify the container name run the following to list the running containers:
133
134 ```
135
136 docker ps
137
138 ```
139
140
141
142 LAVA logs can be found in `/var/log/lava-dispatcher/`.
143
144
145
146 8) Helper scripts
147
148 There are a few helper scripts to automate starting/stopping the lab.
149
150 ```
151
152 ./start.sh slave
153
154 ./restart.sh slave
155
156 ./stop.sh slave
157
158 ```
159
160
161
162 ## Adding new device-type templates ##
163
164
165
166 Not all device types are supported by default. Templates for new devices will
167
168 need to be added to the LAVA master. Please submit new templates to the agl-dev-community
169
170 mailing list.
171
172
173
174 Before you submit any new device-type templates, please verify that they work.
175
176 You can verify that they work in LAVA by carrying out the following instructions:
177
178 1) Install lavacli on Debian Stretch or Ubuntu 18.04 and later (if you don't
179
180 have a compatible OS, please see https://lava.automotivelinux.org/api/help/ for an
181
182 alternative way to use the API)
183
184 2) Create your lavacli config file
185
186 ```
187
188 touch ~/.config/lavacli.yaml
189
190 ```
191
192 3) Configure this file to look like the following (note: use the first token
193
194 created in https://lava.automotivelinux.org/api/tokens/)
195
196 ```
197
198 default:
199
200 uri: https://lava.automotivelinux.org/RPC2
201
202 username: <username>
203
204 token: <API_token>
205
206 ```
207
208 4) Add your device template to the master
209
210 ```
211
212 lavacli device-types template set <device-type-name> <device-type-name>.yaml
213
214 ```
215
216 NOTE: make sure your device-type templates always follow the following naming scheme:
217
218 ```<device-type-name>.yaml```