Python library (and Java dependency) to check that Packet Tracer is running on a given address and port.
import ptchecker
is_running = ptchecker.is_running(jar_path, hostname, port, timeout, wait_between_retries, file_path, device_to_find)
if is_running:
print "The Packet Tracer instance answered. I.e., it is running."
try:
rountrip_time = ptchecker.get_roundtrip_time(jar_path, hostname, port, timeout, wait_between_retries, file_path, device_to_find)
print "The Packet Tracer instance answered in %d msecs." % rountrip_time
except ptchecker.TimeoutError as e:
print e
- jar_path the path to the jar to be executed to contact Packet Tracer (see the jPTChecker directory).
- hostname (optional, default: 'localhost') string with the name of the Packet Tracer instance host.
- port (optional, default: 39000) an int for the port number of the Packet Tracer instance.
- timeout (optional, default: 1.0) number of seconds while the program will retry connections.
- wait_between_retries (optional, default: 0.2) make a new attempt after the specified seconds.
- file_path (optional, default: None) file path in the PT instance filesystem to be opened.
- device_to_find (optional, default: None) name of the device which should be found in the PT instance.