Files
test/keywords/ptp/cat/cat_clock_conf_keywords.py
jpike fdf988430b Adding parsing and object for clock conf files
Adding keyword, parsing and objects for ptp clock conf files.

Change-Id: I394d09f36ca0aac0448d5904a036da0e21e7d40b
2025-04-25 15:21:59 -04:00

28 lines
887 B
Python

from framework.ssh.ssh_connection import SSHConnection
from keywords.base_keyword import BaseKeyword
from keywords.ptp.cat.objects.clock_conf_output import ClockConfOutput
class CatClockConfKeywords(BaseKeyword):
"""
Class for CAT Clock Conf Keywords.
"""
def __init__(self, ssh_connection: SSHConnection):
self.ssh_connection = ssh_connection
def cat_clock_conf(self, clock_conf_location: str) -> ClockConfOutput:
"""
Runs the command sudo cat <clock_conf_location> ex. /etc/linuxptp/ptpinstance/clock-conf.conf.
Args:
clock_conf_location (str): the clock conf location.
Returns:
ClockConfOutput: the ClockConfOutput.
"""
output = self.ssh_connection.send_as_sudo(f"cat {clock_conf_location}")
clock_conf_output = ClockConfOutput(output)
return clock_conf_output