Skip to content

Commit f096cfd

Browse files
authored
Merge pull request #62 from ARMmbed/bring-in-new-pytest-framework
Replace existing test-framework with pytest-based Pelion tests
2 parents 2cc573d + 6228263 commit f096cfd

18 files changed

+51
-858
lines changed

README.md

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
# Pelion Client Mbed OS Example
1+
# Pelion Device Management Client example for Mbed OS
22

3-
This is a simplified example for Mbed OS with the following features:
4-
- Mbed OS 5.14.1 and Pelion Device Management Client 4.0.0
5-
- Support for FW Update
6-
- 200 lines of code + credential sources
3+
This is an basic Device Management client example for Mbed OS with the following features:
4+
- Support for latest Mbed OS and Device Management Client releases.
5+
- Support for Developer mode provisioning.
6+
- Support for FW Update.
77

8-
There is an example of the client for multiple operating systems in [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example) repository. The underlying client library is the same for both. This Mbed OS only example is simpler as it only supports one OS, but if you want to do development in Linux and Mbed OS at the same time - you should use the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example).
8+
There is a more advanced example of the client with support for multiple operating systems in [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example) repository. The underlying client library is the same for both. This Mbed OS only example is simpler as it only supports one OS with a limited set of demonstrated features. If you want to do development in Linux and Mbed OS at the same time - you should use the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example).
99

10-
## Supported platforms
10+
<span class="notes">**Note:** If you want to use production provisioning modes, or use more advanced client features, those are demonstrated via [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example).</span>
1111

12-
This table shows a list of platforms that are supported.
12+
## Supported boards
1313

14-
Platform | Connectivity | Storage for credentials and FW candidate | Notes
14+
This table shows a list of boards that are supported.
15+
16+
Board | Connectivity | Storage for credentials and FW candidate | Notes
1517
----------------------------------| ------------------| ------------------------| --------------
16-
NXP K64F | Ethernet | Internal Flash |
17-
NXP K66F | Ethernet | Internal Flash |
18-
ST NUCLEO_F429ZI | Ethernet | Internal Flash |
19-
ST NUCLEO_F411RE | Wi-Fi ESP8266 | SD card |
20-
Ublox UBLOX_EVK_ODIN_W2 | Wi-Fi | SD card |
21-
ST DISCO_L475VG_IOT01A | Wi-Fi | QSPIF |
18+
`NXP K64F` | Ethernet | Internal Flash |
19+
`NXP K66F` | Ethernet | Internal Flash |
20+
`ST NUCLEO_F429ZI` | Ethernet | Internal Flash |
21+
`ST NUCLEO_F411RE` | Wi-Fi ESP8266 | SD card |
22+
`Ublox UBLOX_EVK_ODIN_W2` | Wi-Fi | SD card |
23+
`ST DISCO_L475VG_IOT01A` | Wi-Fi | QSPIF |
2224

2325
Build-only = This target is currently verified only via compilation, and is not verified at runtime.
2426

@@ -45,8 +47,8 @@ This section is intended for developers to get started, import the example appli
4547
This repository is in the process of being updated and depends on few enhancements being deployed in mbed-cloud-client. In the meantime, follow these steps to import and apply the patches before compiling.
4648

4749
```
48-
mbed import mbed-os-pelion-example
49-
cd mbed-os-pelion-example
50+
mbed import mbed-os-example-pelion
51+
cd mbed-os-example-pelion
5052
```
5153

5254
## Compiling
@@ -155,17 +157,17 @@ You can extend or override the default configuration using `mbed_app.json` in th
155157

156158
- **Option 1:** Allocating credentials in internal memory
157159

158-
**This is the preferred option whenever possible**. Make sure `TDB_INTERNAL` is the type of storage selected in `mbed_app.json`. Specify the base address depending on the available memory in the system. The size of this section should be aligned with the flash erase sector. The value should be multiple of 4 with a minimum of 24KB and upwards depending on the use case (for example the usage of certificate chain will increase the need of storage to hold those certificates). An example of this configuration can be seen for the `NUCLEO_F429ZI` platform in this application.
160+
**This is the preferred option whenever possible**. Make sure `TDB_INTERNAL` is the type of storage selected in `mbed_app.json`. Specify the base address depending on the available memory in the system. The size of this section should be aligned with the flash erase sector. The value should be multiple of 4 with a minimum of 24KB and upwards depending on the use case (for example the usage of certificate chain will increase the need of storage to hold those certificates). An example of this configuration can be seen for the `NUCLEO_F429ZI` board in this application.
159161

