Files
test/keywords/ptp/pmc/objects/pmc_get_domain_output.py
jpike f71d720996 Adding support for multiple port data settings
Updating the pmc parser to allow for multiple setting values. This
meant a refactor of other classes using this table. For now only
the port data seems to have multiple so other formats will fail if
more than one is found.

Also added some new unit tests for formats not covered previously
and fixed a couple of other tests.

Change-Id: I401ae0327399e23bcf2d899f048fe28228246f42
2025-04-24 09:06:31 -04:00

47 lines
1.4 KiB
Python

from framework.exceptions.keyword_exception import KeywordException
from keywords.ptp.pmc.objects.pmc_get_domain_object import PMCGetDomainObject
from keywords.ptp.pmc.pmc_table_parser import PMCTableParser
class PMCGetDomainOutput:
"""
This class parses the output of commands such as 'pmc GET DOMAIN'
Example:
sending: GET DOMAIN
507c6f.fffe.0b5a4d-0 seq 0 RESPONSE MANAGEMENT DOMAIN
domainNumber 24
"""
def __init__(self, pmc_output: list[str]):
"""
Constructor.
Create an internal DOMAIN from the passed parameter.
Args:
pmc_output (list[str]): a list of strings representing the output of the pmc command
"""
pmc_table_parser = PMCTableParser(pmc_output)
output_values_list = pmc_table_parser.get_output_values_dict()
if len(output_values_list) > 1:
raise KeywordException("More then one domain output was found")
output_values = output_values_list[0]
self.pmc_get_domain_object = PMCGetDomainObject()
if "domainNumber" in output_values:
self.pmc_get_domain_object.set_domain_number(int(output_values["domainNumber"]))
def get_pmc_get_domain_object(self) -> PMCGetDomainObject:
"""
Getter for pmc_get_domain_object object.
Returns:
PMCGetDomainObject: A PMCGetDomainObject
"""
return self.pmc_get_domain_object