1.1.4.1.3. test_automation.utils.io_utils

1.1.4.1.3.1. Attributes

logger

DEFAULT_TIMEOUT

1.1.4.1.3.2. Functions

write_file(platform_base_obj, path, value[, timeout])

Write a value to a file using shell redirection.

read_file(platform_base_obj, path[, timeout])

Read the contents of a file using the cat command.

write_to_port(mgr, port, path, value)

Write value to file over a specific port.

read_file_from_port(mgr, port, path[, timeout])

Read file content using cat command over a specific port.

check_if_file_exists(mgr, port, path)

Check if a file exists on the target.

read_int(mgr, port, path)

Read integer value from file using cat command.

1.1.4.1.3.3. Module Contents

test_automation.utils.io_utils.logger[source]
test_automation.utils.io_utils.DEFAULT_TIMEOUT = 120[source]
test_automation.utils.io_utils.write_file(platform_base_obj, path, value, timeout=DEFAULT_TIMEOUT)[source]

Write a value to a file using shell redirection.

Parameters:
  • platform_base_obj – Platform base object providing console access.

  • path (str) – Path to the file to write to.

  • value (Union[str, int]) – Value to write to the file.

  • timeout (int) – Command timeout in seconds.

Returns:

output of the command execution

test_automation.utils.io_utils.read_file(platform_base_obj, path, timeout=DEFAULT_TIMEOUT)[source]

Read the contents of a file using the cat command.

Parameters:
  • platform_base_obj – Platform base object providing console access.

  • path (str) – Path to the file to read from.

  • timeout (int) – Command timeout in seconds.

Returns:

Contents of the file

Return type:

str

test_automation.utils.io_utils.write_to_port(mgr, port, path, value)[source]

Write value to file over a specific port.

Parameters:
  • mgr – Manager object to run command

  • port – Console port to use

  • path (str) – File path to write to

  • value (Union[str, int]) – Value to write

Returns:

output of the command execution

test_automation.utils.io_utils.read_file_from_port(mgr, port, path, timeout=120)[source]

Read file content using cat command over a specific port.

Parameters:
  • mgr – Manager object to run command

  • port – Console port to use

  • path (str) – File path to read from

  • timeout (int) – Command timeout in seconds

Returns:

Contents of the file

Return type:

str

test_automation.utils.io_utils.check_if_file_exists(mgr, port, path)[source]

Check if a file exists on the target.

Parameters:
  • mgr – Manager object to run command

  • port – Console port to use

  • path (str) – File path to read from

Returns:

True if file exists, False otherwise

Return type:

bool

test_automation.utils.io_utils.read_int(mgr, port, path)[source]

Read integer value from file using cat command.

Parameters:
  • mgr – Manager object to run command

  • port – Console port to use

  • path (str) – File path to read from

Returns:

Integer value read from the file

Return type:

int