Blade Only Examples
- test_scripts.test_connect_blade.test_connect_blade()
Login an a remote Blade en start a remote client. Send a ping command to test the connection with the Python interface.
import sys
sys.path.append('..')
import test_config as tc
import client
def test_connect_blade():
"""
Login an a remote Blade en start a remote client.
Send a ping command to test the connection with the Python interface.
"""
# Start remote client
c = client.Client()
res = c.start_remote_client(ip_address=tc.BLADE_1_IP,
user_name=tc.USER_LOGIN,
user_password=tc.USER_PASSWORD)
if not res:
print('Successfully connected to the client.')
else:
print('Failed to connect to the client!')
# Ping client
if not res:
# Get pointer to Python API
p = c.get_python_intf()
# Send ping command
res = p.ping(0x99)
print('Success') if res == 0 else print('Failed')
del c
if __name__ == '__main__':
test_connect_blade()
- test_scripts.test_copy_file_from_blade.test_copy_file_from_blade()
Connect to a remote Blade and copy a file to the local system.
import sys
sys.path.append('..')
import test_config as tc
import client
def test_copy_file_from_blade():
"""
Connect to a remote Blade and copy a file to the local system.
"""
# Init
p = None
# Start remote client
c = client.Client()
res = c.start_remote_client(ip_address=tc.BLADE_1_IP,
user_name=tc.USER_LOGIN,
user_password=tc.USER_PASSWORD)
# Connect to session
if not res:
p = c.get_python_intf()
res = tc.connect_session(python_intf=p,
uuid=tc.SESSION_1_UUID)
# Copy a file from the Blade to the local system
if not res:
p.get_blade_file(src_file=f'{tc.DATA_PATH}/cu0_dg0.rawd',
dst_file=f'{tc.DUMP_PATH}/cu0_dg0.rawd')
del c
if __name__ == '__main__':
test_copy_file_from_blade()
- test_scripts.test_get_dir_info.test_get_dir_info()
Connect to a remote Blade, retrieves a user’s directory structure and file information and displays it as follows:
HOME/user1725061724382024.01.17 14:52:14 14819 axis.bpf2024.03.19 12:27:59 1255 cu0_dg0.rawi2024.03.19 12:27:54 1226 cu0_dg0.cfg2024.03.19 12:27:59 32 cu0_dg0.rawt2024.03.19 12:27:59 4096 cu0_dg0.rawd2024.03.19 12:27:59 10456 cu0_dg0.sdf1725071724552024.03.14 13:50:21 29445 q1_4x28g125.bpf2024.03.15 13:08:35 29030 4x28g125.bpf…In the previous example, ‘172506’ is a Blade session UUID and ‘172438’ is a session logical unit UUID. These numbers can be found in the Exostiv Blade connection dialog.
import sys
sys.path.append('..')
import test_config as tc
import client
import client.hostGetDirInfo as hostGetDirInfo
def test_get_dir_info():
"""
Connect to a remote Blade, retrieves a user's directory structure and
file information and displays it as follows:
| HOME/user
| 172506
| 172438
| 2024.01.17 14:52:14 14819 axis.bpf
| 2024.03.19 12:27:59 1255 cu0_dg0.rawi
| 2024.03.19 12:27:54 1226 cu0_dg0.cfg
| 2024.03.19 12:27:59 32 cu0_dg0.rawt
| 2024.03.19 12:27:59 4096 cu0_dg0.rawd
| 2024.03.19 12:27:59 10456 cu0_dg0.sdf
| 172507
| 172455
| 2024.03.14 13:50:21 29445 q1_4x28g125.bpf
| 2024.03.15 13:08:35 29030 4x28g125.bpf
| ...
In the previous example, '172506' is a Blade session UUID and '172438'
is a session logical unit UUID. These numbers can be found in the
Exostiv Blade connection dialog.
"""
# Init
p = None
# Start remote client
c = client.Client()
res = c.start_remote_client(ip_address=tc.BLADE_1_IP,
user_name=tc.USER_LOGIN,
user_password=tc.USER_PASSWORD)
# Get directory info
if not res:
p = c.get_python_intf()
res, dir_info = p.get_dir_info(path=f'HOME/{tc.USER_LOGIN}')
if res == 0:
hostGetDirInfo.HostGetDirInfo.dump_all(dir_info)
del c
if __name__ == '__main__':
test_get_dir_info()
Probe Only Examples
- test_scripts.test_connect_probe.test_connect_probe()
Start a local client. Send a ping command to test the connection with the Python interface.
import sys
sys.path.append('..')
import client
def test_connect_probe():
"""
Start a local client.
Send a ping command to test the connection with the Python interface.
"""
# Start local client
c = client.Client()
res = c.start_local_client(headless=False)
if not res:
print('Successfully connected to the client.')
else:
print('Failed to connect to the client!')
print('Success') if res == 0 else print('Failed')
# Ping client
if not res:
# Get pointer to Python API
p = c.get_python_intf()
# Send ping command
res = p.ping(0x66)
print('Success') if res == 0 else print('Failed')
del c
if __name__ == '__main__':
test_connect_probe()
Common Examples
- test_scripts.test_ip_uuid.test_ip_uuid()
Connect to a remote Blade, establish a link to the IP and check for a valid IP identification number.
import sys
sys.path.append('..')
import test_config as tc
import client
def test_ip_uuid():
"""
Connect to a remote Blade, establish a link to the IP and check for a
valid IP identification number.
"""
# Init
p = None
linkup = False
# Start remote client
c = client.Client()
res = c.start_remote_client(ip_address=tc.BLADE_1_IP,
user_name=tc.USER_LOGIN,
user_password=tc.USER_PASSWORD)
# Connect to session
if not res:
p = c.get_python_intf()
res = tc.connect_session(python_intf=p,
uuid=tc.SESSION_1_UUID)
# Load a local project file and send it to the remote Blade Client
if not res:
res = p.open_project(tc.FILE_1, True)
# Connect to the IP and wait for the link to come up
if not res:
res = p.connect_ip()
if not res:
linkup = tc.wait_linkup(p)
# Run the test if the link is up
if not res and linkup:
valid_ip = p.ip_valid()
if valid_ip:
print("The IP has the expected UUID.")
else:
print("The IP does not NOT have the expected UUID.")
del c
if __name__ == '__main__':
test_ip_uuid()
- test_scripts.test_simple_capture.test_simple_capture()
Connect to a remote Blade and sample some data.
import sys
sys.path.append('..')
import test_config as tc
import client
def test_simple_capture():
"""
Connect to a remote Blade and sample some data.
"""
# Init
p = None
linkup = False
# Start remote client
c = client.Client()
res = c.start_remote_client(ip_address=tc.BLADE_1_IP,
user_name=tc.USER_LOGIN,
user_password=tc.USER_PASSWORD)
# Connect to session
if not res:
p = c.get_python_intf()
res = tc.connect_session(python_intf=p,
uuid=tc.SESSION_1_UUID)
# Load a local project file and send it to the remote Blade Client
if not res:
res = p.open_project(path=tc.FILE_1)
# Connect to the IP and wait for the link to come up
if not res:
res = p.connect_ip()
if not res:
linkup = tc.wait_linkup(p)
# Run the test if the link is up
if not res and linkup:
res = p.capture_start(capture_unit=tc.CU_NAME_1,
forced=True)
if not res:
print('Successfully started the capture.')
print('Waiting for the capture to be done...')
tc.wait_capture_done(p)
print('Capture done.')
else:
print('Failed to start the capture!')
del c
if __name__ == '__main__':
test_simple_capture()
- test_scripts.test_simple_capture_loop_download.test_simple_capture_loop_download()
Connect to a remote Blade and start several data captures in a loop. Download the data after every capture and append the name with the loop number.
import sys
sys.path.append('..')
import test_config as tc
import client
def test_simple_capture_loop_download():
"""
Connect to a remote Blade and start several data captures in a loop.
Download the data after every capture and append the name with the
loop number.
"""
# Init
p = None
linkup = False
loops = 3
# Start remote client
c = client.Client()
res = c.start_remote_client(ip_address=tc.BLADE_1_IP,
user_name=tc.USER_LOGIN,
user_password=tc.USER_PASSWORD)
# Connect to session
if not res:
p = c.get_python_intf()
res = tc.connect_session(python_intf=p,
uuid=tc.SESSION_1_UUID)
# Load a local project file and send it to the remote Blade Client
if not res:
res = p.open_project(tc.FILE_1)
# Connect to the IP and wait for the link to come up
if not res:
res = p.connect_ip()
if not res:
linkup = tc.wait_linkup(p)
# Run the test if the link is up
src_file = f'{tc.DATA_PATH}/cu0_dg0.rawd'
dst_file = f'{tc.DUMP_PATH}/cu0_dg0.rawd'
if not res and linkup:
for l in range(0, loops):
print(f'\nLoop : {l + 1} of {loops}')
# Capture data
res = p.capture_start(capture_unit=tc.CU_NAME_1,
forced=False)
if not res:
print('Successfully started the capture.')
print('Waiting for the capture to be done...')
tc.wait_capture_done(p)
else:
print('Failed to start the capture!')
# Download data
if not res:
print('Downloading file...')
dst_file_index = dst_file.replace('.rawd', f'_{l + 1}.rawd')
p.get_blade_file(src_file=src_file,
dst_file=dst_file_index)
print('Capture done.')
del c
if __name__ == '__main__':
test_simple_capture_loop_download()
- test_scripts.test_multi_capture.test_multi_capture()
Connect to a remote Blade and sample data simultaneously on multiple capture units.
import sys
sys.path.append('..')
import test_config as tc
import client
def test_multi_capture():
"""
Connect to a remote Blade and sample data simultaneously on multiple
capture units.
"""
# Init
p = None
linkup = False
# Start remote client
c = client.Client()
res = c.start_remote_client(ip_address=tc.BLADE_1_IP,
user_name=tc.USER_LOGIN,
user_password=tc.USER_PASSWORD)
# Connect to session
if not res:
p = c.get_python_intf()
res = tc.connect_session(python_intf=p,
uuid=tc.SESSION_1_UUID)
# Load a local project file and send it to the remote Blade Client
if not res:
res = p.open_project(tc.FILE_1)
# Connect to the IP and wait for the link to come up
if not res:
res = p.connect_ip()
if not res:
linkup = tc.wait_linkup(p)
# Run the test if the link is up
if not res and linkup:
p.capture_start_multi(capture_unit_list=[tc.CU_NAME_1, tc.CU_NAME_2],
forced=False)
if not res:
print('Successfully started multiple captures.')
print('Waiting for the captures to be done...')
tc.wait_capture_done(p, tc.CU_NAME_2)
tc.wait_capture_done(p, tc.CU_NAME_1)
print('Captures done.')
else:
print('Failed to start multiple captures!')
del c
if __name__ == '__main__':
test_multi_capture()