4 Replies Latest reply on Oct 24, 2018 9:31 AM by ToIn_1742091

    Test console commands in WICED Studio6.1

    srpec_3628341

      Hi ,

          I started Wi-Fi 802.11 (Type 1LD Murata Board)Automation Testing using Python script by Test console commands in wiced sdk.The Total test console commands is 90.

         So,What are the feauters of  automation testing.What i Need to do Automation testing Wi-Fi 802.11.Below Attached the Test console commands Xls.PFA.

        • 1. Re: Test console commands in WICED Studio6.1
          ZhengbaoZ_96

          Hello:

           

            Can I know which python script you are using for the total 90 commands test ?

          • 2. Re: Test console commands in WICED Studio6.1
            srpec_3628341

            I am using python 2.7.15 and below attached the script .Murata board is responding  for Read and write the commands.Intially i created 20 test console commands like ,scan ,start_ap,join_specific,stop_ap ,get_acces_parameters_sta_list and so on 

             

            import serial,struct

            from time import sleep

            # import xlsxwriter
            #
            # workbook = xlsxwriter.Workbook('report.xlsx')
            # worksheet = workbook.add_worksheet()
            # # # Widen the first column to make the text clearer.
            # worksheet.set_column('A:A', 50)

            # # Add a bold format to use to highlight cells.
            # bold = workbook.add_format({'bold': True})
            port = "\\\\.\\CNCA0"
            ser = serial.Serial("COM7", 115200, timeout=1)

            ############################################wifi wiced initilization#################
            command16= 'wiced_init 1\r'
            data17 = struct.pack("{}s".format(len(command16)),command16)

            Data_list17=[]

            Timercount17 =0
            MurataTypeBoard = 1
            ESP32 = 2
            def connectivity_initilization(init):

               if MurataTypeBoard == 1:

               print init

               return init

             

               else:

               return ESP32

             

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list17.append(data)

               print data

              init = ser.write(data17)

              connectivity_initilization(init)

              Timercount17 = Timercount17 + 1

               if Timercount17 == 1:

               break
            print "starting the wifi device"

            print "Data_list17",Data_list17

             

            ###########################################################
            command= 'status\r'
            data3 = struct.pack("{}s".format(len(command)),command)

            Data_list1=[]

            Timercount1 =0
            # MurataTypeBoard = 1
            # ESP32 = 2
            def status(self,results_handler,user_data,scan_type,bss_type,optional_ssid,optional_mac,optional_channel_list,optional_extended_params,interface ):

               if MurataTypeBoard == 1:

               print "status:",results

               return results_handler,user_data, scan_type, bss_type, optional_ssid, optional_mac, optional_channel_list, optional_extended_params, interface

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list1.append(data)

               print data

              results = ser.write(data3)

              status(results,None,None,None,None,None,None,None,None,None)

              Timercount1 = Timercount1 + 1

               if Timercount1 == 7:

               break
            print "status the wifi devices"

            print "Data_list1",Data_list1

             

            #####################################################################
            command5 = 'join_specific LTTS-Guest B0:C5:54:E6:CD:81 9 open\r'##Note : Based on requirement SSID , BSSID ,CHANNEL ,SECURITY Need to replace instead of command5 = 'join_specific SSID BSSID ,CHANNEL ,SECURITY#######
            data7 = struct.pack('{}s'.format(len(command5)),command5)

            Data_list6 = []

            Timercount6 = 0
            # MurataTypeBoard = 1
            # ESP32 = 2
            def join_specific(self,ap,security_key,length,semaphore,interface):

               if MurataTypeBoard:

               print "joining specific:",join

               return ap,security_key,length,semaphore,interface

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list6.append(data)

               print data

              join = ser.write(data7)

              join_specific(join,"joining",None,None,None,None)

              Timercount6 = Timercount6+1
               if Timercount6 == 2:

               break
            print ("joining specific STA")

            print "Data_list6",Data_list6

             

             

            ###################################################################
            string = 'start_ap wi-fi open 11 9\r'###Note : Based on Requirement SSID ,SECURITY ,CHANNEL , KEY Need to replace instead of string = 'start_ap SSID , SECURITY , CHANNEL , KEY############
            data1 = struct.pack("{}s".format(len(string)), string)

            Data_list = []

            Timercount = 0
            # MurataTypeBoard = 1
            # ESP32 = 2
            def starting_ap(self,ssid,auth_type,security_key,key_length,channel):

               if MurataTypeBoard:

               print "starting access point:",AP1

               print "starting access point yes:",AP2

               print "getting the soft ap credintials:",AP3

               return ssid, auth_type, security_key, key_length, channel

               else:

               return ESP32

             

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list.append(data)

               print data

              AP1 = ser.write(data1)

              string1 = 'y\r'
               data2 = struct.pack("{}s".format(len(string1)), string1)

              AP2 = ser.write(data2)

              command13 = 'get_soft_ap_credentials\r'
               data14 = struct.pack('{}s'.format(len(command13)),command13)

              AP3 = ser.write(data14)

              starting_ap (AP1,AP2,AP3,None,None,None)

              Timercount = Timercount + 1
               if Timercount == 5:

               break
            print ("started ap and getting the soft ap credintials")

            print "Data_list",Data_list

             

            ##########################################################
            command3 = 'get_ap_info\r'
            data5 = struct.pack('{}s'.format(len(command3)),command3)

            Data_list4 = []

            Timercount4 = 0
            def get_ap_info(self,ap_info,security):

               if MurataTypeBoard:

               print "getting ap information:",ap_info

               return ap_info,security

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list4.append(data)

               print data

              ap_info = ser.write(data5)

              get_ap_info(ap_info,None,None)

              Timercount4 = Timercount4+1
               if Timercount4 == 2:

               break
            print "ap information"
            print "Data_list4",Data_list4

            #######################################################
            command4 = 'get_access_category_parameters_sta\r'
            data6 = struct.pack('{}s'.format(len(command4)),command4)

            Data_list5 = []

            Timercount5 = 0
            def get_acparams_sta(ac_parameters):

               if MurataTypeBoard:

               print "accessing parameters:",ac_parameters

               return None
               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list5.append(data)

               print data

              ac_parameters = ser.write(data6)

              get_acparams_sta(ac_parameters)

              Timercount5 = Timercount5+1
               if Timercount5 == 3:

               break
            print "get access category parameters of station"
            print "Data_list5",Data_list5

             

            #######################
            command2 = 'get_associated_sta_list\r'
            data5 = struct.pack('{}s'.format(len(command2)),command2)

            Data_list3 =[]

            Timercount3 = 0
            def get_associated_station_list(association):

               if MurataTypeBoard:

               print "getting association:",association

               return None
               else:

               return ESP32

            while True:

              data = ser.read(10000)

               if len(data) > 0:

              Data_list3.append(data)

               print data

              association = ser.write(data5)

              get_associated_station_list(association)

              Timercount3=Timercount3+1
               if Timercount3 == 2:

               break
            print "Data_list3",Data_list3

            print "get the associated station list"
            ###########################################
            command6 = 'get_rssi\r'
            data7 = struct.pack('{}s'.format(len(command6)),command6)

            Data_list7 = []

            Timercount7 = 0
            def get_ap_client_rssi (self,rssi,client_mac_addr ):

               if MurataTypeBoard:

               print "getting rssi address:",get_rssi

               return rssi,client_mac_addr

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list7.append(data)

               print data

              get_rssi = ser.write(data7)

              get_ap_client_rssi(get_rssi,None,None)

              Timercount7 = Timercount7+1
               if Timercount7 == 3:

               break
            print "Data_list7",Data_list7

            ########################################################Wi-Fi Get mac address and rate#############################
            command7 = 'get_mac_addr\r'
            data8 = struct.pack('{}s'.format(len(command7)),command7)

            Data_list8 = []

            Timercount8 = 0
            def mac_address(self,mac):

               if MurataTypeBoard:

               print "got the mac address:",macaddr

               return macaddr,mac

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list8.append(data)

               print data

              macaddr = ser.write(data8)

              mac_address(macaddr,None)

              Timercount8 = Timercount8+1
               if Timercount8 == 1:

               break
            print "Data_list8",Data_list8

            #######################################################
            command8 = 'get_rate\r'
            data9 = struct.pack('{}s'.format(len(command8)),command8)

            Data_list9 = []

            Timercount9 = 0
            def getting_rate(get_rate):

               if MurataTypeBoard:

               print "getting rate:",get_rate

               return
              else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list9.append(data)

               print data

              get_rate = ser.write(data9)

              getting_rate(get_rate)

              Timercount9 = Timercount9+1
               if Timercount9 == 2:

               break
            print "Data_list9",Data_list9

            ##############################################
            command9 = 'get_preferred_association_band\r'
            data10 = struct.pack('{}s'.format(len(command9)),command9)

            Data_list10 = []

            Timercount10 = 0
            def get_preferred_association_band(self,band):

               if MurataTypeBoard:

               print "preferred association band:",get_assoc_band

               return get_assoc_band,band

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list10.append(data)

               print data

              get_assoc_band = ser.write(data10)

              get_preferred_association_band(get_assoc_band,None)

              Timercount10 = Timercount10+1
               if Timercount10 == 2:

               break
            print "Data_list10",Data_list10

            ###############################################################
            command10 = 'get_tx_power\r'
            data11 = struct.pack('{}s'.format(len(command10)),command10)

            Data_list11 = []

            Timercount11 = 0
            def get_tx_power(self,dbm):

               if MurataTypeBoard:

               print "getting tx power:",tx_power

               return dbm

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list11.append(data)

               print data

              tx_power = ser.write(data11)

              get_tx_power(tx_power,None)

              Timercount11 = Timercount11+1
               if Timercount11 == 2:

               break
            print "Data_list11",Data_list11

            #############################################################
            command11 = 'get_country\r'
            data12 = struct.pack('{}s'.format(len(command11)), command11)

            Data_list12 = []

            Timercount12 = 0
            def get_country(country):

               if MurataTypeBoard:

               print "getting country:",country

               return
              else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list11.append(data)

               print data

              country = ser.write(data12)

              get_country(country)

              Timercount12 = Timercount12 + 1
               if Timercount12 == 2:

               break
            print "Data_list12", Data_list12

            ##############################################################
            command12 = 'get_random\r'
            data13 = struct.pack('{}s'.format(len(command12)), command12)

            Data_list13 = []

            Timercount13 = 0
            def get_random(get):

               if MurataTypeBoard:

               print "getting random:",get

               return
              else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list13.append(data)

               print data

              get = ser.write(data13)

              get_random(get)

              Timercount13 = Timercount13 + 1
               if Timercount13 == 3:

               break
            print "Data_list13", Data_list13

            ##############################################wifi malloc info and join mesh###
            command13 = 'malloc_info\r'
            data14 = struct.pack('{}s'.format(len(command13)), command13)

            Data_list14 = []

            Timercount14 = 0
            def malloc_info(malloc):

               if MurataTypeBoard:

               print "malloc information:",malloc

               return None
               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list14.append(data)

               print data

              malloc = ser.write(data14)

              malloc_info(malloc)

              Timercount14 = Timercount14 + 1
               if Timercount14 == 3:

               break
            print "Data_list14", Data_list14

            ############################################################
            command17 = 'wlver\r'
            data18 = struct.pack('{}s'.format(len(command17)), command17)

            Data_list18 = []

            Timercount18 = 0
            def get_version(self,version,length):

               if MurataTypeBoard:

               print "wireless version:",wifi_version

               return version,length

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list18.append(data)

               print data

              wifi_version = ser.write(data18)

              get_version(wifi_version,None,None)

              Timercount18 = Timercount18 + 1
               if Timercount18 == 2:

               break
            print "Data_list18", Data_list18

             

            ############################################################
            command18 = 'clmver\r'
            data19 = struct.pack('{}s'.format(len(command18)), command18)

            Data_list19 = []

            Timercount19 = 0
            def clmver(CLMver):

               if MurataTypeBoard:

               print "getting result:",CLMver

               return
              else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list19.append(data)

               print "got:", data

              CLMver = ser.write(data19)

              clmver(CLMver)

              Timercount19 = Timercount19 + 1
               if Timercount19 == 1:

               break
            print "Data_list19", Data_list19

            ###############################################################
            command19 = 'memuse\r'
            data20 = struct.pack('{}s'.format(len(command19)), command19)

            Data_list20 = []

            Timercount20 = 0
            def memuse(Memory):

               if MurataTypeBoard:

               print "printing the memory usage:",Memory

               return Memory

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list20.append(data)

               print "got:", data

              Memory = ser.write(data20)

              memuse(Memory)

              Timercount20 = Timercount20 + 1
               if Timercount20 == 1:

               break
            print "Data_list20", Data_list20

             

            ###########################################################
            command14 = 'join_mesh wifi\r'######Note : Based on requirement SSID Need to replace instead of command14 = 'join_mesh SSID\r'########
            data15 = struct.pack('{}s'.format(len(command14)), command14)

            Data_list15 = []

            Timercount15 = 0


            def join_mesh(self,ssid):

               if MurataTypeBoard:

               return joinmesh,ssid

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list15.append(data)

               print "got:", data

              joinmesh = ser.write(data15)

              Timercount15 = Timercount15 + 1
               if Timercount15 == 1:

               break
            print "Data_list15", Data_list15

            ###########################################################
            command20 = 'ds1_status\r'
            data21 = struct.pack('{}s'.format(len(command20)), command20)

            Data_list21 = []

            Timercount21 = 0


            def ds1_status():

               if MurataTypeBoard:

               return ds1

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list21.append(data)

               print "got:", data

              ds1 = ser.write(data21)

              Timercount21 = Timercount21 + 1
               if Timercount21 == 1:

               break
            print "Data_list21", Data_list21

            ###########//////////////////////////////////////////////###
            command21 = 'wlan_chip_log\r'
            data22 = struct.pack('{}s'.format(len(command21)), command21)

            Data_list22 = []

            Timercount22 = 0


            def chiplog():

               if MurataTypeBoard:

               return chip_log

               else:

               return ESP32

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list22.append(data)

               print "got:", data

              chip_log = ser.write(data22)

              Timercount22 = Timercount22 + 1
               if Timercount22 == 1:

               break
            print "Data_list22", Data_list22

             

            #############################################
            command1 ='stop_ap\r'
            data4 = struct.pack('{}s'.format(len(command1)),command1)

            Data_list2 = []

            Timercount2 = 0
            def stop_ap(self):

               if MurataTypeBoard:

               return stop

               else:

               return ESP32

            while True:

              data = ser.read(10000)

               if len(data) > 0:

              Data_list2.append(data)

               print('stop ap:',data)

              stop = ser.write(data4)

              Timercount2 = Timercount2+1
               if Timercount2 == 1:

               break
              print("stoped the AP ")

            print "Data_list2",Data_list2

             

             

            command15= 'wiced_init 0\r'
            data16 = struct.pack("{}s".format(len(command15)),command15)

            Data_list16=[]

            Timercount16 =0
            MurataTypeBoard = 1
            ESP32 = 2
            def connectivity_deinitilization(self):

               if MurataTypeBoard:

               return deinit

               else:

               return ESP32

             

            while True:

              data = ser.read(9999)

               if len(data) > 0:

              Data_list16.append(data)

               print ('Got:', data)

              deinit = ser.write(data16)

              Timercount16 = Timercount16 + 1

               if Timercount16 == 1:

               break
              print "deintilization the wifi device"
            print "Data_list16",Data_list16

            # worksheet.write('A1',str(Data_list[0]),bold)
            # worksheet.write('A2',str(Data_list1[0]),bold)
            # worksheet.write('A3',str(Data_list8[0]),bold)
            # worksheet.write('A4',str(Data_list9[0]),bold)
            # worksheet.write('A5',str(Data_list6[0]),bold)
            # worksheet.write('A6',str(Data_list3[0]),bold)
            # worksheet.write('A7',str(Data_list7[0]),bold)
            # worksheet.write('A8',str(Data_list10[0]),bold)
            # worksheet.write('A8',str(Data_list11[0]),bold)
            # worksheet.write('A9',str(Data_list17[0]),bold)
            # worksheet.write('A10',str(Data_list16[0]),bold)
            # worksheet.write('A11',str(Data_list14[0]),bold)

            ser.close()

            so , What are the Features I need do automation testing and Procedure.





            • 4. Re: Test console commands in WICED Studio6.1
              ToIn_1742091

              It all depends on what do you want to test. Most customers have test mode in their application to check the critical features of the application. For instance, it starts running and can connect with AP, etc.

              1 of 1 people found this helpful