-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdts-lib.robot
157 lines (142 loc) · 6.73 KB
/
dts-lib.robot
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
*** Settings ***
Resource terminal.robot
*** Keywords ***
Boot Dasharo Tools Suite Via IPXE Shell
[Documentation] Boots DTS via iPXE shell by chaining script. Arguments:
... dts_chain_link: link to the script to chain. This is useful in case
... the version of the DTS being booted has not been released yet or if
... a test version is being used. If no link is given - the standard one
... is being used, that is: http://boot.dasharo.com/dts/dts.ipxe
[Arguments] ${dts_chain_link}
# 1) Check and enable network boot, it is disabled by default:
Make Sure That Network Boot Is Enabled
# 2) Enter iPXE shell:
Enter IPXE
# 3) Set up net card:
Write Into Terminal dhcp net0
${out}= Read From Terminal Until Prompt
Should Contain ${out} ok
Set DUT Response Timeout 60s
# 4) Try to boot via the link:
Write Bare Into Terminal chain ${dts_chain_link}\n 0.1
Read From Terminal Until ${dts_chain_link}...
Read From Terminal Until ok
Set DUT Response Timeout 5m
Boot Dasharo Tools Suite Via IPXE Menu
[Documentation] Boots DTS via option available in Dasharo iPXE menu.
# 1) Check and enable network boot, it is disabled by default:
Make Sure That Network Boot Is Enabled
# 2) Enter iPXE menu:
${boot_menu}= Enter Boot Menu Tianocore And Return Construction
Enter Submenu From Snapshot ${boot_menu} ${IPXE_BOOT_ENTRY}
${ipxe_menu}= Get IPXE Boot Menu Construction
# 3) Boot DTS:
Enter Submenu From Snapshot ${ipxe_menu} Dasharo Tools Suite
Set DUT Response Timeout 5m
Read From Terminal Until .cpio.gz...
Read From Terminal Until ok
Boot Dasharo Tools Suite
[Documentation] Keyword allows to boot Dasharo Tools Suite. Takes the
... boot method (from USB or from iPXE) as parameter.
[Arguments] ${dts_booting_method}
IF '${dts_booting_method}'=='USB'
${boot_menu}= Enter Boot Menu Tianocore And Return Construction
IF '${DUT_CONNECTION_METHOD}' == 'pikvm'
Enter Submenu From Snapshot ${boot_menu} PiKVM Composite KVM Device
ELSE IF '${MANUFACTURER}' == 'QEMU'
Enter Submenu From Snapshot ${boot_menu} Dasharo Tools Suite (on QEMU HARDDISK)
ELSE
# Requires specifying the USB model in the platform's config
Enter Submenu From Snapshot ${boot_menu} ${USB_MODEL}
END
ELSE IF '${dts_booting_method}'=='iPXE'
IF ${BOOT_DTS_FROM_IPXE_SHELL} == ${TRUE} or ${NETBOOT_UTILITIES_SUPPORT} == ${TRUE}
# DTS_IPXE_LINK can be defined before running tests, e.g. via CMD or
# some file:
Boot Dasharo Tools Suite Via IPXE Shell ${DTS_IPXE_LINK}
ELSE
Boot Dasharo Tools Suite Via IPXE Menu
END
ELSE
FAIL Unknown or improper connection method: ${dts_booting_method}
END
# For PiKVM devices, we have only input on serial, not output. The video and serial consoles are
# two different console in case of Linux, they are not in sync anymore as in case of firmware.
# We have to switch to SSH connection to continue test execution on such devices.
IF '${DUT_CONNECTION_METHOD}' == 'pikvm'
# Should be long enough so that DTS can boot
${old_timeout}= Set Timeout 20s
Run Keyword And Ignore Error
... Read From Terminal Until Enter an option:
Set Timeout ${old_timeout}
# Enable SSH server and switch to SSH connection by writing on video console "in blind"
Write Into Terminal K
${dut_connection_method}= Set Variable SSH
Set Global Variable ${DUT_CONNECTION_METHOD} SSH
Login To Linux Via SSH Without Password root root@DasharoToolsSuite:~#
# Spawn DTS menu on SSH console
Write Into Terminal dts
END
Read From Terminal Until Enter an option:
Sleep 5s
Check HCL Report Creation
[Documentation] Keyword allows to check if the Dasharo Tools Suite
... option for creating HCL report works correctly.
Enter Shell In DTS
Set Global Variable ${DUT_CONNECTION_METHOD} SSH
Execute Command In Terminal cd /
${logs}= Execute Command In Terminal
... command=/usr/bin/env DEPLOY_REPORT=false SEND_LOGS=true /usr/sbin/dasharo-hcl-report
... timeout=210s
Should Contain ${logs} Thank you
Should Contain ${logs} exited without errors
Should Contain ${logs} send completed
Enter Shell In DTS
[Documentation] Keyword allows to drop to Shell in the Dasharo Tools
... Suite.
Write Into Terminal S
Set Prompt For Terminal bash-5.1#
# These could be removed once routes priorities in DTS are resolved.
Sleep 10
Press Enter
${out}= Read From Terminal
Log ${out}
Remove Extra Default Route
Run EC Transition
[Documentation] Keyword allows to run EC Transition procedure in the
... Dasharo Tools Suite.
Write Into Terminal 6
Read From Trminal Until Enter an option:
Write Into Terminal 1
${output}= Read From Terminal Until shut down
Should Contain X Times ${output} VERIFIED 2
Sleep 10s
Flash Firmware In DTS
[Documentation] Keyword allows to check if the Dasharo Tools Suite
... ability for flashing firmware work correctly.
[Arguments] ${fw_dl_link}=${FW_DOWNLOAD_LINK}
Execute Command In Terminal
... wget -O /tmp/coreboot.rom ${fw_dl_link}
${out}= Execute Command In Terminal
... command=flashrom --ifd -i bios -p internal -w /tmp/coreboot.rom --noverify-all
... timeout=320s
${verified}= Run Keyword And Return Status
... Should Contain ${out} VERIFIED
IF ${verified} == ${FALSE}
${out}= Execute Command In Terminal
... command=flashrom --ifd -i bios -p internal -w /tmp/coreboot.rom --noverify-all
... timeout=320s
Should Contain ${out} identical
END
Remove Extra Default Route
[Documentation] If two default routes are present in Linux, remove
... the one NOT pointing to the gateway in test network (192.168.10.1)
${route_info}= Execute Command In Terminal ip route | grep ^default
${devname}= String.Get Regexp Matches ${route_info}
... ^default via 172\.16\.0\.1 dev (?P<devname>\\w+) devname
${length}= Get Length ${devname}
IF ${length} > 0
Execute Command In Terminal ip route del default via 172.16.0.1 dev ${devname[0]}
${route_info}= Execute Command In Terminal ip route | grep ^default
Log Default route via 172.16.0.1 dev ${devname[0]} removed
END