takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers send_data_indirect.py Source File

send_data_indirect.py

00001 """
00002 Copyright (c) 2017, Arm Limited and affiliates.
00003 SPDX-License-Identifier: Apache-2.0
00004 
00005 Licensed under the Apache License, Version 2.0 (the "License");
00006 you may not use this file except in compliance with the License.
00007 You may obtain a copy of the License at
00008 
00009     http://www.apache.org/licenses/LICENSE-2.0
00010 
00011 Unless required by applicable law or agreed to in writing, software
00012 distributed under the License is distributed on an "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 See the License for the specific language governing permissions and
00015 limitations under the License.
00016 """
00017 
00018 import os,sys
00019 from icetea_lib.bench import Bench
00020 
00021 class Testcase(Bench):
00022     def __init__(self):
00023         Bench.__init__(self, name = "send_data_indirect",
00024                         title = "Indirect data transmission test",
00025                         status = "development",
00026                         type = "smoke",
00027                         subtype = "",
00028                         execution = {
00029                             "skip": {
00030                                 "value": False,
00031                                 "reason": ""
00032                             }
00033                         },
00034                         author = "Valtteri Erkkila",
00035                         purpose = "Tests sending data indirectly, i.e polling the coordinator for data",
00036                         feature = ["MCPS-DATA", "MLME-POLL"],
00037                         component = ["MAC"],
00038                         requirements = {
00039                             "duts": {
00040                                 '*': {
00041                                     "count":3,
00042                                     "type": "hardware",
00043                                     "allowed_platforms": ["K64F", "K66F", "NUCLEO_F429ZI", "KW24D", "UBLOX_EVK_ODIN_W2"],
00044                                     "application": {
00045                                        "name": "TEST_APPS-device-nanostack_mac_tester"
00046                                     }
00047                                 },
00048                                 "1":{"nick": "First"},
00049                                 "2":{"nick": "Second"},
00050                                 "3":{"nick": "Third"}
00051                         }}
00052         )
00053 
00054     def setUp(self):
00055         self.channel = 11
00056         self.command("First", "addr --64-bit 01:02:03:00:00:00:00:01")
00057         self.command("Second", "addr --64-bit 01:02:03:00:00:00:00:02")
00058         self.command("Third", "addr --64-bit 01:02:03:00:00:00:00:03")
00059 
00060     def case(self):
00061         self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
00062         self.command("Second", "start --pan_coordinator false --logical_channel {}".format(self.channel))
00063         self.command("Third", "start --pan_coordinator false --logical_channel {}".format(self.channel))
00064 
00065         #macRxOnWhenIdle
00066         self.command("Second", "mlme-set --attr 0x52 --value_uint8 0 --value_size 1")
00067         self.command("Third", "mlme-set --attr 0x52 --value_uint8 0 --value_size 1")
00068 
00069         self.command("First", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:02 --pan_id 0x1234 --index 0")
00070         self.command("First", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:03 --pan_id 0x1234 --index 1")
00071         self.command("Second", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:01 --pan_id 0x1234 --index 0")
00072         self.command("Third", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:01 --pan_id 0x1234 --index 0")
00073 
00074         self.command("Second", "config-status --data_ind abcde")
00075         self.command("Third", "config-status --data_ind 12345")
00076 
00077         #Runs into timing issues if extensive printing is enabled
00078         self.command("*", "silent-mode on")
00079         self.command("First", "data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length 5 --msdu abcde --indirect_tx true --wait_for_confirm false")
00080         self.command("Second", "poll --coord_address 01:02:03:00:00:00:00:01")
00081 
00082         self.command("First", "data")
00083         self.command("First", "data")
00084         self.command("Second", "poll")
00085         self.command("Second", "poll")
00086         self.command("Second", "config-status --poll 235")
00087         self.command("Second", "poll")
00088 
00089         self.command("Second", "config-status --poll 235")
00090         self.command("First", "data --dst_addr 01:02:03:00:00:00:00:03 --msdu 12345")
00091         self.command("Second", "poll")
00092         self.command("Third", "poll --coord_address 01:02:03:00:00:00:00:01")
00093         self.command("*", "silent-mode off")
00094 
00095     def tearDown(self):
00096         self.reset_dut()