# Init all nodes wpan.Node.init_all_nodes() # ----------------------------------------------------------------------------------------------------------------------- # Build network topology for node in nodes: node.form(node.interface_name) # ----------------------------------------------------------------------------------------------------------------------- # Test implementation # Perform active scan and check that all nodes are seen in the scan result. scan_result = wpan.parse_scan_result(scanner.active_scan()) for node in nodes: verify(node.is_in_scan_result(scan_result)) # Make every other network joinable, scan and check the result. make_joinable = False for node in nodes: make_joinable = not make_joinable if make_joinable: node.permit_join() scan_result = wpan.parse_scan_result(scanner.active_scan()) for node in nodes:
# ----------------------------------------------------------------------------------------------------------------------- # Build network topology n1.form("n1", channel='20') n2.form("n2", channel='21') n3.form("n3", channel='22') # ----------------------------------------------------------------------------------------------------------------------- # Test implementation # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Scan by scanner nodes (no network) # Scan by s1 (15.4 only), expect to see n1(15.4) and n3(15.4+trel) result = wpan.parse_scan_result(s1.discover_scan()) verify(n1.is_in_scan_result(result)) verify(not n2.is_in_scan_result(result)) verify(n3.is_in_scan_result(result)) # Scan by s2 (trel only), expect to see n2(trel) and n3(15.4+trel) result = wpan.parse_scan_result(s2.discover_scan()) verify(not n1.is_in_scan_result(result)) verify(n2.is_in_scan_result(result)) verify(n3.is_in_scan_result(result)) # Scan by s3 (trel+15.4), expect to see all nodes result = wpan.parse_scan_result(s3.discover_scan()) verify(n1.is_in_scan_result(result)) verify(n2.is_in_scan_result(result)) verify(n3.is_in_scan_result(result))
# Init all nodes wpan.Node.init_all_nodes() # ----------------------------------------------------------------------------------------------------------------------- # Build network topology for node in nodes: node.form(node.interface_name) # ----------------------------------------------------------------------------------------------------------------------- # Test implementation # Perform active scan and check that all nodes are seen in the scan result. scan_result = wpan.parse_scan_result(scanner.discover_scan()) for node in nodes: verify(node.is_in_scan_result(scan_result)) # Scan from an already associated node. scan_result = wpan.parse_scan_result(nodes[0].discover_scan()) for node in nodes[1:]: verify(node.is_in_scan_result(scan_result)) # TODO: add tests for the joiner only and filtering # ----------------------------------------------------------------------------------------------------------------------- # Test finished
# ----------------------------------------------------------------------------------------------------------------------- # Build network topology node1.form("net1", channel='11', panid='0x0001') node2.form("net2", channel='12', panid='0x0002') node3.form("net3", channel='13', panid='0x0002') node4.form("net4", channel='13', panid='0x0004') node5.form("net5", channel='14', panid='0x0005') # ----------------------------------------------------------------------------------------------------------------------- # Test implementation # Perform active scan and check that all nodes are seen in the scan result. scan_result = wpan.parse_scan_result(scanner.discover_scan()) verify(len(scan_result) == 5) for node in [node1, node2, node3, node4, node5]: verify(node.is_in_scan_result(scan_result)) # Scan from an already associated node. scan_result = wpan.parse_scan_result(node1.discover_scan()) verify(len(scan_result) == 4) for node in [node2, node3, node4, node5]: verify(node.is_in_scan_result(scan_result)) # Scan on specific subset of channels
# Init all nodes wpan.Node.init_all_nodes() #----------------------------------------------------------------------------------------------------------------------- # Build network topology for node in nodes: node.form(node.interface_name) #----------------------------------------------------------------------------------------------------------------------- # Test implementation # Perform active scan and check that all nodes are seen in the scan result. scan_result = wpan.parse_scan_result(scanner.discover_scan()) for node in nodes: verify(node.is_in_scan_result(scan_result)) # Scan from an already associated node. scan_result = wpan.parse_scan_result(nodes[0].discover_scan()) for node in nodes[1:]: verify(node.is_in_scan_result(scan_result)) # TODO: add tests for the joiner only and filtering #----------------------------------------------------------------------------------------------------------------------- # Test finished
# Init all nodes wpan.Node.init_all_nodes() #----------------------------------------------------------------------------------------------------------------------- # Build network topology for node in nodes: node.form(node.interface_name) #----------------------------------------------------------------------------------------------------------------------- # Test implementation # Perform active scan and check that all nodes are seen in the scan result. scan_result = wpan.parse_scan_result(scanner.active_scan()) for node in nodes: verify(node.is_in_scan_result(scan_result)) # Make every other network joinable, scan and check the result. make_joinable = False for node in nodes: make_joinable = not make_joinable if make_joinable: node.permit_join() scan_result = wpan.parse_scan_result(scanner.active_scan()) for node in nodes:
# ----------------------------------------------------------------------------------------------------------------------- # Build network topology n1.form("n1", channel='20') n2.form("n2", channel='21') n3.form("n3", channel='22') # ----------------------------------------------------------------------------------------------------------------------- # Test implementation # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Scan by scanner nodes (no network) # Scan by s1 (15.4 only), expect to see n1(15.4) and n3(15.4+trel) result = wpan.parse_scan_result(s1.active_scan()) verify(n1.is_in_scan_result(result)) verify(not n2.is_in_scan_result(result)) verify(n3.is_in_scan_result(result)) # Scan by s2 (trel only), expect to see n2(trel) and n3(15.4+trel) result = wpan.parse_scan_result(s2.active_scan()) verify(not n1.is_in_scan_result(result)) verify(n2.is_in_scan_result(result)) verify(n3.is_in_scan_result(result)) # Scan by s3 (trel+15.4), expect to see all nodes result = wpan.parse_scan_result(s3.active_scan()) verify(n1.is_in_scan_result(result)) verify(n2.is_in_scan_result(result)) verify(n3.is_in_scan_result(result))