|
| 1 | +*** Settings *** |
| 2 | +Documentation This test suite runs the tests with tedge-p11-server pinned to a fixed version to ensure that new |
| 3 | +... versions of thin-edge remain backwards compatible with tedge-p11-server's binary communication protocol. The |
| 4 | +... scope of this test is limited to tedge-p11-server's initial feature set and will generally not be expanded. |
| 5 | +
|
| 6 | +Resource pkcs11_common.resource |
| 7 | + |
| 8 | +Suite Setup Custom Setup |
| 9 | +Suite Teardown Get Suite Logs |
| 10 | + |
| 11 | +Test Tags adapter:docker theme:cryptoki compatibility |
| 12 | + |
| 13 | + |
| 14 | +*** Variables *** |
| 15 | +${TEDGE_P11_SERVER_VERSION} 1.6.1 |
| 16 | + |
| 17 | + |
| 18 | +*** Test Cases *** |
| 19 | +# the test cases are basically copy-pasted from private_key_storage.robot, as the purpose of this suite is to run the |
| 20 | +# exact same tests with a slightly different setup. It would be easiest if we could import the test cases themselves |
| 21 | +# from another test suite, but this isn't possible. So we extract reusable keywords into a resource file, but test cases |
| 22 | +# remain duplicated. |
| 23 | +Use Private Key in SoftHSM2 using tedge-p11-server |
| 24 | + Tedge Reconnect Should Succeed |
| 25 | + |
| 26 | +Renew certificate |
| 27 | + Execute Command tedge cert renew c8y |
| 28 | + Tedge Reconnect Should Succeed |
| 29 | + |
| 30 | + |
| 31 | +*** Keywords *** |
| 32 | +Custom Setup |
| 33 | + ${DEVICE_SN}= Setup register=${False} |
| 34 | + Set Suite Variable ${DEVICE_SN} |
| 35 | + |
| 36 | + # this doesn't install anything but adds cloudsmith repo to apt |
| 37 | + Execute Command curl -1sLf 'https://dl.cloudsmith.io/public/thinedge/tedge-main/setup.deb.sh' | sudo -E bash |
| 38 | + Execute Command cmd=apt-get install -y --allow-downgrades tedge-p11-server=${TEDGE_P11_SERVER_VERSION} |
| 39 | + ${stdout}= Execute Command tedge-p11-server -V strip=True |
| 40 | + Should Be Equal ${stdout} tedge-p11-server ${TEDGE_P11_SERVER_VERSION} |
| 41 | + |
| 42 | + # Allow the tedge user to access softhsm |
| 43 | + Execute Command sudo usermod -a -G softhsm tedge |
| 44 | + Transfer To Device ${CURDIR}/data/init_softhsm.sh /usr/bin/ |
| 45 | + |
| 46 | + # initialize the soft hsm and create a certificate signing request |
| 47 | + Execute Command tedge config set device.cryptoki.pin 123456 |
| 48 | + Execute Command tedge config set device.cryptoki.module_path /usr/lib/softhsm/libsofthsm2.so |
| 49 | + Execute Command sudo -u tedge /usr/bin/init_softhsm.sh --device-id "${DEVICE_SN}" --pin 123456 |
| 50 | + |
| 51 | + # configure tedge |
| 52 | + ${domain}= Cumulocity.Get Domain |
| 53 | + Execute Command tedge config set c8y.url "${domain}" |
| 54 | + Execute Command tedge config set mqtt.bridge.built_in true |
| 55 | + Execute Command tedge config set device.cryptoki.mode socket |
| 56 | + |
| 57 | + ${csr_path}= Execute Command cmd=tedge config get device.csr_path strip=${True} |
| 58 | + Register Device With Cumulocity CA ${DEVICE_SN} csr_path=${csr_path} |
| 59 | + |
| 60 | + Unset tedge-p11-server Uri |
0 commit comments