Skip to content

Commit e6b10f9

Browse files
committed
scripts/freebsd/pressed_opnsesne.sh: full version added
dasharo-compatibility/os-bsd-anysense.robot: test IDs fixed lib/bsd.robot: introducing keyword lib for FreBSD derivatives Signed-off-by: Mateusz Maciejewski <[email protected]>
1 parent f9e2c3a commit e6b10f9

File tree

8 files changed

+329
-154
lines changed

8 files changed

+329
-154
lines changed

dasharo-compatibility/os-bsd-anysense.robot

Lines changed: 0 additions & 151 deletions
This file was deleted.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
*** Settings ***
2+
Library Collections
3+
Library Dialogs
4+
Library DateTime
5+
Library OperatingSystem
6+
Library Process
7+
Library String
8+
Library Telnet timeout=20 seconds connection_timeout=120 seconds
9+
Resource ../variables.robot
10+
Resource ../keywords.robot
11+
Resource ../keys.robot
12+
13+
# Log Out And Close Connection - elementary teardown keyword for all tests.
14+
Suite Setup Run Keywords
15+
... Prepare Test Suite
16+
Suite Teardown Run Keywords
17+
... Log Out And Close Connection
18+
Test Setup Run Keyword
19+
... Restore Initial DUT Connection Method
20+
21+
22+
*** Test Cases ***
23+
PFS001.502 Install pfSense LTS CE (serial output) on disk
24+
[Documentation] Install pfSense LTS CE (serial output) from preseeded
25+
... USB stick on disk. Refer to test case PFS006.502 for preseed.
26+
Power On
27+
Boot PfSense Installer
28+
${installer_message}= Catenate Click OK, after test execution ends,
29+
... connect to DUT via serial and continue manual installation.
30+
Pause Execution ${installer_message}
31+
32+
PFS002.502 Boot pfSense LTS CE (serial output) from disk
33+
[Documentation] Boot pfSense LTS CE (serial output) from disk.
34+
Power On
35+
Boot PfSense
36+
37+
PFS003.502 Boot pfSense LTS CE (serial output) from disk after cold-boot
38+
[Documentation] Boot pfSense LTS CE (serial output) from disk after cold-boot
39+
Power On
40+
Set UEFI Option PowerStateAfterPowerAcLoss Powered On
41+
Sleep 1
42+
Rte Psu Off
43+
Sleep 5
44+
Rte Psu On
45+
${start_date}= Get Current Date
46+
Boot PfSense
47+
${end_date}= Get Current Date
48+
${delta_time}= Subtract Date From Date ${end_date} ${start_date}
49+
Log To Console Cold boot duration in seconds: ${delta_time}}
50+
51+
PFS004.502 Boot pfSense LTS CE (serial output) from disk after warm-boot
52+
[Documentation] Boot pfSense LTS CE (serial output) from disk after warm-boot
53+
Power On
54+
Boot PfSense
55+
Enter PfSense Shell
56+
Write Into Terminal poweroff
57+
Power On
58+
${start_date}= Get Current Date
59+
Boot PfSense
60+
${end_date}= Get Current Date
61+
${delta_time}= Subtract Date From Date ${end_date} ${start_date}
62+
Log To Console Warm boot duration in seconds: ${delta_time}}
63+
64+
PFS005.502 Boot pfSense LTS CE (serial output) from disk after reboot
65+
[Documentation] Boot pfSense LTS CE (serial output) from disk after reboot
66+
Power On
67+
Boot PfSense
68+
Enter PfSense Shell
69+
Write Into Terminal reboot
70+
${start_date}= Get Current Date
71+
Boot PfSense
72+
${end_date}= Get Current Date
73+
${delta_time}= Subtract Date From Date ${end_date} ${start_date}
74+
Log To Console Reboot duration in seconds: ${delta_time}}
75+
76+
77+
PFS006.502 Preseed pfSense Installer
78+
[Documentation] Please use linux fatlabel program to rename ESP partition of
79+
... pfSense installer to PFEFI.
80+
Execute Manual Step Rename ESP partition of pfSense installer to PFEFI.
81+
82+
Power On
83+
Boot PfSense Installer
84+
Enter PfSense Rescue Shell
85+
Execute Command In Terminal
86+
... awk -v sq="'" -v dq='"' -v ROOT_LABEL=PFBOOT '/^NEWFS_ESP=/ { print "NEWFS_ESP=" sq "newfs_msdos -L " ROOT_LABEL " " dq "%s" dq sq; next; }; { print; }' /usr/libexec/bsdinstall/zfsboot > /tmp/zfsboot
87+
Execute Command In Terminal mount -u /
88+
Execute Command In Terminal mv /tmp/zfsboot /usr/libexec/bsdinstall/zfsboot
89+
Execute Command In Terminal chmod +x /usr/libexec/bsdinstall/zfsboot
90+
Execute Command In Terminal sync
91+
${output}= Execute Command In Terminal grep PFBOOT /usr/libexec/bsdinstall/zfsboot
92+
Should Contain ${output} PFBOOT
93+
94+
PFS007.502 Boot pfSense LTS CE (serial output) Installer into rescue shell
95+
Power On
96+
Boot PfSense Installer
97+
Enter PfSense Rescue Shell
98+
${output}= Execute Command In Terminal ls
99+
Should Contain ${output} COPYRIGHT
100+
Should Contain ${output} .profile
101+
102+

keywords.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Resource lib/sleep-lib.robot
1515
Resource lib/framework.robot
1616
Resource lib/me.robot
1717
Resource lib/network.robot
18+
Resource lib/bsd.robot
1819

