aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhilman <khilman@users.noreply.github.com>2018-02-05 08:51:00 -0800
committerGitHub <noreply@github.com>2018-02-05 08:51:00 -0800
commit55ab0db7581e910322b165198a461a30ff87c58d (patch)
tree6a3afae164e8e9acde63719a57ef1ca3a60fda18
parente3b883de8c99832687aeb5950f2114a992541d75 (diff)
parent302e41d55759affe58d77e14c15d728625a03d19 (diff)
Merge pull request #16 from montjoie/rework-misc
Rework misc
-rw-r--r--README.md22
-rw-r--r--boards.yaml57
-rwxr-xr-xlavalab-gen.py49
3 files changed, 45 insertions, 83 deletions
diff --git a/README.md b/README.md
index b8bb503..e0fb466 100644
--- a/README.md
+++ b/README.md
@@ -22,16 +22,18 @@ A sample dhcpd config file is available in the dhcpd directory
### boards.yaml
This file describe how are setuped your boards, and how they are connected and powered.
```
-lab-slave-name:
- devicename:
- type: the devicetype of this device
- pdu:
- daemon: The hostname running the PDU daemon (always localhost)
- host: The host name of the PDU as named in lavapdu.conf
- port: portnumber (The port number of the PDU where the device is connected)
- uart:
- type:
- serial: The serial number in case of FTDI uart
+lab-slave-XX:
+ dispatcher_ip: the IP where the slave could be contacted. In lava-docker it is the host IP since docker proxify TFTP from host to the slave.
+ boardlist:
+ devicename:
+ type: the devicetype of this device
+ pdu:
+ daemon: The hostname running the PDU daemon (always localhost)
+ host: The host name of the PDU as named in lavapdu.conf
+ port: portnumber (The port number of the PDU where the device is connected)
+ uart:
+ type:
+ serial: The serial number in case of FTDI uart
```
Notes:
uart FTDI only need serial
diff --git a/boards.yaml b/boards.yaml
index 1f3788f..88f7e6d 100644
--- a/boards.yaml
+++ b/boards.yaml
@@ -1,55 +1,4 @@
lab-slave-0:
- bcm2837-rpi-3-b-01:
- type: bcm2837-rpi-3-b
- pdu:
- daemon: localhost
- host: acme-0
- port: 1
- uart:
- type: FTDI
- serial: FT9QQZTA
- am335x-boneblack-01:
- type: beaglebone-black
- pdu:
- daemon: localhost
- host: acme-0
- port: 2
- uart:
- type: FTDI
- serial: FT9QR1A9
- meson-gxl-s905x-libretech-cc-01:
- type: meson-gxl-s905x-libretech-cc
- pdu:
- daemon: localhost
- host: acme-0
- port: 3
- uart:
- type: FTDI
- serial: FT9QQYCN
- dragonboard-410c-01:
- type: dragonboard-410c
- pdu:
- daemon: localhost
- host: acme-0
- port: 4
- uart:
- type: FTDI
- serial: FT9R7VDB
- r8a7796-m3ulcb-01:
- type: r8a7796-m3ulcb
- pdu:
- daemon: localhost
- host: acme-0
- port: 5
- uart:
- type: FTDI
- serial: AK04WW0Q
- imx6q-sabrelite-01:
- type: imx6q-sabrelite
- pdu:
- daemon: localhost
- host: acme-0
- port: 6
- uart:
- type: FTDI
- serial: FTAJMM4V
+ boardlist:
+ qemu-01:
+ type: qemu
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 379f6b9..6a5ea43 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -14,7 +14,7 @@ boards_yaml = "boards.yaml"
tokens_yaml = "tokens.yaml"
baud_default = 115200
-template = string.Template("""#
+template_conmux = string.Template("""#
# auto-generated by lavalab-gen.py for ${board}
#
listener ${board}
@@ -27,7 +27,12 @@ command 'on' 'Power on ${board}' 'pduclient --daemon ${daemon} --host ${host} --
#no comment it is volontary
template_device = string.Template("""{% extends '${devicetype}.jinja2' %}
+""")
+
+template_device_conmux = string.Template("""
{% set connection_command = 'conmux-console ${board}' %}
+""")
+template_device_pdu = string.Template("""
{% set hard_reset_command = 'pduclient --daemon localhost --hostname acme-0 --port ${port} --command=reboot' %}
{% set power_off_command = 'pduclient --daemon localhost --hostname acme-0 --port ${port} --command=off' %}
{% set power_on_command = 'pduclient --daemon localhost --hostname acme-0 --port ${port} --command=on' %}
@@ -50,35 +55,45 @@ def main(args):
dockcomp["services"]["lava-slave"]["devices"] = []
dc_devices = dockcomp["services"]["lava-slave"]["devices"]
+ # The slaves directory must exists
+ if not os.path.isdir("lava-master/slaves/"):
+ os.mkdir("lava-master/slaves/")
+ fp = open("lava-master/slaves/.empty", "w")
+ fp.close()
+ if not os.path.isdir("lava-slave/conmux/"):
+ os.mkdir("lava-slave/conmux/")
+ fp = open("lava-slave/conmux/.empty", "w")
+ fp.close()
+
for lab_name in labs:
lab = labs[lab_name]
- for board_name in lab:
- b = lab[board_name]
+ for board_name in lab["boardlist"]:
+ b = lab["boardlist"][board_name]
if b.get("disabled", None):
continue
- if not b.has_key("uart"):
- print("WARNING: %s missing uart property" % board_name)
- continue
-
- baud = b["uart"].get("baud", baud_default)
if b.has_key("pdu"):
daemon = b["pdu"]["daemon"]
host = b["pdu"]["host"]
port = b["pdu"]["port"]
devicetype = b["type"]
delay_opt = ""
- line = template.substitute(board=board_name, baud=baud, daemon=daemon, host=host, port=port, delay=delay_opt)
device_line = template_device.substitute(board=board_name, port=port, devicetype=devicetype)
+ device_line += template_device_pdu.substitute(port=port)
+ if b.has_key("uart"):
+ baud = b["uart"].get("baud", baud_default)
+ line = template_conmux.substitute(board=board_name, baud=baud, daemon=daemon, host=host, port=port, delay=delay_opt)
serial = b["uart"]["serial"]
udev_line += template_udev.substitute(board=board_name, serial=serial)
dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name))
+ fp = open("lava-slave/conmux/%s.cf" % board_name, "w")
+ fp.write(line)
+ fp.close()
+ device_line += template_device_conmux.substitute(board=board_name)
if b.has_key("fastboot_serial_number"):
fserial = b["fastboot_serial_number"]
device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial
- if not os.path.isdir("lava-slave/conmux/"):
- os.mkdir("lava-slave/conmux/")
# board specific hacks
if devicetype == "qemu":
device_line += "{% set no_kvm = True %}\n"
@@ -87,9 +102,6 @@ def main(args):
device_path = "lava-master/devices/%s" % lab_name
if not os.path.isdir(device_path):
os.mkdir(device_path)
- fp = open("lava-slave/conmux/%s.cf" % board_name, "w")
- fp.write(line)
- fp.close()
board_device_file = "%s/%s.jinja2" % (device_path, board_name)
fp = open(board_device_file, "w")
fp.write(device_line)
@@ -97,11 +109,10 @@ def main(args):
fp = open("lavalab-udev-%s.rules" % lab_name, "w")
fp.write(udev_line)
fp.close()
- if not os.path.isdir("lava-master/slaves/"):
- os.mkdir("lava-master/slaves/")
- fp = open("lava-master/slaves/%s.yaml" % lab_name, "w")
- fp.write("dispatcher_ip: 192.168.66.1")
- fp.close()
+ if lab.has_key("dispatcher_ip"):
+ fp = open("lava-master/slaves/%s.yaml" % lab_name, "w")
+ fp.write("dispatcher_ip: %s" % lab["dispatcher_ip"])
+ fp.close()
#now proceed with tokens
fp = open(tokens_yaml, "r")