Skip to content

Commit 3dba55f

Browse files
committed
fix: default for custom device types on idrac_interfaces
closes: redhat-performance#446
1 parent fc5967d commit 3dba55f

File tree

4 files changed

+124
-83
lines changed

4 files changed

+124
-83
lines changed

config/idrac_interfaces.yml

Lines changed: 70 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,88 @@
44
# Also see /opt/quads/quads/config.py SUPPORTED list if adding system types.
55
#
66
---
7-
director_b01_fc640_interfaces: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
8-
director_b02_fc640_interfaces: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
9-
director_b03_fc640_interfaces: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
10-
director_b04_fc640_interfaces: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
11-
director_r630_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
12-
director_r640_interfaces: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
13-
director_r650_interfaces: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
14-
director_r660_interfaces: NIC.PxeDevice.2-1,RAID.SL.3-2,NIC.PxeDevice.1-1
15-
director_r720xd_interfaces: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
16-
director_r730xd_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
17-
director_740xd_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
18-
director_r740xd_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
19-
director_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
20-
director_7425_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
21-
director_7525_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
22-
director_r930_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
23-
foreman_b01_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.8-1-1
24-
foreman_b02_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.4-1-1
25-
foreman_b03_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.6-1-1
26-
foreman_b04_fc640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.2-1-1
27-
foreman_r630_interfaces: NIC.Slot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
28-
foreman_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
29-
foreman_r650_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
30-
foreman_r660_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2,NIC.PxeDevice.2-1
31-
foreman_r720xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.4-2-1
32-
foreman_r730xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
33-
foreman_740xd_interfaces: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
34-
foreman_r740xd_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
35-
foreman_r750_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
36-
foreman_7425_interfaces: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1
37-
foreman_7525_interfaces: NIC.Embedded.1-1-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
38-
foreman_r930_interfaces: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
7+
director_b01_fc640: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
8+
director_b02_fc640: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
9+
director_b03_fc640: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
10+
director_b04_fc640: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
11+
director_r630: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
12+
director_r640: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
13+
director_r650: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
14+
director_r660: NIC.PxeDevice.2-1,RAID.SL.3-2,NIC.PxeDevice.1-1
15+
director_r720xd: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
16+
director_r730xd: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
17+
director_740xd: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
18+
director_r740xd: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
19+
director_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
20+
director_7425: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
21+
director_7525: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
22+
director_r930: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
23+
foreman_b01_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.8-1-1
24+
foreman_b02_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.4-1-1
25+
foreman_b03_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.6-1-1
26+
foreman_b04_fc640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.ChassisSlot.2-1-1
27+
foreman_r630: NIC.Slot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
28+
foreman_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
29+
foreman_r650: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
30+
foreman_r660: NIC.PxeDevice.1-1,RAID.SL.3-2,NIC.PxeDevice.2-1
31+
foreman_r720xd: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Slot.4-2-1
32+
foreman_r730xd: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
33+
foreman_740xd: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
34+
foreman_r740xd: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
35+
foreman_r750: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
36+
foreman_7425: NIC.Integrated.1-3-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,HardDisk.List.1-1
37+
foreman_7525: NIC.Embedded.1-1-1,NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
38+
foreman_r930: NIC.Integrated.1-3-1,HardDisk.List.1-1,NIC.Integrated.1-2-1
3939
# These are for EFI
4040
# Expanding rest of models as a workaround for issue #239
41-
uefi_r630_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
42-
uefi_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
43-
uefi_b01_fc640_interfaces: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
44-
uefi_b02_fc640_interfaces: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
45-
uefi_b03_fc640_interfaces: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
46-
uefi_b04_fc640_interfaces: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
47-
uefi_r650_interfaces: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
41+
uefi_r630: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1
42+
uefi_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-1-1
43+
uefi_b01_fc640: NIC.ChassisSlot.8-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
44+
uefi_b02_fc640: NIC.ChassisSlot.4-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
45+
uefi_b03_fc640: NIC.ChassisSlot.6-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
46+
uefi_b04_fc640: NIC.ChassisSlot.2-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
47+
uefi_r650: NIC.Slot.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
4848
# Here we should be able to distinguish between 'foreman' and 'director'
4949
# interface layouts.
50-
uefi_r720xd_interfaces: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
51-
uefi_r730xd_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
52-
uefi_740xd_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
53-
uefi_r740xd_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
54-
uefi_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
55-
uefi_7425_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
56-
uefi_7525_interfaces: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
57-
uefi_r930_interfaces: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
58-
uefi_mx750c_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2
50+
uefi_r720xd: NIC.Slot.4-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
51+
uefi_r730xd: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
52+
uefi_740xd: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
53+
uefi_r740xd: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
54+
uefi_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
55+
uefi_7425: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.7-2-1,NIC.Slot.7-1-1,NIC.Integrated.1-3-1,HardDisk.List.1-1
56+
uefi_7525: NIC.Integrated.1-1-1,NIC.Integrated.1-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
57+
uefi_r930: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-3-1
58+
uefi_mx750c: NIC.PxeDevice.1-1,RAID.SL.3-2
5959

