6e835ae758
Ironic enabled secure RBAC with system scoped enforcement [1].
Some API calls, for instance 'baremetal:driver:get' needs system
scope role by design [2], even with elevated access project scope
service role [3].
[1] https://review.opendev.org/c/openstack/ironic/+/902009
[2] 8ec5606622/ironic/common/policy.py (L1349-L1357)
[3] https://review.opendev.org/c/openstack/kolla-ansible/+/908007
Related-Bug: #2051837
Change-Id: Id6313d7dd343b82d4c9ccf7bf429d340ea0e93d1
70 lines
2.2 KiB
Bash
Executable File
70 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -o xtrace
|
|
set -o errexit
|
|
set -o pipefail
|
|
|
|
# Enable unbuffered output for Ansible in Jenkins.
|
|
export PYTHONUNBUFFERED=1
|
|
|
|
function test_ironic_logged {
|
|
# Assumes init-runonce has been executed.
|
|
KOLLA_CONFIG_PATH=${KOLLA_CONFIG_PATH:-/etc/kolla}
|
|
export OS_CLIENT_CONFIG_FILE=${KOLLA_CONFIG_PATH}/clouds.yaml
|
|
export OS_CLOUD=kolla-admin-internal
|
|
. ~/openstackclient-venv/bin/activate
|
|
|
|
echo "Enabling DHCP on the external (\"public\") subnet"
|
|
openstack subnet set --dhcp public1-subnet
|
|
|
|
# Smoke test ironic API.
|
|
openstack --os-cloud kolla-admin-system-internal baremetal driver list
|
|
openstack baremetal node list
|
|
openstack baremetal port list
|
|
# Ironic Inspector API
|
|
openstack baremetal introspection rule list
|
|
|
|
openstack baremetal node show tk0
|
|
openstack baremetal node power off tk0
|
|
openstack baremetal node show tk0
|
|
openstack baremetal node manage tk0
|
|
openstack baremetal node show tk0
|
|
openstack baremetal node provide tk0
|
|
openstack baremetal node show tk0
|
|
openstack baremetal node validate tk0
|
|
|
|
echo "TESTING: Server creation"
|
|
openstack server create --image cirros --flavor test-rc --key-name mykey --network public1 kolla_bm_boot_test
|
|
local attempt
|
|
attempt=1
|
|
while [[ $(openstack server show kolla_bm_boot_test -f value -c status) != "ACTIVE" ]]; do
|
|
echo "Server not yet active, check $attempt - retrying"
|
|
attempt=$((attempt+1))
|
|
if [[ $attempt -eq 16 ]]; then
|
|
echo "FAILED: Server did not become active after $attempt checks"
|
|
openstack server show kolla_bm_boot_test
|
|
return 1
|
|
fi
|
|
sleep 60
|
|
done
|
|
echo "SUCCESS: Server creation"
|
|
|
|
echo "TESTING: Server deletion"
|
|
openstack server delete --wait kolla_bm_boot_test
|
|
echo "SUCCESS: Server deletion"
|
|
}
|
|
|
|
function test_ironic {
|
|
echo "Testing Ironic"
|
|
test_ironic_logged > /tmp/logs/ansible/test-ironic 2>&1
|
|
result=$?
|
|
if [[ $result != 0 ]]; then
|
|
echo "Testing Ironic failed. See ansible/test-ironic for details"
|
|
else
|
|
echo "Successfully tested Ironic. See ansible/test-ironic for details"
|
|
fi
|
|
return $result
|
|
}
|
|
|
|
test_ironic
|