diff --git a/.gitlab/testbed.yml b/.gitlab/testbed.yml index 9a632f07b8..d7696b733c 100644 --- a/.gitlab/testbed.yml +++ b/.gitlab/testbed.yml @@ -26,6 +26,7 @@ DUT_TR181_WAN_INTERFACE: Device.Ethernet.Link.2. DUT_TR181_LAN_INTERFACE: Device.Ethernet.Link.3. CRAM_REMOTE_COMMAND: ssh root@$TARGET_LAN_IP + CRAM_REMOTE_COPY: scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null CRAM_TEST_SUITE: | .gitlab/tests/cram/generic/acceleration-plan-components .gitlab/tests/cram/$DUT_BOARD/acceleration-plan-components diff --git a/.gitlab/tests/cram/generic/lcm/030-lcm-general.t b/.gitlab/tests/cram/generic/lcm/030-lcm-general.t new file mode 100644 index 0000000000..4add2e60c2 --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/030-lcm-general.t @@ -0,0 +1,35 @@ +## Setup test configuration +Setup the test configuration: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + $ alias C="${CRAM_REMOTE_COPY:-}" + $ S=". /tmp/script_functions.sh" + $ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh + Warning: Permanently added '*' (*) to the list of known hosts* (glob) + + +Check Global Execution Environment and configuration: + + $ R "${S} && check_ee_status --ee" + 1 + Up + + +Check /lcm is using ext4 as filesystem: + + $ R "df -PkT /lcm" | awk '{print $2}' + Type + ext4 + + +Check internal Cthulhu.Config datamodel: + + $ R "${S} && check_cthulhu_config" + /lcm/rlyeh/images + /usr/*/cthulhu-lxc/cthulhu-lxc.so (glob) + 1 + + +Cleanup test environment: + + $ R "rm -f /tmp/script_functions.sh" diff --git a/.gitlab/tests/cram/generic/lcm/031-lcm-basic.t b/.gitlab/tests/cram/generic/lcm/031-lcm-basic.t new file mode 100644 index 0000000000..3ecb214d69 --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/031-lcm-basic.t @@ -0,0 +1,79 @@ +## Setup test configuration +Setup the test configuration: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + $ alias C="${CRAM_REMOTE_COPY:-}" + $ S=". /tmp/script_functions.sh" + $ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh 2>/dev/null + +### BASIC CONTAINER TEST +### Trying privileged and unprivileged modes and switching between them + +Install a the container in privileged mode and check its status and type: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged true" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && get_ctr_type --uuid" + Privileged container + $ R "${S} && execute_in_container --uuid --cmd 'cat /etc/container-version'" + 1 + +Update to prplOS container to v2 in unprivileged mode: + + $ R "${S} && update_ctr --version prplos-v2 --ee --uuid --privileged false" > /dev/null + $ sleep 20 + $ R "${S} && get_container_info --uuid" + Active + prplos-v2 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && get_ctr_type --uuid" + Unprivileged container + $ R "${S} && execute_in_container --uuid --cmd 'cat /etc/container-version'" + 2 + +Uninstall the testing container and check datamodel cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata false" + [1] + + +Install the container in unprivileged mode and check its status and type: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged false" > /dev/null + $ sleep 20 + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && get_ctr_type --uuid" + Unprivileged container + $ R "${S} && execute_in_container --uuid --cmd 'cat /etc/container-version'" + 1 + + +Update to prplOS container to v2 in privileged mode: + + $ R "${S} && update_ctr --version prplos-v2 --ee --uuid --privileged true" > /dev/null + $ sleep 20 + $ R "${S} && get_container_info --uuid" + Active + prplos-v2 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && get_ctr_type --uuid" + Privileged container + $ R "${S} && execute_in_container --uuid --cmd 'cat /etc/container-version'" + 2 + + +Uninstall the container and check everything is cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid" + [1] + + +Cleanup test environment: + + $ R "rm -f /tmp/script_functions.sh" diff --git a/.gitlab/tests/cram/generic/lcm/032-lcm-hostobject.t b/.gitlab/tests/cram/generic/lcm/032-lcm-hostobject.t new file mode 100644 index 0000000000..9db08fffdd --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/032-lcm-hostobject.t @@ -0,0 +1,59 @@ +## Setup test configuration +Set-up the test configuration: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + $ alias C="${CRAM_REMOTE_COPY:-}" + $ S=". /tmp/script_functions.sh" + $ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh 2>/dev/null + $ R "${S} && setup_hostobjects" + + +### PRIVILEGED CONTAINER SECTION ### +Install container with HostObject and check its running and objects shared: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged true --network --hostobject" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + +Verify share objects are available on container side: + + $ R "${S} && get_hostobjects" + /testdir/: + testfile + test sharing file + /dev/host_serial + +Uninstall the testing container and check datamodel cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata false" + [1] + +### UNPRIVILEGED CONTAINER SECTION ### +Install container with HostObject and check its running and objects shared: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged false --network --hostobject" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + +Verify share objects are available on container side: + + $ R "${S} && get_hostobjects" + /testdir/: + testfile + test sharing file + /dev/host_serial + +Uninstall the testing container and check datamodel cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata false" + [1] + + +Cleanup test environment: + + $ R "${S} && cleanup_hostobjects" + $ R "rm -f /tmp/script_functions.sh" diff --git a/.gitlab/tests/cram/generic/lcm/033-lcm-networking.t b/.gitlab/tests/cram/generic/lcm/033-lcm-networking.t new file mode 100644 index 0000000000..4b0f505523 --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/033-lcm-networking.t @@ -0,0 +1,99 @@ +## Setup test configuration +Set-up the test configuration: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + $ alias C="${CRAM_REMOTE_COPY:-}" + $ S=". /tmp/script_functions.sh" + $ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh 2>/dev/null + + +### PRIVILEGED CONTAINER SECTION ### +Install the container and check its status: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged true --network" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + +Check NetworkConfig correctly applied: + + $ sleep 30 + $ CTR_IP=$(R "${S} && get_ctr_ip --uuid") + $ R "rm -f /root/.ssh/known_hosts > /dev/null; ssh -y root@${CTR_IP} 'cat /etc/container-version ; ip route show default | grep default' 2> /dev/null" + 1 + default via 192.168.*.1 dev lcm0* (glob) + + +Update to prplOS container to v2: + + $ R "${S} && update_ctr --version prplos-v2 --ee --uuid --privileged true --network" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v2 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + +Check NetworkConfig correctly applied: + + $ sleep 30 + $ CTR_IP=$(R "${S} && get_ctr_ip --uuid") + $ R "rm -f /root/.ssh/known_hosts > /dev/null; ssh -y root@${CTR_IP} 'cat /etc/container-version ; ip route show default | grep default' 2> /dev/null" + 2 + default via 192.168.*.1 dev lcm0* (glob) + +Uninstall the container and check everything is cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid" + [1] + + +### UNPRIVILEGED CONTAINER SECTION #### +Install the container and check its status: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged false --network" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + +### Network connectivity test can only be done unpriv container gets the capability in its own net ns to +### bind to a system port (< 1024) or test container is modified to not use system ports for SSH +### Test only checks the attribution of IP address +Check NetworkConfig correctly applied: + + $ sleep 10 + $ R "${S} && get_ctr_ip --uuid" + 192.168.*.* (glob) +# $ sleep 30 +# $ R "rm -f /root/.ssh/known_hosts > /dev/null; ssh -y root@${CTR_IP} 'cat /etc/container-version ; ip route show default | grep default' 2> /dev/null" +# 1 +# default via 192.168.3.1 dev lcm0 + +Update to prplOS container to v2: + + $ R "${S} && update_ctr --version prplos-v2 --ee --uuid --privileged false --network" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v2 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + +### Network connectivity test can only be done unpriv container gets the capability in its own net ns to +### bind to a system port (< 1024) or test container is modified to not use system ports for SSH +### Test only checks the attribution of IP address +Check NetworkConfig correctly applied: + + $ R "${S} && get_ctr_ip --uuid" + 192.168.*.* (glob) +# $ R "rm -f /root/.ssh/known_hosts > /dev/null; ssh -y root@${CTR_IP} 'cat /etc/container-version ; ip route show default | grep default' 2> /dev/null" +# 2 +# default via 192.168.3.1 dev lcm0 + +Remove the container and check everything is cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid" + [1] + + +Cleanup test environment: + + $ R "rm -f /tmp/script_functions.sh" diff --git a/.gitlab/tests/cram/generic/lcm/034-lcm-envvar.t b/.gitlab/tests/cram/generic/lcm/034-lcm-envvar.t new file mode 100644 index 0000000000..7a7ada5d4f --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/034-lcm-envvar.t @@ -0,0 +1,63 @@ +## Setup test configuration +Set-up the test configuration: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + $ alias C="${CRAM_REMOTE_COPY:-}" + $ S=". /tmp/script_functions.sh" + $ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh 2>/dev/null + +### PRIVILEGED CONTAINER SECTION ### +Install container with EnvVariables and check its running: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged true --envvar" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + + +Verify that the EnvVariables were properly passed to the container: + + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep ENVVAR_KEY1" + ENVVAR_KEY1=ENVVAR_VALUE1 + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep ENVVAR_KEY2" + ENVVAR_KEY2=ENVVAR_VALUE2 + + +Update the container without EnvVariables and check its running the previous list is kept: + + $ R "${S} && update_ctr --version prplos-v2 --ee --uuid --privileged true" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v2 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep ENVVAR_KEY1" + ENVVAR_KEY1=ENVVAR_VALUE1 + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep ENVVAR_KEY2" + ENVVAR_KEY2=ENVVAR_VALUE2 + + +Update the container with a new list of EnvVariables and check its running and the variables updated: + + $ R "${S} && update_ctr --version prplos-v1 --ee --uuid --privileged true --envvar '[{Key=\"ENVVAR_KEY3\", Value=\"ENVVAR_VALUE3\"}]'" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep ENVVAR_KEY3" + ENVVAR_KEY3=ENVVAR_VALUE3 + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep ENVVAR_KEY1" + [1] + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep ENVVAR_KEY2" + [1] + + +Uninstall the testing container and check datamodel cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata false" + [1] + + +Cleanup test environment: + + $ R "rm -f /tmp/script_functions.sh" diff --git a/.gitlab/tests/cram/generic/lcm/035-lcm-usp.t b/.gitlab/tests/cram/generic/lcm/035-lcm-usp.t new file mode 100644 index 0000000000..454d50e2c6 --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/035-lcm-usp.t @@ -0,0 +1,80 @@ +## Setup test configuration +Setup the test configuration: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + $ alias C="${CRAM_REMOTE_COPY:-}" + $ S=". /tmp/script_functions.sh" + $ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh 2>/dev/null + + +Set-up ExecEnv configuration + + $ R "${S} && set_ee_usp_roles --roles \"Full Access\"" > /dev/null + $ R "${S} && check_available_roles --ee" + Device.LocalAgent.ControllerTrust.Role.1. + +### PRIVILEGED CONTAINER SECTION ### +Install the container and check its status and type: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged true --usprequired \"Full Access\"" > /dev/null + $ sleep 30 + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && get_ctr_type --uuid" + Privileged container + $ R "${S} && execute_in_container --uuid --cmd 'cat /etc/container-version'" + 1 + +Check that UDS sockets and the random USP_ENDPOINT_ID are shared with the container: + + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep USP_ENDPOINT_ID" + USP_ENDPOINT_ID=uuid::* (glob) + $ R "${S} && execute_in_container --uuid --cmd \"ls /run/usp/\"" + broker_agent_path + broker_controller_path + +## TODO: +## add test to check connection to USP broker: This is requiring support of USP in the test container + +Uninstall the container and check everything is cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid" + [1] + + +### UNPRIVILEGED CONTAINER SECTION ### +Install the container and check its status and type: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged false --usprequired \"Full Access\"" > /dev/null + $ sleep 30 + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + $ R "${S} && get_ctr_type --uuid" + Unprivileged container + $ R "${S} && execute_in_container --uuid --cmd 'cat /etc/container-version'" + 1 + +Check that UDS sockets and the random USP_ENDPOINT_ID are shared with the container: + + $ R "${S} && execute_in_container --uuid --cmd \"env\" | grep USP_ENDPOINT_ID" + USP_ENDPOINT_ID=uuid::* (glob) + $ R "${S} && execute_in_container --uuid --cmd \"ls /run/usp/\"" + broker_agent_path + broker_controller_path + +## TODO: add test to check connection to USP broker: This is requiring support of USP in the test container + +Uninstall the container and check everything is cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid" + [1] + + +Cleanup test environment: + + $ R "${S} && set_ee_usp_roles --roles \"\"" > /dev/null + $ R "rm -f /tmp/script_functions.sh" diff --git a/.gitlab/tests/cram/generic/lcm/036-lcm-applicationdata.t b/.gitlab/tests/cram/generic/lcm/036-lcm-applicationdata.t new file mode 100644 index 0000000000..809ca7887f --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/036-lcm-applicationdata.t @@ -0,0 +1,159 @@ +## Setup test configuration +Setup the test configuration: + + $ alias R="${CRAM_REMOTE_COMMAND:-}" + $ alias C="${CRAM_REMOTE_COPY:-}" + $ S=". /tmp/script_functions.sh" + $ C ${TESTDIR}/script_functions.sh root@${TARGET_LAN_IP}:/tmp/script_functions.sh 2>/dev/null + + +### PRIVILEGED CONTAINER SECTION ### +Install a test container with ApplicationData config and check it is running: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged true --network --appdata" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + + +Check that ApplicationData volumes are available inside the container and use them: + + $ R "${S} && execute_in_container --uuid --cmd 'ls -l /'" | grep volume | awk '{print $9}' + volume1 + volume2 + $ R "${S} && execute_in_container --uuid --cmd 'echo volume1_content > /volume1/file_volume1'" + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume1/file_volume1'" + volume1_content + $ R "${S} && execute_in_container --uuid --cmd 'echo volume2_content > /volume2/file_volume2'" + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume2/file_volume2'" + volume2_content + +Uninstall the testing container with retaining data and check it is cleaned in the datamodel: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata true" + [1] + + +Reinstall the container and check the content of the retained ApplicationData volumes: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged true --network --appdata" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + + $ R "${S} && execute_in_container --uuid --cmd 'ls -l /'" | grep volume | awk '{print $9}' + volume1 + volume2 + + $ R "${S} && execute_in_container --uuid --cmd 'ls /volume1/file_volume1'" 2> /dev/null + [1] + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume2/file_volume2'" + volume2_content + + +Test the upgrade persistence of the ApplicationData volumes: + + $ R "${S} && update_ctr --version prplos-v2 --ee --uuid --privileged true --network --appdata --retaindata true" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v2 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + + $ R "${S} && execute_in_container --uuid --cmd 'ls -l /'" | grep volume | awk '{print $9}' + volume1 + volume2 + + $ R "${S} && execute_in_container --uuid --cmd 'ls /volume1/file_volume1'" 2> /dev/null + [1] + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume2/file_volume2'" + volume2_content + + +Uninstall the testing container without retaining data and check it is cleaned in the datamodel: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata false" + [1] + + + + +### PRIVILEGED CONTAINER SECTION ### +Install a test container with ApplicationData config and check it is running: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged false --network --appdata" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + + +Check that ApplicationData volumes are available inside the container and use them: + + $ R "${S} && execute_in_container --uuid --cmd 'ls -l /'" | grep volume | awk '{print $9}' + volume1 + volume2 + $ R "${S} && execute_in_container --uuid --cmd 'echo volume1_content > /volume1/file_volume1'" + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume1/file_volume1'" + volume1_content + $ R "${S} && execute_in_container --uuid --cmd 'echo volume2_content > /volume2/file_volume2'" + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume2/file_volume2'" + volume2_content + +Uninstall the testing container with retaining data and check it is cleaned in the datamodel: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata true" + [1] + + +Reinstall the container and check the content of the retained ApplicationData volumes: + + $ R "${S} && install_ctr --version prplos-v1 --ee --uuid --privileged false --network --appdata" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v1 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + + $ R "${S} && execute_in_container --uuid --cmd 'ls -l /'" | grep volume | awk '{print $9}' + volume1 + volume2 + + $ R "${S} && execute_in_container --uuid --cmd 'ls /volume1/file_volume1'" 2> /dev/null + [1] + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume2/file_volume2'" + volume2_content + + $ R "${S} && execute_in_container --uuid --cmd 'ls /volume1/file_volume1'" 2> /dev/null + [1] + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume2/file_volume2'" + volume2_content + + +Test the upgrade persistence of the ApplicationData volumes: + + $ R "${S} && update_ctr --version prplos-v2 --ee --uuid --privileged false --network --appdata --retaindata true" > /dev/null + $ R "${S} && get_container_info --uuid" + Active + prplos-v2 + prpl-foundation/prplos/prplos/prplos/lcm-test-* (glob) + + $ R "${S} && execute_in_container --uuid --cmd 'ls -l /'" | grep volume | awk '{print $9}' + volume1 + volume2 + + $ R "${S} && execute_in_container --uuid --cmd 'ls /volume1/file_volume1'" 2> /dev/null + [1] + $ R "${S} && execute_in_container --uuid --cmd 'cat /volume2/file_volume2'" + volume2_content + + +Uninstall the testing container and check datamodel cleaned: + + $ R "${S} && uninstall_ctr_and_check --uuid --retaindata false" + [1] + + +Cleanup test environment: + + $ R "rm -f /tmp/script_functions.sh" diff --git a/.gitlab/tests/cram/generic/lcm/script_functions.sh b/.gitlab/tests/cram/generic/lcm/script_functions.sh new file mode 100755 index 0000000000..38cd58f2c0 --- /dev/null +++ b/.gitlab/tests/cram/generic/lcm/script_functions.sh @@ -0,0 +1,624 @@ +#!/bin/sh + +### Default parameters config when value is not provided +DEFAULT_UUID="00000000-0000-5000-b000-000000000001" +DEFAULT_HOSTOBJECT='[{Source="/tmp/testdir", Destination="/testdir", Options="type=mount,bind"}, {Source="/tmp/testfile", Destination="/testfile", Options="type=mount,bind"}, {Source="", Destination="/dev/host_serial", Options="type=device,devicetype=c,major=5,minor=1,access=rwm,create=1"}]' +#DEFAULT_NETWORK='{ShareParentNetwork = "true"}'' +DEFAULT_NETWORK='{AccessInterfaces = [{Reference = "Lan"}]}' +DEFAULT_EE="generic" +DEFAULT_APPDATA='[{Name = "Volume1", Capacity = 1, Retain = "UntilStopped", AccessPath = "/volume1"}, {Name = "Volume2", Capacity = 1, Retain = "Forever", AccessPath = "/volume2"}]' +DEFAULT_URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos" +DEFAULT_USPROLES="Full Access" +DEFAULT_USPREQUIRED="Full Access" +DEFAULT_USPOPTIONAL="" +DEFAULT_RETAINDATA="false" +DEFAULT_ENVVAR='[{Key="ENVVAR_KEY1", Value="ENVVAR_VALUE1"}, {Key="ENVVAR_KEY2", Value="ENVVAR_VALUE2"}]' + +CLI_JSON="ba-cli -l -j" +CLI="ba-cli" + +MAX_WAIT_CTR_UP=60 + + +## Return default container name based on target. +## Default is ARM container +get_container_name(){ + board_name=$(cat /tmp/sysinfo/board_name | cut -d ',' -f 2) + if [ "${board_name}" = "haze" ] || [ "${board_name}" = "freedom" ]; then + echo lcm-test-ipq807x-generic + elif [ "${board_name}" = "lgm" ] || [ "${board_name}" = "qemu-standard-pc-i440fx-piix-1996" ]; then + echo lcm-test-x86-64 + else + echo lcm-test-ipq807x-generic + fi +} + + +concat_comma_string() { + _concat_global_str="$1" + _concat_param="$2" + + if [ -n "${_concat_global_str}" ]; then + _concat_global_str="${_concat_global_str}, " + fi + + _concat_global_str="${_concat_global_str}${_concat_param}" + + echo "${_concat_global_str}" +} + +## waits for a container to go up or timeout +wait_ctr_up(){ + uuid="" + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "uuid" ]; then + uuid=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + else + echo "Unknown argument: ${key}=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${uuid}" ]; then + echo "Missing UUID parameter: Cannot wait for container up" + else + duid=$(${CLI_JSON} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\" ].DUID?" | jsonfilter -e @[*].*.DUID) + if [ -z "${duid}" ]; then + echo "Container with UUID=${uuid} is not found" + return + fi + i=0 + while [ $i -le ${MAX_WAIT_CTR_UP} ]; do + status=$(${CLI_JSON} "SoftwareModules.ExecutionUnit.[ EUID == \"${duid}\" ].Status?" | jsonfilter -e @[*].*.Status) + if [ "${status}" != "Active" ]; then + i=$((i+2)) + sleep 2 + else + break + fi + # timeout + done + fi +} + +## waits for a container to go down or timeout +wait_ctr_down(){ + # Read max shutdown delay + shutdowndelay=$(${CLI_JSON} Cthulhu.Config.GracefulShutdownTimeoutSeconds? | jsonfilter -e @[*].*.GracefulShutdownTimeoutSeconds) + if [ -z "$shutdowndelay" ]; then + shutdowndelay=10 + fi + + # Add extra 3 seconds delay + shutdowndelay=$((shutdowndelay+3)) + + sleep ${shutdowndelay} +} + +## Return default value if no value is given +## or the value provided +value_or_default(){ + _assign_value_missing="$1" + _assign_default="$2" + _assign_value="$3" + + if [ "${_assign_value_missing}" = "true" ]; then + echo "${_assign_default}" + else + echo "${_assign_value}" + fi +} + +install_update_ctr_with_params() { + operation=$1 + if [ "${operation}" != "install" ] && [ "${operation}" != "update" ]; then + echo "Unknown operation: $operation" + return + fi + + shift + str_params="" + uuid="" + + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "url" ]; then + #value=$(value_or_default "${value_missing}" "$(get_container_url)" "${value}") + str_params=$(concat_comma_string "${str_params}" "URL = \"${value}\"") + elif [ "${key}" = "version" ]; then + ctr_name=$(get_container_name) + str_params=$(concat_comma_string "${str_params}" "URL = \"${DEFAULT_URL}/${ctr_name}:${value}\"") + elif [ "${key}" = "uuid" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + str_params=$(concat_comma_string "${str_params}" "UUID = ${value}") + uuid=${value} + elif [ "${key}" = "ee" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_EE}" "${value}") + str_params=$(concat_comma_string "${str_params}" "ExecutionEnvRef = \"${value}\"") + elif [ "${key}" = "network" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_NETWORK}" "${value}") + str_params=$(concat_comma_string "${str_params}" "NetworkConfig = ${value}") + elif [ "${key}" = "hostobject" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_HOSTOBJECT}" "${value}") + str_params=$(concat_comma_string "${str_params}" "HostObject = ${value}") + elif [ "${key}" = "appdata" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_APPDATA}" "${value}") + str_params=$(concat_comma_string "${str_params}" "ApplicationData = ${value}") + elif [ "${key}" = "usprequired" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_USPREQUIRED}" "${value}") + str_params=$(concat_comma_string "${str_params}" "RequiredRoles = \"${value}\"") + elif [ "${key}" = "uspeoptional" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_USPOPTIONAL}" "${value}") + str_params=$(concat_comma_string "${str_params}" "OptionalRoles = \"${value}\"") + elif [ "${key}" = "privileged" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_PRIVILEGED}" "${value}") + str_params=$(concat_comma_string "${str_params}" "Privileged = ${value}") + if [ "${value}" = "false" ]; then + str_params=$(concat_comma_string "${str_params}" "NumRequiredUIDs = 10") + fi + elif [ "${key}" = "retaindata" ]; then + retaindata=$(value_or_default "${value_missing}" "${DEFAULT_RETAINDATA}" "${value}") + str_params=$(concat_comma_string "${str_params}" "RetainData = $retaindata") + elif [ "${key}" = "envvar" ]; then + value=$(value_or_default "${value_missing}" "${DEFAULT_ENVVAR}" "${value}") + str_params=$(concat_comma_string "${str_params}" "EnvVariable = ${value}") + else + echo "Unknown paramter: ${key}" + fi + + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + + if [ "${operation}" = "install" ]; then + ${CLI} "SoftwareModules.InstallDU($str_params)" + elif [ "${operation}" = "update" ]; then + ${CLI} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\" ].Update($str_params)" + wait_ctr_down + fi + + wait_ctr_up --uuid "${uuid}" +} + +uninstall_ctr() { + uuid="" + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "uuid" ]; then + uuid=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + elif [ "${key}" = "retaindata" ]; then + retaindata=$(value_or_default "${value_missing}" "${DEFAULT_RETAINDATA}" "${value}") + else + echo "Unknown argument: $key=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${uuid}" ]; then + echo "Missing UUID paramter: Uninstall not possible" + else + ${CLI} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\" ].Uninstall(RetainData = ${retaindata})" + fi + +} + +uninstall_ctr_and_check() { + save_params="$*" + uuid="" + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "uuid" ]; then + uuid=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + elif [ "${key}" = "retaindata" ]; then + retaindata=$(value_or_default "${value_missing}" "${DEFAULT_RETAINDATA}" "${value}") + else + echo "Unknown argument: $key=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${uuid}" ]; then + echo "Missing UUID parameter. Cannot uninstall ctr" + else + duid=$(${CLI_JSON} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\" ].DUID?" | jsonfilter -e @[*].*.DUID) + + # uninstall the container and then check that both the DU and EU instances are gone + # shellcheck disable=SC2086 + uninstall_ctr ${save_params} >> /dev/null + wait_ctr_down + ${CLI_JSON} "SoftwareModules.DeploymentUnit.[ DUID == \"$duid\" ].?0" | jsonfilter -e @[*].*.UUID \ + && ${CLI_JSON} "SoftwareModules.ExecutionUnit.[ EUID == \"$duid\" ].?0" | jsonfilter -e @[*].*.EUID \ + && ${CLI_JSON} "Rlyeh.Images.[ DUID == \"$duid\" ].?0" | jsonfilter -e @[*].*.DUID + fi +} + +## returns container status, version and name +get_container_info(){ + uuid="" + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "uuid" ]; then + uuid=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + else + echo "Unknown argument: $key=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${uuid}" ]; then + echo "Missing UUID parameter: Cannot get info" + else + duid=$(${CLI_JSON} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\" ].DUID?" | jsonfilter -e @[*].*.DUID) + ${CLI_JSON} "SoftwareModules.ExecutionUnit.[ EUID == \"${duid}\" ].?0" | jsonfilter -e @[*].*.Status -e @[*].*.Version | sort + ${CLI_JSON} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\"].Name?0" | jsonfilter -e @[*].*.Name + fi +} + + +set_ee_usp_roles(){ + roles="" + ee=${DEFAULT_EE} + + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "roles" ]; then + roles=$(value_or_default "${value_missing}" "${DEFAULT_USPROLES}" "${value}") + elif [ "${key}" = "ee" ]; then + ee=$(value_or_default "${value_missing}" "${DEFAULT_EE}" "${value}") + else + echo "Unknown argument: ${key}=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + ## Roles list can be empty + ${CLI} "SoftwareModules.ExecEnv.[ Name == \"${ee}\" ].ModifyAvailableRoles(AvailableRoles = \"${roles}\")" +} + +check_available_roles() { + roles="" + ee=${DEFAULT_EE} + + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "ee" ]; then + ee=$(value_or_default "${value_missing}" "${DEFAULT_EE}" "${value}") + else + echo "Unknown argument: ${key}=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "$ee" ]; then + echo "Missing EE parameter." + else + ${CLI_JSON} "SoftwareModules.ExecEnv.[ Name == \"${ee}\" ].AvailableRoles?" | jsonfilter -e @[*].*.AvailableRoles + fi +} + +execute_in_container() { + uuid="" + cmd="" + + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "uuid" ]; then + uuid=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + elif [ "${key}" = "cmd" ]; then + cmd="${value}" + else + echo "Unknown argument: $key=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${uuid}" ]; then + echo "Missing UUID parameter." + else + duid=$(${CLI_JSON} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\" ].DUID?" | jsonfilter -e @[*].*.DUID) + lxc-attach "${duid}" -- sh -c "${cmd}" + fi + +} + +check_ee_status(){ + ee="" + while [ $# -gt 0 ]; do + key="$1" + value="" + ee=${DEFAULT_EE} + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "ee" ]; then + ee=$(value_or_default "${value_missing}" "${DEFAULT_EE}" "${value}") + else + echo "Unknown argument: ${key}=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${ee}" ]; then + echo "Missing EE parameter." + else + ${CLI_JSON} "SoftwareModules.ExecEnv.[ Name == \"${ee}\" ].?0" | jsonfilter -e @[*].*.Status -e @[*].*.Enable | sort + fi +} + +check_cthulhu_config(){ + ${CLI_JSON} "Cthulhu.Config.?0" | jsonfilter -e @[*].*.UseOverlayFS -e @[*].*.DefaultBackend -e @[*].*.ImageLocation | sort +} + +get_ctr_ip(){ + uuid="" + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "uuid" ]; then + uuid=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + else + echo "Unknown argument: $key=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${uuid}" ]; then + echo "Missing UUID parameter: Cannot retrieve IP" + else + ${CLI_JSON} "Cthulhu.Container.Instances.[ LinkedUUID == \"${uuid}\" ].Interfaces.[Name == \"lcm0\"].Addresses.1.?" | jsonfilter -e @[*].*.Address + fi +} + +get_ctr_type(){ + uuid="" + while [ $# -gt 0 ]; do + key="$1" + value="" + value_missing=false + case $key in + --*) # If argument starts with "--" + key="${key#--}" + shift + if [ $# -gt 0 ] && case "$1" in --*) false;; *) true;; esac; then + value="$1" + shift + elif [ $# -eq 0 ] || case "$1" in --*) true;; *) false;; esac; then + value_missing=true + fi + + if [ "${key}" = "uuid" ]; then + uuid=$(value_or_default "${value_missing}" "${DEFAULT_UUID}" "${value}") + else + echo "Unknown argument: $key=${value}" + fi + ;; + *) + echo "Unknown argument: $1" + shift + ;; + esac + done + + if [ -z "${uuid}" ]; then + echo "Missing UUID parameter: Cannot retrieve IP" + else + duid=$(${CLI_JSON} "SoftwareModules.DeploymentUnit.[ UUID == \"${uuid}\" ].DUID?" | jsonfilter -e @[*].*.DUID) + uid=$(${CLI_JSON} "SoftwareModules.ExecutionUnit.[ EUID == \"${duid}\" ].?0" | jsonfilter -e @[*].*.AllocatedHostUID) + gid=$(${CLI_JSON} "SoftwareModules.ExecutionUnit.[ EUID == \"${duid}\" ].?0" | jsonfilter -e @[*].*.AllocatedHostGID) + + if [ "${uid}" -ne 0 ] && [ "${gid}" -ne 0 ]; then + echo "Unprivileged container" + elif [ "${uid}" -eq 0 ] && [ "${gid}" -eq 0 ]; then + echo "Privileged container" + else + echo "Unknown container" + fi + fi + +} + +install_ctr() { + install_update_ctr_with_params install "$@" +} + +update_ctr() { + install_update_ctr_with_params update "$@" +} + +## Create the host object resources used for the default HostObject config +setup_hostobjects() { + mkdir /tmp/testdir + echo 'test sharing a dir' > /tmp/testdir/testfile + echo 'test sharing file' > /tmp/testfile + + chmod -R 777 /tmp/testdir + chmod -R 777 /tmp/testfile +} + +cleanup_hostobjects() { + rm -rf /tmp/testdir + rm -f /tmp/testfile +} + +get_hostobjects() { + execute_in_container --uuid --cmd "ls -R /testdir/" + execute_in_container --uuid --cmd "cat /testfile" + execute_in_container --uuid --cmd "ls /dev/host_serial" +} diff --git a/.gitlab/tests/cram/mxl25641-hdk-6/acceleration-plan-components/030-lcm.t b/.gitlab/tests/cram/mxl25641-hdk-6/acceleration-plan-components/030-lcm.t deleted file mode 100644 index 5cf635e59a..0000000000 --- a/.gitlab/tests/cram/mxl25641-hdk-6/acceleration-plan-components/030-lcm.t +++ /dev/null @@ -1,92 +0,0 @@ -Create R alias: - - $ alias R="${CRAM_REMOTE_COMMAND:-}" - -Check Cthulhu.Sandbox datamodel: - - $ R "ubus -S call Cthulhu.Sandbox.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Enable -e @[*].SandboxId | sort" - Up - generic - true - -Check Cthulhu.Config datamodel: - - $ R "ubus -S call Cthulhu.Config _get | jsonfilter -e @[*].UseOverlayFS -e @[*].DefaultBackend -e @[*].ImageLocation | sort" - /lcm/rlyeh/images - /usr/lib/cthulhu-lxc/cthulhu-lxc.so - true - -Install testing prplOS container v1: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.InstallDU\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64:prplos-v1", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v1 is running: - - $ sleep 40 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64 - prplos-v1 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.1.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 1 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Update to prplOS container v2: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Update\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64:prplos-v2", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v2 is running: - - $ sleep 40 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64 - prplos-v2 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.2.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 2 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Uninstall prplOS testing container: - - $ script --command "ssh -t root@$TARGET_LAN_IP 'ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Uninstall\(\)'" > /dev/null; sleep 10 - -Check that prplOS container is not running: - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get" - [4] - -Check that Rlyeh has no container images: - - $ R "ubus -S call Rlyeh.Images _get" - {"Rlyeh.Images.":{}} - {} - {"amxd-error-code":0} diff --git a/.gitlab/tests/cram/prpl-haze/acceleration-plan-components/030-lcm.t b/.gitlab/tests/cram/prpl-haze/acceleration-plan-components/030-lcm.t deleted file mode 100644 index b1ba8dbd62..0000000000 --- a/.gitlab/tests/cram/prpl-haze/acceleration-plan-components/030-lcm.t +++ /dev/null @@ -1,93 +0,0 @@ -Create R alias: - - $ alias R="${CRAM_REMOTE_COMMAND:-}" - -Check Cthulhu.Sandbox datamodel: - - $ R "ubus -S call Cthulhu.Sandbox.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Enable -e @[*].SandboxId | sort" - Up - generic - true - -Check Cthulhu.Config datamodel: - - $ R "ubus -S call Cthulhu.Config _get | jsonfilter -e @[*].UseOverlayFS -e @[*].DefaultBackend -e @[*].ImageLocation | sort" - /lcm/rlyeh/images - /usr/lib/cthulhu-lxc/cthulhu-lxc.so - true - -Install testing prplOS container v1: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.InstallDU\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic:prplos-v1", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v1 is running: - - $ sleep 30 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic - prplos-v1 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.1.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 1 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Update to prplOS container v2: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Update\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic:prplos-v2", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v2 is running: - - $ sleep 30 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic - prplos-v2 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.2.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 2 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Uninstall prplOS testing container: - - $ script --command "ssh -t root@$TARGET_LAN_IP 'ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Uninstall\(\)'" > /dev/null; sleep 5 - -Check that prplOS container is not running: - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get" - [4] - -Check that Rlyeh has no container images: - - $ R "ubus -S call Rlyeh.Images _get" - {"Rlyeh.Images.":{}} - {} - {"amxd-error-code":0} diff --git a/.gitlab/tests/cram/turris-omnia/acceleration-plan-components/030-lcm.t b/.gitlab/tests/cram/turris-omnia/acceleration-plan-components/030-lcm.t deleted file mode 100644 index 334ede34a3..0000000000 --- a/.gitlab/tests/cram/turris-omnia/acceleration-plan-components/030-lcm.t +++ /dev/null @@ -1,93 +0,0 @@ -Create R alias: - - $ alias R="${CRAM_REMOTE_COMMAND:-}" - -Check Cthulhu.Sandbox datamodel: - - $ R "ubus -S call Cthulhu.Sandbox.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Enable -e @[*].SandboxId | sort" - Up - generic - true - -Check Cthulhu.Config datamodel: - - $ R "ubus -S call Cthulhu.Config _get | jsonfilter -e @[*].UseOverlayFS -e @[*].DefaultBackend -e @[*].ImageLocation | sort" - /lcm/rlyeh/images - /usr/lib/cthulhu-lxc/cthulhu-lxc.so - true - -Install testing prplOS container v1: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.InstallDU\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-mvebu-cortexa9:prplos-v1", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v1 is running: - - $ sleep 30 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-mvebu-cortexa9 - prplos-v1 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.1.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 1 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Update to prplOS container v2: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Update\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-mvebu-cortexa9:prplos-v2", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v2 is running: - - $ sleep 30 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-mvebu-cortexa9 - prplos-v2 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.2.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 2 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Uninstall prplOS testing container: - - $ script --command "ssh -t root@$TARGET_LAN_IP 'ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Uninstall\(\)'" > /dev/null; sleep 5 - -Check that prplOS container is not running: - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get" - [4] - -Check that Rlyeh has no container images: - - $ R "ubus -S call Rlyeh.Images _get" - {"Rlyeh.Images.":{}} - {} - {"amxd-error-code":0} diff --git a/.gitlab/tests/cram/urx851-b0-dk/acceleration-plan-components/030-lcm.t b/.gitlab/tests/cram/urx851-b0-dk/acceleration-plan-components/030-lcm.t deleted file mode 100644 index 5cf635e59a..0000000000 --- a/.gitlab/tests/cram/urx851-b0-dk/acceleration-plan-components/030-lcm.t +++ /dev/null @@ -1,92 +0,0 @@ -Create R alias: - - $ alias R="${CRAM_REMOTE_COMMAND:-}" - -Check Cthulhu.Sandbox datamodel: - - $ R "ubus -S call Cthulhu.Sandbox.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Enable -e @[*].SandboxId | sort" - Up - generic - true - -Check Cthulhu.Config datamodel: - - $ R "ubus -S call Cthulhu.Config _get | jsonfilter -e @[*].UseOverlayFS -e @[*].DefaultBackend -e @[*].ImageLocation | sort" - /lcm/rlyeh/images - /usr/lib/cthulhu-lxc/cthulhu-lxc.so - true - -Install testing prplOS container v1: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.InstallDU\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64:prplos-v1", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v1 is running: - - $ sleep 40 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64 - prplos-v1 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.1.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 1 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Update to prplOS container v2: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Update\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64:prplos-v2", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v2 is running: - - $ sleep 40 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-x86-64 - prplos-v2 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.2.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 2 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Uninstall prplOS testing container: - - $ script --command "ssh -t root@$TARGET_LAN_IP 'ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Uninstall\(\)'" > /dev/null; sleep 10 - -Check that prplOS container is not running: - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get" - [4] - -Check that Rlyeh has no container images: - - $ R "ubus -S call Rlyeh.Images _get" - {"Rlyeh.Images.":{}} - {} - {"amxd-error-code":0} diff --git a/.gitlab/tests/cram/wnc-freedom/acceleration-plan-components/030-lcm.t b/.gitlab/tests/cram/wnc-freedom/acceleration-plan-components/030-lcm.t deleted file mode 100644 index 15ecdf2857..0000000000 --- a/.gitlab/tests/cram/wnc-freedom/acceleration-plan-components/030-lcm.t +++ /dev/null @@ -1,93 +0,0 @@ -Create R alias: - - $ alias R="${CRAM_REMOTE_COMMAND:-}" - -Check Cthulhu.Sandbox datamodel: - - $ R "ubus -S call Cthulhu.Sandbox.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Enable -e @[*].SandboxId | sort" - Up - generic - true - -Check Cthulhu.Config datamodel: - - $ R "ubus -S call Cthulhu.Config _get | jsonfilter -e @[*].UseOverlayFS -e @[*].DefaultBackend -e @[*].ImageLocation | sort" - /lcm/rlyeh/images - /usr/lib/cthulhu-lxc/cthulhu-lxc.so - true - -Install testing prplOS container v1: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.InstallDU\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic:prplos-v1", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > ExecutionEnvRef="generic", \ - > Privileged=True, \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v1 is running: - - $ sleep 30 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic - prplos-v1 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.1.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 1 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Update to prplOS container v2: - - $ cat > /tmp/run-container < ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Update\( \ - > URL="docker://registry.gitlab.com/prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic:prplos-v2", \ - > UUID="0f032bd7-54bd-5b81-b14e-9441d730092f", \ - > Privileged=True, \ - > ExecutionEnvRef="generic", \ - > NetworkConfig = { "AccessInterfaces" = [{"Reference" = "Lan"}] } \ - > \) - > EOF - $ script --command "ssh -t root@$TARGET_LAN_IP '$(cat /tmp/run-container)'" > /dev/null - -Check that prplOS container v2 is running: - - $ sleep 30 - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get | jsonfilter -e @[*].Status -e @[*].Bundle -e @[*].BundleVersion -e @[*].ContainerId -e @[*].Alias | sort" - Running - c879945e-d002-5775-88a8-e29bc0c641b4 - cpe-c879945e-d002-5775-88a8-e29bc0c641b4 - prpl-foundation/prplos/prplos/prplos/lcm-test-ipq807x-generic - prplos-v2 - - $ container_ip=$(R "ubus call DHCPv4Server.Pool.3.Client.2.IPv4Address.1 _get | jsonfilter -e @[*].IPAddress") - $ R "ssh -y root@$container_ip 'cat /etc/container-version ; ip r' 2> /dev/null" - 2 - default via 192.168.3.1 dev lcm0 - 192.168.3.0/24 dev lcm0 scope link src 192.168.3.100 - -Uninstall prplOS testing container: - - $ script --command "ssh -t root@$TARGET_LAN_IP 'ubus-cli SoftwareModules.DeploymentUnit.cpe-c879945e-d002-5775-88a8-e29bc0c641b4.Uninstall\(\)'" > /dev/null; sleep 5 - -Check that prplOS container is not running: - - $ R "ubus -S call Cthulhu.Container.Instances.1 _get" - [4] - -Check that Rlyeh has no container images: - - $ R "ubus -S call Rlyeh.Images _get" - {"Rlyeh.Images.":{}} - {} - {"amxd-error-code":0}