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