Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 E2E: Prepare for emulator based on protocol #1656

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions hack/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,37 @@ REPO_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")/..")

cd "${REPO_ROOT}" || exit 1

# BMO_E2E_EMULATOR can be set to either "vbmc" or "sushy-tools"
BMO_E2E_EMULATOR=${BMO_E2E_EMULATOR:-"sushy-tools"}
# We can choose to use redfish-virtualmedia or redfish as the protocol when using sushy-tools
SUSHY_TOOLS_PROTOCOL=${SUSHY_TOOLS_PROTOCOL:-"redfish-virtualmedia"}
# CI originally specified BMO_E2E_EMULATOR only. To avoid breaking it,
# we need to set BMC_PROTOCOL based on this variable.
# TODO(lentzi90): Change this to just set the BMO_E2E_EMULATOR based on the
# BMC_PROTOCOL once CI has been adapted to use it.
if [[ -z "${BMC_PROTOCOL:-}" ]]; then
# If no protocol is specified, we set it based on the emulator.
BMO_E2E_EMULATOR=${BMO_E2E_EMULATOR:-"sushy-tools"}
if [[ "${BMO_E2E_EMULATOR}" == "sushy-tools" ]]; then
BMC_PROTOCOL=${BMC_PROTOCOL:-${SUSHY_TOOLS_PROTOCOL:-"redfish-virtualmedia"}}
elif [[ "${BMO_E2E_EMULATOR}" == "vbmc" ]]; then
BMC_PROTOCOL=${BMC_PROTOCOL:-"ipmi"}
else
echo "FATAL: Invalid e2e emulator specified: ${BMO_E2E_EMULATOR}"
exit 1
fi
else
# The protocol is set. Pick emulator based on it.
if [[ "${BMC_PROTOCOL}" == "redfish" ]] || [[ "${BMC_PROTOCOL}" == "redfish-virtualmedia" ]]; then
BMO_E2E_EMULATOR="sushy-tools"
elif [[ "${BMC_PROTOCOL}" == "ipmi" ]]; then
BMO_E2E_EMULATOR="vbmc"
else
echo "FATAL: Invalid BMC protocol specified: ${BMC_PROTOCOL}"
exit 1
fi
fi
echo "BMC_PROTOCOL=${BMC_PROTOCOL}"
echo "BMO_E2E_EMULATOR=${BMO_E2E_EMULATOR}"

export E2E_CONF_FILE="${REPO_ROOT}/test/e2e/config/ironic.yaml"
export E2E_BMCS_CONF_FILE="${REPO_ROOT}/test/e2e/config/bmcs-${BMC_PROTOCOL}.yaml"

case "${GINKGO_FOCUS:-}" in
*upgrade*)
Expand Down Expand Up @@ -74,8 +99,6 @@ rm /tmp/bmo-e2e.tar
IP_ADDRESS="192.168.222.1"

if [[ "${BMO_E2E_EMULATOR}" == "vbmc" ]]; then
BMC_PROTOCOL="ipmi"
export E2E_BMCS_CONF_FILE="${REPO_ROOT}/test/e2e/config/bmcs-ipmi.yaml"
# Start VBMC
docker run --name vbmc --network host -d \
-v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock \
Expand All @@ -84,11 +107,8 @@ if [[ "${BMO_E2E_EMULATOR}" == "vbmc" ]]; then


elif [[ "${BMO_E2E_EMULATOR}" == "sushy-tools" ]]; then
BMC_PROTOCOL=${SUSHY_TOOLS_PROTOCOL}
export E2E_BMCS_CONF_FILE="${REPO_ROOT}/test/e2e/config/bmcs-${SUSHY_TOOLS_PROTOCOL}.yaml"
# Sushy-tools variables
SUSHY_EMULATOR_FILE="${REPO_ROOT}"/test/e2e/sushy-tools/sushy-emulator.conf

# Start sushy-tools
docker run --name sushy-tools -d --network host \
-v "${SUSHY_EMULATOR_FILE}":/etc/sushy/sushy-emulator.conf:Z \
Expand All @@ -97,7 +117,7 @@ elif [[ "${BMO_E2E_EMULATOR}" == "sushy-tools" ]]; then
quay.io/metal3-io/sushy-tools:latest sushy-emulator

else
echo "Invalid e2e emulator specified: ${BMO_E2E_EMULATOR}"
echo "FATAL: Invalid e2e emulator specified: ${BMO_E2E_EMULATOR}"
exit 1
fi

Expand Down