Skip to content

Commit

Permalink
tests: add fakeipmi container
Browse files Browse the repository at this point in the history
In order to remove the need to install OpenIPMI in the server container,
prepare a container image to run the fake IPMI server.
  • Loading branch information
cbosdo committed Dec 16, 2024
1 parent 59d9e9a commit f5671f0
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build_containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,34 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-and-push-fakeipmi-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/ci-fakeipmi

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./testsuite/dockerfiles/fakeipmi/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 8 additions & 0 deletions testsuite/dockerfiles/fakeipmi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM opensuse/leap:15.5

RUN zypper -n in OpenIPMI && \
mkdir -p /etc/ipmi

COPY ipmisim1.emu lan.conf fake_ipmi_host.sh /etc/ipmi

CMD ["ipmi_sim", "-n"]
9 changes: 9 additions & 0 deletions testsuite/dockerfiles/fakeipmi/fake_ipmi_host.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/bash

echo
echo "#### Fake IPM host started ####"
echo

while true; do
sleep 5
done
17 changes: 17 additions & 0 deletions testsuite/dockerfiles/fakeipmi/ipmisim1.emu
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Minimalistic simulation setup for ipmi_sim.

# The BMC is the MC at address 20
mc_setbmc 0x20

# Now add the BMC
mc_add 0x20 0 no-device-sdrs 0x23 9 8 0x9f 0x1291 0xf02 persist_sdr
sel_enable 0x20 1000 0x0a

# Watchdog sensor. This must be sensor zero.
sensor_add 0x20 0 0 35 0x6f event-only
sensor_set_event_support 0x20 0 0 enable scanning per-state \
000000000001111 000000000000000 \
000000000001111 000000000000000

# Turn on the BMC
mc_enable 0x20
25 changes: 25 additions & 0 deletions testsuite/dockerfiles/fakeipmi/lan.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name "ipmisim1"

set_working_mc 0x20

# Define a LAN channel on channel 1
startlan 1
addr 127.0.0.1 623
priv_limit admin

allowed_auths_callback none md2 md5 straight
allowed_auths_user none md2 md5 straight
allowed_auths_operator none md2 md5 straight
allowed_auths_admin none md2 md5 straight

guid a123456789abcdefa123456789abcdef
endlan

serial 15 127.0.0.1 9002 codec VM

startcmd "/etc/ipmi/fake_ipmi_host.sh"
startnow false

user 1 true "admin" "admin" user 10 none md2 md5 straight
user 2 true "ipmiusr" "test" admin 10 none md2 md5 straight

0 comments on commit f5671f0

Please sign in to comment.