1920

2021
*** Keywords ***

lib/bios/menus.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ def merge_lists(list1, list2):
217217
"Power Management Options",
218218
"CPU Throttling",
219219
],
220+
"PowerStateAfterPowerAcLoss": [
221+
"Dasharo System Features",
222+
"Power Management Options",
223+
"Power state after"
224+
]
220225
}
221226

222227

lib/bsd.robot

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
*** Settings ***
2+
Library Collections
3+
Resource ../keywords.robot
4+
5+
6+
*** Keywords ***
7+
Boot PfSense Installer
8+
[Documentation] Run /EFI/BOOT/bootx64.efi file from PFEFI-labeled partition;
9+
... Select console type vt100 and accept the license
10+
Enter Boot From File
11+
Enter Volume In File Explorer PFEFI
12+
Execute File In File Explorer EFI
13+
Execute File In File Explorer BOOT
14+
Execute File In File Explorer bootx64.efi
15+
Read From Terminal Until Console type [vt100]:
16+
Write Into Terminal vt100
17+
Read From Terminal Until [Accept]
18+
Press Enter
19+
Set Suite Variable ${BOOTED_OS_ID} 502
20+
Import Variables ${CURDIR}/../os-config/${BOOTED_OS_ID}-credentials.py
21+
22+
Boot OPNsense Installer
23+
[Documentation] Run /efi/boot/bootx64.efi file from OPNEFI-labeled partition;
24+
Enter Boot From File
25+
Enter Volume In File Explorer OPNEFI
26+
Execute File In File Explorer efi
27+
Execute File In File Explorer boot
28+
Execute File In File Explorer bootx64.efi
29+
Read From Terminal Until FreeBSD/amd64 (OPNsense.localdomain) (ttyu0)
30+
Read From Terminal Until login:
31+
Set Suite Variable ${BOOTED_OS_ID} 503
32+
Import Variables ${CURDIR}/../os-config/${BOOTED_OS_ID}-credentials.py
33+
34+
Enter PfSense Shell
35+
Write Into Terminal 8
36+
Read From Terminal Until ${DEVICE_OS_ROOT_PROMPT}
37+
Set Prompt For Terminal ${DEVICE_OS_ROOT_PROMPT}
38+
39+
Enter PfSense Rescue Shell
40+
${menu}= Read From Terminal Until <Cancel>
41+
# end would be 5 but it's 3 due to two empty lines
42+
${construction}= Parse Menu Snapshot Into Construction ${menu} 5 3
43+
Enter Submenu From Snapshot
44+
... ${construction}
45+
... Rescue Shell${SPACE * 8}Launch a shell for rescue operations
46+
... "APP"
47+
Set Prompt For Terminal ${DEVICE_RESCUE_PROMPT}
48+
49+
Enter OPNsense Shell
50+
Read From Terminal Until login:
51+
Write Into Terminal ${DEVICE_OS_USERNAME}
52+
Read From Terminal Until Password:
53+
Write Into Terminal ${DEVICE_OS_PASSWORD}
54+
Read From Terminal Until Enter an option:
55+
Write Into Terminal 8
56+
Read From Terminal Until ${DEVICE_OS_ROOT_PROMPT}
57+
Set Prompt For Terminal ${DEVICE_OS_ROOT_PROMPT}
58+
59+
Boot PfSense
60+
[Documentation] PFBOOT -> /efi/boot/bootx64.efi
61+
Enter Boot From File
62+
Enter Volume In File Explorer PFBOOT
63+
Execute File In File Explorer efi
64+
Execute File In File Explorer boot
65+
Execute File In File Explorer bootx64.efi
66+
Read From Terminal Until Enter an option:
67+
Set Suite Variable ${BOOTED_OS_ID} ${ENV_ID_PFSENSE}
68+
Import Variables ${CURDIR}/../os-config/${BOOTED_OS_ID}-credentials.py
69+
70+
Boot OPNsense
71+
[Documentation] OPNBOOT -> /efi/boot/bootx64.efi
72+
Enter Boot From File
73+
Enter Volume In File Explorer OPNBOOT
74+
Execute File In File Explorer efi
75+
Execute File In File Explorer boot
76+
Execute File In File Explorer bootx64.efi
77+
Read From Terminal Until FreeBSD/amd64 (OPNsense.localdomain) (ttyu0)
78+
Set Suite Variable ${BOOTED_OS_ID} ${ENV_ID_OPNSENSE}
79+
Import Variables ${CURDIR}/../os-config/${BOOTED_OS_ID}-credentials.py

os-config/502-credentials.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
DEVICE_OS_USERNAME = "pfsense"
66
DEVICE_OS_PASSWORD = "pfsense"
7-
DEVICE_OS_HOSTNAME = pfSense.home.arpa
7+
DEVICE_OS_HOSTNAME = "pfSense.home.arpa"
88

9-
DEVICE_OS_USER_PROMPT = f"{DEVICE_OS_USERNAME}@{DEVICE_OS_HOSTNAME}:~$"
10-
DEVICE_OS_ROOT_PROMPT = f"root@{DEVICE_OS_HOSTNAME}:/home/{DEVICE_OS_USERNAME}#"
9+
DEVICE_OS_ROOT_PROMPT = f"[2.7.2-RELEASE][{DEVICE_OS_USERNAME}@{DEVICE_OS_HOSTNAME}]/root"
10+
DEVICE_OS_RESCUE_PROMPT = "#"

0 commit comments

Comments
 (0)