6060
# To understand how custom overrides and hierarchy work please see https://github.com/redhat-performance/badfish#host-type-overrides
6161
# PerfLab Entries
62-
foreman_cc37_r750_interfaces: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
63-
director_cc37_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
64-
foreman_bb37_r750_interfaces: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
65-
director_bb37_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
66-
foreman_r760_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2
67-
director_r760_interfaces: RAID.SL.3-2,NIC.PxeDevice.1-1
68-
foreman_mx750c_interfaces: NIC.PxeDevice.1-1,RAID.SL.3-2
69-
director_mx750c_interfaces: RAID.SL.3-2,NIC.PxeDevice.1-1
62+
foreman_cc37_r750: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
63+
director_cc37_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
64+
foreman_bb37_r750: NIC.Embedded.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1-1
65+
director_bb37_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
66+
foreman_r760: NIC.PxeDevice.1-1,RAID.SL.3-2
67+
director_r760: RAID.SL.3-2,NIC.PxeDevice.1-1
68+
foreman_mx750c: NIC.PxeDevice.1-1,RAID.SL.3-2
69+
director_mx750c: RAID.SL.3-2,NIC.PxeDevice.1-1
7070

7171
# Custom Rack F04
72-
director_f18_r640_interfaces: NIC.Slot.3-2,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Integrated.1-1-1
73-
foreman_f18_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.3-2,NIC.Slot.2-1,NIC.Slot.2-2
72+
director_f18_r640: NIC.Slot.3-2,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.2-1,NIC.Slot.2-2,NIC.Integrated.1-1-1
73+
foreman_f18_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.3-1,NIC.Slot.3-2,NIC.Slot.2-1,NIC.Slot.2-2
7474

7575
# Custom Rack E27 and E28 for Dell R750
76-
director_e27_r750_interfaces: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
77-
director_e28_r750_interfaces: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
78-
foreman_e27_r750_interfaces: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
79-
foreman_e28_r750_interfaces: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
80-
uefi_e27_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
81-
uefi_e28_r750_interfaces: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
76+
director_e27_r750: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
77+
director_e28_r750: NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,NIC.Embedded.1-1-1,HardDisk.List.1-1
78+
foreman_e27_r750: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
79+
foreman_e28_r750: NIC.Embedded.1-1-1,NIC.Slot.3-1-1,NIC.Slot.3-2-1,NIC.Slot.6-1-1,NIC.Slot.6-2-1,HardDisk.List.1-1
80+
uefi_e27_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
81+
uefi_e28_r750: NIC.Slot.3-1-1,HardDisk.List.1-1,NIC.Embedded.1-1-1
8282

8383
## Custom F04 specific overrides (examples)
8484
## h34 (should resemble other r640 hosts)
85-
# director_f04_h34_r640_interfaces: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
86-
# foreman_f04_h34_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
85+
# director_f04_h34_r640: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
86+
# foreman_f04_h34_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
8787
# h35 (should resemble other r640 hosts)
88-
# director_f04_h35_r640_interfaces: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
89-
# foreman_f04_h35_r640_interfaces: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
88+
# director_f04_h35_r640: NIC.Slot.1-2-1,HardDisk.List.1-1,NIC.Integrated.1-1-1
89+
# foreman_f04_h35_r640: NIC.Integrated.1-1-1,HardDisk.List.1-1,NIC.Slot.1-2-1
90+
91+
custom: NIC.Integrated.1-2-1,HardDisk.List.1-1,NIC.Slot.2-1-1

src/badfish/main.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,26 +211,34 @@ async def get_interfaces_by_type(self, host_type, _interfaces_path):
211211
definitions = await self.read_yaml(_interfaces_path)
212212

213213
host_name_split = self.host.split(".")[0].split("-")
214-
host_model = host_name_split[-1]
215-
rack = host_name_split[1]
216-
uloc = host_name_split[2]
214+
host_model = None
215+
rack = None
216+
uloc = None
217+
host_blade = None
218+
prefix = [host_type]
219+
if len(host_name_split) > 1:
220+
host_model = host_name_split[-1]
221+
rack = host_name_split[1]
222+
uloc = host_name_split[2]
223+
prefix.extend([rack, uloc])
217224

218-
host_blade = "000"
219225
if len(host_name_split) > 4:
220226
host_blade = host_name_split[3]
227+
prefix.append(host_blade)
221228

222-
prefix = [host_type, rack, uloc, host_blade]
223-
224-
key = f"{host_type}_{host_blade}_{host_model}_interfaces"
225-
interfaces_string = definitions.get(key)
226-
if interfaces_string:
227-
return interfaces_string.split(",")
229+
if host_blade:
230+
key = f"{host_type}_{host_blade}_{host_model}"
231+
interfaces_string = definitions.get(key)
232+
if interfaces_string:
233+
return interfaces_string.split(",")
228234

