diff --git a/.github/workflows/virtual-integration.yml b/.github/workflows/virtual-integration.yml index ae3421cc6..d3c27a708 100644 --- a/.github/workflows/virtual-integration.yml +++ b/.github/workflows/virtual-integration.yml @@ -486,6 +486,16 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false + - name: Install DNSmasq + run: | + cd ci/ven + ./dnsmasq-setup.sh "kind.internal" setup + - name: Install Libvirt + env: + LIBVIRT_DEFAULT_URI: 'qemu:///system' + run: | + cd ci/ven + ./libvirt-setup.sh - name: Deploy Kind Orchestrator id: deploy-kind-orchestrator uses: ./.github/actions/deploy_kind @@ -501,10 +511,15 @@ jobs: if: always() uses: ./.github/actions/collect_diagnostics timeout-minutes: 15 + - name: Config DNSmasq + run: | + cd ci/ven + ./dnsmasq-setup.sh "kind.internal" config - name: Run policy compliance tests run: mage test:policyCompliance - name: Run image pull policy compliance tests run: mage test:imagePullPolicyCompliance + - name: Setup Sample Org and Project with default users id: default-mt-setup run: mage tenantUtils:createDefaultMtSetup @@ -522,152 +537,71 @@ jobs: - name: Create default user and run e2e tests run: mage devUtils:createDefaultUser test:e2e - - name: "Test Observability SRE Exporter w/o ENiC" + - name: "Test Observability SRE Exporter w/o VEN" env: ORCH_DEFAULT_PASSWORD: ${{ secrets.ORCH_DEFAULT_PASSWORD }} run: | mage test:e2eSreObservabilityNoEnic - - - name: Deploy ENiC - if: ${{ always() && steps.deploy-kind-orchestrator.conclusion == 'success' && steps.default-mt-setup.conclusion == 'success' }} + + - name: Read test-automation dependency Version + id: read-test-automation-version shell: bash - timeout-minutes: 5 - env: - ORCH_ORG: sample-org - ORCH_PROJECT: sample-project - ORCH_USER: sample-project-onboarding-user - ORCH_USER_API: sample-project-api-user - EDGE_MANAGEABILITY_FRAMEWORK_REV: ${{ env.GIT_HASH }} run: | - mage devUtils:deployEnic 1 dev - - # wait until SN and UUID are available - mage devUtils:getEnicSerialNumber - mage devUtils:getEnicUUID - - # then get then and store them in the env - UUID=$(kubectl exec -it -n enic enic-0 -c edge-node -- bash -c "dmidecode -s system-uuid") - SN=$(kubectl exec -it -n enic enic-0 -c edge-node -- bash -c "dmidecode -s system-serial-number") - echo "EN_UUID=$UUID" >> "$GITHUB_ENV" - echo "EN_SN=$SN" >> "$GITHUB_ENV" - - - name: Print current EN UUID and SN - if: ${{ always() && steps.deploy-kind-orchestrator.conclusion == 'success' && steps.default-mt-setup.conclusion == 'success' }} - run: echo "Current ENiC has UUID ${{ env.EN_UUID }} and SN ${{ env.EN_SN }}" - - - name: UI E2E Tests - if: ${{ always() && steps.deploy-kind-orchestrator.conclusion == 'success' && steps.default-mt-setup.conclusion == 'success' }} - uses: ./.github/actions/cypress + cat /proc/cpuinfo + version=$(yq '.test-automation.version' ${{ github.workspace }}/.test-dependencies.yaml | tr -d '\n' | xargs) + echo $version + echo "version=$version" >> $GITHUB_OUTPUT + - name: Checkout edge-manage-test-automation repository with submodules + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: + repository: open-edge-platform/edge-manage-test-automation + ref: ${{ steps.read-test-automation-version.outputs.version }} + path: edge-manage-test-automation + submodules: 'recursive' token: ${{ secrets.SYS_EMF_GH_TOKEN }} - en_serial_number: ${{ env.EN_SN }} - en_uuid: ${{ env.EN_UUID }} - infra: "cypress/e2e/infra/locations.cy.ts,cypress/e2e/infra/new-host-provision.cy.ts,cypress/e2e/infra/verify-host.cy.ts" - - - name: "Test Observability Public Endpoints" - env: - ORCH_DEFAULT_PASSWORD: ${{ secrets.ORCH_DEFAULT_PASSWORD }} - run: | - mage test:e2eObservability - - - name: "Test Observability Orchestrator Stack" - env: - ORCH_DEFAULT_PASSWORD: ${{ secrets.ORCH_DEFAULT_PASSWORD }} - run: | - mage test:e2eOrchObservability - - # TODO - The base extension deployment including observability stack has been removed. Need to revist this test stack later and see how to proceed further. - # - name: "Test Observability EdgeNode Stack" - # env: - # ORCH_DEFAULT_PASSWORD: ${{ secrets.ORCH_DEFAULT_PASSWORD }} - # run: | - # mage test:e2eENObservability - - # TODO - The base extension deployment including observability stack has been removed. Need to revist this test stack later and see how to proceed further. - # - name: "Test Observability Alerts" - # env: - # ORCH_DEFAULT_PASSWORD: ${{ secrets.ORCH_DEFAULT_PASSWORD }} - # run: | - # mage test:e2eAlertsObservability - - # TODO - The base extension deployment including observability stack has been removed. Need to revist this test stack later and see how to proceed further. - # - name: "Test Observability SRE Exporter" - # env: - # ORCH_DEFAULT_PASSWORD: ${{ secrets.ORCH_DEFAULT_PASSWORD }} - # run: | - # mage test:e2eSreObservability - - - name: deploy, register & provision new ENiC instance # previous instance was deatuhorized by the cluster delete in UI tests - if: ${{ always() && steps.deploy-kind-orchestrator.conclusion == 'success' && steps.default-mt-setup.conclusion == 'success' }} - shell: bash - timeout-minutes: 5 - env: - ORCH_ORG: sample-org - ORCH_PROJECT: sample-project - ORCH_USER: sample-project-onboarding-user - ORCH_USER_API: sample-project-api-user - EDGE_MANAGEABILITY_FRAMEWORK_REV: ${{ env.GIT_HASH }} - run: | - # delete the previous ENiC instance - kubectl delete ns enic - - # deploy a new ENiC instance - mage devUtils:deployEnic 1 dev - - # wait until SN and UUID are available - mage devUtils:getEnicSerialNumber - mage devUtils:getEnicUUID - - # then get then and store them in the env - UUID=$(kubectl exec -it -n enic enic-0 -c edge-node -- bash -c "dmidecode -s system-uuid") - SN=$(kubectl exec -it -n enic enic-0 -c edge-node -- bash -c "dmidecode -s system-serial-number") - echo "EN_UUID=$UUID" >> "$GITHUB_ENV" - echo "EN_SN=$SN" >> "$GITHUB_ENV" - - # register the ENiC in the orchestrator - ORCH_USER=${ORCH_USER_API} mage devUtils:registerEnic enic-0 - - # provision the ENiC - ORCH_USER=${ORCH_USER_API} mage devUtils:provisionEnic enic-0 - sleep 5 - mage devUtils:WaitForEnic - - - name: Wait for cluster agent to be ready - if: ${{ always() && steps.deploy-kind-orchestrator.conclusion == 'success' }} + persist-credentials: false + - name: Setup virtual environment + working-directory: edge-manage-test-automation run: | - mkdir -p smoke-test/logs - kubectl exec -n enic enic-0 -c edge-node -- bash -c "journalctl -x" > smoke-test/logs/enic-journalctl-pre.log - kubectl exec -n enic enic-0 -c edge-node -- bash -c "journalctl -xeu cluster-agent" > smoke-test/logs/enic-cluster-agent-pre.log - timeout 5m kubectl exec -n enic enic-0 -c edge-node -- bash -c "journalctl -f" | grep -m 1 "Cluster Agent state update" - - - name: Run AO / CO smoke test - if: ${{ always() && steps.deploy-kind-orchestrator.conclusion == 'success' && steps.default-mt-setup.conclusion == 'success' }} + git submodule update --init --recursive + make asdf-install + make venv_edge-manage-test-automation + # install required versions for Pico + pushd repos/ven/pico + asdf install + sudo apt-get install xsltproc + popd + - name: Run Golden Suite Robot Framework Tests + id: robot-tests + working-directory: edge-manage-test-automation + timeout-minutes: 45 env: - PROJECT: sample-project - NODE_UUID: ${{ env.EN_UUID }} - EDGE_MGR_USER: sample-project-edge-mgr - EDGE_INFRA_USER: sample-project-api-user - run: | - echo "Running AO / CO smoke test..." - mage test:clusterOrchSmokeTest - - - name: Collect smoke test logs - if: always() + REQUESTS_CA_BUNDLE: /usr/local/share/ca-certificates/orch-ca.crt + LIBVIRT_DEFAULT_URI: 'qemu:///system' run: | - mkdir -p smoke-test/logs - kubectl logs -n orch-app -l app=app-deployment-api -c app-deployment-api --tail=-1 > smoke-test/logs/app-deployment-api.log - kubectl logs -n orch-app -l app=app-deployment-manager --tail=-1 > smoke-test/logs/app-deployment-manager.log - kubectl logs -n orch-app -l app=app-resource-manager -c app-resource-manager --tail=-1 > smoke-test/logs/app-resource-manager.log - kubectl logs -n orch-app -l app.kubernetes.io/name=app-orch-catalog --tail=-1 > smoke-test/logs/application-catalog.log - kubectl exec -n enic enic-0 -c edge-node -- bash -c "journalctl -xeu cluster-agent" > smoke-test/logs/enic-cluster-agent-post.log - - - name: Upload smoke test logs + kubectl -n orch-platform get secrets platform-keycloak -o yaml || true + KC_ADMIN_PWD=$(kubectl -n orch-platform get secrets platform-keycloak -o jsonpath='{.data.admin-password}' | base64 -d) + # Add the password to the orchestrator config + yq eval ".orchestrator.admin_password = \"${KC_ADMIN_PWD}\"" -i orchestrator-configs/kind.yaml + yq eval '.infra.host.edgenode.hw_info.libvirt_pool_name = "default"' -i tests/core_foundation/data/cf_data_1_ven_VEN-libvirt_microvisor-nonrt.yaml + yq eval '.infra.host.edgenode.hw_info.libvirt_network_name = "default"' -i tests/core_foundation/data/cf_data_1_ven_VEN-libvirt_microvisor-nonrt.yaml + cat tests/core_foundation/data/cf_data_1_ven_VEN-libvirt_microvisor-nonrt.yaml || true + source venv_edge-manage-test-automation/bin/activate + robot -L DEBUG --pythonpath . \ + --name "Golden Suite: Core Foundation" \ + -d robot_output/core_foundation \ + -V orchestrator-configs/kind.yaml \ + --exitonfailure \ + --exclude cf6 \ + --exclude cf8 \ + tests/core_foundation/core_foundation.robot + - name: Upload test artifacts if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: - name: smoke-test + name: kind-${{ github.event_name }}-${{ github.event.number }}-robot-report path: | - smoke-test/logs/* + edge-manage-test-automation/robot_output/**/* deploy-on-prem: permissions: diff --git a/ci/ven/dnsmasq-setup.sh b/ci/ven/dnsmasq-setup.sh new file mode 100755 index 000000000..0baf6b988 --- /dev/null +++ b/ci/ven/dnsmasq-setup.sh @@ -0,0 +1,151 @@ +#!/bin/bash +# SPDX-FileCopyrightText: (C) 2025 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +set -x + +# Check if at least two arguments are provided +if [ -z "$1" ] || [ -z "$2" ]; then + echo "Usage: $0 {setup|config}" + exit 1 +fi + +CLUSTER_FQDN="$1" +ACTION="$2" + +# Get interface name with 10 network IP +interface_name=$(ip -o -4 addr show | awk '$4 ~ /^10\./ {print $2}') + +# Check if any interfaces were found +if [ -n "$interface_name" ]; then + echo "Interfaces with IP addresses starting with 10.:" + echo "$interface_name" +else + echo "No interfaces found with IP addresses starting with 10." + ip -o -4 addr show + exit 1 +fi + +# Get the IP address of the specified interface +ip_address=$(ip -4 addr show "$interface_name" | grep -oP '(?<=inet\s)\d+(\.\d+){3}') +if [ -z "$ip_address" ]; then + echo "No IP address found for $interface_name. Exiting." + exit 1 +fi + +function setup_dns() { + sudo apt update -y + resolvectl status + dns_server_ip=$(resolvectl status | awk '/Current DNS Server/ {print $4}') + sudo apt install -y dnsmasq + sudo systemctl disable systemd-resolved + sudo systemctl stop systemd-resolved + + # Backup the original dnsmasq configuration file + echo "Backing up the original dnsmasq configuration..." + sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.bak + + # Get the current hostname + current_hostname=$(hostname) + echo "Adding hostname '$current_hostname' to /etc/hosts..." + echo "$ip_address $current_hostname" | sudo tee -a /etc/hosts > /dev/null + + # Unlink and recreate /etc/resolv.conf + echo "Configuring /etc/resolv.conf..." + sudo unlink /etc/resolv.conf + cat < {setup|config}" + exit 1 +fi diff --git a/ci/ven/libvirt-setup.sh b/ci/ven/libvirt-setup.sh new file mode 100755 index 000000000..e13d321e2 --- /dev/null +++ b/ci/ven/libvirt-setup.sh @@ -0,0 +1,118 @@ +#!/bin/bash +# SPDX-FileCopyrightText: (C) 2025 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +# Check virtualization environment +if command -v systemd-detect-virt &>/dev/null; then + env_type=$(systemd-detect-virt) + if [ "$env_type" == "none" ]; then + echo "Bare Metal continuing install" + else + echo "Running in a VM: $env_type" + fi +else + echo "systemd-detect-virt not found. Install or try another method." +fi + +# Update package list +sudo apt-get update +sudo apt-get install -y ca-certificates curl + +# TODO: Detect Ubuntu 22.04 or 24.04 and install packages accordingly + +# Install virtualization packages +sudo apt-get install -y qemu qemu-kvm libvirt-dev libvirt-daemon-system libvirt-clients pesign virt-manager ovmf expect minicom socat xterm efitools xsltproc libxslt1-dev + +# Start and enable libvirtd service +sudo systemctl start libvirtd +sudo systemctl enable libvirtd +sleep 3 + +# Add user to virtualization groups +sudo usermod -aG libvirt "$USER" +sudo usermod -aG kvm "$USER" + +# Backup and configure libvirtd +sudo cp /etc/libvirt/libvirtd.conf /etc/libvirt/libvirtd.conf.bak + +# Update libvirtd configuration +sudo sed -i 's/^#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/' /etc/libvirt/libvirtd.conf +sudo sed -i 's/^#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/' /etc/libvirt/libvirtd.conf + +#TODO detect ubuntu 22.04 or 24.04 +# based on that install softwares + +# Install specific packages +sudo apt-get install -y qemu qemu-kvm libvirt-dev + +# Install additional tools +sudo apt-get install -y libvirt-daemon-system libvirt-clients pesign virt-manager ovmf expect minicom socat xterm efitools + +sudo systemctl start libvirtd +sudo systemctl enable libvirtd +sleep 3 +sudo usermod -aG libvirt "$USER" +sudo usermod -aG kvm "$USER" + +# Backup the original configuration file +sudo cp /etc/libvirt/libvirtd.conf /etc/libvirt/libvirtd.conf.bak + +# Update the configuration file +sudo sed -i 's/^#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/' /etc/libvirt/libvirtd.conf +# Reload the systemd daemon to apply the changes +sudo systemctl daemon-reload + +#TODO detect ubuntu 22.04 or 24.04 +# based on that install softwares + +# Install specific packages +sudo apt-get install -y qemu qemu-kvm libvirt-dev + +# Install additional tools +sudo apt-get install -y libvirt-daemon-system libvirt-clients pesign virt-manager ovmf expect minicom socat xterm efitools + +sudo systemctl start libvirtd +sudo systemctl enable libvirtd +sleep 3 +sudo usermod -aG libvirt "$USER" +sudo usermod -aG kvm "$USER" + +# Backup the original configuration file +sudo cp /etc/libvirt/libvirtd.conf /etc/libvirt/libvirtd.conf.bak + +# Update the configuration file +sudo sed -i 's/^#unix_sock_group = "libvirt"/unix_sock_group = "libvirt"/' /etc/libvirt/libvirtd.conf +sudo sed -i 's/^#unix_sock_rw_perms = "0770"/unix_sock_rw_perms = "0770"/' /etc/libvirt/libvirtd.conf + +# Ensure the settings are present in the file if they were not commented out +grep -q '^unix_sock_group = "libvirt"' /etc/libvirt/libvirtd.conf || echo 'unix_sock_group = "libvirt"' | sudo tee -a /etc/libvirt/libvirtd.conf +grep -q '^unix_sock_rw_perms = "0770"' /etc/libvirt/libvirtd.conf || echo 'unix_sock_rw_perms = "0770"' | sudo tee -a /etc/libvirt/libvirtd.conf + +sudo systemctl restart libvirtd +# Disable apparmor profiles for libvirt +sudo ln -sf /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/ +sudo ln -sf /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper /etc/apparmor.d/disable/ +sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd +sudo apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper + +sudo systemctl restart libvirtd +sleep 2 +sudo systemctl reload apparmor +sleep 2 +# Verify installations and display versions +echo "Installed applications and their versions:" +dpkg -l | grep -E 'qemu|libvirt-daemon-system|ebtables|libguestfs-tools|libxslt-dev|libxml2-dev' + +# Check KVM support +echo "Checking KVM support..." +if kvm-ok; then + echo "KVM acceleration is supported on this system." +else + echo "KVM acceleration is not supported or not enabled. Please check your BIOS/UEFI settings." +fi +sudo chmod 666 /var/run/libvirt/libvirt-sock || true +sudo chmod 666 /var/run/libvirt/libvirt-sock-ro || true +# Restart libvirtd to refresh socket +sudo systemctl restart libvirtd || true +virsh list --all +virsh pool-list --all