takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers send_large_payloads.py Source File

send_large_payloads.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_large_payloads",
00024                         title = "Data transmission test with large packets",
00025                         status = "development",
00026                         type = "reliability",
00027                         subtype = "",
00028                         execution = {
00029                             "skip": {
00030                                 "value": False,
00031                                 "reason": ""
00032                             }
00033                         },
00034                         author = "Valtteri Erkkila",
00035                         purpose = "Repeatedly sends long packets, checking that the payload is correct in each one",
00036                         feature = ["MCPS-DATA"],
00037                         component = ["MAC"],
00038                         requirements = {
00039                             "duts": {
00040                                 '*': {
00041                                     "count":2,
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                         }}
00051         )
00052 
00053     def setUp(self):
00054         self.channel = 11
00055         self.command("First", "addr --64-bit 01:02:03:00:00:00:00:01")
00056         self.command("Second", "addr --64-bit 01:02:03:00:00:00:00:02")
00057 
00058     def case(self):
00059         #104 characters, headers are 2+1+2+8+8+2=23 bytes, resulting in a packet size of 127 (max)
00060         large_payload = "0123456789abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZZZZZZZZ0123456789012345678901234567891234"
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 
00064         self.command("First", "config-status --data_ind {}".format(large_payload))
00065         self.command("Second", "config-status --data_ind {}".format(large_payload))
00066 
00067         self.command("First", "data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length {} --msdu {}".format(len(large_payload), large_payload))
00068         self.command("Second", "wait --timeout 500")
00069 
00070         self.command("Second", "data --dst_addr 01:02:03:00:00:00:00:01 --msdu_length {} --msdu {}".format(len(large_payload), large_payload))
00071         self.command("First", "wait --timeout 500")
00072         for i in range(0, 25):
00073             self.command("First", "data")
00074             self.command("Second", "wait")
00075             self.command("Second", "data")
00076             self.command("First", "wait")
00077 
00078     def tearDown(self):
00079         self.reset_dut()