45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
from DeviceInterface import DeviceInterface
|
|
from LinuxPtpController import LinuxPtpObserver
|
|
|
|
class TestController:
|
|
def __reset_flexptp(self) -> None:
|
|
self.__di.execute_command("ptp reset")
|
|
|
|
def __start_e2e_l4(self) -> None:
|
|
self.__di.execute_command("ptp profile preset default")
|
|
|
|
def __start_p2p_l4(self) -> None:
|
|
self.__di.execute_command("ptp profile preset defp2p")
|
|
|
|
def __start_e2e_l2(self) -> None:
|
|
self.__di.execute_command("ptp profile preset default")
|
|
self.__di.execute_command("ptp transport 802.3")
|
|
self.__reset_flexptp()
|
|
|
|
def __start_p2p_l2(self) -> None:
|
|
self.__di.execute_command("ptp profile preset defp2p")
|
|
self.__di.execute_command("ptp transport 802.3")
|
|
self.__reset_flexptp()
|
|
|
|
def __start_gPTP(self) -> None:
|
|
self.__di.execute_command("ptp profile preset gPTP")
|
|
|
|
def __set_priority(self, priority1: int, priority2: int) -> None:
|
|
self.__di.execute_command("ptp priority {:d} {:d}".format(priority1, priority2))
|
|
|
|
def __set_domain(self, domain: int) -> None:
|
|
self.__di.execute_command("ptp domain {:d}".format(domain))
|
|
|
|
def __disable_all_logging(self) -> None:
|
|
logging_types = [ "def", "corr", "ts", "info", "locked", "bmca" ]
|
|
for lt in logging_types:
|
|
self.__di.execute_command("ptp log " + lt + " off", expect_results=False)
|
|
|
|
def __set_servo_offset(self, offset: int) -> None:
|
|
self.__di.execute_command("ptp servo offset {:d}".format(offset))
|
|
|
|
|
|
def __init__(self, di: DeviceInterface, lptp_observer: LinuxPtpObserver) -> None:
|
|
self.__di = di
|
|
self.__lptp_observer = lptp_observer
|
|
pass |