Skip to content

Commit 3d6593e

Browse files
committed
OpTestMambo: Integrate Mambo
Integrate Mambo simulator to provide mechanism to run op-test testcases. Need to have a mambo binary, --mambo-binary, defaults to /opt/ibm/systemsim-p9/run/p9/power9. Need to configure --bmc-type mambo, --flash-skiboot (skiboot.lid) and --flash-kernel (zImage.epapr or vmlinux) and conditionally --flash-initramfs. Signed-off-by: Deb McLemore <[email protected]>
1 parent d3c2c8a commit 3d6593e

13 files changed

+1209
-11
lines changed

OpTestConfiguration.py

+52-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from common.OpTestFSP import OpTestFSP
99
from common.OpTestOpenBMC import OpTestOpenBMC
1010
from common.OpTestQemu import OpTestQemu
11+
from common.OpTestMambo import OpTestMambo
1112
import common.OpTestSystem
1213
import common.OpTestHost
1314
from common.OpTestIPMI import OpTestIPMI, OpTestSMCIPMI
@@ -41,12 +42,16 @@
4142

4243
import importlib
4344
import os
45+
import stat
4446
import addons
4547

4648
optAddons = dict() # Store all addons found. We'll loop through it a couple time below
4749
# Look at the top level of the addons for any directories and load their Setup modules
4850

4951
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"
5055

5156
# HostLocker credentials need to be in Notes Web section ('comment' section of JSON)
5257
# bmc_type:OpenBMC
@@ -122,13 +127,18 @@
122127
# see OpTestQemu.py
123128
}
124129

130+
default_val_mambo = {
131+
'bmc_type' : 'mambo',
132+
}
133+
125134
default_templates = {
126135
# lower case insensitive lookup used later
127136
'openbmc' : default_val,
128137
'fsp' : default_val_fsp,
129138
'ami' : default_val_ami,
130139
'smc' : default_val_smc,
131140
'qemu' : default_val_qemu,
141+
'mambo' : default_val_mambo,
132142
}
133143

134144

@@ -192,7 +202,7 @@ def get_parser():
192202
bmcgroup = parser.add_argument_group('BMC',
193203
'Options for Service Processor')
194204
# The default supported BMC choices in --bmc-type
195-
bmcChoices = ['AMI', 'SMC', 'FSP', 'OpenBMC', 'qemu']
205+
bmcChoices = ['AMI', 'SMC', 'FSP', 'OpenBMC', 'qemu', 'mambo']
196206
# Loop through any addons let it append the extra bmcChoices
197207
for opt in optAddons:
198208
bmcChoices = optAddons[opt].addBMCType(bmcChoices)
@@ -210,6 +220,12 @@ def get_parser():
210220
bmcgroup.add_argument("--smc-presshipmicmd")
211221
bmcgroup.add_argument("--qemu-binary", default=qemu_default,
212222
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")
213229

214230
hostgroup = parser.add_argument_group('Host', 'Installed OS information')
215231
hostgroup.add_argument("--host-ip", help="Host address")
@@ -332,6 +348,11 @@ def parse_args(self, argv=None):
332348
if defaults.get('qemu_binary'):
333349
qemu_default = defaults['qemu_binary']
334350

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+
335356
parser.add_argument("--check-ssh-keys", action='store_true', default=False,
336357
help="Check remote host keys when using SSH (auto-yes on new)")
337358
parser.add_argument("--known-hosts-file",
@@ -437,7 +458,7 @@ def parse_args(self, argv=None):
437458
self.util.check_lockers()
438459

439460
if self.args.machine_state == None:
440-
if self.args.bmc_type in ['qemu']:
461+
if self.args.bmc_type in ['qemu', 'mambo']:
441462
# Force UNKNOWN_BAD so that we don't try to setup the console early
442463
self.startState = common.OpTestSystem.OpSystemState.UNKNOWN_BAD
443464
else:
@@ -582,6 +603,35 @@ def objs(self):
582603
self.op_system = common.OpTestSystem.OpTestQemuSystem(host=host, bmc=bmc,
583604
state=self.startState)
584605
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+
585635
# Check that the bmc_type exists in our loaded addons then create our objects
586636
elif self.args.bmc_type in optAddons:
587637
(bmc, self.op_system) = optAddons[self.args.bmc_type].createSystem(self, host)

0 commit comments

Comments
 (0)