thin-edge.io icon indicating copy to clipboard operation
thin-edge.io copied to clipboard

Add AWS keywords and create test for connecting thinedge to AWS using keys for authentication

Open gligorisaev opened this issue 6 months ago • 2 comments

New keywords are added to the ThinEdgeIO Robot Framework Library

  1. Create Session With Keys - Creates an AWS session using the provided access key, secret key, and optional region.
  2. Create New Policy - Creates a new IoT policy with the provided name and reads the policy document from a file.
  3. Register Device - Registers a new IoT Thing with the provided device ID.
  4. Check Policy Exists - Checks if the specified IoT policy exists.
  5. Check Device Exists - Checks if the specified IoT device (thing) exists.
  6. Configure Device - Configures the device by creating keys and certificates, attaching the policy to the certificate,
  7. Teardown AWS Resources- Deletes the created IoT policy and the registered device (thing) in AWS IoT Core.

Test Case created: tests/RobotFramework/tests/aws/aws_coonect_with_keys.robot

Description:

This test case validates the ability of thin-edge.io to successfully connect to AWS IoT Core. The test ensures that the necessary AWS credentials are available in the .env file and that the AWS IoT Core environment is correctly configured.

Preconditions:

AWS credentials:

  • AWS_URL
  • AWS_ACCESS_KEY
  • AWS_SECRET_KEY
  • AWS_REGION

must be provided in the .env file.

The test also support SSH adapter to be used.

Test Steps:

- Verify the certificate creation on the thin-edge.io device.
- Create an AWS session using the provided credentials.
- Create a new IoT policy in AWS IoT Core.
- Verify that the IoT policy was created successfully.
- Register the thin-edge.io device (thing) in AWS IoT Core.
- Verify that the device was registered successfully.
- Attach the IoT policy and certificate to the registered device.
- Connect the thin-edge.io device to AWS IoT Core.

Suite Setup:

Custom setup is executed, which includes setting up the device serial number and configuring the AWS IoT Core URL.

Teardown:

Custom teardown is performed, which includes removing the created resources from AWS IoT Core, deleting the certificate files from the device, and retrieving logs.

Tags:

theme:aws test:on_demand

  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • [ ] Documentation Update (if none of the other choices apply)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


Checklist

  • [x] I have read the CONTRIBUTING doc
  • [x] I have signed the CLA (in all commits with git commit -s)
  • [ ] I ran cargo fmt as mentioned in CODING_GUIDELINES
  • [ ] I used cargo clippy as mentioned in CODING_GUIDELINES
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added necessary documentation (if appropriate)

Further comments

gligorisaev avatar Aug 15 '24 11:08 gligorisaev