229235
len_prefix = len(prefix)
230236
key = "None"
231237
for _ in range(len_prefix):
232238
prefix_string = "_".join(prefix)
233-
key = "%s_%s_interfaces" % (prefix_string, host_model)
239+
key = prefix_string
240+
if host_model:
241+
key = "_".join([prefix_string, host_model])
234242
interfaces_string = definitions.get(key)
235243
if interfaces_string:
236244
return interfaces_string.split(",")
@@ -451,7 +459,10 @@ async def get_host_type(self, _interfaces_path):
451459
host_types = await self.get_host_types_from_yaml(_interfaces_path)
452460
for host_type in host_types:
453461
match = True
454-
interfaces = await self.get_interfaces_by_type(host_type, _interfaces_path)
462+
try:
463+
interfaces = await self.get_interfaces_by_type(host_type, _interfaces_path)
464+
except BadfishException as e:
465+
continue
455466

456467
for device in sorted(self.boot_devices[: len(interfaces)], key=lambda x: x["Index"]):
457468
if device["Name"] == interfaces[device["Index"]]:

tests/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ def render_device_dict(index, device):
9797
f"- WARNING - Job queue already cleared for iDRAC {MOCK_HOST}, DELETE command will not execute.\n"
9898
"- INFO - Command passed to set BIOS attribute pending values.\n"
9999
)
100-
RESPONSE_BOOT_TO_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['director', 'foreman', 'uefi']\n"
100+
RESPONSE_BOOT_TO_CUSTOM = (
101+
f"- WARNING - Job queue already cleared for iDRAC host01.example.com, DELETE command will not execute.\n"
102+
"- INFO - Command passed to set BIOS attribute pending values.\n"
103+
)
104+
RESPONSE_BOOT_TO_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['custom', 'director', 'foreman', 'uefi']\n"
101105
RESPONSE_BOOT_TO_SERVICE_UNAVAILABLE = (
102106
f"- WARNING - Job queue already cleared for iDRAC {MOCK_HOST}, DELETE command will not execute.\n"
103107
"- ERROR - Command failed, error code is: 503.\n"
@@ -216,7 +220,7 @@ def render_device_dict(index, device):
216220
"- INFO - Polling for host state: Not Down\n"
217221
"- INFO - Command passed to On server, code return is 200.\n"
218222
)
219-
RESPONSE_CHANGE_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['director', 'foreman', 'uefi']\n"
223+
RESPONSE_CHANGE_BAD_TYPE = "- ERROR - Expected values for -t argument are: ['custom', 'director', 'foreman', 'uefi']\n"
220224
RESPONSE_CHANGE_TO_SAME = "- WARNING - No changes were made since the boot order already matches the requested.\n"
221225
RESPONSE_CHANGE_NO_INT = "- ERROR - You must provide a path to the interfaces yaml via `-i` optional argument.\n"
222226

tests/test_boot_to_type.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
BOOT_SEQ_RESPONSE_DIRECTOR, INIT_RESP,
55
INTERFACES_PATH, JOB_OK_RESP, RESET_TYPE_RESP,
66
RESPONSE_BOOT_TO, RESPONSE_BOOT_TO_BAD_FILE,
7-
RESPONSE_BOOT_TO_BAD_TYPE, RESPONSE_BOOT_TO_NO_FILE,
7+
RESPONSE_BOOT_TO_BAD_TYPE, RESPONSE_BOOT_TO_CUSTOM, RESPONSE_BOOT_TO_NO_FILE,
88
STATE_ON_RESP)
99
from tests.test_base import TestBase
1010

@@ -36,6 +36,30 @@ def test_boot_to_type_foreman(self, mock_get, mock_patch, mock_post, mock_delete
3636
_, err = self.badfish_call()
3737
assert err == RESPONSE_BOOT_TO
3838

39+
@patch("aiohttp.ClientSession.delete")
40+
@patch("aiohttp.ClientSession.post")
41+
@patch("aiohttp.ClientSession.patch")
42+
@patch("aiohttp.ClientSession.get")
43+
def test_boot_to_type_custom(self, mock_get, mock_patch, mock_post, mock_delete):
44+
boot_seq_resp_fmt = BOOT_SEQ_RESP % str(BOOT_SEQ_RESPONSE_DIRECTOR)
45+
get_resp = [
46+
BOOT_MODE_RESP,
47+
boot_seq_resp_fmt.replace("'", '"'),
48+
BLANK_RESP,
49+
BOOT_MODE_RESP,
50+
RESET_TYPE_RESP,
51+
STATE_ON_RESP,
52+
STATE_ON_RESP,
53+
]
54+
responses = INIT_RESP + get_resp
55+
self.set_mock_response(mock_get, 200, responses)
56+
self.set_mock_response(mock_patch, 200, ["OK"])
57+
self.set_mock_response(mock_post, 200, JOB_OK_RESP)
58+
self.set_mock_response(mock_delete, 200, "OK")
59+
self.args = ["-i", INTERFACES_PATH, self.option_arg, "custom"]
60+
_, err = self.badfish_call(mock_host="host01.example.com")
61+
assert err == RESPONSE_BOOT_TO_CUSTOM
62+
3963
@patch("aiohttp.ClientSession.delete")
4064
@patch("aiohttp.ClientSession.post")
4165
@patch("aiohttp.ClientSession.patch")

0 commit comments

Comments
 (0)