|
| 1 | +## Nanostack MAC RF tests |
| 2 | + |
| 3 | +This folder contains nanostack MAC RF tests for Icetea. |
| 4 | +The test located under this folder is dependent of the application [`nanostack_mac_tester`](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/device/nanostack_mac_tester). |
| 5 | +The nanostack MAC tester is disabled by default. To run the test cases with the application, either remove the preprocessor macro from main.cpp or add `-DICETEA_MAC_TESTER_ENABLED` to the `mbed test` command. |
| 6 | + |
| 7 | +Icetea test cases are processed by passing commands through the `mbed-client-cli` command line. It is possible to manually replicate most test cases by following the instructions below. |
| 8 | + |
| 9 | +In test cases with more than one device under test (DUT) the target device is given in the instructions as DUT1, DUT2 or DUT3. |
| 10 | + |
| 11 | +## Test cases |
| 12 | + |
| 13 | +### `address_read_and_write` |
| 14 | + |
| 15 | +**Description:** |
| 16 | + |
| 17 | +Write addresses to MAC interface, verify successful write. |
| 18 | + |
| 19 | +**Preconditions:** |
| 20 | + |
| 21 | +None |
| 22 | + |
| 23 | +**Test steps:** |
| 24 | + |
| 25 | +1. Set 64-bit MAC address to 01:02:03:00:00:00:00:01: |
| 26 | + `addr --64-bit 01:02:03:00:00:00:00:01` |
| 27 | +2. Set 16-bit MAC address to 0xABCD: |
| 28 | + `addr --16-bit 0xABCD` |
| 29 | +3. Set MAC PAN ID to 0xCDCD: |
| 30 | + `mlme-set --attr 0x50 --value_bytes CD:CD --value_size 2` |
| 31 | +4. Read and verify 64-bit address: |
| 32 | + `addr` |
| 33 | + |
| 34 | +**Expected result:** |
| 35 | + |
| 36 | +The address that was read is the same as the one that was written. |
| 37 | + |
| 38 | +The test exits with status `PASS` without timeouts. |
| 39 | + |
| 40 | +### `create_and_join_PAN` |
| 41 | + |
| 42 | +**Description:** |
| 43 | + |
| 44 | +Create two Personal Area Networks (PAN) and verify beacon transmission. |
| 45 | + |
| 46 | +Requires 3 devices. |
| 47 | + |
| 48 | +**Preconditions:** |
| 49 | + |
| 50 | +1. All devices have 802.15.4 tranceivers and are in sufficient proximity. |
| 51 | +2. RF channel and adjacent channel are sufficiently clear. |
| 52 | + The RF channel is set in the test case method setUp(). The adjacent |
| 53 | + channel is automatically the next higher one, except for channel 26, |
| 54 | + where the adjacent channel becomes the next lower one. This is because |
| 55 | + 26 is the highest available of the 16 channels in the 2.4-GHz band. |
| 56 | + |
| 57 | +**Test steps:** |
| 58 | + |
| 59 | +1. DUT1: Set MAC beacon payload to "mac-tester": |
| 60 | + `mlme-set --attr 0x45 --value_ascii mac-tester --value_size 10` |
| 61 | +2. DUT1: Set payload length: |
| 62 | + `mlme-set --attr 0x46 --value_uint8 10 --value_size 1` |
| 63 | +3. DUT2: Set MAC beacon payload to "second-mac-tester": |
| 64 | + `mlme-set --attr 0x45 --value_ascii second-mac-tester --value_size 17` |
| 65 | +4. DUT2: Set payload length: |
| 66 | + `mlme-set --attr 0x46 --value_uint8 17 --value_size 1` |
| 67 | +5. DUT1: Start PAN coordinator in chosen channel: |
| 68 | + `start --pan_coordinator true --logical_channel <channel 1>` |
| 69 | +6. DUT2: Start PAN coordinator in adjacent channel: |
| 70 | + `start --pan_coordinator true --logical_channel <channel 2>` |
| 71 | +7. DUT3: Scan with channel mask: |
| 72 | + `scan --channel_mask <hex channel mask>` |
| 73 | + Channel mask is given as a left bitshifted channel number in hexadecimal format. |
| 74 | + For channels 11 and 12, the channel mask becomes 0x1800. |
| 75 | +8. DUT3: Search beacon data for DUT1's beacon: |
| 76 | + `find-beacon --data mac-tester` |
| 77 | +9. DUT3: Search beacon data for DUT2's beacon: |
| 78 | + `find-beacon --data second-mac-tester` |
| 79 | + |
| 80 | +**Expected result:** |
| 81 | + |
| 82 | +DUT1 and DUT2 start beacon transmissions on respective channels. |
| 83 | + |
| 84 | +DUT3 receives and parses beacon transmissions. |
| 85 | + |
| 86 | +The test exits with status `PASS` without timeouts. |
| 87 | + |
| 88 | +### `ED_scan` |
| 89 | + |
| 90 | +**Description:** |
| 91 | + |
| 92 | +Perform Energy Detection (ED) scan to find Personal Area Networks (PAN). |
| 93 | + |
| 94 | +The test case requires that a lot of data is sent on the RF channel. In the test case |
| 95 | +this is done automatically at a rate that is hard to perform manually, which makes |
| 96 | +it difficult to run the test case manually. |
| 97 | + |
| 98 | +Requires 3 devices. |
| 99 | + |
| 100 | +**Preconditions:** |
| 101 | + |
| 102 | +1. All devices have 802.15.4 tranceivers and are in sufficient proximity. |
| 103 | +2. RF channel is sufficiently clear. |
| 104 | + |
| 105 | +**Test steps:** |
| 106 | + |
| 107 | +1. Set addresses for devices: |
| 108 | + DUT1: `addr --64-bit 01:02:03:00:00:00:00:01` |
| 109 | + DUT2: `addr --64-bit 01:02:03:00:00:00:00:02` |
| 110 | + DUT3: `addr --64-bit 01:02:03:00:00:00:00:03` |
| 111 | +2. DUT1: Start PAN coordinator: |
| 112 | + `start --pan_coordinator true --logical_channel <channel>` |
| 113 | +3. DUT2,DUT3: Start PAN beacon: |
| 114 | + `start --pan_coordinator false --logical_channel <channel>` |
| 115 | +4. (optional) Silence beacon traces: |
| 116 | + `silent-mode on` |
| 117 | +5. Start repeatedly sending data between DUT1 and DUT3: |
| 118 | + DUT1: `data --dst_addr 01:02:03:00:00:00:00:03 --msdu <payload> --msdu_length <payload_length> --wait_for_confirm false` |
| 119 | + DUT3: `data --dst_addr 01:02:03:00:00:00:00:01 --msdu <payload> --msdu_length <payload_length> --wait_for_confirm false` |
| 120 | + In the test case this repeats every 100ms. |
| 121 | +6. DUT1,DUT3: Reset MAC settings: |
| 122 | + `mlme-reset` |
| 123 | +7. DUT1: Start PAN coordinator: |
| 124 | + `start --pan_coordinator true --logical_channel <channel>` |
| 125 | +8. DUT3: Start PAN beacon: |
| 126 | + `start --pan_coordinator false --logical_channel <channel>` |
| 127 | +9. DUT2: Scan channels 11-26: |
| 128 | + `scan --scan_type 0 --scan_duration 7 --channel_mask 0x7fff800` |
| 129 | + Channel mask is given as a left bitshifted channel numbers in hexadecimal format. |
| 130 | +10. DUT2: Do Energy Detection analysis on data: |
| 131 | + `analyze-ed --channel <channel> --above 100` |
| 132 | + |
| 133 | +Test case repeats steps 5 to 10 three times. |
| 134 | + |
| 135 | +**Expected result:** |
| 136 | + |
| 137 | +Devices start beacon transmissions and send data on channel. |
| 138 | + |
| 139 | +DUT2 scans channels for activity, and verifies that ED value for test channel is above 100. |
| 140 | + |
| 141 | +The test exits with status `PASS` without timeouts. |
| 142 | + |
| 143 | +### `send_data` |
| 144 | + |
| 145 | +**Description:** |
| 146 | + |
| 147 | +Send data between two devices over single RF hop. |
| 148 | + |
| 149 | +Requires 2 devices. |
| 150 | + |
| 151 | +**Preconditions:** |
| 152 | + |
| 153 | +1. All devices have 802.15.4 tranceivers and are in sufficient proximity. |
| 154 | +2. RF channel is sufficiently clear. |
| 155 | + |
| 156 | +**Test steps:** |
| 157 | + |
| 158 | +1. DUT1: Set 64-bit MAC address to 01:02:03:00:00:00:00:01: |
| 159 | + `addr --64-bit 01:02:03:00:00:00:00:01` |
| 160 | +2. DUT2: Set 64-bit MAC address to 01:02:03:00:00:00:00:02: |
| 161 | + `addr --64-bit 01:02:03:00:00:00:00:02` |
| 162 | +3. DUT1: Start PAN coordinator: |
| 163 | + `start --pan_coordinator true --logical_channel <channel>` |
| 164 | +4. DUT2: Start PAN beacon: |
| 165 | + `start --pan_coordinator false --logical_channel <channel>` |
| 166 | +5. DUT1: Send data to DUT2: |
| 167 | + `data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length 5 --msdu abcde` |
| 168 | +6. DUT1: Send data to DUT2: |
| 169 | + `data --dst_addr 01:02:03:00:00:00:00:01 --msdu_length 5 --msdu 12345` |
| 170 | + |
| 171 | +**Expected result:** |
| 172 | + |
| 173 | +Data send commands succeeds. |
| 174 | + |
| 175 | +The test exits with status `PASS` without timeouts. |
| 176 | + |
| 177 | +### `send_data_indirect` |
| 178 | + |
| 179 | +**Description:** |
| 180 | + |
| 181 | +Send data between two devices over two RF hops with one relay. |
| 182 | + |
| 183 | +Requires 3 devices. |
| 184 | + |
| 185 | +**Preconditions:** |
| 186 | + |
| 187 | +1. All devices have 802.15.4 tranceivers and are in sufficient proximity. |
| 188 | +2. RF channel is sufficiently clear. |
| 189 | + |
| 190 | +**Test steps:** |
| 191 | + |
| 192 | +1. DUT1: Set 64-bit MAC address to 01:02:03:00:00:00:00:01: |
| 193 | + `addr --64-bit 01:02:03:00:00:00:00:01` |
| 194 | +2. DUT2: Set 64-bit MAC address to 01:02:03:00:00:00:00:02: |
| 195 | + `addr --64-bit 01:02:03:00:00:00:00:02` |
| 196 | +3. DUT3: Set 64-bit MAC address to 01:02:03:00:00:00:00:03: |
| 197 | + `addr --64-bit 01:02:03:00:00:00:00:03` |
| 198 | +4. DUT1: Start PAN coordinator: |
| 199 | + `start --pan_coordinator true --logical_channel <channel>` |
| 200 | +5. DUT2: Start PAN beacon: |
| 201 | + `start --pan_coordinator false --logical_channel <channel>` |
| 202 | +6. DUT3: Start PAN beacon: |
| 203 | + `start --pan_coordinator false --logical_channel <channel>` |
| 204 | +7. DUT2,DUT3: Set MAC RX on-while-idle off: |
| 205 | + `mlme-set --attr 0x52 --value_uint8 0 --value_size 1` |
| 206 | +8. DUT1: Add DUT2 and DUT3 as neighbours: |
| 207 | + `add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:02 --pan_id 0x1234 --index 0` |
| 208 | + `add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:03 --pan_id 0x1234 --index 1` |
| 209 | +9. DUT2,DUT3: Add DUT1 as neighbour: |
| 210 | + `add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:01 --pan_id 0x1234 --index 0` |
| 211 | +10. DUT2: Configure indirect data: |
| 212 | + `config-status --data_ind abcde` |
| 213 | +10. DUT3: Configure indirect data: |
| 214 | + `config-status --data_ind 12345` |
| 215 | +11. DUT1,DUT2,DUT3: Mute traces (can cause timing issues): |
| 216 | + `silent-mode on` |
| 217 | +12. DUT1: Send data indirectly to DUT2: |
| 218 | + `data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length 5 --msdu abcde --indirect_tx true --wait_for_confirm false` |
| 219 | +13. DUT2: Poll DUT1 (coordinator) for data: |
| 220 | + `poll --coord_address 01:02:03:00:00:00:00:01` |
| 221 | +14. DUT1: Resend data twice: |
| 222 | + `data` |
| 223 | + `data` |
| 224 | +15. DUT2: Poll data twice: |
| 225 | + `poll` |
| 226 | + `poll` |
| 227 | +16. DUT2: Set expected poll return status to 0xEB (No data after poll): |
| 228 | + `config-status --poll 235")` |
| 229 | +17. DUT2: Expected fail for poll command: |
| 230 | + `poll` |
| 231 | +16. DUT2: Set expected poll return status to 0xEB (No data after poll): |
| 232 | + `config-status --poll 235")` |
| 233 | +17. DUT1: Send data indirectly to DUT3 (other values set before are preserved): |
| 234 | + `data --dst_addr 01:02:03:00:00:00:00:03 --msdu 12345` |
| 235 | +19. DUT2: Expected fail for poll command: |
| 236 | + `poll` |
| 237 | +20. DUT3: Poll DUT1 (coordinator) for data: |
| 238 | + `poll --coord_address 01:02:03:00:00:00:00:01` |
| 239 | + |
| 240 | +**Expected result:** |
| 241 | + |
| 242 | +DUT2 receives data from DUT1 when polling after send. |
| 243 | + |
| 244 | +DUT2 does not receive data from DUT1 when no data available. |
| 245 | + |
| 246 | +DUT2 does not receive data from DUT1 when data available for DUT3. |
| 247 | + |
| 248 | +DUT3 receives data from DUT1 when polling after send. |
| 249 | + |
| 250 | +The test exits with status `PASS` without timeouts. |
| 251 | + |
| 252 | +### `send_large_payloads` |
| 253 | + |
| 254 | +**Description:** |
| 255 | + |
| 256 | +Send large payloads between two devices. |
| 257 | + |
| 258 | +Requires 2 devices. |
| 259 | + |
| 260 | +**Preconditions:** |
| 261 | + |
| 262 | +1. All devices have 802.15.4 tranceivers and are in sufficient proximity. |
| 263 | +2. RF channel is sufficiently clear. |
| 264 | + |
| 265 | +**Test steps:** |
| 266 | + |
| 267 | +1. DUT1: Set 64-bit MAC address to 01:02:03:00:00:00:00:01: |
| 268 | + `addr --64-bit 01:02:03:00:00:00:00:01` |
| 269 | +2. DUT2: Set 64-bit MAC address to 01:02:03:00:00:00:00:02: |
| 270 | + `addr --64-bit 01:02:03:00:00:00:00:02` |
| 271 | +3. DUT1: Start PAN coordinator: |
| 272 | + `start --pan_coordinator true --logical_channel <channel>` |
| 273 | +4. DUT2: Start PAN beacon: |
| 274 | + `start --pan_coordinator false --logical_channel <channel>` |
| 275 | +5. Create large payload: |
| 276 | + 104 characters, headers are 2+1+2+8+8+2=23 bytes, resulting in a packet size of 127 (max): |
| 277 | + `large_payload = "0123456789abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZZZZZZZZ0123456789012345678901234567891234"` |
| 278 | +6. DUT1,DUT2: Set indirect data: |
| 279 | + `config-status --data_ind <large_payload>` |
| 280 | +7. DUT1: Send payload: |
| 281 | + `data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length <large_payload length> --msdu <large_payload>` |
| 282 | +8. DUT2: wait for transmission to finish: |
| 283 | + `wait --timeout 500` |
| 284 | +9. DUT2: send data : |
| 285 | + `data --dst_addr 01:02:03:00:00:00:00:01 --msdu_length <large_payload length> --msdu <large_payload>` |
| 286 | +10. DUT1: wait for transmission to finish: |
| 287 | + `wait --timeout 500` |
| 288 | +11. DUT1,DUT2: Take turns waiting and transmitting: |
| 289 | + `data` |
| 290 | + `wait` |
| 291 | + |
| 292 | +Test case repeats step 11 25 times for both devices. |
| 293 | + |
| 294 | +**Expected result:** |
| 295 | + |
| 296 | +Data send commands succeed. |
| 297 | + |
| 298 | +The test exits with status `PASS` without timeouts. |
0 commit comments