mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Nanostack mac tester: document testcase steps in testcases
							parent
							
								
									a513751907
								
							
						
					
					
						commit
						3732f72e4e
					
				| 
						 | 
				
			
			@ -75,7 +75,9 @@ class Testcase(Bench):
 | 
			
		|||
        self.lock_th = threading.Lock()
 | 
			
		||||
        self.payload = "01234567890123456789012345678901234567890123456789"
 | 
			
		||||
 | 
			
		||||
        # Start PAN coordinator
 | 
			
		||||
        self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
 | 
			
		||||
        # Start PAN beacon
 | 
			
		||||
        self.command("Second", "start --pan_coordinator false --logical_channel {}".format(self.channel))
 | 
			
		||||
        self.command("Third", "start --pan_coordinator false --logical_channel {}".format(self.channel))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -90,12 +92,17 @@ class Testcase(Bench):
 | 
			
		|||
        channels = range(11,27)
 | 
			
		||||
        for i in range(0, 3):
 | 
			
		||||
            self.lock_th.acquire()
 | 
			
		||||
            # Reset MAC settings
 | 
			
		||||
            self.command("First", "mlme-reset")
 | 
			
		||||
            # Start PAN coordinator
 | 
			
		||||
            self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
 | 
			
		||||
            self.command("Third", "mlme-reset")
 | 
			
		||||
            # Start PAN beacon
 | 
			
		||||
            self.command("Third", "start --pan_coordinator false --logical_channel {}".format(self.channel))
 | 
			
		||||
            self.lock_th.release()
 | 
			
		||||
            # Scan all channels
 | 
			
		||||
            self.command("Second", "scan --scan_type 0 --scan_duration 7 --channel_mask {}".format(self.mask_from_channel_list(channels)))
 | 
			
		||||
            # Energy detection analysis
 | 
			
		||||
            self.command("Second", "analyze-ed --channel {} --above 100".format(self.channel))
 | 
			
		||||
 | 
			
		||||
    def tearDown(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ class Testcase(Bench):
 | 
			
		|||
        self.command("First", "addr")
 | 
			
		||||
        self.command("First", "addr --64-bit 01:02:03:00:00:00:00:01")
 | 
			
		||||
        self.command("First", "addr --16-bit 0xABCD")
 | 
			
		||||
        #macPANId
 | 
			
		||||
        # Set MAC PAN ID
 | 
			
		||||
        self.command("First", "mlme-set --attr 0x50 --value_bytes CD:CD --value_size 2")
 | 
			
		||||
        self.command("First", "addr")
 | 
			
		||||
        self.verify_trace(1, "MAC64: 01:02:03:00:00:00:00:01")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,13 +61,15 @@ class Testcase(Bench):
 | 
			
		|||
        self.channel = 11
 | 
			
		||||
 | 
			
		||||
    def case(self):
 | 
			
		||||
        #Beacon payload & length
 | 
			
		||||
        # Beacon payload
 | 
			
		||||
        self.command("First", "mlme-set --attr 0x45 --value_ascii mac-tester --value_size 10")
 | 
			
		||||
        # Beacon payload length
 | 
			
		||||
        self.command("First", "mlme-set --attr 0x46 --value_uint8 10 --value_size 1")
 | 
			
		||||
        
 | 
			
		||||
        self.command("Second", "mlme-set --attr 0x45 --value_ascii second-mac-tester --value_size 17")
 | 
			
		||||
        self.command("Second", "mlme-set --attr 0x46 --value_uint8 17 --value_size 1")
 | 
			
		||||
 | 
			
		||||
        # Start PAN coordinator
 | 
			
		||||
        self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
 | 
			
		||||
        self.command("Second", "start --pan_coordinator true --logical_channel {}".format(int(self.channel)+1))
 | 
			
		||||
        self.delay(3)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,9 +56,12 @@ class Testcase(Bench):
 | 
			
		|||
        self.command("Second", "addr --64-bit 01:02:03:00:00:00:00:02")
 | 
			
		||||
 | 
			
		||||
    def case(self):
 | 
			
		||||
        # Start PAN coordinator
 | 
			
		||||
        self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
 | 
			
		||||
        # Start PAN beacon
 | 
			
		||||
        self.command("Second", "start --pan_coordinator false --logical_channel {}".format(self.channel))
 | 
			
		||||
 | 
			
		||||
        # Send data
 | 
			
		||||
        self.command("First", "data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length 5 --msdu abcde")
 | 
			
		||||
        self.command("Second", "data --dst_addr 01:02:03:00:00:00:00:01 --msdu_length 5 --msdu 12345")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,37 +58,52 @@ class Testcase(Bench):
 | 
			
		|||
        self.command("Third", "addr --64-bit 01:02:03:00:00:00:00:03")
 | 
			
		||||
 | 
			
		||||
    def case(self):
 | 
			
		||||
        # Start PAN coordinator
 | 
			
		||||
        self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
 | 
			
		||||
        # Start PAN beacon
 | 
			
		||||
        self.command("Second", "start --pan_coordinator false --logical_channel {}".format(self.channel))
 | 
			
		||||
        self.command("Third", "start --pan_coordinator false --logical_channel {}".format(self.channel))
 | 
			
		||||
 | 
			
		||||
        #macRxOnWhenIdle
 | 
			
		||||
        # Set MAC RX on-while-idle off
 | 
			
		||||
        self.command("Second", "mlme-set --attr 0x52 --value_uint8 0 --value_size 1")
 | 
			
		||||
        self.command("Third", "mlme-set --attr 0x52 --value_uint8 0 --value_size 1")
 | 
			
		||||
 | 
			
		||||
        # Add neighbours
 | 
			
		||||
        self.command("First", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:02 --pan_id 0x1234 --index 0")
 | 
			
		||||
        self.command("First", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:03 --pan_id 0x1234 --index 1")
 | 
			
		||||
        self.command("Second", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:01 --pan_id 0x1234 --index 0")
 | 
			
		||||
        self.command("Third", "add-neigh --frame_ctr 0 --mac16 0xFFFF --mac64 01:02:03:00:00:00:00:01 --pan_id 0x1234 --index 0")
 | 
			
		||||
 | 
			
		||||
        # Configure indirect data
 | 
			
		||||
        self.command("Second", "config-status --data_ind abcde")
 | 
			
		||||
        self.command("Third", "config-status --data_ind 12345")
 | 
			
		||||
 | 
			
		||||
        #Runs into timing issues if extensive printing is enabled
 | 
			
		||||
        # Runs into timing issues if extensive printing is enabled
 | 
			
		||||
        self.command("*", "silent-mode on")
 | 
			
		||||
 | 
			
		||||
        # Send data indirectly to DUT2
 | 
			
		||||
        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")
 | 
			
		||||
        # Poll DUT1 for data
 | 
			
		||||
        self.command("Second", "poll --coord_address 01:02:03:00:00:00:00:01")
 | 
			
		||||
 | 
			
		||||
        # Send more data
 | 
			
		||||
        self.command("First", "data")
 | 
			
		||||
        self.command("First", "data")
 | 
			
		||||
        # Poll more data
 | 
			
		||||
        self.command("Second", "poll")
 | 
			
		||||
        self.command("Second", "poll")
 | 
			
		||||
        # Set expected poll return status to 0xEB(no data after poll)
 | 
			
		||||
        self.command("Second", "config-status --poll 235")
 | 
			
		||||
        # No data should remain to be polled for
 | 
			
		||||
        self.command("Second", "poll")
 | 
			
		||||
 | 
			
		||||
        # Set expected poll return status to 0xEB(no data after poll)
 | 
			
		||||
        self.command("Second", "config-status --poll 235")
 | 
			
		||||
        # Send data to DUT3
 | 
			
		||||
        self.command("First", "data --dst_addr 01:02:03:00:00:00:00:03 --msdu 12345")
 | 
			
		||||
        # Poll(expected failure)
 | 
			
		||||
        self.command("Second", "poll")
 | 
			
		||||
        # Poll DUT1 for data(expected success)
 | 
			
		||||
        self.command("Third", "poll --coord_address 01:02:03:00:00:00:00:01")
 | 
			
		||||
        self.command("*", "silent-mode off")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,17 +58,25 @@ class Testcase(Bench):
 | 
			
		|||
    def case(self):
 | 
			
		||||
        #104 characters, headers are 2+1+2+8+8+2=23 bytes, resulting in a packet size of 127 (max)
 | 
			
		||||
        large_payload = "0123456789abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZZZZZZZZZ0123456789012345678901234567891234"
 | 
			
		||||
        # Start PAN coordinator
 | 
			
		||||
        self.command("First", "start --pan_coordinator true --logical_channel {}".format(self.channel))
 | 
			
		||||
        # Start PAN beacon
 | 
			
		||||
        self.command("Second", "start --pan_coordinator false --logical_channel {}".format(self.channel))
 | 
			
		||||
 | 
			
		||||
        # Set indirect data
 | 
			
		||||
        self.command("First", "config-status --data_ind {}".format(large_payload))
 | 
			
		||||
        self.command("Second", "config-status --data_ind {}".format(large_payload))
 | 
			
		||||
 | 
			
		||||
        # Send data to DUT2
 | 
			
		||||
        self.command("First", "data --dst_addr 01:02:03:00:00:00:00:02 --msdu_length {} --msdu {}".format(len(large_payload), large_payload))
 | 
			
		||||
        # Wait for transmission to finish
 | 
			
		||||
        self.command("Second", "wait --timeout 500")
 | 
			
		||||
 | 
			
		||||
        # Send data to DUT1
 | 
			
		||||
        self.command("Second", "data --dst_addr 01:02:03:00:00:00:00:01 --msdu_length {} --msdu {}".format(len(large_payload), large_payload))
 | 
			
		||||
        # Wait for transmission to finish
 | 
			
		||||
        self.command("First", "wait --timeout 500")
 | 
			
		||||
        # Loop with previous settings
 | 
			
		||||
        for i in range(0, 25):
 | 
			
		||||
            self.command("First", "data")
 | 
			
		||||
            self.command("Second", "wait")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue