testers module
Tester APIs Overview
Id |
Action |
API |
Description |
|---|---|---|---|
1 |
Connect Chassis |
testers.L23Tester() |
Create a tester object representing a chassis and connect to the chassis at IP address |
2 |
Disconnect Chassis |
tester.session.logoff() |
Disconnect from the chassis |
3 |
Shutdown Chassis |
tester.down.set_poweroff() |
Shut down the chassis and leave it powered off |
4 |
Restart Chassis |
tester.down.set_restart() |
Restart the chassis in a clean state |
5 |
Release Chassis |
tester.reservation.set_release() |
Release the chassis |
6 |
Relinquish Chassis |
tester.reservation.set_relinquish() |
Relinquish the chassis |
7 |
Reserve Chassis |
tester.reservation.set_reserve() |
Reserve the chassis |
8 |
Get Reservation Status |
tester.reservation.get() |
Get the current reservation status of the chassis |
9 |
Get Reserved By |
tester.reserved_by.get() |
Get the current reservation status of the chassis |
10 |
Flash LEDs Off |
tester.flash.set_off() |
Turn off the test port LEDs flashing |
11 |
Flash LEDs On |
tester.flash.set_on() |
Make all the test port LEDs flash on and off with a 1-second interval |
12 |
Get Flash Status |
tester.flash.get() |
Get the current LED flash status |
13 |
Set Management IP |
tester.management_interface.ip_address.set() |
Set the management IP address of the chassis management port |
14 |
Get Management IP |
tester.management_interface.ip_address.get() |
Get the management IP address of the chassis management port |
15 |
Get MAC Address |
tester.management_interface.macaddress.get() |
Get the MAC address for the chassis management port |
16 |
Set Management Hostname |
tester.management_interface.hostname.set() |
Set the chassis hostname used when DHCP is enabled |
17 |
Get Management Hostname |
tester.management_interface.hostname.get() |
Get the chassis hostname used when DHCP is enabled |
18 |
Enable DHCP |
tester.management_interface.dhcp.set_on() |
Enable DHCP for the chassis management IP address |
19 |
Disable DHCP |
tester.management_interface.dhcp.set_off() |
Disable DHCP for the chassis management IP address |
20 |
Get DHCP Status |
tester.management_interface.dhcp.get() |
Get the DHCP status of the chassis |
21 |
Get Capabilities |
tester.capabilities.get() |
Get the chassis capabilities information |
22 |
Set Chassis Name |
tester.name.set() |
Set the name of the chassis |
23 |
Get Chassis Name |
tester.name.get() |
Get the name of the chassis |
24 |
Set Chassis Password |
tester.password.set() |
Set the password of the chassis |
25 |
Get Chassis Password |
tester.password.get() |
Get the password of the chassis |
26 |
Set Chassis Description |
tester.comment.set() |
Set a text description of the chassis |
27 |
Get Chassis Description |
tester.comment.get() |
Get a text description of the chassis |
28 |
Get Chassis Model |
tester.model.get() |
Get the model of the chassis |
29 |
Get Chassis Serial Number |
tester.serial_no.get() |
Get the serial number of the chassis |
30 |
Get Chassis Build String |
tester.build_string.get() |
Get the chassis build string |
31 |
Get Chassis Version String |
tester.version_str.get() |
Get the currently running chassis software version |
32 |
Get Used TPLD IDs |
tester.used_tpld_ids.get() |
Get the used TPLD IDs in the chassis |
33 |
Get Chassis Time |
tester.time.get() |
Get the chassis local time |
34 |
Start Synchronized Port Traffic |
tester.traffic.set_on() |
Start synchronous traffic control for multiple ports on the same chassis |
35 |
Stop Synchronized Port Traffic |
tester.traffic.set_off() |
Stop synchronous traffic control for multiple ports on the same chassis |
36 |
Start Synchronized Chassis Traffic |
tester.traffic_sync.set_on() |
Start synchronous traffic control for multiple ports on different chassis |
37 |
Stop Synchronized Chassis Traffic |
tester.traffic_sync.set_off() |
Stop synchronous traffic control for multiple ports on different chassis |
Examples - Tester APIs
# [testers]
"""Connect Chassis"""
# Create a tester object representing a chassis
# and connect to the chassis at IP address 10.10.10.
tester = await testers.L23Tester(
host="10.10.10.10",
username="my_name",
password="xena",
enable_logging=False)
"""Disconnect Chassis"""
# Disconnect from the chassis.
await tester.session.logoff()
"""Shutdown/Restart Chassis"""
# Shuts down the chassis, and either restarts it
# in a clean state or leaves it powered off.
await tester.down.set_poweroff()
await tester.down.set_restart()
"""Reserve/Release Chassis"""
# Reserve or release the chassis.
await tester.reservation.set_release()
await tester.reservation.set_relinquish()
await tester.reservation.set_reserve()
resp_obj = await tester.reservation.get()
"""Reservation Status"""
# Get the current reservation status of the chassis.
resp_obj = await tester.reserved_by.get()
"""Flash LEDs"""
# Make all the test port LEDs flash on and off with a 1-second interval.
# This is helpful if you have multiple chassis mounted side by side and you need to identify a specific one.
await tester.flash.set_off()
await tester.flash.set_on()
resp_obj = await tester.flash.get()
"""Management IP Address"""
# The management IP address of the chassis management port.
await tester.management_interface.ip_address.set(
ipv4_address=ipaddress.IPv4Address("10.10.10.10"),
subnet_mask=ipaddress.IPv4Address("255.255.255.0"),
gateway=ipaddress.IPv4Address("10.10.10.1"))
resp_obj = await tester.management_interface.ip_address.get()
"""Management MAC Address"""
# Get the MAC address for the chassis management port.
resp_obj = await tester.management_interface.macaddress.get()
"""Management Hostname"""
# Get or set the chassis hostname used when DHCP is enabled.
await tester.management_interface.hostname.set(hostname="name")
resp_obj = await tester.management_interface.hostname.get()
"""Management DHCP"""
# Controls whether the chassis will use DHCP
# to get the management IP address.
await tester.management_interface.dhcp.set_on()
await tester.management_interface.dhcp.set_off()
resp_obj = await tester.management_interface.dhcp.get()
"""Capabilities"""
# Get the chassis capabilities information.
resp_obj = await tester.capabilities.get()
"""Chassis Name"""
# The name of the chassis, as it appears at various places in the user interface.
# The name is also used to distinguish the various chassis contained within a testbed,
# and in files containing the configuration for an entire test case.
await tester.name.set(chassis_name="name")
resp_obj = await tester.name.get()
"""Chassis Password"""
# The password of the chassis must be provided
# when logging on to the chassis.
await tester.password.set(password="xena")
resp_obj = await tester.password.get()
"""Chassis Description"""
# A text description of the chassis.
await tester.comment.set(comment="description")
resp_obj = await tester.comment.get()
"""Chassis Model"""
# The model of the chassis.
resp_obj = await tester.model.get()
"""Chassis Serial Number"""
# The serial number of the chassis.
resp_obj = await tester.serial_no.get()
"""Chassis Build String"""
resp_obj = await tester.build_string.get()
"""Chassis Version String"""
# Returns the currently running chassis software version.
resp_obj = await tester.version_str.get()
"""Used TPLD IDs"""
# Get the used TPLD IDs in the chassis.
resp_obj = await tester.used_tpld_ids.get()
"""Chassis Time"""
# Get the chassis local time.
resp_obj = await tester.time.get()
"""Synchronized Port Traffic"""
# Synchronous traffic control for multiple ports on the same chassis.
await tester.traffic.set_on(module_ports=[0,0,0,1])
await tester.traffic.set_off(module_ports=[0,0,0,1])
"""Synchronized Chassis Traffic"""
# Synchronous traffic control for multiple ports on different chassis.
# This requires all involved chassis to have their internal clocks synchronized.
await tester.traffic_sync.set_on(timestamp=1234567, module_ports=[0,0,0,1])
await tester.traffic_sync.set_off(timestamp=1234567, module_ports=[0,0,0,1])