Skip to content

Commit

Permalink
test two node from e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
mboukhalfa committed Dec 4, 2023
1 parent 40182bf commit 27063f9
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,11 @@ done
podman pull quay.io/metal3-io/keepalived:v0.2.0
podman tag quay.io/metal3-io/keepalived:v0.2.0 127.0.0.1:5000/localimages/keepalived:latest
podman push --tls-verify=false 127.0.0.1:5000/localimages/keepalived:latest
./build-sushytools-image-with-fakeipa-changes.sh
su -c './build-sushytools-image-with-fakeipa-changes.sh' cloud-user
#./build-sushytools-image-with-fakeipa-changes.sh
# Define variables for repeated values
IRONIC_IMAGE="127.0.0.1:5000/localimages/ironic:latest"
SUSHY_TOOLS_IMAGE="127.0.0.1:5000/localimages/sushy-tools"
LIBVIRT_URI="qemu+ssh://root@192.168.111.1/system?&keyfile=/root/ssh/id_rsa_virt_power&no_verify=1&no_tty=1"
API_URL="http://172.22.0.2:6385"
CALLBACK_URL="http://172.22.0.2:5050/v1/continue"
ADVERTISE_HOST="192.168.111.1"
ADVERTISE_PORT="9999"

# Create directories
DIRECTORIES=(
Expand All @@ -59,23 +55,9 @@ podman run -d --net host --name httpd-infra \
--entrypoint /bin/runhttpd \
"$IRONIC_IMAGE"
# Set configuration options
cat <<EOF >$HOME/sushy-tools/conf.py
import collections
Host = collections.namedtuple('Host', ['hostname', 'port'])
SUSHY_EMULATOR_LIBVIRT_URI = "${LIBVIRT_URI}"
SUSHY_EMULATOR_IGNORE_BOOT_DEVICE = False
SUSHY_EMULATOR_VMEDIA_VERIFY_SSL = False
SUSHY_EMULATOR_AUTH_FILE = "/root/sushy/htpasswd"
SUSHY_EMULATOR_FAKE_DRIVER = True
SUSHY_EMULATOR_FAKE_IPA = False
FAKE_IPA_API_URL = "${API_URL}"
FAKE_IPA_INSPECTION_CALLBACK_URL = "${CALLBACK_URL}"
FAKE_IPA_ADVERTISE_ADDRESS = Host(hostname="${ADVERTISE_HOST}", port="${ADVERTISE_PORT}")
cp conf.py $HOME/sushy-tools/conf.py

EOF

# Create an htpasswd file
cat <<'EOF' >$HOME/sushy-tools/htpasswd
admin:$2b$12$/dVOBNatORwKpF.ss99KB.vESjfyONOxyH.UgRwNyZi1Xs/W2pGVS
Expand Down
1 change: 1 addition & 0 deletions Support/Multitenancy/ironic-env/04-start-minikube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ sudo su -l -c "minikube ssh sudo ip addr add 172.22.0.2/24 dev ironicendpoint"

# Firewall rules
for i in 8000 80 9999 6385 5050 6180 53 5000; do sudo firewall-cmd --zone=public --add-port=${i}/tcp; done
for i in 8000 80 9999 6385 5050 6180 53 5000; do sudo firewall-cmd --zone=libvirt --add-port=${i}/tcp; done
for i in 69 547 546 68 67 5353 6230 6231 6232 6233 6234 6235; do sudo firewall-cmd --zone=libvirt --add-port=${i}/udp; done
sudo firewall-cmd --zone=libvirt --add-port=8000/tcp
16 changes: 12 additions & 4 deletions Support/Multitenancy/ironic-env/05-apply-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ baremetal node create --driver redfish --driver-info \
redfish_address=http://192.168.111.1:8000 --driver-info \
redfish_system_id=/redfish/v1/Systems/27946b59-9e44-4fa7-8e91-f3527a1ef094 --driver-info \
redfish_username=admin --driver-info redfish_password=password \
--name default-node
--name default-node-1

# baremetal node manage $NODE_UUID
# get mac : virsh domiflist vmname
# baremetal port create 00:5c:52:31:3a:9c --node $NODE_UUID
baremetal node set default-node-1 --driver-info deploy_kernel="http://172.22.0.2:6180/images/ironic-python-agent.kernel" --driver-info deploy_ramdisk="http://172.22.0.2:6180/images/ironic-python-agent.initramfs"
baremetal node set default-node-1 --instance-info image_source=http://172.22.0.1/images/image.qcow2 --instance-info image_checksum=http://172.22.0.1/images/image.qcow2

baremetal node create --driver redfish --driver-info \
redfish_address=http://192.168.111.1:8000 --driver-info \
redfish_system_id=/redfish/v1/Systems/27946b59-9e44-4fa7-8e91-f3527a1ef095 --driver-info \
redfish_username=admin --driver-info redfish_password=password \
--name default-node-2

baremetal node set default-node-2 --driver-info deploy_kernel="http://172.22.0.2:6180/images/ironic-python-agent.kernel" --driver-info deploy_ramdisk="http://172.22.0.2:6180/images/ironic-python-agent.initramfs"
baremetal node set default-node-2 --instance-info image_source=http://172.22.0.1/images/image.qcow2 --instance-info image_checksum=http://172.22.0.1/images/image.qcow2
8 changes: 8 additions & 0 deletions Support/Multitenancy/ironic-env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
Machine: `4c / 16gb / 100gb`
OS: `CentOS9-20220330`

# Test fake ipa

1. clone the env scripts and `cd metal3-clusterapi-docs/Support/Multitenancy/ironic-env`
2. check configs in config.py
3. run init `./Init-environment.sh`
4. to just rebuild fake-ipa from the local repo run `./rebuild-fipa.sh`
5. to clean the env `./clean.sh`

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/bash
#
# SUSHYTOOLS_DIR="$HOME/sushy-tools-19"
SUSHYTOOLS_DIR="$HOME/sushy-tools"
#rm -rf "$SUSHYTOOLS_DIR"
#git clone https://opendev.org/openstack/sushy-tools.git "$SUSHYTOOLS_DIR"

SUSHYTOOLS_DIR="$HOME/sushy-tools" || true
rm -rf "$SUSHYTOOLS_DIR"
git clone https://opendev.org/openstack/sushy-tools.git "$SUSHYTOOLS_DIR"
cd "$SUSHYTOOLS_DIR" || exit
#git fetch https://review.opendev.org/openstack/sushy-tools refs/changes/66/875366/30 && git cherry-pick FETCH_HEAD
git fetch https://review.opendev.org/openstack/sushy-tools refs/changes/66/875366/38 && git cherry-pick FETCH_HEAD

cd ..

Expand All @@ -27,4 +26,3 @@ CMD ["sushy-emulator", "-i", "::", "--config", "/root/sushy/conf.py"]
EOF

sudo podman build -t 127.0.0.1:5000/localimages/sushy-tools .
# rm -rf "$SUSHYTOOLS_DIR"
35 changes: 35 additions & 0 deletions Support/Multitenancy/ironic-env/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SUSHY_EMULATOR_LIBVIRT_URI = "qemu+ssh://root@192.168.111.1/system?&keyfile=/root/ssh/id_rsa_virt_power&no_verify=1&no_tty=1"
SUSHY_EMULATOR_IGNORE_BOOT_DEVICE = False
SUSHY_EMULATOR_VMEDIA_VERIFY_SSL = False
SUSHY_EMULATOR_AUTH_FILE = "/root/sushy/htpasswd"
SUSHY_EMULATOR_FAKE_DRIVER = True
SUSHY_EMULATOR_FAKE_IPA = True
FAKE_IPA_API_URL = "http://172.22.0.2:6385"
FAKE_IPA_INSPECTION_CALLBACK_URL = "http://172.22.0.2:5050/v1/continue"
FAKE_IPA_ADVERTISE_ADDRESS_IP = "192.168.111.1"
SUSHY_EMULATOR_FAKE_SYSTEMS = [
{
'uuid': '27946b59-9e44-4fa7-8e91-f3527a1ef094',
'name': 'fake1',
'power_state': 'Off',
'fake_ipa': False,
'nics': [
{
'mac': '00:5c:52:31:3a:9c',
'ip': '172.22.0.100'
}
]
},
{
'uuid': '27946b59-9e44-4fa7-8e91-f3527a1ef095',
'name': 'fake2',
'power_state': 'Off',
'fake_ipa': False,
'nics': [
{
'mac': '00:5c:52:31:3a:9d',
'ip': '172.22.0.101'
}
]
}
]
19 changes: 19 additions & 0 deletions Support/Multitenancy/ironic-env/ironicclient.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

DIR="$(dirname "$(readlink -f "$0")")"

if [ -d "${PWD}/_clouds_yaml" ]; then
MOUNTDIR="${PWD}/_clouds_yaml"
else
echo "cannot find _clouds_yaml"
exit 1
fi

if [ "$1" == "baremetal" ] ; then
shift 1
fi

# shellcheck disable=SC2086
sudo podman run --net=host --tls-verify=false \
-v "${MOUNTDIR}:/etc/openstack" --rm \
-e OS_CLOUD="${OS_CLOUD:-metal3}" "172.22.0.1:5000/localimages/ironic-client" "$@"
36 changes: 36 additions & 0 deletions Support/Multitenancy/ironic-env/rebuild-fipa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
baremetal node delete default-node

su -c './build-sushytools-image-with-fakeipa-changes.sh' cloud-user
SUSHY_TOOLS_IMAGE="127.0.0.1:5000/localimages/sushy-tools"
LIBVIRT_URI="qemu+ssh://root@192.168.111.1/system?&keyfile=/root/ssh/id_rsa_virt_power&no_verify=1&no_tty=1"
API_URL="http://172.22.0.2:6385"
CALLBACK_URL="http://172.22.0.2:5050/v1/continue"
ADVERTISE_HOST="192.168.111.1"
ADVERTISE_PORT="9999"

# Set configuration options
cp conf.py $HOME/sushy-tools/conf.py

# Create an htpasswd file
cat <<'EOF' >$HOME/sushy-tools/htpasswd
admin:$2b$12$/dVOBNatORwKpF.ss99KB.vESjfyONOxyH.UgRwNyZi1Xs/W2pGVS
EOF

podman stop fake-ipa
podman rm fake-ipa
podman run --entrypoint='["sushy-fake-ipa", "--config", "/root/sushy/conf.py"]' \
-d --net host --name fake-ipa --pod infra-pod \
-v $HOME/sushy-tools:/root/sushy \
-v /root/.ssh:/root/ssh \
"${SUSHY_TOOLS_IMAGE}"

mkdir /opt/metal3-dev-env/ironic/html/images
touch /opt/metal3-dev-env/ironic/html/images/image.qcow2
baremetal node create --driver redfish --driver-info \
redfish_address=http://192.168.111.1:8000 --driver-info \
redfish_system_id=/redfish/v1/Systems/27946b59-9e44-4fa7-8e91-f3527a1ef094 --driver-info \
redfish_username=admin --driver-info redfish_password=password \
--name default-node

baremetal node set default-node --driver-info deploy_kernel="http://172.22.0.2:6180/images/ironic-python-agent.kernel" --driver-info deploy_ramdisk="http://172.22.0.2:6180/images/ironic-python-agent.initramfs"
baremetal node set default-node --instance-info image_source=http://172.22.0.1/images/image.qcow2 --instance-info image_checksum=http://172.22.0.1/images/image.qcow2

0 comments on commit 27063f9

Please sign in to comment.