forked from tbird20d/labcontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNOTES-api-schema.txt
113 lines (87 loc) · 5.4 KB
/
NOTES-api-schema.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Here is information about the REST API schema.
It also includes the command line path and and result code
schema ignores result code, with has schema:
"result": "success"|"fail"
Schema issues:
- I don't like unnamed lists in the schema - see list boards and mydevices
- list is not inside a dictionary - what about
command line REST API URI path result display
------------- ------------------ ---------- ---------
*list boards, api/v0.2/devices/ { [ {"hostname":"board1"}, board1
list devices ...] }
----------------------------------------------------------------------------
*mydevices api/v0.2/devices/mine { [ {"hostname":"board1"}, board1
....] }
----------------------------------------------------------------------------
{board} allocate api/v0.2/devices/{board}/assign | "message":"msg" | "Device is assigned to user $USER_NAME"
----------------------------------------------------------------------------
{board} release api/v0.2/devices/{board}/release | <no more> | "Device is released"
----------------------------------------------------------------------------
{board} info api/v0.2/devices/{board} | "DevicePort": ...
"IOCXConnected": ...
"Zombie": ...
{ "name": "<name>",
"ip": "<ipaddr>"}
"Power":
{ "PowerSwitch": "<name>",
{ "PowerSwitchPort": <port>,
{ "SupportedCommands": [][] }
----------------------------------------------------------------------------
{board} power status api/v0.2/devices/{board}/power | "data": "ON" or "OFF" | Devices $DEVICE is Powered $STATUS
---or is it?-------------------------------------------------------------------------
{board} power status api/v0.2/devices/{board}/power/status | "data": "ON" or "OFF" | Devices $DEVICE is Powered $STATUS
----------------------------------------------------------------------------
{board} power reboot api/v0.2/devices/{board}/power/reboot | <nothing more> | Devices $DEVICE is Powered reboot (??)
----------------------------------------------------------------------------
{board} power on api/v0.2/devices/{board}/power/on | <nothing more> | Devices $DEVICE is Powered on
----------------------------------------------------------------------------
{board} power off api/v0.2/devices/{board}/power/off | <nothing more> | Devices $DEVICE is Powered off
if "result" != "success", then "message" has a string explaining the problem
EBF curl commands:
Here are commands from ebf:
Authentication:
POST api/v0.2/token/ --header 'Content-Type: application/json' --data-raw '{"username":"'"$USER_NAME"'" , "password":"'"$PASSWORD"'"}
Boards and reservations:
GET api/v0.2/devices/
GET api/v0.2/devices/mine/
GET api/v0.2/devices/$DEVICE
GET api/v0.2/devices/$DEVICE/assign
GET api/v0.2/devices/$DEVICE/release
GET api/v0.2/devices/$DEVICE/release/force
Power:
GET api/v0.2/devices/$DEVICE/power
PUT api/v0.2/devices/$DEVICE/power/$OPTION3
GET api/v0.2/devices/$DEVICE/hotplug/$OPTION3/
PUT api/v0.2/devices/$DEVICE/hotplug/$OPTION3/$OPTION4/
GET api/v0.2/devices/$DEVICE/portfw/$OPTION4/
Zombie control (port forwarding):
---------------------------------
POST api/v0.2/zombies/$ZOMBIE_NAME/portforward/nat/" '' --data-raw '{ "device_ip":"'"$DEVICE_IP"'", "dut_port":"'"$DUT_PORT"'", "zombie_port":"'"$ZOMBIE_PORT"'", "pcol":"'"$PROTOCOL"'" }')
POST api/v0.2/devices/$DEVICE/portfw/ssh/" '' --data-raw '{ "dut_ip":"'"$DEVICE_IP"'", "username":"'"$USERNAME"'", "dut_pw":"'"$PASSWORD"'", "dut_port":"'"$DUT_PORT"'", "zombie_port":"'"$ZOMBIE_PORT"'" }')
GET api/v0.2/devices/$DEVICE/portfw/$OPTION4/" '')
DELERL/api/v0.2/devices/$DEVICE/portfw/$OPTION4/" '' --data-raw '{ "device_ip":"'"$DEVICE_IP"'", "dut_port":"'"$DUT_PORT"'", "zombie_port":"'"$ZOMBIE_PORT"'", "pcol":"'"$PROTOCOL"'" }')
DELERL/api/v0.2/zombies/$ZOMBIE_NAME/portforward/ssh/?ports=$ZOMBIE_PORT/" '')
Execute and file transfers:
---------------------------
GET api/v0.2/devices/$DEVICE/run/serial/" '' --data-raw '{ "command":"'"$DEVICE_COMMAND"'" }')
GET api/v0.2/devices/$DEVICE/run/ssh/" '' --data-raw '{ "command": "'"$DEVICE_COMMAND"'" }')
GET api/v0.2/devices/$DEVICE/download/serial/$FILE_PATH/ --output ${FILE_PATH##*/})
POST api/v0.2/devices/$DEVICE/upload/serial/ --form 'file=@'$FILE_PATH'' )
GET api/v0.2/devices/$DEVICE/downld/ssh?path=$SRC_FILE_PATH --output ${DST_FILE_PATH})
POST api/v0.2/devices/$DEVICE/upld/ssh/ --form 'file=@'$SRC_FILE_PATH'' --form 'path='$DST_FILE_PATH'' )
GPIO:
-----
GET api/v0.2/devices/$DEVICE/gpio/$COMMAND/$GPIO_PATTERN/$GPIO_DATA
Console:
--------
GET api/v0.2/devices/$DEVICE/console/serial/isactive/
GET api/v0.2/devices/$DEVICE/console/serial/restart/
GET api/v0.2/devices/$DEVICE/console/serial/isactive/
???:
----
GET api/v0.2/devices/$DEVICE/labcontrollers/
LAVA REST API:
--------------
The LAVA server is apparently based on DJango.
This commit is worth examining:
https://git.lavasoftware.org/lava/lava/-/commit/8e38d322e70aa34ad648cafb7d55972d61c3b566