Skip to content

Commit

Permalink
Merge pull request #39 from ARMmbed/release-2.2.1
Browse files Browse the repository at this point in the history
mbed-cloud-client-example 2.2.1
  • Loading branch information
teetak01 authored Feb 28, 2019
2 parents e58c37a + f38ef71 commit 51b2658
Show file tree
Hide file tree
Showing 36 changed files with 287 additions and 110 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog for Pelion Device Management Client example application

## Release 2.2.1 (28.02.2019)

* Updated to Mbed OS 5.11.5.
* Added KVStore support for Nucleo F411RE.
* Changed the board configuration for Nucleo F429ZI to use internal flash profile.
* Added bootloaders for the `legacy_storage` configurations as part of the application repository. Explicitly defined the target offsets for each bootloader to provide more clarify on the board configuration.
* By default, `MBED_CLOUD_CLIENT_STL_API` is set to `0` in `mbed_lib-json`. This disables the deprecated client APIs completely in `SimpleM2MResourceString` and `SimpleM2MResourceInt` classes. `MBED_CLOUD_CLIENT_STD_NAMESPACE_POLLUTION` is `0` also by default. It disables the namespace pollution of code that includes `MbedCloudClient.h` with using `namespace std;`. With these changes you can save extra ROM overhead of ~15 KB on ROM budget, depending on the compiler toolchain used.
* Added Python3 support for Device Management end-to-end tests.
* Updated the minimum required version of Mbed Python SDK to 2.0.5.
* Updated the minimum Icetea version to 1.2.1.

## Release 2.2.0 (25.02.2019)

* Updated to Mbed OS 5.11.4.
Expand Down
50 changes: 29 additions & 21 deletions TESTS/E2E/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Device Management E2E testing

Device Management E2E tests are platform-agnostic. They verify that a target platform can reliably perform basic critical operations.
Device Management E2E tests are platform agnostic. They verify that a target platform can reliably perform basic critical operations.
There are two different test sets:
- The tests are designed for verifying the basic functionality of a target platform.

- Tests for verifying the basic functionality of a target platform.
- Advanced tests for more complex use cases (for example `device_update` test case).

## Requirements

