diff --git a/config/lab/files/template_dc.json5 b/config/lab/files/template_dc.json5 index c7133be8..0f90d69c 100644 --- a/config/lab/files/template_dc.json5 +++ b/config/lab/files/template_dc.json5 @@ -36,5 +36,5 @@ "subcloud1": "config/lab/files/template_subcloud1.json5", "subcloud2": "config/lab/files/template_subcloud2.json5" }, - "secondary_system_controller": "config/lab/files/secondary_system_controller.json5", + "secondary_system_controller": "config/lab/files/template_secondary_system_controller.json5", } \ No newline at end of file diff --git a/keywords/ptp/cat/cat_ptp_cgu_parser.py b/keywords/ptp/cat/cat_ptp_cgu_parser.py index 3934b889..df65ddc3 100644 --- a/keywords/ptp/cat/cat_ptp_cgu_parser.py +++ b/keywords/ptp/cat/cat_ptp_cgu_parser.py @@ -58,34 +58,26 @@ class CatPtpCguParser: - (.*): Captures any characters (phase offset). Returns: - PtpCguComponentObject - the PtpCguComponentObject. + PtpCguComponentObject: the PtpCguComponentObject. Raise: - KeywordException - if output is unable to be parsed. + KeywordException: if output is unable to be parsed. """ cgu: PtpCguComponentObject = None - match = re.match(r"(Found (\S+) CGU|Password: Found (\S+) CGU)", self.cat_ptp_cgu_output[0]) # Ask about this + match = re.match(r"Found (\S+) CGU", self.cat_ptp_cgu_output[0]) # Ask about this if match: chip_model = match.group(1) - config_version_match = re.search( - r"DPLL Config ver: (.*)", self.cat_ptp_cgu_output[1] - ) - fw_version_match = re.search( - r"DPLL FW ver: (.*)", self.cat_ptp_cgu_output[2] - ) + config_version_match = re.search(r"DPLL Config ver: (.*)", self.cat_ptp_cgu_output[1]) + fw_version_match = re.search(r"DPLL FW ver: (.*)", self.cat_ptp_cgu_output[2]) if config_version_match and fw_version_match: config_version = config_version_match.group(1) fw_version = fw_version_match.group(1) cgu = PtpCguComponentObject(config_version, fw_version, chip_model) else: - raise KeywordException( - f"Unable to parse output. Got : {self.cat_ptp_cgu_output}" - ) + raise KeywordException(f"Unable to parse output. Got : {self.cat_ptp_cgu_output}") else: - raise KeywordException( - f"Unexpected format: could not parse. Got: {self.cat_ptp_cgu_output}" - ) + raise KeywordException(f"Unexpected format: could not parse. Got: {self.cat_ptp_cgu_output}") for i, line in enumerate(self.cat_ptp_cgu_output): # CGU Input Status @@ -95,40 +87,22 @@ class CatPtpCguParser: ) if match and cgu: input_name, idx, state, eec, pps, esync_fail = match.groups() - cgu.append_cgu_input( - PtpCguInputObject( - input_name, int(idx), state, int(eec), int(pps), esync_fail - ) - ) + cgu.append_cgu_input(PtpCguInputObject(input_name, int(idx), state, int(eec), int(pps), esync_fail)) # EEC DPLL match = re.match(r"EEC DPLL:", line) if match and cgu: - current_ref_match = re.search( - r"Current reference:\s*(.*)", self.cat_ptp_cgu_output[i + 1] - ) - status_match = re.search( - r"Status:\s*(.*)", self.cat_ptp_cgu_output[i + 2] - ) + current_ref_match = re.search(r"Current reference:\s*(.*)", self.cat_ptp_cgu_output[i + 1]) + status_match = re.search(r"Status:\s*(.*)", self.cat_ptp_cgu_output[i + 2]) if current_ref_match and status_match: - cgu.set_eec_dpll( - PtpCguEecDpllObject( - current_ref_match.group(1), status_match.group(1) - ) - ) + cgu.set_eec_dpll(PtpCguEecDpllObject(current_ref_match.group(1), status_match.group(1))) # PPS DPLL match = re.match(r"PPS DPLL:", line) if match and cgu: - current_ref_match = re.search( - r"Current reference:\s*(.*)", self.cat_ptp_cgu_output[i + 1] - ) - status_match = re.search( - r"Status:\s*(.*)", self.cat_ptp_cgu_output[i + 2] - ) - phase_offset_match = re.search( - r"Phase offset \[ps]:\s*(.*)", self.cat_ptp_cgu_output[i + 3] - ) + current_ref_match = re.search(r"Current reference:\s*(.*)", self.cat_ptp_cgu_output[i + 1]) + status_match = re.search(r"Status:\s*(.*)", self.cat_ptp_cgu_output[i + 2]) + phase_offset_match = re.search(r"Phase offset \[ps]:\s*(.*)", self.cat_ptp_cgu_output[i + 3]) if current_ref_match and status_match and phase_offset_match: cgu.set_pps_dpll( diff --git a/unit_tests/parser/ptp/cat_ptp_config_test.py b/unit_tests/parser/ptp/cat_ptp_config_test.py index 6d0d47c7..828b2783 100644 --- a/unit_tests/parser/ptp/cat_ptp_config_test.py +++ b/unit_tests/parser/ptp/cat_ptp_config_test.py @@ -164,7 +164,7 @@ def test_cat_ptp_config_output(): assert default_data_set_object.get_socket_priority() == 0 assert default_data_set_object.get_priority1() == 128 assert default_data_set_object.get_priority2() == 128 - assert default_data_set_object.get_domain_number() == "0" + assert default_data_set_object.get_domain_number() == 0 assert default_data_set_object.get_utc_offset() == 37 assert default_data_set_object.get_clock_class() == 248 assert default_data_set_object.get_clock_accuracy() == "0xFE" @@ -283,7 +283,7 @@ def test_cat_ptp_output_format_with_associated_interfaces(): assert default_data_set_object.get_clock_servo() == "linreg" assert default_data_set_object.get_dataset_comparison() == "G.8275.x" assert default_data_set_object.get_delay_mechanism() == "E2E" - assert default_data_set_object.get_domain_number() == "24" + assert default_data_set_object.get_domain_number() == 24 assert default_data_set_object.get_message_tag() == "ptp1" assert default_data_set_object.get_network_transport() == "L2" assert default_data_set_object.get_priority2() == 100 diff --git a/unit_tests/parser/ptp/pmc_parser_test.py b/unit_tests/parser/ptp/pmc_parser_test.py index fc1fc4ea..90b429da 100644 --- a/unit_tests/parser/ptp/pmc_parser_test.py +++ b/unit_tests/parser/ptp/pmc_parser_test.py @@ -20,7 +20,7 @@ pmc_output = [ " offsetScaledLogVariance 0xffff\n", " priority2 128\n", " clockIdentity 507c6f.fffe.0b5a4d\n", - " domainNumber 0.\n", + " domainNumber 0\n", "sysadmin@controller-0:~$\n", ] @@ -125,7 +125,7 @@ def test_pmc_get_default_data_set_table_parser(): assert output_dict["offsetScaledLogVariance"] == "0xffff" assert output_dict["priority2"] == "128" assert output_dict["clockIdentity"] == "507c6f.fffe.0b5a4d" - assert output_dict["domainNumber"] == "0." + assert output_dict["domainNumber"] == 0 def test_pmc_get_default_data_set_output(): @@ -145,7 +145,7 @@ def test_pmc_get_default_data_set_output(): assert pmc_get_default_data_set_object.get_offset_scaled_log_variance() == "0xffff" assert pmc_get_default_data_set_object.get_priority2() == 128 assert pmc_get_default_data_set_object.get_clock_identity() == "507c6f.fffe.0b5a4d" - assert pmc_get_default_data_set_object.get_domain_number() == "0." + assert pmc_get_default_data_set_object.get_domain_number() == 0 def test_pmc_get_parent_data_set_table_parser():