Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
create_and_join_PAN.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 = "create_and_join_PAN", 00024 title = "Create a PAN and have a device join it", 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 = "", 00036 feature = ["MLME-START", "MLME-SCAN (active)"], 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 mask_from_channel_list(self, channels): 00055 res = 0 00056 for ch in channels: 00057 res = res | ( 1 << ch) 00058 return hex(res) 00059 00060 def setUp(self): 00061 self.channel = 11 00062 00063 def case(self): 00064 #Beacon payload & length 00065 self.command("First", "mlme-set --attr 0x45 --value_ascii mac-tester --value_size 10") 00066 self.command("First", "mlme-set --attr 0x46 --value_uint8 10 --value_size 1") 00067 00068 self.command("Second", "mlme-set --attr 0x45 --value_ascii second-mac-tester --value_size 17") 00069 self.command("Second", "mlme-set --attr 0x46 --value_uint8 17 --value_size 1") 00070 00071 self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel)) 00072 self.command("Second", "start --pan_coordinator true --logical_channel {}".format(int(self.channel)+1)) 00073 self.delay(3) 00074 if self.channel == 11: 00075 channels = [11,12] 00076 elif self.channel == 26: 00077 channels = [25,26] 00078 else: 00079 channels = [self.channel, self.channel+1] 00080 self.command("Third", "scan --channel_mask {}".format(self.mask_from_channel_list(channels))) 00081 self.delay(0.2) 00082 self.command("Third", "find-beacon --data mac-tester") 00083 self.command("Third", "find-beacon --data second-mac-tester") 00084 00085 def tearDown(self): 00086 self.reset_dut()
Generated on Tue Aug 9 2022 00:37:04 by
1.7.2