160162
"storage.storage_type" : "TDB_INTERNAL"
161163
"storage_tdb_internal.internal_base_address": "(MBED_ROM_START+1024*1024)",
162164
"storage_tdb_internal.internal_size" : "(128*1024)",
163165

164166
- **Option 2:** Allocating credentials in external memory:
165167

166-
This is possible when the platform has an storage device wired to the MCU (could be on-board or external component). Make sure `FILESYSTEM` is specified as type of storage. The blockdevice and filesystem should be one of the supported in Mbed OS (see [docs](https://os.mbed.com/docs/mbed-os/latest/porting/blockdevice-port.html)).
168+
This is possible when the board has an storage device wired to the MCU (could be on-board or external component). Make sure `FILESYSTEM` is specified as type of storage. The blockdevice and filesystem should be one of the supported in Mbed OS (see [docs](https://os.mbed.com/docs/mbed-os/latest/porting/blockdevice-port.html)).
167169

168-
An example of this configuration can be seen for the `K64F` platform in the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/mbed_app.json#L32)
170+
An example of this configuration can be seen for the `K64F` board in the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/mbed_app.json#L32)
169171

170172
"storage.storage_type" : "FILESYSTEM",
171173
"storage_filesystem.blockdevice" : "SD",
@@ -179,7 +181,7 @@ You can extend or override the default configuration using `mbed_app.json` in th
179181

180182
Before enabling FW updates, it's recomended that the application is able to initialize the network and connect to Pelion DM.
181183

182-
Once the connection is successfull, you can follow the steps below to enable the platform to receive FW updates. Note the configuration for the application in this section should match with the one on the bootloader - see section below.
184+
Once the connection is successfull, you can follow the steps below to enable the board to receive FW updates. Note the configuration for the application in this section should match with the one on the bootloader - see section below.
183185

184186
- Common configuration
185187

@@ -199,7 +201,7 @@ You can extend or override the default configuration using `mbed_app.json` in th
199201

200202
- `target.header_offset` is also relative offset to the `flash-start-address` you specified in the `bootloader_app.json`, and is the hex value of the offset specified by `update-client.application-details`. For example, `(MBED_CONF_APP_FLASH_START_ADDRESS+64*1024)` dec equals `0x10000` hex.</span>
201203

202-
An example of this configuration can be seen for the `NUCLEO_F429ZI` platform.
204+
An example of this configuration can be seen for the `NUCLEO_F429ZI` board.
203205

204206
"update-client.application-details" : "(MBED_ROM_START + MBED_BOOTLOADER_SIZE)",
205207
"update-client.bootloader-details" : "0x08007300",
@@ -209,7 +211,7 @@ You can extend or override the default configuration using `mbed_app.json` in th
209211

210212
- **Option 1:** Allocating the firmware update candidate in internal memory
211213

212-
**This is the preferred option whenever possible**. Make sure `ARM_UCP_FLASHIAP` is selected in `update-storage` in `mbed_app.json`. This area should be located at the end of the flash after the KVSTORE area. Specify the `storage-address`, `storage-size` and `storage-page` as required. The `application-details` option should point at the end of the bootloader area. An example of this configuration can be seen for the `NUCLEO_F429ZI` platform.
214+
**This is the preferred option whenever possible**. Make sure `ARM_UCP_FLASHIAP` is selected in `update-storage` in `mbed_app.json`. This area should be located at the end of the flash after the KVSTORE area. Specify the `storage-address`, `storage-size` and `storage-page` as required. The `application-details` option should point at the end of the bootloader area. An example of this configuration can be seen for the `NUCLEO_F429ZI` board.
213215

214216
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP",
215217
"update-client.storage-address" : "(MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS+MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE)",
@@ -220,7 +222,7 @@ You can extend or override the default configuration using `mbed_app.json` in th
220222

221223
When using an external device to the MCU to store the firmware candidate, make sure `ARM_UCP_FLASHIAP_BLOCKDEVICE` is specified as type of `update-storage`. Specify the `storage-address`, `storage-size` and `storage-page` as required.
222224

223-
An example of this configuration can be seen for the `K64F` platform in the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/mbed_app.json#L32)
225+
An example of this configuration can be seen for the `K64F` board in the [mbed-cloud-client-example](https://github.com/ARMmbed/mbed-cloud-client-example/blob/master/mbed_app.json#L32)
224226

225227
"mbed-cloud-client.update-storage" : "ARM_UCP_FLASHIAP_BLOCKDEVICE",
226228
"update-client.storage-address" : "(1024*1024*64)",
@@ -232,7 +234,7 @@ The bootloader is required to perform FW Updates. The steps below explain how to
232234

233235
1. Import as a new application the [mbed-bootloader](https://github.com/ARMmbed/mbed-bootloader/) repository.
234236

235-
1. Edit the bootloader application configuration in this example (`bootloader/bootloader_app.json`) and add a new target entry. An example of this configuration can be seen for the `NUCLEO_F429ZI` platform:
237+
1. Edit the bootloader application configuration in this example (`bootloader/bootloader_app.json`) and add a new target entry. An example of this configuration can be seen for the `NUCLEO_F429ZI` board:
236238

237239

238240
"update-client.firmware-header-version" : "2",
@@ -254,23 +256,40 @@ The bootloader is required to perform FW Updates. The steps below explain how to
254256
<span class="notes">**Note:** `mbed-bootloader` is primarily optimized for `GCC_ARM`, so you may want to compile it with that toolchain.
255257
Before jumping to the next step, you should compile and flash the bootloader and then connect over the virtual serial port to ensure the bootloader is running correctly. You can ignore errors related to checksum verification or failure to jump to application - these are expected at this stage.</span>
256258

257-
## Validation and testing
259+
## Validation and testing for the board configuration
258260

259-
In addition to having an example application succesfully connected to Pelion DM, it's required to ensure that the application is working correcly in multiple situations. This can be achived by running the following tests:
261+
The board needs to pass the underlying Mbed OS tests and be supported by official Mbed OS release.
260262

261263
- Mbed OS tests (as described in our [documentation](https://os.mbed.com/docs/mbed-os/latest/porting/testing.html))
262264

263-
`mbed test`
265+
`cd mbed-os`
266+
`mbed test -m <target> -t <toolchain>`
264267

265268
- Mbed OS integration tests
266269

267270
See [mbed-os/TESTS/integration/README.md](https://github.com/ARMmbed/mbed-os/blob/sip-workshop/TESTS/integration/README.md) (sip-workshop branch)
268271

269-
`mbed test -t <toolchain> -m <platform> -n *integration-* -DINTEGRATION_TESTS -v`
272+
`cd mbed-os`
273+
`mbed test -t <toolchain> -m <board> -n *integration-* -DINTEGRATION_TESTS -v`
274+
275+
## Validation and testing for the client configuration
276+
277+
Basic pelion features are required to work:
278+
- Connects to Pelion in developer mode.
279+
- Firmware can be updated.
280+
- Responsive to REST API commands.
281+
282+
This should be verified by executing the Pelion E2E python test library tests.
283+
284+
- Install the prerequisites listed in the README of the [pelion-e2e-python-test-library](https://github.com/ARMmbed/pelion-e2e-python-test-library).
285+
- Configure your API-key as instructed in the same README.
286+
- Basic tests can be then executed as:
287+
288+
`pytest TESTS/pelion-e2e-python-test-library/tests/dev-client-tests.py`
270289

271-
- Pelion Client tests, including firmware update.
290+
After the first test starts running, press the reset-button on your board to start bootstrap/registration.
272291

273-
See the [testing](./TESTS/README.md) documentation to validate the configuration in this example.
292+
<span class="notes">**Note:** Future version will bring in also firmware update test as part of the minimum test set.</span>.
274293

275294
# Known-issues
276295

TESTS/README.md

Lines changed: 0 additions & 116 deletions
This file was deleted.

TESTS/__init__.py

Whitespace-only changes.

TESTS/basic_os_tests.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

TESTS/basic_tests.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)