-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Huy Mai <huy.mai@est.tech>
- Loading branch information
Showing
20 changed files
with
255 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This script reads BMC information in a config file and prepare VMs | ||
# whose info match those config | ||
# | ||
set -eux | ||
|
||
REPO_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")/..") | ||
cd "${REPO_ROOT}" || exit 1 | ||
|
||
CONFIG_FILE=$1 | ||
NETWORK=${2:-"baremetal-e2e"} | ||
|
||
readarray -t BMCs < <(yq e -o=j -I=0 '.[]' "${CONFIG_FILE}") | ||
|
||
# N_BMCS=$(yq '.bmcs | length' "${CONFIG_FILE}") | ||
# echo ${N_BMCS} | ||
for bmc in "${BMCs[@]}"; do | ||
address=$(echo "${bmc}" | jq -r '.address') | ||
bootMacAddress=$(echo "${bmc}" | jq -r '.bootMacAddress') | ||
hostName=$(echo "${bmc}" | jq -r '.hostName') | ||
ipAddress=$(echo "${bmc}" | jq -r '.ipAddress') | ||
|
||
# Create VM | ||
"${REPO_ROOT}/tools/bmh_test/create_vm.sh" "${hostName}" "${bootMacAddress}" | ||
|
||
# Add the the VM to the network host list | ||
virsh net-update "${NETWORK}" add-last ip-dhcp-host \ | ||
"<host mac='${bootMacAddress}' name='${hostName}' ip='${ipAddress}' />" \ | ||
--live --config --parent-index 0 | ||
|
||
# Add BMH VM to VBMC | ||
if [[ "${address}" =~ "ipmi://" ]]; then | ||
vbmc_port="${address##*:}" | ||
"${REPO_ROOT}/tools/bmh_test/vm2vbmc.sh" "${hostName}" "${vbmc_port}" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package e2e | ||
|
||
import ( | ||
"os" | ||
|
||
. "github.com/onsi/gomega" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
// BMC defines a BMH to use in the tests | ||
type BMC struct { | ||
User string `yaml:"user,omitempty"` | ||
Password string `yaml:"password,omitempty"` | ||
Address string `yaml:"address,omitempty"` | ||
BootMacAddress string `yaml:"bootMacAddress,omitempty"` | ||
HostName string `yaml:"hostName,omitempty"` | ||
IpAddress string `yaml:"ipAddress,omitempty"` | ||
SSHPort string `yaml:"sshPort,omitempty"` | ||
} | ||
|
||
func LoadBMCConfig(configPath string) *[]BMC { | ||
configData, err := os.ReadFile(configPath) //#nosec | ||
Expect(err).ToNot(HaveOccurred(), "Failed to read the bmcs config file") | ||
var bmcs []BMC | ||
Expect(yaml.Unmarshal(configData, &bmcs)).To(Succeed()) | ||
return &bmcs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# For fixture config, only the `hostName` field matters. The number of BMCs, | ||
# however, needs to be equal or larger than `GINKGO_NODES`. | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-0" | ||
bootMacAddress: "00:60:2f:31:81:01" | ||
hostName: "" | ||
ipAddress: "192.168.222.122" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-1" | ||
bootMacAddress: "00:60:2f:31:81:02" | ||
hostName: "" | ||
ipAddress: "192.168.222.123" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-2" | ||
bootMacAddress: "00:60:2f:31:81:01" | ||
hostName: "" | ||
ipAddress: "192.168.222.124" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-3" | ||
bootMacAddress: "00:60:2f:31:81:02" | ||
hostName: "" | ||
ipAddress: "192.168.222.125" | ||
sshPort: "22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-0" | ||
bootMacAddress: "00:60:2f:31:81:01" | ||
hostName: "bmo-e2e-0" | ||
ipAddress: "192.168.222.122" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-1" | ||
bootMacAddress: "00:60:2f:31:81:02" | ||
hostName: "bmo-e2e-1" | ||
ipAddress: "192.168.222.123" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "redfish+http://192.168.222.1:8000/redfish/v1/Systems/bmo-e2e-2" | ||
bootMacAddress: "00:60:2f:31:81:03" | ||
hostName: "bmo-e2e-2" | ||
ipAddress: "192.168.222.124" | ||
sshPort: "22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
- user: admin | ||
password: password | ||
address: "ipmi://192.168.222.1:16230" | ||
bootMacAddress: "00:60:2f:31:81:01" | ||
hostName: "bmo-e2e-0" | ||
ipAddress: "192.168.222.122" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "ipmi://192.168.222.1:16231" | ||
bootMacAddress: "00:60:2f:31:81:02" | ||
hostName: "bmo-e2e-1" | ||
ipAddress: "192.168.222.123" | ||
sshPort: "22" | ||
- user: admin | ||
password: password | ||
address: "ipmi://192.168.222.1:16232" | ||
bootMacAddress: "00:60:2f:31:81:03" | ||
hostName: "bmo-e2e-2" | ||
ipAddress: "192.168.222.124" | ||
sshPort: "22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.