diff --git a/.builder/actions/build_samples.py b/.builder/actions/build_samples.py index 9ebf864f31..337e3053ae 100644 --- a/.builder/actions/build_samples.py +++ b/.builder/actions/build_samples.py @@ -20,30 +20,12 @@ def run(self, env): steps = [] samples = [ 'samples/commands/commands-sandbox', - 'samples/deprecated/fleet_provisioning/fleet_provisioning', - 'samples/deprecated/fleet_provisioning/mqtt5_fleet_provisioning', - 'samples/deprecated/jobs/job_execution', - 'samples/deprecated/jobs/mqtt5_job_execution', - 'samples/deprecated/shadow/shadow_sync', - 'samples/deprecated/shadow/mqtt5_shadow_sync', 'samples/greengrass/basic_discovery', 'samples/greengrass/ipc', 'samples/fleet_provisioning/provision-basic', 'samples/fleet_provisioning/provision-csr', 'samples/jobs/jobs-sandbox', - 'samples/mqtt/basic_connect', - 'samples/mqtt/custom_authorizer_connect', - 'samples/mqtt/pkcs11_connect', - 'samples/mqtt/pkcs12_connect', - 'samples/mqtt/websocket_connect', - 'samples/mqtt/windows_cert_connect', - 'samples/mqtt/x509_credentials_provider_connect', - 'samples/mqtt/custom_authorizer_connect', - 'samples/mqtt/cognito_connect', 'samples/mqtt5/mqtt5_pubsub', - 'samples/mqtt5/mqtt5_shared_subscription', - "samples/pub_sub/basic_pub_sub", - "samples/pub_sub/cycle_pub_sub", 'samples/secure_tunneling/secure_tunnel', 'samples/secure_tunneling/tunnel_notification', 'samples/shadow/shadow-sandbox', @@ -55,20 +37,13 @@ def run(self, env): defender_samples.append('samples/device_defender/basic_report') defender_samples.append('samples/device_defender/mqtt5_basic_report') - da_samples = [ - 'deviceadvisor/tests/mqtt_connect', - 'deviceadvisor/tests/mqtt_publish', - 'deviceadvisor/tests/mqtt_subscribe', - 'deviceadvisor/tests/shadow_update' - ] - servicetests = [ 'servicetests/tests/JobsExecution/', 'servicetests/tests/FleetProvisioning/', 'servicetests/tests/ShadowUpdate/', ] - for sample_path in itertools.chain(samples, servicetests, da_samples, defender_samples): + for sample_path in itertools.chain(samples, servicetests, defender_samples): build_path = os.path.join('build', sample_path) steps.append(['cmake', f'-B{build_path}', diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5fe162a99..61201e2709 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,6 @@ env: CI_SHADOW_ROLE: arn:aws:iam::180635532705:role/CI_Shadow_Role CI_JOBS_ROLE: arn:aws:iam::180635532705:role/CI_Jobs_Role CI_FLEET_PROVISIONING_ROLE: arn:aws:iam::180635532705:role/service-role/CI_FleetProvisioning_Role - CI_DEVICE_ADVISOR: arn:aws:iam::180635532705:role/CI_DeviceAdvisor_Role CI_DEVICE_DEFENDER: arn:aws:iam::180635532705:role/CI_DeviceDefender_Role CI_SECURE_TUNNEL: arn:aws:iam::180635532705:role/CI_SecureTunnel_Role CI_X509_ROLE: arn:aws:iam::180635532705:role/CI_X509_Role @@ -43,6 +42,7 @@ jobs: linux-compat: runs-on: ubuntu-22.04 strategy: + fail-fast: false matrix: image: - manylinux2014-x64 @@ -69,6 +69,7 @@ jobs: run: | aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ matrix.image }} build -p ${{ env.PACKAGE_NAME }} + raspberry: runs-on: ubuntu-24.04 # latest strategy: @@ -91,9 +92,11 @@ jobs: run: | aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ matrix.image }} build -p ${{ env.PACKAGE_NAME }} + linux-compiler-compat: runs-on: ubuntu-22.04 strategy: + fail-fast: false matrix: compiler: - clang-6 @@ -119,6 +122,7 @@ jobs: run: | aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ env.LINUX_BASE_IMAGE }} build -p ${{ env.PACKAGE_NAME }} --compiler=${{ matrix.compiler }} + byo-crypto: runs-on: ubuntu-latest permissions: @@ -134,6 +138,7 @@ jobs: run: | aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ env.LINUX_BASE_IMAGE }} build -p ${{ env.PACKAGE_NAME }} --cmake-extra=-DBYO_CRYPTO=ON --variant=skip_sample + linux-no-cpu-extensions: runs-on: ubuntu-latest permissions: @@ -149,6 +154,7 @@ jobs: run: | aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ env.LINUX_BASE_IMAGE }} build -p ${{ env.PACKAGE_NAME }} --cmake-extra=-DUSE_CPU_EXTENSIONS=OFF + windows: runs-on: windows-latest permissions: @@ -165,46 +171,13 @@ jobs: cd ${{ env.CI_FOLDER }} python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder.pyz')" python builder.pyz build -p ${{ env.PACKAGE_NAME }} - - name: Running samples in CI setup - run: | - python -m pip install boto3 - - name: configure AWS credentials (PubSub) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_PUBSUB_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT3 PubSub sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_windows_cfg.json - - name: run Windows Certificate Connect sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_windows_cert_connect_cfg.json - - name: configure AWS credentials (MQTT5) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_MQTT5_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT5 PubSub sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_windows_cfg.json - - name: configure AWS credentials (Device Advisor) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_DEVICE_ADVISOR }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run DeviceAdvisor - run: | - cd ${{ env.CI_FOLDER }}/aws-iot-device-sdk-cpp-v2 - python ./deviceadvisor/script/DATestRun.py + windows-vs17: runs-on: windows-2025 strategy: + fail-fast: false matrix: arch: [Win32, x64] - fail-fast: false permissions: id-token: write # This is required for requesting the JWT steps: @@ -221,40 +194,7 @@ jobs: cd ${{ env.CI_FOLDER }} python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" python builder.pyz build -p ${{ env.PACKAGE_NAME }} --cmake-extra=-Tv143 --cmake-extra=-A${{ matrix.arch }} - - name: Running samples in CI setup - run: | - python -m pip install boto3 - - name: configure AWS credentials (PubSub) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_PUBSUB_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT3 PubSub sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_windows_cfg.json - - name: run Windows Certificate Connect sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_windows_cert_connect_cfg.json - - name: configure AWS credentials (MQTT5) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_MQTT5_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT5 PubSub sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_windows_cfg.json - - name: configure AWS credentials (Device Advisor) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_DEVICE_ADVISOR }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run DeviceAdvisor - run: | - cd ${{ env.CI_FOLDER }}/aws-iot-device-sdk-cpp-v2 - python ./deviceadvisor/script/DATestRun.py + windows-no-cpu-extensions: runs-on: windows-latest permissions: @@ -271,40 +211,7 @@ jobs: cd ${{ env.CI_FOLDER }} python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder.pyz')" python builder.pyz build -p ${{ env.PACKAGE_NAME }} --cmake-extra=-DUSE_CPU_EXTENSIONS=OFF - - name: Running samples in CI setup - run: | - python -m pip install boto3 - - name: configure AWS credentials (PubSub) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_PUBSUB_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT3 PubSub sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_windows_cfg.json - - name: run Windows Certificate Connect sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_windows_cert_connect_cfg.json - - name: configure AWS credentials (MQTT5) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_MQTT5_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT5 PubSub sample - run: | - cd ${{ env.CI_FOLDER }} - python ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_windows_cfg.json - - name: configure AWS credentials (Device Advisor) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_DEVICE_ADVISOR }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run DeviceAdvisor - run: | - cd ${{ env.CI_FOLDER }}/aws-iot-device-sdk-cpp-v2 - python ./deviceadvisor/script/DATestRun.py + windows-app-verifier: runs-on: windows-2025 permissions: @@ -324,16 +231,17 @@ jobs: - name: Running samples in CI setup run: | python -m pip install boto3 - - name: configure AWS credentials (CyclePubSub) + - name: configure AWS credentials (MQTT5) uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ env.CI_CYCLEPUBSUB_ROLE }} + role-to-assume: ${{ env.CI_MQTT5_ROLE }} aws-region: ${{ env.AWS_DEFAULT_REGION }} - name: Run and check AppVerifier run: | cd ${{ env.CI_FOLDER }} - echo "Starting to run AppVerifier with cycle pub-sub sample" - python ${{ env.CI_UTILS_FOLDER }}/appverifier_launch_sample.py --sample_file ".\aws-iot-device-sdk-cpp-v2\build\samples\pub_sub\cycle_pub_sub\RelWithDebInfo\cycle-pub-sub.exe" --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/CyclePubSub/cert' --sample_secret_private_key 'ci/CyclePubSub/key' + echo "Starting to run AppVerifier with mqtt5 pub-sub sample" + python ${{ env.CI_UTILS_FOLDER }}/appverifier_launch_sample.py --sample_file ".\aws-iot-device-sdk-cpp-v2\build\samples\mqtt5\mqtt5_pubsub\RelWithDebInfo\mqtt5_pubsub.exe" --sample_secret_endpoint 'ci/endpoint' --sample_secret_certificate 'ci/mqtt5/us/mqtt5_thing/cert' --sample_secret_private_key 'ci/mqtt5/us/mqtt5_thing/key' + windows-shared-lib: runs-on: windows-latest permissions: @@ -354,6 +262,7 @@ jobs: osx: runs-on: ${{ matrix.runner }} strategy: + fail-fast: false matrix: runner: - macos-13 @@ -372,58 +281,7 @@ jobs: python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream - - name: Running samples in CI setup - run: | - python3 -m venv .venv - source .venv/bin/activate - python3 -m pip install boto3 - - name: configure AWS credentials (PubSub) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_PUBSUB_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT3 PubSub sample - run: | - source .venv/bin/activate - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_cfg.json - - name: run PKCS12 sample - run: | - source .venv/bin/activate - aws s3 cp s3://iot-sdk-ci-bucket-us-east1/pkcs12_identity.p12 ./pkcs12_identity.p12 - pkcs12_identity_name=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/macos/pkcs12_identity" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - pkcs12_identity_password=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/macos/pkcs12_identity_password" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > /tmp/certificate.pem - key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > /tmp/privatekey.pem - iot_pkcs12_password=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/PubSub/key_pkcs12_password" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - openssl pkcs12 -export -in /tmp/certificate.pem -inkey /tmp/privatekey.pem -out ./iot_pkcs12_key.p12 -name PubSub_Thing_Alias -password pass:$iot_pkcs12_password - security create-keychain -p test_password build.keychain - security set-keychain-settings -lut 21600 build.keychain - security default-keychain -s build.keychain - security unlock-keychain -p test_password build.keychain - security import pkcs12_identity.p12 -A -k build.keychain -f pkcs12 -P $pkcs12_identity_password -T /usr/bin/codesign -T /usr/bin/security - security set-key-partition-list -S 'apple-tool:,apple:' -k test_password build.keychain - /usr/bin/codesign --force -s $pkcs12_identity_name ./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/pkcs12_connect/pkcs12-connect -v - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pkcs12_connect_cfg.json - - name: configure AWS credentials (MQTT5) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_MQTT5_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT5 PubSub sample - run: | - source .venv/bin/activate - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_cfg.json - - name: configure AWS credentials (Device Advisor) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_DEVICE_ADVISOR }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run DeviceAdvisor - run: | - source .venv/bin/activate - cd ./aws-iot-device-sdk-cpp-v2 - python3 ./deviceadvisor/script/DATestRun.py - # Not strictly needed, but allows us to run Device Advisor and PubSub on Linux without needing to run all samples + linux-github-actions: runs-on: ubuntu-latest strategy: @@ -440,34 +298,9 @@ jobs: run: | python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" python builder.pyz build -p ${{ env.PACKAGE_NAME }} - - name: Running samples in CI setup + - name: Device Defender setup run: | python3 -m pip install boto3 - - name: configure AWS credentials (PubSub) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_PUBSUB_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT3 PubSub sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_cfg.json - - name: configure AWS credentials (MQTT5) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_MQTT5_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT5 PubSub sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_cfg.json - - name: configure AWS credentials (Device Advisor) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_DEVICE_ADVISOR }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run DeviceAdvisor - run: | - cd ./aws-iot-device-sdk-cpp-v2 - python3 ./deviceadvisor/script/DATestRun.py - name: configure AWS credentials (Device Defender) uses: aws-actions/configure-aws-credentials@v4 with: @@ -481,7 +314,7 @@ jobs: run: | cd ./aws-iot-device-sdk-cpp-v2 python3 ./devicedefender/script/DDTestRun.py mqtt5 - # Runs the samples and ensures that everything is working + linux-smoke-tests: runs-on: ubuntu-22.04 strategy: @@ -514,7 +347,6 @@ jobs: sudo apt-get update -y sudo apt-get install softhsm -y softhsm2-util --version - - name: configure AWS credentials (Fleet provisioning) uses: aws-actions/configure-aws-credentials@v4 with: @@ -540,7 +372,6 @@ jobs: run: | export PYTHONPATH=${{ github.workspace }}/aws-iot-device-sdk-cpp-v2/utils python3 ./test_cases/test_fleet_provisioning.py --config-file test_cases/mqtt5_fleet_provisioning_with_csr_cfg.json --thing-name-prefix Fleet_Thing_ - - name: configure AWS credentials (Jobs) uses: aws-actions/configure-aws-credentials@v4 with: @@ -581,111 +412,7 @@ jobs: run: | export PYTHONPATH=${{ github.workspace }}/aws-iot-device-sdk-cpp-v2/utils python3 ./test_cases/test_shadow_update.py --config-file test_cases/mqtt5_named_shadow_cfg.json - - name: configure AWS credentials (Connect and PubSub) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_PUBSUB_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Basic Connect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_basic_connect_cfg.json - - name: run Websocket Connect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_websocket_connect_cfg.json - - name: run MQTT3 PubSub sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_cfg.json - - name: run PKCS11 Connect sample - run: | - mkdir -p /tmp/tokens - export SOFTHSM2_CONF=/tmp/softhsm2.conf - echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pkcs11_connect_cfg.json - - name: configure AWS credentials (MQTT5) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_MQTT5_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT5 PubSub sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_cfg.json - - name: run MQTT5 Shared Subscription sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_shared_subscription_cfg.json - - name: configure AWS credentials (Jobs) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_JOBS_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Jobs sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_jobs_cfg.json - - name: run Mqtt5 Jobs sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_jobs_mqtt5_cfg.json - - name: configure AWS credentials (Cognito) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_COGNITO_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run CognitoConnect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_cognito_connect_cfg.json - - name: configure AWS credentials (Custom Authorizer) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_CUSTOM_AUTHORIZER_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run CustomAuthorizerConnect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_custom_authorizer_connect_cfg.json - - name: configure AWS credentials (Shadow) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_SHADOW_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Shadow sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_shadow_cfg.json - - name: run Mqtt5 Shadow sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_shadow_mqtt5_cfg.json - - name: configure AWS credentials (Fleet provisioning) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Fleet Provisioning sample - run: | - echo "Generating UUID for IoT thing" - Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())") - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_fleet_provisioning_cfg.json --input_uuid ${Sample_UUID} - python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1" - - name: run Mqtt5 Fleet Provisioning sample - run: | - echo "Generating UUID for IoT thing" - Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())") - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_fleet_provisioning_mqtt5_cfg.json --input_uuid ${Sample_UUID} - python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1" - - name: configure AWS credentials (Secure tunneling) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_SECURE_TUNNEL }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - # Secure Tunneling has special requirements, so it uses a different Python file - - name: run Secure Tunneling sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_secure_tunnel_ci.py --sample_file "./aws-iot-device-sdk-cpp-v2/build/samples/secure_tunneling/secure_tunnel/secure-tunnel" --sample_region ${{ env.AWS_DEFAULT_REGION }} - - name: configure AWS credentials (X509) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_X509_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run X509 sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_x509_connect_cfg.json - # check that docs can still build check-docs: runs-on: ubuntu-22.04 # latest steps: @@ -706,6 +433,7 @@ jobs: cd ../.. echo "Finished compiling and installing Doxygen" ./make-docs.py + check-submodules: runs-on: ubuntu-latest steps: @@ -820,106 +548,3 @@ jobs: run: | export PYTHONPATH=${{ github.workspace }}/aws-iot-device-sdk-cpp-v2/utils python3 ./test_cases/test_shadow_update.py --config-file test_cases/mqtt5_named_shadow_cfg.json - - name: configure AWS credentials (Connect and PubSub) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_PUBSUB_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Basic Connect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_basic_connect_cfg.json - - name: run Websocket Connect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_websocket_connect_cfg.json - - name: run MQTT3 PubSub sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pubsub_cfg.json - - name: run PKCS11 Connect sample - run: | - mkdir -p /tmp/tokens - export SOFTHSM2_CONF=/tmp/softhsm2.conf - echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_pkcs11_connect_cfg.json - - name: configure AWS credentials (MQTT5) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_MQTT5_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run MQTT5 PubSub sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_pubsub_cfg.json - - name: run MQTT5 Shared Subscription sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_mqtt5_shared_subscription_cfg.json - - name: configure AWS credentials (Jobs) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_JOBS_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Jobs sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_jobs_cfg.json - - name: run Mqtt5 Jobs sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_jobs_mqtt5_cfg.json - - name: configure AWS credentials (Cognito) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_COGNITO_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run CognitoConnect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_cognito_connect_cfg.json - - name: configure AWS credentials (Custom Authorizer) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_CUSTOM_AUTHORIZER_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run CustomAuthorizerConnect sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_custom_authorizer_connect_cfg.json - - name: configure AWS credentials (Shadow) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_SHADOW_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Shadow sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_shadow_cfg.json - - name: run Mqtt5 Shadow sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_shadow_mqtt5_cfg.json - - name: configure AWS credentials (Fleet provisioning) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_FLEET_PROVISIONING_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run Fleet Provisioning sample - run: | - echo "Generating UUID for IoT thing" - Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())") - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_fleet_provisioning_cfg.json --input_uuid ${Sample_UUID} - python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1" - - name: run Mqtt5 Fleet Provisioning sample - run: | - echo "Generating UUID for IoT thing" - Sample_UUID=$(python3 -c "import uuid; print (uuid.uuid4())") - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_fleet_provisioning_mqtt5_cfg.json --input_uuid ${Sample_UUID} - python3 ${{ env.CI_UTILS_FOLDER }}/delete_iot_thing_ci.py --thing_name "Fleet_Thing_${Sample_UUID}" --region "us-east-1" - - name: configure AWS credentials (Secure tunneling) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_SECURE_TUNNEL }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - # Secure Tunneling has special requirements, so it uses a different Python file - - name: run Secure Tunneling sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_secure_tunnel_ci.py --sample_file "./aws-iot-device-sdk-cpp-v2/build/samples/secure_tunneling/secure_tunnel/secure-tunnel" --sample_region ${{ env.AWS_DEFAULT_REGION }} - - name: configure AWS credentials (X509) - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ env.CI_X509_ROLE }} - aws-region: ${{ env.AWS_DEFAULT_REGION }} - - name: run X509 sample - run: | - python3 ${{ env.CI_UTILS_FOLDER }}/run_sample_ci.py --file ${{ env.CI_SAMPLES_CFG_FOLDER }}/ci_run_x509_connect_cfg.json diff --git a/.github/workflows/ci_run_basic_connect_cfg.json b/.github/workflows/ci_run_basic_connect_cfg.json deleted file mode 100644 index de19724385..0000000000 --- a/.github/workflows/ci_run_basic_connect_cfg.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/basic_connect/basic-connect", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/PubSub/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/PubSub/key", - "filename": "tmp_key.pem" - } - ] -} diff --git a/.github/workflows/ci_run_cognito_connect_cfg.json b/.github/workflows/ci_run_cognito_connect_cfg.json deleted file mode 100644 index 35cf4c8953..0000000000 --- a/.github/workflows/ci_run_cognito_connect_cfg.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/cognito_connect/cognito-connect", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--signing_region", - "data": "us-east-1" - }, - { - "name": "--cognito_identity", - "secret": "ci/Cognito/identity_id" - } - ] -} diff --git a/.github/workflows/ci_run_custom_authorizer_connect_cfg.json b/.github/workflows/ci_run_custom_authorizer_connect_cfg.json deleted file mode 100644 index e1886fb1a2..0000000000 --- a/.github/workflows/ci_run_custom_authorizer_connect_cfg.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/custom_authorizer_connect/custom-authorizer-connect", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--custom_auth_authorizer_name", - "secret": "ci/CustomAuthorizer/name" - }, - { - "name": "--custom_auth_password", - "secret": "ci/CustomAuthorizer/password" - } - ] -} diff --git a/.github/workflows/ci_run_fleet_provisioning_cfg.json b/.github/workflows/ci_run_fleet_provisioning_cfg.json deleted file mode 100644 index b4c0e51f30..0000000000 --- a/.github/workflows/ci_run_fleet_provisioning_cfg.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/fleet_provisioning/fleet_provisioning/fleet-provisioning", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/FleetProvisioning/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/FleetProvisioning/key", - "filename": "tmp_key.pem" - }, - { - "name": "--template_name", - "data": "CI_FleetProvisioning_Template" - }, - { - "name": "--template_parameters", - "data": "{\"SerialNumber\":\"$INPUT_UUID\"}" - } - ] -} diff --git a/.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json b/.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json deleted file mode 100644 index b569e1ee32..0000000000 --- a/.github/workflows/ci_run_fleet_provisioning_mqtt5_cfg.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/fleet_provisioning/mqtt5_fleet_provisioning/mqtt5-fleet-provisioning", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/FleetProvisioning/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/FleetProvisioning/key", - "filename": "tmp_key.pem" - }, - { - "name": "--template_name", - "data": "CI_FleetProvisioning_Template" - }, - { - "name": "--template_parameters", - "data": "{\"SerialNumber\":\"$INPUT_UUID\"}" - } - ] -} diff --git a/.github/workflows/ci_run_greengrass_discovery_cfg.json b/.github/workflows/ci_run_greengrass_discovery_cfg.json deleted file mode 100644 index b89c1240d5..0000000000 --- a/.github/workflows/ci_run_greengrass_discovery_cfg.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "language": "CPP", - "runnable_file": "basic-discovery", - "runnable_region": "us-east-1", - "runnable_main_class": "", - "arguments": [ - { - "name": "--cert", - "secret": "ci/GreengrassDiscovery/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/GreengrassDiscovery/key", - "filename": "tmp_key.pem" - }, - { - "name": "--thing_name", - "data": "CI_Greengrass_Discovery_Thing" - }, - { - "name": "--region", - "data": "us-east-1" - }, - { - "name": "--topic", - "data": "clients/CI_Greengrass_Discovery_Thing/hello/world/$INPUT_UUID" - }, - { - "name": "--mode", - "data": "publish" - } - ], - "stdin_file": "messages.txt" -} diff --git a/.github/workflows/ci_run_greengrass_ipc_cfg.json b/.github/workflows/ci_run_greengrass_ipc_cfg.json deleted file mode 100644 index 11f95a1bb0..0000000000 --- a/.github/workflows/ci_run_greengrass_ipc_cfg.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "language": "CPP", - "runnable_file": "greengrass-ipc", - "runnable_region": "us-east-1", - "runnable_main_class": "", - "arguments": [ - { - "name": "--topic", - "data": "test/gg-ipc-topic" - }, - { - "name": "--message", - "data": "hello" - }, - { - "name": "--is_ci", - "data": "true" - } - - ] -} diff --git a/.github/workflows/ci_run_jobs_cfg.json b/.github/workflows/ci_run_jobs_cfg.json deleted file mode 100644 index e9ad04a00e..0000000000 --- a/.github/workflows/ci_run_jobs_cfg.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/jobs/job_execution/job-execution", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/Jobs/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/Jobs/key", - "filename": "tmp_key.pem" - }, - { - "name": "--thing_name", - "data": "CI_Jobs_Thing" - }, - { - "name": "--job_id", - "data": "CI_Jobs_Thing_Job_1" - }, - { - "name": "--is_ci", - "data": "true" - } - ] -} diff --git a/.github/workflows/ci_run_jobs_mqtt5_cfg.json b/.github/workflows/ci_run_jobs_mqtt5_cfg.json deleted file mode 100644 index c8907ae2ed..0000000000 --- a/.github/workflows/ci_run_jobs_mqtt5_cfg.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/jobs/mqtt5_job_execution/mqtt5-job-execution", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/Jobs/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/Jobs/key", - "filename": "tmp_key.pem" - }, - { - "name": "--thing_name", - "data": "CI_Jobs_Thing" - }, - { - "name": "--job_id", - "data": "CI_Jobs_Thing_Job_1" - }, - { - "name": "--is_ci", - "data": "true" - } - - ] -} diff --git a/.github/workflows/ci_run_mqtt5_pubsub_cfg.json b/.github/workflows/ci_run_mqtt5_pubsub_cfg.json deleted file mode 100644 index 6bee3979d9..0000000000 --- a/.github/workflows/ci_run_mqtt5_pubsub_cfg.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt5/mqtt5_pubsub/mqtt5_pubsub", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/mqtt5/us/mqtt5_thing/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/mqtt5/us/mqtt5_thing/key", - "filename": "tmp_key.pem" - } - ] -} diff --git a/.github/workflows/ci_run_mqtt5_pubsub_windows_cfg.json b/.github/workflows/ci_run_mqtt5_pubsub_windows_cfg.json deleted file mode 100644 index 5ebd5b85ea..0000000000 --- a/.github/workflows/ci_run_mqtt5_pubsub_windows_cfg.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt5/mqtt5_pubsub/RelWithDebInfo/mqtt5_pubsub.exe", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/mqtt5/us/mqtt5_thing/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/mqtt5/us/mqtt5_thing/key", - "filename": "tmp_key.pem" - } - ] -} diff --git a/.github/workflows/ci_run_mqtt5_shared_subscription_cfg.json b/.github/workflows/ci_run_mqtt5_shared_subscription_cfg.json deleted file mode 100644 index d64afd9f17..0000000000 --- a/.github/workflows/ci_run_mqtt5_shared_subscription_cfg.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt5/mqtt5_shared_subscription/mqtt5_shared_subscription", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/mqtt5/us/mqtt5_thing/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/mqtt5/us/mqtt5_thing/key", - "filename": "tmp_key.pem" - }, - { - "name": "--is_ci", - "data": "true" - } - ] -} diff --git a/.github/workflows/ci_run_pkcs11_connect_cfg.json b/.github/workflows/ci_run_pkcs11_connect_cfg.json deleted file mode 100644 index 8eff84e8f6..0000000000 --- a/.github/workflows/ci_run_pkcs11_connect_cfg.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/pkcs11_connect/pkcs11-connect", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/PubSub/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/PubSub/keyp8", - "filename": "tmp_key.pem", - "pkcs11_key": "true" - }, - { - "name": "--pkcs11_lib", - "data": "/usr/lib/softhsm/libsofthsm2.so" - }, - { - "name": "--pin", - "data": "0000" - }, - { - "name": "--token_label", - "data": "my-token" - }, - { - "name": "--key_label", - "data": "my-key" - } - ] -} diff --git a/.github/workflows/ci_run_pkcs12_connect_cfg.json b/.github/workflows/ci_run_pkcs12_connect_cfg.json deleted file mode 100644 index 15167cce6e..0000000000 --- a/.github/workflows/ci_run_pkcs12_connect_cfg.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/pkcs12_connect/pkcs12-connect", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--pkcs12_file", - "data": "./iot_pkcs12_key.p12" - }, - { - "name": "--pkcs12_password", - "secret": "ci/PubSub/key_pkcs12_password" - }, - { - "name": "--verbosity", - "data": "Trace" - } - ] -} diff --git a/.github/workflows/ci_run_pubsub_cfg.json b/.github/workflows/ci_run_pubsub_cfg.json deleted file mode 100644 index b8f3db0c5b..0000000000 --- a/.github/workflows/ci_run_pubsub_cfg.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/pub_sub/basic_pub_sub/basic-pub-sub", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/PubSub/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/PubSub/key", - "filename": "tmp_key.pem" - } - ] -} diff --git a/.github/workflows/ci_run_pubsub_windows_cfg.json b/.github/workflows/ci_run_pubsub_windows_cfg.json deleted file mode 100644 index 7302fe4c42..0000000000 --- a/.github/workflows/ci_run_pubsub_windows_cfg.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/pub_sub/basic_pub_sub/RelWithDebInfo/basic-pub-sub.exe", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/PubSub/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/PubSub/key", - "filename": "tmp_key.pem" - } - ] -} diff --git a/.github/workflows/ci_run_shadow_cfg.json b/.github/workflows/ci_run_shadow_cfg.json deleted file mode 100644 index 8166e7151c..0000000000 --- a/.github/workflows/ci_run_shadow_cfg.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/shadow/shadow_sync/shadow-sync", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/Shadow/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/Shadow/key", - "filename": "tmp_key.pem" - }, - { - "name": "--thing_name", - "data": "CI_Shadow_Thing" - }, - { - "name": "--is_ci", - "data": "true" - } - ] -} diff --git a/.github/workflows/ci_run_shadow_mqtt5_cfg.json b/.github/workflows/ci_run_shadow_mqtt5_cfg.json deleted file mode 100644 index 5713df596d..0000000000 --- a/.github/workflows/ci_run_shadow_mqtt5_cfg.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/deprecated/shadow/mqtt5_shadow_sync/mqtt5-shadow-sync", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "secret": "ci/Shadow/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--key", - "secret": "ci/Shadow/key", - "filename": "tmp_key.pem" - }, - { - "name": "--thing_name", - "data": "CI_Shadow_Thing" - }, - { - "name": "--is_ci", - "data": "true" - } - ] -} diff --git a/.github/workflows/ci_run_websocket_connect_cfg.json b/.github/workflows/ci_run_websocket_connect_cfg.json deleted file mode 100644 index 39db80e859..0000000000 --- a/.github/workflows/ci_run_websocket_connect_cfg.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/websocket_connect/websocket-connect", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--signing_region", - "data": "us-east-1" - } - ] -} diff --git a/.github/workflows/ci_run_windows_cert_connect_cfg.json b/.github/workflows/ci_run_windows_cert_connect_cfg.json deleted file mode 100644 index 559ccd9bf5..0000000000 --- a/.github/workflows/ci_run_windows_cert_connect_cfg.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/windows_cert_connect/RelWithDebInfo/windows-cert-connect.exe", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--cert", - "windows_cert_certificate": "ci/PubSub/cert", - "windows_cert_certificate_path": "tmp_cert.pem", - "windows_cert_key": "ci/PubSub/key", - "windows_cert_key_path": "tmp_key.pem", - "windows_cert_pfx_key_path": "tmp_pfx.pem" - } - ] -} diff --git a/.github/workflows/ci_run_x509_connect_cfg.json b/.github/workflows/ci_run_x509_connect_cfg.json deleted file mode 100644 index 2ec7aa7498..0000000000 --- a/.github/workflows/ci_run_x509_connect_cfg.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "language": "CPP", - "sample_file": "./aws-iot-device-sdk-cpp-v2/build/samples/mqtt/x509_credentials_provider_connect/x509-credentials-provider-connect", - "sample_region": "us-east-1", - "sample_main_class": "", - "arguments": [ - { - "name": "--endpoint", - "secret": "ci/endpoint" - }, - { - "name": "--x509_cert", - "secret": "ci/PubSub/cert", - "filename": "tmp_certificate.pem" - }, - { - "name": "--x509_key", - "secret": "ci/PubSub/key", - "filename": "tmp_key.pem" - }, - { - "name": "--x509_ca_file", - "secret": "ci/PubSub/ca", - "filename": "tmp_ca.pem" - }, - { - "name": "--x509_endpoint", - "secret": "ci/X509/endpoint_credentials" - }, - { - "name": "--x509_role_alias", - "secret": "ci/X509/alias" - }, - { - "name": "--signing_region", - "data": "us-east-1" - }, - { - "name": "--x509_thing_name", - "data": "CI_PubSub_Thing" - } - ] -} diff --git a/codebuild/samples/connect-linux.sh b/codebuild/samples/connect-linux.sh deleted file mode 100755 index 2fdaa31de2..0000000000 --- a/codebuild/samples/connect-linux.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -set -e - -env - -pushd $CODEBUILD_SRC_DIR/samples/mqtt/basic_connect - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') - -echo "Basic Connect test" -./basic-connect --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem - -popd - -pushd $CODEBUILD_SRC_DIR/samples/mqtt/websocket_connect - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -echo "Websocket test" -./websocket-connect --endpoint $ENDPOINT --signing_region us-east-1 - -popd diff --git a/codebuild/samples/custom-auth-linux.sh b/codebuild/samples/custom-auth-linux.sh deleted file mode 100755 index 2a2c4bbb11..0000000000 --- a/codebuild/samples/custom-auth-linux.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -e - -env - -pushd $CODEBUILD_SRC_DIR/samples/mqtt/custom_authorizer_connect - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') -AUTH_NAME=$(aws secretsmanager get-secret-value --secret-id "ci/CustomAuthorizer/name" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') -AUTH_PASSWORD=$(aws secretsmanager get-secret-value --secret-id "ci/CustomAuthorizer/password" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') - -echo "Custom Authorizer Connnect Test" -./custom-authorizer-connect --endpoint $ENDPOINT --custom_auth_authorizer_name $AUTH_NAME --custom_auth_password $AUTH_PASSWORD - -popd diff --git a/codebuild/samples/linux-smoke-tests.yml b/codebuild/samples/linux-smoke-tests.yml index 18b9c8311e..96a8e8cde0 100644 --- a/codebuild/samples/linux-smoke-tests.yml +++ b/codebuild/samples/linux-smoke-tests.yml @@ -11,11 +11,6 @@ phases: commands: - echo Build started on `date` - $CODEBUILD_SRC_DIR/codebuild/samples/setup-linux.sh - - $CODEBUILD_SRC_DIR/codebuild/samples/connect-linux.sh - - $CODEBUILD_SRC_DIR/codebuild/samples/custom-auth-linux.sh - - $CODEBUILD_SRC_DIR/codebuild/samples/pkcs11-connect-linux.sh - - $CODEBUILD_SRC_DIR/codebuild/samples/pubsub-linux.sh - - $CODEBUILD_SRC_DIR/codebuild/samples/shadow-linux.sh post_build: commands: - echo Build completed on `date` diff --git a/codebuild/samples/pkcs11-connect-linux.sh b/codebuild/samples/pkcs11-connect-linux.sh deleted file mode 100755 index 692d9cce4c..0000000000 --- a/codebuild/samples/pkcs11-connect-linux.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -e -set -o pipefail - -pushd $CODEBUILD_SRC_DIR/samples/mqtt/pkcs11_connect - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') - -# from hereon commands are echoed. don't leak secrets -set -x - -softhsm2-util --version - -# SoftHSM2's default tokendir path might be invalid on this machine -# so set up a conf file that specifies a known good tokendir path -mkdir -p /tmp/tokens -export SOFTHSM2_CONF=/tmp/softhsm2.conf -echo "directories.tokendir = /tmp/tokens" > /tmp/softhsm2.conf - -# create token -softhsm2-util --init-token --free --label my-token --pin 0000 --so-pin 0000 - -# add private key to token (must be in PKCS#8 format) -openssl pkcs8 -topk8 -in /tmp/privatekey.pem -out /tmp/privatekey.p8.pem -nocrypt -softhsm2-util --import /tmp/privatekey.p8.pem --token my-token --label my-key --id BEEFCAFE --pin 0000 - -# run sample -./pkcs11-connect --endpoint $ENDPOINT --cert /tmp/certificate.pem --pkcs11_lib /usr/lib/softhsm/libsofthsm2.so --pin 0000 --token_label my-token --key_label my-key - -popd diff --git a/codebuild/samples/pubsub-linux.sh b/codebuild/samples/pubsub-linux.sh deleted file mode 100755 index 44ccc38a14..0000000000 --- a/codebuild/samples/pubsub-linux.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -e - -env - -pushd $CODEBUILD_SRC_DIR/samples/pub_sub/basic_pub_sub - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') - -echo "PubSub test" -./basic-pub-sub --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem - -popd diff --git a/codebuild/samples/shadow-linux.sh b/codebuild/samples/shadow-linux.sh deleted file mode 100755 index 9956b00626..0000000000 --- a/codebuild/samples/shadow-linux.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -set -e - -env - -# v1 MQTT311 shadow sample -pushd $CODEBUILD_SRC_DIR/samples/deprecated/shadow/shadow_sync - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') - -echo "Shadow-Sync test" -./shadow-sync --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --thing_name CI_CodeBuild_Thing --is_ci true - -popd - -# v1 MQTT5 shadow sample -pushd $CODEBUILD_SRC_DIR/samples/deprecated/shadow/mqtt5_shadow_sync - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') - -echo "Shadow-Sync test" -./mqtt5-shadow-sync --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --thing_name CI_CodeBuild_Thing --is_ci true - -popd - -# v2 MQTT5 shadow sample - smaple is interactive so build but don't run - -pushd $CODEBUILD_SRC_DIR/samples/shadow/shadow-sandbox - -mkdir _build -cd _build -cmake -DCMAKE_PREFIX_PATH=/tmp/install .. -make -j - -popd \ No newline at end of file diff --git a/deviceadvisor/script/DATestConfig.json b/deviceadvisor/script/DATestConfig.json deleted file mode 100644 index 6982c6fe9f..0000000000 --- a/deviceadvisor/script/DATestConfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "tests" :[ "MQTT Connect", "MQTT Publish", "MQTT Subscribe", "Shadow Publish", "Shadow Update"], - "test_suite_ids" : - { - "MQTT Connect" : "mxn32qkm8npn", - "MQTT Publish" : "gcjhujhhz50p", - "MQTT Subscribe" : "nyiuiwx5yxtj", - "Shadow Publish" : "fttdr8ufljnf", - "Shadow Update" : "ng9t8am2jnry" - }, - "test_exe_path" : - { - "MQTT Connect" : "mqtt_connect", - "MQTT Publish" : "mqtt_publish", - "MQTT Subscribe" : "mqtt_subscribe", - "Shadow Publish" : "shadow_update", - "Shadow Update" : "shadow_update" - } -} diff --git a/deviceadvisor/script/DATestRun.py b/deviceadvisor/script/DATestRun.py deleted file mode 100644 index 2e504e0334..0000000000 --- a/deviceadvisor/script/DATestRun.py +++ /dev/null @@ -1,314 +0,0 @@ -import boto3 -import uuid -import json -import os -import subprocess -import platform -import re -import random -from time import sleep - -############################################## -# Cleanup Certificates and Things and created certificate and private key file -def delete_thing_with_certi(thingName, certiId, certiArn): - client.detach_thing_principal( - thingName = thingName, - principal = certiArn) - client.update_certificate( - certificateId =certiId, - newStatus ='INACTIVE') - client.delete_certificate(certificateId = certiId, forceDelete = True) - client.delete_thing(thingName = thingName) - os.remove(os.environ["DA_CERTI"]) - os.remove(os.environ["DA_KEY"]) - -def process_logs(log_group, log_stream, thing_name): - logs_client = boto3.client('logs') - response = logs_client.get_log_events( - logGroupName=log_group, - logStreamName=log_stream - ) - log_file = "DA_Log_CPP_" + thing_name + ".log" - f = open(log_file, 'w') - for event in response["events"]: - f.write(event['message']) - f.close() - - try: - secrets_client = boto3.client( - "secretsmanager", region_name=os.environ["AWS_DEFAULT_REGION"]) - s3_bucket_name = secrets_client.get_secret_value(SecretId="ci/DeviceAdvisor/s3bucket")["SecretString"] - s3.Bucket(s3_bucket_name).upload_file(log_file, log_file) - print("[Device Advisor] Device Advisor Log file uploaded to "+ log_file) - - except Exception: - print ("[Device Advisor] Error: could not store log in S3 bucket!") - - os.remove(log_file) - print("[Device Advisor] Issues on test " + test_name + ". Please check out the logs at "+thing_name+".log on S3.") - -# Sleep for a random time -def sleep_with_backoff(base, max): - sleep(random.randint(base,max)) - - -############################################## -# Initialize variables -# create aws clients -try: - client = boto3.client('iot') - dataClient = boto3.client('iot-data') - deviceAdvisor = boto3.client('iotdeviceadvisor') - s3 = boto3.resource('s3') -except Exception: - print ("[Device Advisor] Error: could not create boto3 clients") - exit(-1) - -# const -BACKOFF_BASE = 5 -BACKOFF_MAX = 10 -# 60 minutes divided by the maximum back-off = longest time a DA run can last with this script. -MAXIMUM_CYCLE_COUNT = (3600 / BACKOFF_MAX) - -# Did Device Advisor fail a test? If so, this should be true -did_at_least_one_test_fail = False - -# load test config -f = open('deviceadvisor/script/DATestConfig.json') -DATestConfig = json.load(f) -f.close() - -# create an temporary certificate/key file path -certificate_path = os.path.join(os.getcwd(), 'certificate.pem.crt') -key_path = os.path.join(os.getcwd(), 'private.pem.key') - -# load environment variables requried for testing -shadowProperty = os.environ['DA_SHADOW_PROPERTY'] -shadowDefault = os.environ['DA_SHADOW_VALUE_DEFAULT'] - -# test result -test_result = {} - -for test_name in DATestConfig['tests']: - ############################################## - # create a test thing - thing_name = "DATest_" + str(uuid.uuid4()) - try: - # create_thing_response: - # { - # 'thingName': 'string', - # 'thingArn': 'string', - # 'thingId': 'string' - # } - print("[Device Advisor] Info: Started to create thing...") - create_thing_response = client.create_thing( - thingName=thing_name - ) - os.environ["DA_THING_NAME"] = thing_name - - except Exception: - print("[Device Advisor] Error: Failed to create thing: " + thing_name) - exit(-1) - - - ############################################## - # create certificate and keys used for testing - try: - print("[Device Advisor] Info: Started to create certificate...") - # create_cert_response: - # { - # 'certificateArn': 'string', - # 'certificateId': 'string', - # 'certificatePem': 'string', - # 'keyPair': - # { - # 'PublicKey': 'string', - # 'PrivateKey': 'string' - # } - # } - create_cert_response = client.create_keys_and_certificate( - setAsActive=True - ) - # write certificate to file - f = open(certificate_path, "w") - f.write(create_cert_response['certificatePem']) - f.close() - - # write private key to file - f = open(key_path, "w") - f.write(create_cert_response['keyPair']['PrivateKey']) - f.close() - - # setup environment variable - os.environ["DA_CERTI"] = certificate_path - os.environ["DA_KEY"] = key_path - - except Exception: - try: - client.delete_thing(thingName = thing_name) - except Exception: - print ("[Device Advisor] Error: Could not delete thing.") - print("[Device Advisor] Error: Failed to create certificate.") - exit(-1) - - certificate_arn = create_cert_response['certificateArn'] - certificate_id = create_cert_response['certificateId'] - - ############################################## - # attach policy to certificate - try: - secrets_client = boto3.client( - "secretsmanager", region_name=os.environ["AWS_DEFAULT_REGION"]) - policy_name = secrets_client.get_secret_value(SecretId="ci/DeviceAdvisor/policy_name")["SecretString"] - client.attach_policy ( - policyName= policy_name, - target = certificate_arn - ) - except Exception as ex: - print (ex) - delete_thing_with_certi(thing_name, certificate_id, certificate_arn ) - print("[Device Advisor] Error: Failed to attach policy.") - exit(-1) - - ############################################## - # attach certification to thing - try: - print("[Device Advisor] Info: Attach certificate to test thing...") - # attache the certificate to thing - client.attach_thing_principal( - thingName = thing_name, - principal = create_cert_response['certificateArn'] - ) - - except Exception: - delete_thing_with_certi(thing_name, certificate_id ,certificate_arn ) - print("[Device Advisor]Error: Failed to attach certificate.") - exit(-1) - - -############################################## -# Run device advisor - try: - ###################################### - # set default shadow, for shadow update, if the - # shadow does not exists, update will fail - print("[Device Advisor] Info: About to update shadow.") - payload_shadow = json.dumps( - { - "state": { - "desired": { - shadowProperty: shadowDefault - }, - "reported": { - shadowProperty: shadowDefault - } - } - }) - shadow_response = dataClient.update_thing_shadow( - thingName = thing_name, - payload = payload_shadow) - get_shadow_response = dataClient.get_thing_shadow(thingName = thing_name) - # make sure shadow is created before we go to next step - print("[Device Advisor] Info: About to wait for shadow update.") - while(get_shadow_response is None): - get_shadow_response = dataClient.get_thing_shadow(thingName = thing_name) - - # start device advisor test - # test_start_response - # { - # 'suiteRunId': 'string', - # 'suiteRunArn': 'string', - # 'createdAt': datetime(2015, 1, 1) - # } - print("[Device Advisor] Info: Start device advisor test: " + test_name) - sleep_with_backoff(BACKOFF_BASE, BACKOFF_MAX) - test_start_response = deviceAdvisor.start_suite_run( - suiteDefinitionId=DATestConfig['test_suite_ids'][test_name], - suiteRunConfiguration={ - 'primaryDevice': { - 'thingArn': create_thing_response['thingArn'], - }, - 'parallelRun': True - }) - - # get DA endpoint - print("[Device Advisor] Info: Getting Device Advisor endpoint.") - endpoint_response = deviceAdvisor.get_endpoint( - thingArn = create_thing_response['thingArn'] - ) - os.environ['DA_ENDPOINT'] = endpoint_response['endpoint'] - - cycle_number = 0 - while True: - cycle_number += 1 - if (cycle_number >= MAXIMUM_CYCLE_COUNT): - print(f"[Device Advisor] Error: {cycle_number} of cycles lasting {BACKOFF_BASE} to {BACKOFF_MAX} seconds have passed.") - raise Exception(f"ERROR - {cycle_number} of cycles lasting {BACKOFF_BASE} to {BACKOFF_MAX} seconds have passed.") - - # sleep for 1s every loop to avoid TooManyRequestsException - sleep_with_backoff(BACKOFF_BASE, BACKOFF_MAX) - test_result_responds = deviceAdvisor.get_suite_run( - suiteDefinitionId=DATestConfig['test_suite_ids'][test_name], - suiteRunId=test_start_response['suiteRunId'] - ) - # If the status is PENDING or the responds does not loaded, the test suite is still loading - if (test_result_responds['status'] == 'PENDING' or - len(test_result_responds['testResult']['groups']) == 0 or # test group has not been loaded - len(test_result_responds['testResult']['groups'][0]['tests']) == 0 or #test case has not been loaded - test_result_responds['testResult']['groups'][0]['tests'][0]['status'] == 'PENDING'): - continue - - # Start to run the test sample after the status turns into RUNNING - elif (test_result_responds['status'] == 'RUNNING' and - test_result_responds['testResult']['groups'][0]['tests'][0]['status'] == 'RUNNING'): - try: - print ("[Device Advisor] Info: About to get start Device Advisor companion test application.") - exe_path = os.path.join("build/deviceadvisor/tests/",DATestConfig['test_exe_path'][test_name]) - # Windows and MAC/LINUX has a different build folder structure - if platform.system() == 'Windows': - exe_path = os.path.join(exe_path, "RelWithDebInfo",DATestConfig['test_exe_path'][test_name]) - else: - exe_path = os.path.join(exe_path, DATestConfig['test_exe_path'][test_name]) - print("start to run" + exe_path) - result = subprocess.run(exe_path, timeout = 60*2) - except: - continue - - # If the test finalizing or store the test result - elif (test_result_responds['status'] != 'RUNNING'): - test_result[test_name] = test_result_responds['status'] - # If the test failed, upload the logs to S3 before clean up - if(test_result[test_name] != "PASS"): - print ("[Device Advisor] Info: About to upload log to S3.") - log_url = test_result_responds['testResult']['groups'][0]['tests'][0]['logUrl'] - group_string = re.search('group=(.*);', log_url) - log_group = group_string.group(1) - stream_string = re.search('stream=(.*)', log_url) - log_stream = stream_string.group(1) - process_logs(log_group, log_stream, thing_name) - delete_thing_with_certi(thing_name, certificate_id ,certificate_arn ) - break - except Exception: - delete_thing_with_certi(thing_name, certificate_id ,certificate_arn ) - print("[Device Advisor]Error: Failed to test: "+ test_name) - did_at_least_one_test_fail = True - sleep_with_backoff(BACKOFF_BASE, BACKOFF_MAX) - -############################################## -# print result and cleanup things -print(test_result) -failed = False -for test in test_result: - if(test_result[test] != "PASS" and - test_result[test] != "PASS_WITH_WARNINGS"): - print("[Device Advisor]Error: Test \"" + test + "\" Failed with status:" + test_result[test]) - failed = True -if failed: - # if the test failed, we dont clean the Thing so that we can track the error - exit(-1) - -if (did_at_least_one_test_fail == True): - print("[Device Advisor] At least one test failed!") - exit(-1) - -exit(0) diff --git a/deviceadvisor/tests/mqtt_connect/CMakeLists.txt b/deviceadvisor/tests/mqtt_connect/CMakeLists.txt deleted file mode 100644 index 3ae4324158..0000000000 --- a/deviceadvisor/tests/mqtt_connect/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 3.9...3.31) -# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12 -project(mqtt_connect CXX) - -file(GLOB SRC_FILES - "*.cpp" - "../utils/*.cpp" - "../utils/*.h" -) - -add_executable(${PROJECT_NAME} ${SRC_FILES}) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14) - -#set warnings -if (MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX /wd4068) -else () - target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror) -endif () - -find_package(aws-crt-cpp REQUIRED) - -target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp) diff --git a/deviceadvisor/tests/mqtt_connect/main.cpp b/deviceadvisor/tests/mqtt_connect/main.cpp deleted file mode 100644 index c2e72f82c7..0000000000 --- a/deviceadvisor/tests/mqtt_connect/main.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -#include -#include -#include -#include - -#include - -#include "../utils/datest_utils.h" - -using namespace Aws::Crt; -using namespace DATest_Utils; - -int main() -{ - - /************************ Setup the Lib ****************************/ - /* - * Do the global initialization for the API. - */ - ApiHandle apiHandle; - String clientId(String("test-") + Aws::Crt::UUID().ToString()); - - /*********************** Parse Arguments ***************************/ - DeviceAdvisorEnvironment daVars; - if (!daVars.init(TestType::CONNECT)) - { - return -1; - } - - /********************** Now Setup an Mqtt Client ******************/ - /* - * Setup client configuration with the MqttClientConnectionConfigBuilder. - */ - Aws::Iot::MqttClientConnectionConfigBuilder builder = - Aws::Iot::MqttClientConnectionConfigBuilder(daVars.certificatePath.c_str(), daVars.keyPath.c_str()); - builder.WithEndpoint(daVars.endpoint); - auto clientConfig = builder.Build(); - if (!clientConfig) - { - exit(-1); - } - - /* - * Setup up mqttClients - */ - Aws::Iot::MqttClient mqttClient; - if (!mqttClient) - { - exit(-1); - } - - /* - * Now create a connection object. - */ - auto connection = mqttClient.NewConnection(clientConfig); - if (!connection) - { - exit(-1); - } - - /* - * Invoked when connection and disconnection has completed. - */ - std::promise connectionCompletedPromise; - std::promise connectionClosedPromise; - connection->OnConnectionCompleted = [&](Mqtt::MqttConnection &, int errorCode, Mqtt::ReturnCode returnCode, bool) { - connectionCompletedPromise.set_value(errorCode == AWS_ERROR_SUCCESS && returnCode == AWS_MQTT_CONNECT_ACCEPTED); - }; - connection->OnDisconnect = [&](Mqtt::MqttConnection &) { connectionClosedPromise.set_value(); }; - - /* - * Actually perform the connect dance. - */ - if (!connection->Connect( - clientId.c_str(), true /*cleanSession*/, 1000 /*keepAliveTimeSecs*/, 60000 /*pingTimeoutMs*/)) - { - exit(-1); - } - - if (!connectionCompletedPromise.get_future().get()) - { - exit(-1); - } - - /* Disconnect */ - if (connection->Disconnect()) - { - connectionClosedPromise.get_future().wait(); - } - - return 0; -} diff --git a/deviceadvisor/tests/mqtt_publish/CMakeLists.txt b/deviceadvisor/tests/mqtt_publish/CMakeLists.txt deleted file mode 100644 index 84dc8757c1..0000000000 --- a/deviceadvisor/tests/mqtt_publish/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 3.9...3.31) -# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12 -project(mqtt_publish CXX) - -file(GLOB SRC_FILES - "*.cpp" - "../utils/*.cpp" - "../utils/*.h" -) - -add_executable(${PROJECT_NAME} ${SRC_FILES}) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14) - -#set warnings -if (MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX /wd4068) -else () - target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror) -endif () - -find_package(aws-crt-cpp REQUIRED) - -target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp) diff --git a/deviceadvisor/tests/mqtt_publish/main.cpp b/deviceadvisor/tests/mqtt_publish/main.cpp deleted file mode 100644 index 1ef9dbfc5a..0000000000 --- a/deviceadvisor/tests/mqtt_publish/main.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -#include -#include -#include - -#include - -#include "../utils/datest_utils.h" - -using namespace Aws::Crt; -using namespace DATest_Utils; - -int main() -{ - - /************************ Setup the Lib ****************************/ - /* - * Do the global initialization for the API. - */ - ApiHandle apiHandle; - String clientId(String("test-") + Aws::Crt::UUID().ToString()); - String messagePayload("Hello world!"); - - /*********************** Parse Arguments ***************************/ - DeviceAdvisorEnvironment daVars; - if (!daVars.init(TestType::SUB_PUB)) - { - exit(1); - } - - /********************** Now Setup an Mqtt Client ******************/ - /* - * Setup client configuration with the MqttClientConnectionConfigBuilder. - */ - Aws::Iot::MqttClientConnectionConfigBuilder builder = - Aws::Iot::MqttClientConnectionConfigBuilder(daVars.certificatePath.c_str(), daVars.keyPath.c_str()); - builder.WithEndpoint(daVars.endpoint); - auto clientConfig = builder.Build(); - if (!clientConfig) - { - exit(2); - } - - /* - * Setup up mqttClients - */ - Aws::Iot::MqttClient mqttClient; - if (!mqttClient) - { - exit(3); - } - - /* - * Now create a connection object. - */ - auto connection = mqttClient.NewConnection(clientConfig); - if (!connection) - { - exit(4); - } - - /* - * Invoked when connection and disconnection has completed. - */ - std::promise connectionCompletedPromise; - std::promise connectionClosedPromise; - std::promise publishFinishedPromise; - connection->OnConnectionCompleted = [&](Mqtt::MqttConnection &, int errorCode, Mqtt::ReturnCode returnCode, bool) { - connectionCompletedPromise.set_value(errorCode == AWS_ERROR_SUCCESS && returnCode == AWS_MQTT_CONNECT_ACCEPTED); - }; - connection->OnDisconnect = [&](Mqtt::MqttConnection &) { connectionClosedPromise.set_value(); }; - - /* - * Actually perform the connect dance. - */ - if (!connection->Connect( - clientId.c_str(), true /*cleanSession*/, 1000 /*keepAliveTimeSecs*/, 60000 /*pingTimeoutMs*/)) - { - exit(5); - } - - if (connectionCompletedPromise.get_future().get()) - { - - ByteBuf payload = ByteBufFromArray((const uint8_t *)messagePayload.data(), messagePayload.length()); - - auto onPublishComplete = [&](Mqtt::MqttConnection &, uint16_t, int) { publishFinishedPromise.set_value(); }; - connection->Publish(daVars.topic.c_str(), AWS_MQTT_QOS_AT_MOST_ONCE, false, payload, onPublishComplete); - fprintf(stderr, "waiting on publish..... "); - publishFinishedPromise.get_future().wait(); - fprintf(stderr, "get on publish..... "); - - /* Disconnect */ - if (connection->Disconnect()) - { - connectionClosedPromise.get_future().wait(); - } - } - else - { - exit(6); - } - - return 0; -} diff --git a/deviceadvisor/tests/mqtt_subscribe/CMakeLists.txt b/deviceadvisor/tests/mqtt_subscribe/CMakeLists.txt deleted file mode 100644 index 67344199a8..0000000000 --- a/deviceadvisor/tests/mqtt_subscribe/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 3.9...3.31) -# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12 -project(mqtt_subscribe CXX) - -file(GLOB SRC_FILES - "*.cpp" - "../utils/*.cpp" - "../utils/*.h" -) - -add_executable(${PROJECT_NAME} ${SRC_FILES}) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14) - -#set warnings -if (MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX /wd4068) -else () - target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror) -endif () - -find_package(aws-crt-cpp REQUIRED) - -target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp) diff --git a/deviceadvisor/tests/mqtt_subscribe/main.cpp b/deviceadvisor/tests/mqtt_subscribe/main.cpp deleted file mode 100644 index 5259a828b0..0000000000 --- a/deviceadvisor/tests/mqtt_subscribe/main.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -#include -#include -#include - -#include - -#include "../utils/datest_utils.h" - -using namespace Aws::Crt; -using namespace DATest_Utils; - -int main() -{ - - /************************ Setup the Lib ****************************/ - /* - * Do the global initialization for the API. - */ - ApiHandle apiHandle; - apiHandle.InitializeLogging(Aws::Crt::LogLevel::Debug, stdout); - String clientId(String("test-") + Aws::Crt::UUID().ToString()); - - /*********************** Parse Arguments ***************************/ - DeviceAdvisorEnvironment daVars; - if (!daVars.init(TestType::SUB_PUB)) - { - exit(-1); - } - - /********************** Now Setup an Mqtt Client ******************/ - /* - * Setup client configuration with the MqttClientConnectionConfigBuilder. - */ - Aws::Iot::MqttClientConnectionConfigBuilder builder = - Aws::Iot::MqttClientConnectionConfigBuilder(daVars.certificatePath.c_str(), daVars.keyPath.c_str()); - builder.WithEndpoint(daVars.endpoint); - auto clientConfig = builder.Build(); - if (!clientConfig) - { - exit(-1); - } - - /* - * Setup up mqttClients - */ - Aws::Iot::MqttClient mqttClient; - if (!mqttClient) - { - exit(-1); - } - - /* - * Now create a connection object. - */ - auto connection = mqttClient.NewConnection(clientConfig); - if (!connection) - { - exit(-1); - } - - /* - * Invoked when connection and disconnection has completed. - */ - std::promise connectionCompletedPromise; - std::promise subscriptionCompletedPromise; - std::promise connectionClosedPromise; - - connection->OnConnectionCompleted = [&](Mqtt::MqttConnection &, int errorCode, Mqtt::ReturnCode returnCode, bool) { - connectionCompletedPromise.set_value(errorCode == AWS_ERROR_SUCCESS && returnCode == AWS_MQTT_CONNECT_ACCEPTED); - }; - connection->OnDisconnect = [&](Mqtt::MqttConnection &) { connectionClosedPromise.set_value(); }; - - /* - * Actually perform the connect dance. - */ - if (!connection->Connect( - clientId.c_str(), true /*cleanSession*/, 1000 /*keepAliveTimeSecs*/, 60000 /*pingTimeoutMs*/)) - { - exit(-1); - } - - if (connectionCompletedPromise.get_future().get()) - { - /* - * This is invoked upon the receipt of a Publish on a subscribed topic. - */ - std::promise subscribeFinishedPromise; - - auto onMessage = [&](Mqtt::MqttConnection &, - const String & /*topic*/, - const ByteBuf & /*byteBuf*/, - bool /*dup*/, - Mqtt::QOS /*qos*/, - bool /*retain*/) { subscriptionCompletedPromise.set_value(); }; - - auto onSubAck = [&](Mqtt::MqttConnection &, - uint16_t /*packetId*/, - const String & /*topic*/, - Mqtt::QOS /*QoS*/, - int /*errorCode*/) { subscriptionCompletedPromise.set_value(); }; - - connection->Subscribe(daVars.topic.c_str(), AWS_MQTT_QOS_AT_MOST_ONCE, onMessage, onSubAck); - subscriptionCompletedPromise.get_future().wait(); - - /* Disconnect */ - if (connection->Disconnect()) - { - connectionClosedPromise.get_future().wait(); - } - } - else - { - exit(-1); - } - - return 0; -} diff --git a/deviceadvisor/tests/shadow_update/CMakeLists.txt b/deviceadvisor/tests/shadow_update/CMakeLists.txt deleted file mode 100644 index f3c90da238..0000000000 --- a/deviceadvisor/tests/shadow_update/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.9...3.31) -# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12 -project(shadow_update CXX) - -file(GLOB SRC_FILES - "*.cpp" - "../utils/*.cpp" - "../utils/*.h" -) - -add_executable(${PROJECT_NAME} ${SRC_FILES}) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14) - -#set warnings -if (MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) -else () - target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror) -endif () - -find_package(aws-crt-cpp REQUIRED) -find_package(IotShadow-cpp REQUIRED) - -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotShadow-cpp) diff --git a/deviceadvisor/tests/shadow_update/main.cpp b/deviceadvisor/tests/shadow_update/main.cpp deleted file mode 100644 index 1b03a6b72d..0000000000 --- a/deviceadvisor/tests/shadow_update/main.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "../utils/datest_utils.h" - -using namespace Aws::Crt; -using namespace Aws::Iotshadow; -using namespace DATest_Utils; - -static void s_setShadowState(const String &shadowProperty, const String &value, ShadowState &state) -{ - JsonObject desired; - JsonObject reported; - - desired.WithString(shadowProperty, value); - reported.WithString(shadowProperty, value); - state.Desired = desired; - state.Reported = reported; -} - -int main() -{ - /************************ Setup the Lib ****************************/ - /* - * Do the global initialization for the API. - */ - ApiHandle apiHandle; - String clientId(String("test-") + Aws::Crt::UUID().ToString()); - - /*********************** Parse Arguments ***************************/ - DeviceAdvisorEnvironment daEnv; - if (!daEnv.init(TestType::SHADOW)) - { - exit(-1); - } - - /********************** Now Setup an Mqtt Client ******************/ - /* - * Setup client configuration with the MqttClientConnectionConfigBuilder. - */ - Aws::Iot::MqttClientConnectionConfigBuilder builder = - Aws::Iot::MqttClientConnectionConfigBuilder(daEnv.certificatePath.c_str(), daEnv.keyPath.c_str()); - builder.WithEndpoint(daEnv.endpoint); - auto clientConfig = builder.Build(); - if (!clientConfig) - { - exit(-1); - } - - /* - * Setup up mqttClients - */ - Aws::Iot::MqttClient mqttClient; - if (!mqttClient) - { - exit(-1); - } - - /* - * Now create a connection object. - */ - auto connection = mqttClient.NewConnection(clientConfig); - if (!connection) - { - exit(-1); - } - - /* - * Invoked when connection and disconnection has completed. - */ - std::promise connectionCompletedPromise; - std::promise connectionClosedPromise; - std::promise shadowUpdatePromise; - - connection->OnConnectionCompleted = [&](Mqtt::MqttConnection &, int errorCode, Mqtt::ReturnCode returnCode, bool) { - connectionCompletedPromise.set_value(errorCode == AWS_ERROR_SUCCESS && returnCode == AWS_MQTT_CONNECT_ACCEPTED); - }; - connection->OnDisconnect = [&](Mqtt::MqttConnection &) { connectionClosedPromise.set_value(); }; - - /* - * Actually perform the connect dance. - */ - if (!connection->Connect( - clientId.c_str(), true /*cleanSession*/, 1000 /*keepAliveTimeSecs*/, 60000 /*pingTimeoutMs*/)) - { - exit(-1); - } - - if (connectionCompletedPromise.get_future().get()) - { - Aws::Iotshadow::IotShadowClient shadowClient(connection); - - ShadowState shadowState; - s_setShadowState(daEnv.shadowProperty, daEnv.shadowValue, shadowState); - - /* - * The program will ignore the shadow updat error. If the update failed, device adivsor should report error. - */ - auto publishCompleted = [&shadowUpdatePromise](int /*ioErr*/) { shadowUpdatePromise.set_value(); }; - - UpdateShadowRequest updateShadowRequest; - Aws::Crt::UUID uuid; - updateShadowRequest.ClientToken = uuid.ToString(); - updateShadowRequest.ThingName = daEnv.thing_name; - updateShadowRequest.State = shadowState; - /* - * Update the shadow property. We use AWS_MQTT_QOS_AT_MOST_ONCE since the device advisor will not send - * back PUBACK. In case we busy waiting on the PUBACK, we used AWS_MQTT_QOS_AT_MOST_ONCE for now. - */ - shadowClient.PublishUpdateShadow(updateShadowRequest, AWS_MQTT_QOS_AT_MOST_ONCE, publishCompleted); - shadowUpdatePromise.get_future().wait(); - - /* Disconnect */ - if (connection->Disconnect()) - { - connectionClosedPromise.get_future().wait(); - } - } - else - { - exit(-1); - } - - return 0; -} diff --git a/deviceadvisor/tests/utils/datest_utils.cpp b/deviceadvisor/tests/utils/datest_utils.cpp deleted file mode 100644 index 937cf854e0..0000000000 --- a/deviceadvisor/tests/utils/datest_utils.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include "datest_utils.h" - -using namespace Aws::Crt; -using namespace DATest_Utils; - -namespace DATest_Utils -{ - AWS_STATIC_STRING_FROM_LITERAL(AWS_ENDPONT, "DA_ENDPOINT"); - AWS_STATIC_STRING_FROM_LITERAL(AWS_CERTI, "DA_CERTI"); - AWS_STATIC_STRING_FROM_LITERAL(AWS_KEY, "DA_KEY"); - AWS_STATIC_STRING_FROM_LITERAL(AWS_TOPIC, "DA_TOPIC"); - AWS_STATIC_STRING_FROM_LITERAL(AWS_THING_NAME, "DA_THING_NAME"); - AWS_STATIC_STRING_FROM_LITERAL(AWS_SHADOW_PROPERTY, "DA_SHADOW_PROPERTY"); - AWS_STATIC_STRING_FROM_LITERAL(AWS_SHADOW_VALUE_SET, "DA_SHADOW_VALUE_SET"); -} // namespace DATest_Utils - -bool DeviceAdvisorEnvironment::init(TestType type) -{ - /* - * Use aws_string to retrieve the environment variables. - */ - aws_string *aws_string_endpoint = NULL; - aws_string *aws_string_key = NULL; - aws_string *aws_string_topic = NULL; - aws_string *aws_string_certificate = NULL; - aws_string *aws_string_thing_name = NULL; - aws_string *aws_string_shadow_property = NULL; - aws_string *aws_string_shadow_value = NULL; - - aws_get_environment_value(g_allocator, AWS_ENDPONT, &aws_string_endpoint); - aws_get_environment_value(g_allocator, AWS_CERTI, &aws_string_certificate); - aws_get_environment_value(g_allocator, AWS_KEY, &aws_string_key); - aws_get_environment_value(g_allocator, AWS_TOPIC, &aws_string_topic); - aws_get_environment_value(g_allocator, AWS_THING_NAME, &aws_string_thing_name); - aws_get_environment_value(g_allocator, AWS_SHADOW_PROPERTY, &aws_string_shadow_property); - aws_get_environment_value(g_allocator, AWS_SHADOW_VALUE_SET, &aws_string_shadow_value); - - /* - * Assign environment variable value to the parameters. - */ - endpoint = aws_string_endpoint == nullptr ? "" : aws_string_c_str(aws_string_endpoint); - certificatePath = aws_string_certificate == nullptr ? "" : aws_string_c_str(aws_string_certificate); - keyPath = aws_string_key == nullptr ? "" : aws_string_c_str(aws_string_key); - topic = aws_string_topic == nullptr ? "" : aws_string_c_str(aws_string_topic); - thing_name = aws_string_thing_name == nullptr ? "" : aws_string_c_str(aws_string_thing_name); - shadowProperty = aws_string_shadow_property == nullptr ? "" : aws_string_c_str(aws_string_shadow_property); - shadowValue = aws_string_shadow_value == nullptr ? "" : aws_string_c_str(aws_string_shadow_value); - - /* - * Destroy the aws_string. - */ - aws_string_destroy(aws_string_endpoint); - aws_string_destroy(aws_string_certificate); - aws_string_destroy(aws_string_key); - aws_string_destroy(aws_string_topic); - aws_string_destroy(aws_string_thing_name); - aws_string_destroy(aws_string_shadow_property); - aws_string_destroy(aws_string_shadow_value); - - /* - * Validate environment variables. - */ - if (endpoint.empty() || certificatePath.empty() || keyPath.empty()) - { - return false; - } - - if (topic.empty() && type == SUB_PUB) - { - return false; - } - - if ((thing_name.empty() || shadowProperty.empty() || shadowValue.empty()) && type == SHADOW) - { - return false; - } - - return true; -} \ No newline at end of file diff --git a/deviceadvisor/tests/utils/datest_utils.h b/deviceadvisor/tests/utils/datest_utils.h deleted file mode 100644 index 91389d46c8..0000000000 --- a/deviceadvisor/tests/utils/datest_utils.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -#include -#include -#include -#include -#include - -using namespace Aws::Crt; - -namespace DATest_Utils -{ - enum TestType - { - CONNECT, - SUB_PUB, - SHADOW - }; - - struct DeviceAdvisorEnvironment - { - String endpoint; - String certificatePath; - String keyPath; - String topic; - String thing_name; - String shadowProperty; - String shadowValue; - bool init(TestType type); - }; -} // namespace DATest_Utils diff --git a/documents/FAQ.md b/documents/FAQ.md index 67d5297898..b814bde387 100644 --- a/documents/FAQ.md +++ b/documents/FAQ.md @@ -10,6 +10,7 @@ * [I am experiencing deadlocks](#i-am-experiencing-deadlocks) * [How do debug in VSCode?](#how-do-debug-in-vscode) * [What certificates do I need?](#what-certificates-do-i-need) +* [Where can I find MQTT 311 Samples?](#where-can-i-find-mqtt-311-samples) * [I still have more questions about this sdk?](#i-still-have-more-questions-about-this-sdk) ### Where should I start? @@ -123,6 +124,9 @@ Here is an example launch.json file to run the pubsub sample * You should have generated/downloaded private and public keys that will be used to verify that communications are coming from you * When using samples you only need the private key and it will look like this: `--key abcde12345-private.pem.key` +### Where can I find MQTT 311 Samples? +The MQTT 311 Samples can be found in the v1.40.0 samples folder [here](https://github.com/aws/aws-iot-device-sdk-cpp-v2/tree/v1.40.0/samples) + ### I still have more questions about this sdk? * [Here](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) are the AWS IoT Core docs for more details about IoT Core diff --git a/format-check.py b/format-check.py index 8dcc21958f..d55723d89c 100755 --- a/format-check.py +++ b/format-check.py @@ -18,7 +18,7 @@ os.chdir(Path(__file__).parent) -check_dirs = ['deviceadvisor', 'devicedefender', 'discovery', 'eventstream_rpc', 'greengrass_ipc', 'identity', 'iotdevicecommon', 'jobs', 'shadow', 'samples', 'secure_tunneling'] +check_dirs = ['devicedefender', 'discovery', 'eventstream_rpc', 'greengrass_ipc', 'identity', 'iotdevicecommon', 'jobs', 'shadow', 'samples', 'secure_tunneling'] filepaths_file = NamedTemporaryFile(delete=False) for check_dir in check_dirs: diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index c819ef358a..a2ce916072 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -9,27 +9,8 @@ add_subdirectory(fleet_provisioning/provision-csr) add_subdirectory(greengrass/ipc) add_subdirectory(greengrass/basic_discovery) add_subdirectory(jobs/jobs-sandbox) -add_subdirectory(mqtt/basic_connect) -add_subdirectory(mqtt/custom_authorizer_connect) -add_subdirectory(mqtt/pkcs11_connect) -add_subdirectory(mqtt/pkcs12_connect) -add_subdirectory(mqtt/websocket_connect) -add_subdirectory(mqtt/windows_cert_connect) -add_subdirectory(mqtt/x509_credentials_provider_connect) -add_subdirectory(mqtt/cognito_connect) add_subdirectory(mqtt5/mqtt5_pubsub) -add_subdirectory(mqtt5/mqtt5_shared_subscription) -add_subdirectory(pub_sub/basic_pub_sub) -add_subdirectory(pub_sub/cycle_pub_sub) add_subdirectory(secure_tunneling/secure_tunnel) add_subdirectory(secure_tunneling/tunnel_notification) add_subdirectory(shadow/shadow_sync) add_subdirectory(commands/commands-sandbox) - - -add_subdirectory(deprecated/shadow/shadow_sync) -add_subdirectory(deprecated/shadow/mqtt5_shadow_sync) -add_subdirectory(deprecated/fleet_provisioning/fleet_provisioning) -add_subdirectory(deprecated/fleet_provisioning/mqtt5_fleet_provisioning) -add_subdirectory(deprecated/jobs/job_execution) -add_subdirectory(deprecated/jobs/mqtt5_job_execution) diff --git a/samples/README.md b/samples/README.md index b4890255cb..f184961717 100644 --- a/samples/README.md +++ b/samples/README.md @@ -8,17 +8,6 @@ + [Direct MQTT with Custom Authentication](./mqtt5/mqtt5_pubsub/README.md#direct-mqtt-with-custom-authentication) + [MQTT over Websockets with Cognito](./mqtt5/mqtt5_pubsub/README.md#mqtt-over-websockets-with-cognito) + [HTTP Proxy](./mqtt5/mqtt5_pubsub/README.md#http-proxy) -* [Mqtt5 Shared Subscription](./mqtt5/mqtt5_shared_subscription/README.md) -## MQTT311 Samples -* [Basic Pub-Sub](./pub_sub/basic_pub_sub/README.md) -* [Basic Connect](./mqtt/basic_connect/README.md) -* [Websocket Connect](./mqtt/websocket_connect/README.md) -* [PKCS#11 Connect](./mqtt/pkcs11_connect/README.md) -* [PKCS#12 Connect](./mqtt/pkcs12_connect/README.md) -* [x509 Credentials Provider Connect](./mqtt/x509_credentials_provider_connect/README.md) -* [Windows Certificate MQTT Connect](./mqtt/windows_cert_connect/README.md) -* [Custom Authorizer Connect](./mqtt/custom_authorizer_connect/README.md) -* [Cognito Connect](./mqtt/cognito_connect/README.md) ## Other Samples * [Jobs Sandbox](./jobs/jobs-sandbox/README.md) * [Shadow Sandbox](./shadow/shadow-sandbox/README.md) @@ -35,7 +24,7 @@ ## Build Instruction -Firstly, build and install aws-iot-devices-sdk-cpp-v2 with following instructions from [Installation](../README.md#Installation). +First build and install aws-iot-devices-sdk-cpp-v2 with following instructions from [Installation](../README.md#Installation). ### Build individual sample diff --git a/samples/deprecated/fleet_provisioning/fleet_provisioning/CMakeLists.txt b/samples/deprecated/fleet_provisioning/fleet_provisioning/CMakeLists.txt deleted file mode 100644 index 67f99a0433..0000000000 --- a/samples/deprecated/fleet_provisioning/fleet_provisioning/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 3.9...3.31) -# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12 -project(fleet-provisioning CXX) - -file(GLOB SRC_FILES - "*.cpp" - "../../../utils/CommandLineUtils.cpp" - "../../../utils/CommandLineUtils.h" -) - -add_executable(${PROJECT_NAME} ${SRC_FILES}) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14) - -#set warnings -if (MSVC) - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) -else () - target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror) -endif () - -find_package(aws-crt-cpp REQUIRED) -find_package(IotIdentity-cpp REQUIRED) - -install(TARGETS ${PROJECT_NAME} DESTINATION bin) - -include(AwsSanitizers) -enable_language(C) -aws_add_sanitizers(${PROJECT_NAME}) - -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp AWS::IotIdentity-cpp) diff --git a/samples/deprecated/fleet_provisioning/fleet_provisioning/README.md b/samples/deprecated/fleet_provisioning/fleet_provisioning/README.md deleted file mode 100644 index 4226783c87..0000000000 --- a/samples/deprecated/fleet_provisioning/fleet_provisioning/README.md +++ /dev/null @@ -1,307 +0,0 @@ -# Fleet provisioning - -[**Return to main sample list**](../../../README.md) - -This sample uses the AWS IoT [Fleet provisioning](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html) to provision devices using either a CSR or Keys-And-Certificate and subsequently calls RegisterThing. This allows you to create new AWS IoT Core things using a Fleet Provisioning Template. - -On startup, the script subscribes to topics based on the request type of either CSR or Keys topics, publishes the request to corresponding topic and calls RegisterThing. - -Your IoT Core Thing's [Policy](https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html) must provide privileges for this sample to connect, subscribe, publish, and receive. Below is a sample policy that can be used on your IoT Core Thing that will allow this sample to run as intended. - -
-(see sample policy) -
-{
-  "Version": "2012-10-17",
-  "Statement": [
-    {
-      "Effect": "Allow",
-      "Action": "iot:Publish",
-      "Resource": [
-        "arn:aws:iot:region:account:topic/$aws/certificates/create/json",
-        "arn:aws:iot:region:account:topic/$aws/certificates/create-from-csr/json",
-        "arn:aws:iot:region:account:topic/$aws/provisioning-templates/templatename/provision/json"
-      ]
-    },
-    {
-      "Effect": "Allow",
-      "Action": [
-        "iot:Receive"
-      ],
-      "Resource": [
-        "arn:aws:iot:region:account:topic/$aws/certificates/create/json/accepted",
-        "arn:aws:iot:region:account:topic/$aws/certificates/create/json/rejected",
-        "arn:aws:iot:region:account:topic/$aws/certificates/create-from-csr/json/accepted",
-        "arn:aws:iot:region:account:topic/$aws/certificates/create-from-csr/json/rejected",
-        "arn:aws:iot:region:account:topic/$aws/provisioning-templates/templatename/provision/json/accepted",
-        "arn:aws:iot:region:account:topic/$aws/provisioning-templates/templatename/provision/json/rejected"
-      ]
-    },
-    {
-      "Effect": "Allow",
-      "Action": [
-        "iot:Subscribe"
-      ],
-      "Resource": [
-        "arn:aws:iot:region:account:topicfilter/$aws/certificates/create/json/accepted",
-        "arn:aws:iot:region:account:topicfilter/$aws/certificates/create/json/rejected",
-        "arn:aws:iot:region:account:topicfilter/$aws/certificates/create-from-csr/json/accepted",
-        "arn:aws:iot:region:account:topicfilter/$aws/certificates/create-from-csr/json/rejected",
-        "arn:aws:iot:region:account:topicfilter/$aws/provisioning-templates/templatename/provision/json/accepted",
-        "arn:aws:iot:region:account:topicfilter/$aws/provisioning-templates/templatename/provision/json/rejected"
-      ]
-    },
-    {
-      "Effect": "Allow",
-      "Action": "iot:Connect",
-      "Resource": "arn:aws:iot:region:account:client/test-*"
-    }
-  ]
-}
-
- -Replace with the following with the data from your AWS account: -* ``: The AWS IoT Core region where you created your AWS IoT Core thing you wish to use with this sample. For example `us-east-1`. -* ``: Your AWS IoT Core account ID. This is the set of numbers in the top right next to your AWS account name when using the AWS IoT Core website. -* ``: The name of your AWS Fleet Provisioning template you want to use to create new AWS IoT Core Things. - -Note that in a real application, you may want to avoid the use of wildcards in your ClientID or use them selectively. Please follow best practices when working with AWS on production applications using the SDK. Also, for the purposes of this sample, please make sure your policy allows a client ID of `test-*` to connect or use `--client_id ` to send the client ID your policy supports. - -
- -## How to run - -There are many different ways to run the Fleet Provisioning sample because of how many different ways there are to setup a Fleet Provisioning template in AWS IoT Core. **The easiest and most common way is to run the sample with the following**: - -``` sh -./fleet-provisioning --endpoint --cert --key --template_name