Skip to content

Commit 30520c9

Browse files
authored
Merge pull request #8342 from JuhPuur/icetea_missing_test_doc
Icetea missing test doc
2 parents 70dfbbf + 93e90f7 commit 30520c9

File tree

10 files changed

+456
-18
lines changed

10 files changed

+456
-18
lines changed

TEST_APPS/testcases/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ Testcases
1010

1111
Current testcases:
1212

13-
- [netsocket](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/testcases/netsocket)
14-
- [example](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/testcases/example)
13+
- [`netsocket`](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/testcases/netsocket)
14+
- [`example`](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/testcases/example)
15+
- [`nanostack_mac_tester`](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/testcases/nanostack_mac_tester)

TEST_APPS/testcases/example/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
Example tests
2-
=============
1+
##Example tests
32

43
This folder contains example tests for Icetea
5-
The test located under this folder is dependent of the application [exampleapp](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/device/exampleapp)
4+
The test located under this folder is dependent of the application [`exampleapp`](https://github.com/ARMmbed/mbed-os/blob/master/TEST_APPS/device/exampleapp)
65
The exampleapp is disabled by default, to be able to run the test_cmdline with the exampleapp, either remove the preprocessor macro from exampleapp.cpp or add `-DICETEA_EXAMPLE_ENABLED` to the mbed test command
76

8-
Testcases
9-
---------
7+
## Test cases
108

11-
### test_cmdline
9+
### `test_cmdline`
1210

1311
**Description:**
1412
Send command line commands to target over serial interface.
15-
This test introduces the Icetea testcase structure to the user.
13+
This test introduces the Icetea test case structure to the user.
1614

1715
**Test steps:**
1816
Send "echo hello world" to the target.

TEST_APPS/testcases/nanostack_mac_tester/ED_scan.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def case(self):
7575
self.lock_th = threading.Lock()
7676
self.payload = "01234567890123456789012345678901234567890123456789"
7777

78+
# Start PAN coordinator
7879
self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
80+
# Start PAN beacon
7981
self.command("Second", "start --pan_coordinator false --logical_channel {}".format(self.channel))
8082
self.command("Third", "start --pan_coordinator false --logical_channel {}".format(self.channel))
8183

@@ -90,12 +92,17 @@ def case(self):
9092
channels = range(11,27)
9193
for i in range(0, 3):
9294
self.lock_th.acquire()
95+
# Reset MAC settings
9396
self.command("First", "mlme-reset")
97+
# Start PAN coordinator
9498
self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
9599
self.command("Third", "mlme-reset")
100+
# Start PAN beacon
96101
self.command("Third", "start --pan_coordinator false --logical_channel {}".format(self.channel))
97102
self.lock_th.release()
103+
# Scan all channels
98104
self.command("Second", "scan --scan_type 0 --scan_duration 7 --channel_mask {}".format(self.mask_from_channel_list(channels)))
105+
# Energy detection analysis
99106
self.command("Second", "analyze-ed --channel {} --above 100".format(self.channel))
100107

101108
def tearDown(self):
Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
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.

TEST_APPS/testcases/nanostack_mac_tester/address_read_and_write.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def case(self):
5656
self.command("First", "addr")
5757
self.command("First", "addr --64-bit 01:02:03:00:00:00:00:01")
5858
self.command("First", "addr --16-bit 0xABCD")
59-
#macPANId
59+
# Set MAC PAN ID
6060
self.command("First", "mlme-set --attr 0x50 --value_bytes CD:CD --value_size 2")
6161
self.command("First", "addr")
6262
self.verify_trace(1, "MAC64: 01:02:03:00:00:00:00:01")

TEST_APPS/testcases/nanostack_mac_tester/create_and_join_PAN.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ def setUp(self):
6161
self.channel = 11
6262

6363
def case(self):
64-
#Beacon payload & length
64+
# Beacon payload
6565
self.command("First", "mlme-set --attr 0x45 --value_ascii mac-tester --value_size 10")
66+
# Beacon payload length
6667
self.command("First", "mlme-set --attr 0x46 --value_uint8 10 --value_size 1")
67-
68+
6869
self.command("Second", "mlme-set --attr 0x45 --value_ascii second-mac-tester --value_size 17")
6970
self.command("Second", "mlme-set --attr 0x46 --value_uint8 17 --value_size 1")
7071

72+
# Start PAN coordinator
7173
self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
7274
self.command("Second", "start --pan_coordinator true --logical_channel {}".format(int(self.channel)+1))
7375
self.delay(3)

TEST_APPS/testcases/nanostack_mac_tester/send_data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ def setUp(self):
5656
self.command("Second", "addr --64-bit 01:02:03:00:00:00:00:02")
5757

5858
def case(self):
59+
# Start PAN coordinator
5960
self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
61+
# Start PAN beacon
6062
self.command("Second", "start --pan_coordinator false --logical_channel {}".format(self.channel))
6163

64+
# Send data
6265
self.command("First", "data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length 5 --msdu abcde")
6366
self.command("Second", "data --dst_addr 01:02:03:00:00:00:00:01 --msdu_length 5 --msdu 12345")
6467

0 commit comments

Comments
 (0)