8
8
from common .OpTestFSP import OpTestFSP
9
9
from common .OpTestOpenBMC import OpTestOpenBMC
10
10
from common .OpTestQemu import OpTestQemu
11
+ from common .OpTestMambo import OpTestMambo
11
12
import common .OpTestSystem
12
13
import common .OpTestHost
13
14
from common .OpTestIPMI import OpTestIPMI , OpTestSMCIPMI
41
42
42
43
import importlib
43
44
import os
45
+ import stat
44
46
import addons
45
47
46
48
optAddons = dict () # Store all addons found. We'll loop through it a couple time below
47
49
# Look at the top level of the addons for any directories and load their Setup modules
48
50
49
51
qemu_default = "qemu-system-ppc64"
52
+ mambo_default = "/opt/ibm/systemsim-p9/run/p9/power9"
53
+ mambo_initial_run_script = "skiboot.tcl"
54
+ mambo_autorun = "1"
50
55
51
56
# HostLocker credentials need to be in Notes Web section ('comment' section of JSON)
52
57
# bmc_type:OpenBMC
122
127
# see OpTestQemu.py
123
128
}
124
129
130
+ default_val_mambo = {
131
+ 'bmc_type' : 'mambo' ,
132
+ }
133
+
125
134
default_templates = {
126
135
# lower case insensitive lookup used later
127
136
'openbmc' : default_val ,
128
137
'fsp' : default_val_fsp ,
129
138
'ami' : default_val_ami ,
130
139
'smc' : default_val_smc ,
131
140
'qemu' : default_val_qemu ,
141
+ 'mambo' : default_val_mambo ,
132
142
}
133
143
134
144
@@ -192,7 +202,7 @@ def get_parser():
192
202
bmcgroup = parser .add_argument_group ('BMC' ,
193
203
'Options for Service Processor' )
194
204
# The default supported BMC choices in --bmc-type
195
- bmcChoices = ['AMI' , 'SMC' , 'FSP' , 'OpenBMC' , 'qemu' ]
205
+ bmcChoices = ['AMI' , 'SMC' , 'FSP' , 'OpenBMC' , 'qemu' , 'mambo' ]
196
206
# Loop through any addons let it append the extra bmcChoices
197
207
for opt in optAddons :
198
208
bmcChoices = optAddons [opt ].addBMCType (bmcChoices )
@@ -210,6 +220,12 @@ def get_parser():
210
220
bmcgroup .add_argument ("--smc-presshipmicmd" )
211
221
bmcgroup .add_argument ("--qemu-binary" , default = qemu_default ,
212
222
help = "[QEMU Only] qemu simulator binary" )
223
+ bmcgroup .add_argument ("--mambo-binary" , default = mambo_default ,
224
+ help = "[Mambo Only] mambo simulator binary, defaults to /opt/ibm/systemsim-p9/run/p9/power9" )
225
+ bmcgroup .add_argument ("--mambo-initial-run-script" , default = mambo_initial_run_script ,
226
+ help = "[Mambo Only] mambo simulator initial run script, defaults to skiboot.tcl" )
227
+ bmcgroup .add_argument ("--mambo-autorun" , default = mambo_autorun ,
228
+ help = "[Mambo Only] mambo autorun, defaults to '1' to autorun" )
213
229
214
230
hostgroup = parser .add_argument_group ('Host' , 'Installed OS information' )
215
231
hostgroup .add_argument ("--host-ip" , help = "Host address" )
@@ -332,6 +348,11 @@ def parse_args(self, argv=None):
332
348
if defaults .get ('qemu_binary' ):
333
349
qemu_default = defaults ['qemu_binary' ]
334
350
351
+ if defaults .get ('mambo_binary' ):
352
+ mambo_default = defaults ['mambo_binary' ]
353
+ if defaults .get ('mambo_initial_run_script' ):
354
+ mambo_default = defaults ['mambo_initial_run_script' ]
355
+
335
356
parser .add_argument ("--check-ssh-keys" , action = 'store_true' , default = False ,
336
357
help = "Check remote host keys when using SSH (auto-yes on new)" )
337
358
parser .add_argument ("--known-hosts-file" ,
@@ -437,7 +458,7 @@ def parse_args(self, argv=None):
437
458
self .util .check_lockers ()
438
459
439
460
if self .args .machine_state == None :
440
- if self .args .bmc_type in ['qemu' ]:
461
+ if self .args .bmc_type in ['qemu' , 'mambo' ]:
441
462
# Force UNKNOWN_BAD so that we don't try to setup the console early
442
463
self .startState = common .OpTestSystem .OpSystemState .UNKNOWN_BAD
443
464
else :
@@ -582,6 +603,35 @@ def objs(self):
582
603
self .op_system = common .OpTestSystem .OpTestQemuSystem (host = host , bmc = bmc ,
583
604
state = self .startState )
584
605
bmc .set_system (self .op_system )
606
+ elif self .args .bmc_type in ['mambo' ]:
607
+ if not (os .stat (self .args .mambo_binary ).st_mode & stat .S_IXOTH ):
608
+ raise ParameterCheck (msg = "Check that the file exists with"
609
+ " X permissions"
610
+ " mambo-binary={}"
611
+ .format (self .args .mambo_binary ))
612
+ if self .args .flash_skiboot is None \
613
+ or not os .access (self .args .flash_skiboot , os .R_OK | os .W_OK | os .X_OK ):
614
+ raise ParameterCheck (msg = "Check that the file exists with"
615
+ " R/W/X permissions"
616
+ " flash-skiboot={}"
617
+ .format (self .args .flash_skiboot ))
618
+ if self .args .flash_kernel is None \
619
+ or not os .access (self .args .flash_kernel , os .R_OK | os .W_OK ):
620
+ raise ParameterCheck (msg = "Check that the file exists with"
621
+ " R/W permissions"
622
+ " flash-kernel={}"
623
+ .format (self .args .flash_kernel ))
624
+ bmc = OpTestMambo (self .args .mambo_binary ,
625
+ self .args .mambo_initial_run_script ,
626
+ self .args .mambo_autorun ,
627
+ self .args .flash_skiboot ,
628
+ self .args .flash_kernel ,
629
+ self .args .flash_initramfs ,
630
+ logfile = self .logfile )
631
+ self .op_system = common .OpTestSystem .OpTestMamboSystem (host = host , bmc = bmc ,
632
+ state = self .startState )
633
+ bmc .set_system (self .op_system )
634
+
585
635
# Check that the bmc_type exists in our loaded addons then create our objects
586
636
elif self .args .bmc_type in optAddons :
587
637
(bmc , self .op_system ) = optAddons [self .args .bmc_type ].createSystem (self , host )
0 commit comments