1. [IceTea](https://github.com/ARMmbed/icetea) v1.0.0 or later.
1. [Mbed Cloud SDK for Python](https://cloud.mbed.com/docs/current/mbed-cloud-sdk-python/index.html) v2.0.0 or later.
1. [IceTea](https://github.com/ARMmbed/icetea) v1.2.1 or later.
1. [Mbed Cloud SDK for Python](https://cloud.mbed.com/docs/current/mbed-cloud-sdk-python/index.html) v2.0.5 or later.

## Installation

Expand All @@ -18,43 +19,49 @@ pip install icetea mbed-cloud-sdk

## Basic usage

1. Register your device to Device Management. For examples see the [tutorials](https://cloud.mbed.com/docs/current/connecting/device-management-client-tutorials.html).
1. Input your [device_id](https://cloud.mbed.com/docs/current/connecting/device-identity.html) to `TESTS/E2E/pelion.tc_cfg`.
1. Input your [API key](https://cloud.mbed.com/docs/current/integrate-web-app/api-keys.html) to `TESTS/E2E/pelion.tc_cfg`.
1. Register your device to Device Management. For examples, see the [tutorials](https://cloud.mbed.com/docs/current/connecting/device-management-client-tutorials.html).
1. Enter your [device_id](https://cloud.mbed.com/docs/current/connecting/device-identity.html) to `TESTS/E2E/pelion.tc_cfg`.
1. Enter your [API key](https://cloud.mbed.com/docs/current/integrate-web-app/api-keys.html) to `TESTS/E2E/pelion.tc_cfg`.

### Running the test suite

### Running test-suite
To run the test suite, use the following command:

```
icetea --suite basic_tests.json --suitedir TESTS/E2E/ --tcdir ./TESTS/E2E/ --tc_cfg TESTS/E2E/pelion.tc_cfg
```
If you have prepared a manifest (See below notes for `device_update` testcase), you can run the full suite with:

If you have prepared a manifest (see below the instructions for `device_update` testcase), you can run the full suite with:

```
icetea --suite full_tests.json --suitedir TESTS/E2E/ --tcdir ./TESTS/E2E/ --tc_cfg TESTS/E2E/pelion.tc_cfg
```

### Running a single test

To run a single test, use the following command:

### Running single test
```
icetea --tc basic_get --tcdir ./TESTS/E2E/ --tc_cfg TESTS/E2E/pelion.tc_cfg
```

## Current tests

| Testname | Main functions | Notes |
| Test name | Main functions | Notes |
| ---------------- | ------------------------------------------ | --------------------------------------|
| `register` | Verify that device is registered. | |
| `get` | Verify that device responds to GET. | Uses OMA resource `/3/0/0` |
| `put` | Verify that device responds to PUT. | Uses custom resource `/3201/0/5853` |
| `post` | Verify that device responds to POST. | Uses custom resource `/3201/0/5850` |
| `observation` | Verify that device can send otifications. | Uses custom resource `/3201/0/5853` |
| `deregister` | Verify that device can deregister . | Uses custom resource `/5000/0/1` |
| `device_update` | Performs firmware update | This testcase verifies that the endpoint can perform a firmware update. For this testcase, you need to manually generate an update image and a manifest.|
| `register` | Verify that the device is registered. | |
| `get` | Verify that the device responds to GET. | Uses OMA resource `/3/0/0` |
| `put` | Verify that the device responds to PUT. | Uses custom resource `/3201/0/5853` |
| `post` | Verify that the device responds to POST. | Uses custom resource `/3201/0/5850` |
| `observation` | Verify that the device can send notifications. | Uses custom resource `/3201/0/5853` |
| `deregister` | Verify that the device can deregister. | Uses custom resource `/5000/0/1` |
| `device_update` | Performs the firmware update. | This testcase verifies that the device can perform a firmware update. For this testcase, you need to manually generate an update image and a manifest. |

### Executing `device_update` test case

The test case does not automatically generate an update image or generate a manifest. We recommend that you read [Update documentation](https://cloud.mbed.com/docs/current/updating-firmware/index.html).
The test case does not automatically generate an update image or generate a manifest. Read [Update documentation](https://cloud.mbed.com/docs/current/updating-firmware/index.html) for more information.

You need to do the following:
To run the test case:

1. Compile a new update image.
1. Upload the image to Device Management.
Expand All @@ -77,8 +84,9 @@ The last command uploads the `mbed-cloud-client-example_update.bin`, generates a
```

To execute the test, use the following command:

```
icetea --tc device_update --tcdir ./TESTS/E2E/ --tc_cfg TESTS/E2E/pelion.tc_cfg
```

<span class="notes">**Note**: After each successful update you need to generate a new manifest for a new firmware update test. Otherwise the test will pass without actually performing any device side updates. The update campaign ends automatically because the manifest has already been applied to the device.</span>
<span class="notes">**Note:** After each successful update, you need to generate a new manifest for a new firmware update test. Otherwise, the test will pass without actually performing any device side updates. The update campaign ends automatically because the manifest has already been applied to the device.</span>
7 changes: 4 additions & 3 deletions TESTS/E2E/pelion_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def setup_update(self):
self.update_api = UpdateAPI(self.test_config)

def _callback_fn(self, device_id, path, value):
self.logger.info("Notification for %s received: %r value: %r", device_id, path, value)
self.notified_value = value
string = value.decode("utf-8")
self.logger.info("Notification for %s received: %r value: %r", device_id, path, string)
self.notified_value = string

def verify_registration(self, expected_state):
self.logger.info("Verify device to in state %s", expected_state)
Expand Down Expand Up @@ -134,7 +135,7 @@ def check_campaign_state(self, campaign_id):
raise TestStepFail("Get Campaign metadata returned %d" % response.status_code)

resp = json.loads(response.content)
if 'data' in resp and resp['data'] > 0:
if 'data' in resp and resp['data'][0]['deployment_state']:
meta_data = resp['data']
device_state = meta_data[0]['deployment_state']
results.append(device_state)
Expand Down
33 changes: 16 additions & 17 deletions configs/eth_v4.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"macros": [
"MBED_BOOTLOADER_SIZE=(32*1024)",
"ARM_UC_USE_PAL_BLOCKDEVICE=1"
],
"target_overrides": {
Expand All @@ -21,6 +22,8 @@
"K64F": {
"target.network-default-interface-type" : "ETHERNET",
"target.bootloader_img" : "tools/mbed-bootloader-k64f-block_device-kvstore-v4.0.0.bin",
"target.header_offset" : "0xa000",
"target.app_offset" : "0xa400",
"target.components_add" : ["SD"],
"update-client.bootloader-details" : "0x00007188",
"update-client.application-details" : "(40*1024)",
Expand Down Expand Up @@ -52,28 +55,24 @@
},
"NUCLEO_F429ZI": {
"target.network-default-interface-type" : "ETHERNET",
"target.bootloader_img" : "tools/mbed-bootloader-nucleo_f429zi-block_device-kvstore-v4.0.0.bin",
"target.components_add" : ["SD"],
"target.bootloader_img" : "tools/mbed-bootloader-nucleo_f429zi-internal_flash-no_rot-v4.0.0.bin",
"target.header_offset" : "0x8000",
"target.app_offset" : "0x8400",
"update-client.bootloader-details" : "0x080078CC",
"update-client.application-details" : "(0x08000000+64*1024)",
"update-client.storage-address" : "(1024*1024*64)",
"update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)",
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
"storage_filesystem.internal_base_address" : "(0x08000000+32*1024)",
"storage_filesystem.rbp_internal_size" : "(32*1024)",
"storage_filesystem.external_base_address" : "(0x0)",
"storage_filesystem.external_size" : "(1024*1024*64)",
"storage.storage_type" : "FILESYSTEM",
"storage_filesystem.filesystem" : "LITTLE",
"storage_filesystem.blockdevice" : "SD",
"sd.SPI_MOSI" : "PC_12",
"sd.SPI_MISO" : "PC_11",
"sd.SPI_CLK" : "PC_10",
"sd.SPI_CS" : "PA_15"
"update-client.application-details" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
"update-client.storage-address" : "(MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS+MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)",
"update-client.storage-size" : "(1024*1024-MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)",
"update-client.storage-page" : 1,
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP",
"storage_tdb_internal.internal_base_address": "(MBED_ROM_START+1024*1024)",
"storage_tdb_internal.internal_size" : "(128*1024)",
"storage.storage_type" : "TDB_INTERNAL"
},
"UBLOX_EVK_ODIN_W2": {
"target.network-default-interface-type" : "ETHERNET",
"target.bootloader_img" : "tools/mbed-bootloader-ublox_evk_odin_w2-block_device-kvstore-v4.0.0.bin",
"target.header_offset" : "0x10000",
"target.app_offset" : "0x10400",
"target.components_add" : ["SD"],
"update-client.bootloader-details" : "0x08007300",
"update-client.application-details" : "(0x08000000+64*1024)",
Expand Down
33 changes: 16 additions & 17 deletions configs/eth_v6.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"macros": [
"MBED_BOOTLOADER_SIZE=(32*1024)",
"ARM_UC_USE_PAL_BLOCKDEVICE=1"
],
"target_overrides": {
Expand All @@ -23,6 +24,8 @@
"K64F": {
"target.network-default-interface-type" : "ETHERNET",
"target.bootloader_img" : "tools/mbed-bootloader-k64f-block_device-kvstore-v4.0.0.bin",
"target.header_offset" : "0xa000",
"target.app_offset" : "0xa400",
"target.components_add" : ["SD"],
"update-client.bootloader-details" : "0x00007188",
"update-client.application-details" : "(40*1024)",
Expand Down Expand Up @@ -54,28 +57,24 @@
},
"NUCLEO_F429ZI": {
"target.network-default-interface-type" : "ETHERNET",
"target.bootloader_img" : "tools/mbed-bootloader-nucleo_f429zi-block_device-kvstore-v4.0.0.bin",
"target.components_add" : ["SD"],
"target.bootloader_img" : "tools/mbed-bootloader-nucleo_f429zi-internal_flash-no_rot-v4.0.0.bin",
"target.header_offset" : "0x8000",
"target.app_offset" : "0x8400",
"update-client.bootloader-details" : "0x080078CC",
"update-client.application-details" : "(0x08000000+64*1024)",
"update-client.storage-address" : "(1024*1024*64)",
"update-client.storage-size" : "((MBED_ROM_START + MBED_ROM_SIZE - APPLICATION_ADDR) * MBED_CONF_UPDATE_CLIENT_STORAGE_LOCATIONS)",
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
"storage_filesystem.internal_base_address" : "(0x08000000+32*1024)",
"storage_filesystem.rbp_internal_size" : "(32*1024)",
"storage_filesystem.external_base_address" : "(0x0)",
"storage_filesystem.external_size" : "(1024*1024*64)",
"storage.storage_type" : "FILESYSTEM",
"storage_filesystem.filesystem" : "LITTLE",
"storage_filesystem.blockdevice" : "SD",
"sd.SPI_MOSI" : "PC_12",
"sd.SPI_MISO" : "PC_11",
"sd.SPI_CLK" : "PC_10",
"sd.SPI_CS" : "PA_15"
"update-client.application-details" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
"update-client.storage-address" : "(MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS+MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)",
"update-client.storage-size" : "(1024*1024-MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)",
"update-client.storage-page" : 1,
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP",
"storage_tdb_internal.internal_base_address": "(MBED_ROM_START+1024*1024)",
"storage_tdb_internal.internal_size" : "(128*1024)",
"storage.storage_type" : "TDB_INTERNAL"
},
"UBLOX_EVK_ODIN_W2": {
"target.network-default-interface-type" : "ETHERNET",
"target.bootloader_img" : "tools/mbed-bootloader-ublox_evk_odin_w2-block_device-kvstore-v4.0.0.bin",
"target.header_offset" : "0x10000",
"target.app_offset" : "0x10400",
"target.components_add" : ["SD"],
"update-client.bootloader-details" : "0x08007300",
"update-client.application-details" : "(0x08000000+64*1024)",
Expand Down
12 changes: 12 additions & 0 deletions configs/legacy_storage/eth_v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"lwip.mem-size" : 12500
},
"K64F": {
"target.bootloader_img" : "tools/mbed-bootloader-k64f-block_device-sotp-v3.4.0.bin",
"target.header_offset" : "0xa000",
"target.app_offset" : "0xa400",
"target.network-default-interface-type" : "ETHERNET",
"update-client.bootloader-details" : "0x00007188",
"update-client.application-details" : "(40*1024)",
Expand All @@ -34,6 +37,9 @@
"client_app.sotp-section-2-size" : "( 4*1024)"
},
"K66F": {
"target.bootloader_img" : "tools/mbed-bootloader-k66f-block_device-sotp-v3.4.0.bin",
"target.header_offset" : "0xa000",
"target.app_offset" : "0xa400",
"target.network-default-interface-type" : "ETHERNET",
"update-client.bootloader-details" : "0x00007188",
"update-client.application-details" : "(40*1024)",
Expand All @@ -44,6 +50,9 @@
"client_app.sotp-section-2-size" : "( 4*1024)"
},
"NUCLEO_F429ZI": {
"target.bootloader_img" : "tools/mbed-bootloader-nucleo_f429zi-block_device-sotp-v3.4.0.bin",
"target.header_offset" : "0x10000",
"target.app_offset" : "0x10400",
"target.network-default-interface-type" : "ETHERNET",
"update-client.bootloader-details" : "0x080078CC",
"update-client.application-details" : "(0x08000000+64*1024)",
Expand All @@ -58,6 +67,9 @@
"sd.SPI_CS" : "PA_15"
},
"UBLOX_EVK_ODIN_W2": {
"target.bootloader_img" : "tools/mbed-bootloader-ublox_evk_odin_w2-block_device-sotp-v3.4.0.bin",
"target.header_offset" : "0x10000",
"target.app_offset" : "0x10400",
"target.network-default-interface-type" : "ETHERNET",
"update-client.bootloader-details" : "0x08007300",
"update-client.application-details" : "(0x08000000+64*1024)",
Expand Down
Loading

0 comments on commit 51b2658

Please sign in to comment.