diff --git a/docs/src/schemas/csp/low/assignresources/ska-low-csp-assignresources-7.4.rst b/docs/src/schemas/csp/low/assignresources/ska-low-csp-assignresources-7.4.rst new file mode 100644 index 0000000000000000000000000000000000000000..4045332c8179966a220a6748794e10e1f5d37d23 --- /dev/null +++ b/docs/src/schemas/csp/low/assignresources/ska-low-csp-assignresources-7.4.rst @@ -0,0 +1,15 @@ +CSP assignresources 7.4 +======================= + +JSON schema and example for CSP Low assignresources + +.. ska-schema:: https://schema.skao.int/ska-low-csp-assignresources/7.4 + :auto_reference: + :auto_target: + :lift_description: + :lift_definitions: + :lift_title: + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-assignresources/7.4 + + Example JSON (LOW CSP assignresources v. 7.4) diff --git a/docs/src/schemas/csp/low/configure/index.rst b/docs/src/schemas/csp/low/configure/index.rst index a8b511e9ed5ff417e28d089132af29cd80307a70..0e2b247ffa676ebf5ad66ad0a86c31737d7f7d1a 100644 --- a/docs/src/schemas/csp/low/configure/index.rst +++ b/docs/src/schemas/csp/low/configure/index.rst @@ -9,6 +9,7 @@ Examples for the different versions of the configure schema :maxdepth: 1 :caption: LOW CSP configure examples + ska-low-csp-configure-7.4 ska-low-csp-configure-7.3 ska-low-csp-configure-7.2 ska-low-csp-configure-7.1 diff --git a/docs/src/schemas/csp/low/configure/ska-low-csp-configure-7.4.rst b/docs/src/schemas/csp/low/configure/ska-low-csp-configure-7.4.rst new file mode 100644 index 0000000000000000000000000000000000000000..c5b27181ac79fd3d66afb53954fc17849a86cbec --- /dev/null +++ b/docs/src/schemas/csp/low/configure/ska-low-csp-configure-7.4.rst @@ -0,0 +1,40 @@ +CSP configure 7.4 +================= + +JSON schema and example for CSP Low configure + +.. ska-schema:: https://schema.skao.int/ska-low-csp-configure/7.4 + :auto_reference: + :auto_target: + :lift_description: + :lift_definitions: + :lift_title: + + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-configure/7.4 + + Example (TMC input for CBF 0.4 science_a visibility scan) + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-configure/7.4 pss + + Example (CSP configuration for CBF 0.4, PSS 1.4 using pulsar search scan) + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-configure/7.4 pss_pst_scan_vr + + Example (CSP configuration for CBF 0.4, PSS 1.4 using pulsar search scan, PST 3.0 using voltage recording scan) + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-configure/7.4 pst_scan_pt + + Example (CSP configuration for CBF 0.4, PST 3.0 using pulsar timing scan) + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-configure/7.4 pst_scan_ft + + Example (CSP configuration for CBF 0.4, PST 3.0 using flow through scan) + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-configure/7.4 pst_scan_vr + + Example (CSP configuration for CBF 0.4, PST 3.0 using voltage recording scan) + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-configure/7.4 pst_scan_df + + Example (CSP configuration for CBF 0.4, PST 3.0 using detect filterbank scan) \ No newline at end of file diff --git a/docs/src/schemas/csp/low/releaseresources/index.rst b/docs/src/schemas/csp/low/releaseresources/index.rst index 0e415ae93cc7b947013fd243c9c09fda06dc4999..3c2a8685901782d9dad14eec0486eab922568fce 100644 --- a/docs/src/schemas/csp/low/releaseresources/index.rst +++ b/docs/src/schemas/csp/low/releaseresources/index.rst @@ -9,6 +9,7 @@ Examples for the different versions of the releaseresources schema :maxdepth: 1 :caption: LOW CSP releaseresources examples + ska-low-csp-releaseresources-7.4 ska-low-csp-releaseresources-7.3 ska-low-csp-releaseresources-7.2 ska-low-csp-releaseresources-7.1 diff --git a/docs/src/schemas/csp/low/releaseresources/ska-low-csp-releaseresources-7.4.rst b/docs/src/schemas/csp/low/releaseresources/ska-low-csp-releaseresources-7.4.rst new file mode 100644 index 0000000000000000000000000000000000000000..18d8b744b51337e7233c764c07fb15cd916aec1c --- /dev/null +++ b/docs/src/schemas/csp/low/releaseresources/ska-low-csp-releaseresources-7.4.rst @@ -0,0 +1,15 @@ +CSP releaseresources 7.4 +======================== + +JSON schema and example for CSP Low releaseresources + +.. ska-schema:: https://schema.skao.int/ska-low-csp-releaseresources/7.4 + :auto_reference: + :auto_target: + :lift_description: + :lift_definitions: + :lift_title: + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-releaseresources/7.4 + + Example JSON (LOW CSP releaseresources JSON v. 7.4) diff --git a/docs/src/schemas/csp/low/scan/index.rst b/docs/src/schemas/csp/low/scan/index.rst index f4ccb3bd7d750ecad94331dded4f2d98754bf1dc..da90c85fb56384765c7e331cbef04e7d358a08da 100644 --- a/docs/src/schemas/csp/low/scan/index.rst +++ b/docs/src/schemas/csp/low/scan/index.rst @@ -9,6 +9,8 @@ Examples for the different versions of the scan schema :maxdepth: 1 :caption: LOW CSP scan examples + ska-low-csp-scan-7.4 + ska-low-csp-scan-7.3 ska-low-csp-scan-7.2 ska-low-csp-scan-7.1 ska-low-csp-scan-7.0 diff --git a/docs/src/schemas/csp/low/scan/ska-low-csp-scan-7.3.rst b/docs/src/schemas/csp/low/scan/ska-low-csp-scan-7.3.rst new file mode 100644 index 0000000000000000000000000000000000000000..14b4b86b522e1fa5e39c316587df9b28601de064 --- /dev/null +++ b/docs/src/schemas/csp/low/scan/ska-low-csp-scan-7.3.rst @@ -0,0 +1,15 @@ +CSP scan 7.3 +============ + +JSON schema and example for CSP Low scan + +.. ska-schema:: https://schema.skao.int/ska-low-csp-scan/7.3 + :auto_reference: + :auto_target: + :lift_description: + :lift_definitions: + :lift_title: + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-scan/7.3 + + Example JSON (LOW CSP scan JSON v. 7.3) diff --git a/docs/src/schemas/csp/low/scan/ska-low-csp-scan-7.4.rst b/docs/src/schemas/csp/low/scan/ska-low-csp-scan-7.4.rst new file mode 100644 index 0000000000000000000000000000000000000000..10000a824cec319322337d5c479806ffcf181efb --- /dev/null +++ b/docs/src/schemas/csp/low/scan/ska-low-csp-scan-7.4.rst @@ -0,0 +1,15 @@ +CSP scan 7.4 +============ + +JSON schema and example for CSP Low scan + +.. ska-schema:: https://schema.skao.int/ska-low-csp-scan/7.4 + :auto_reference: + :auto_target: + :lift_description: + :lift_definitions: + :lift_title: + + .. ska-schema-example:: https://schema.skao.int/ska-low-csp-scan/7.4 + + Example JSON (LOW CSP scan JSON v. 7.4) diff --git a/docs/src/schemas/csp/mid/configurescan/index.rst b/docs/src/schemas/csp/mid/configurescan/index.rst index b6d4846a71427695a01dbea7ac7bc1ab52f0509d..5a1dd50b5e3862387e5bfecaba465c712a7639c6 100644 --- a/docs/src/schemas/csp/mid/configurescan/index.rst +++ b/docs/src/schemas/csp/mid/configurescan/index.rst @@ -10,6 +10,7 @@ Examples for the different versions of the configurescan schema :maxdepth: 1 :caption: MID CSP configurescan examples + ska-csp-configure-8.4 ska-csp-configure-8.3 ska-csp-configure-8.2 ska-csp-configure-8.1 diff --git a/docs/src/schemas/csp/mid/configurescan/ska-csp-configure-8.4.rst b/docs/src/schemas/csp/mid/configurescan/ska-csp-configure-8.4.rst new file mode 100644 index 0000000000000000000000000000000000000000..500d9845438f4eabed2a41227efe1af32673bde1 --- /dev/null +++ b/docs/src/schemas/csp/mid/configurescan/ska-csp-configure-8.4.rst @@ -0,0 +1,44 @@ + +CSP configurescan 8.4 +====================== + +JSON schema and example for CSP Mid configure + +.. ska-schema:: https://schema.skao.int/ska-csp-configurescan/8.4 + :auto_reference: + :auto_target: + :lift_description: + :lift_definitions: + :lift_title: + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 + + Example (TMC input for science_a visibility scan) + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 science_a + + Example (CSP configuration for CBF 8.4 using science_a visibility scan) + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 cal_a + + Example (CSP configuration for CBF 8.4 using cal_a visibility scan) + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 pss + + Example (CSP configuration for CBF 8.4 using PSS scan 1.4) + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 pst_scan_pt + + Example (CSP configuration for CBF 8.4 and PST 3.0 pulsar timing scan) + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 pst_scan_ft + + Example (CSP configuration for CBF 8.4 and PST 3.0 flow through scan) + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 pst_scan_vr + + Example (CSP configuration for CBF 8.4 and PST 3.0 voltage recording scan) + + .. ska-schema-example:: https://schema.skao.int/ska-csp-configurescan/8.4 pst_scan_df + + Example (CSP configuration for CBF 8.4 and PST 3.0 using detect filterbank scan) diff --git a/docs/src/schemas/pst/ska-pst-configure-3.1.rst b/docs/src/schemas/pst/ska-pst-configure-3.1.rst new file mode 100644 index 0000000000000000000000000000000000000000..89d1f80935ca080440b040349fc5d923a94978a2 --- /dev/null +++ b/docs/src/schemas/pst/ska-pst-configure-3.1.rst @@ -0,0 +1,40 @@ +JSON schema and example for Configure version 3.1 +================================================= +.. ska-schema:: https://schema.skao.int/ska-pst-configure/3.1 + :auto_reference: + :auto_target: + :lift_description: + :lift_definitions: + :lift_title: + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 low_pst_scan_ft + + Example (LOW PST configuration for FLOW THROUGH scan 3.1) + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 low_pst_scan_pt + + Example (LOW PST configuration for PULSAR TIMING scan 3.1) + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 low_pst_scan_df + + Example (LOW PST configuration for DETECTED FILTERBANK scan 3.1) + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 low_pst_scan_vr + + Example (LOW PST configuration for VOLTAGE RECORDER scan 3.1) + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 mid_pst_scan_ft + + Example (MID PST configuration for FLOW THROUGH scan 3.1) + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 mid_pst_scan_pt + + Example (MID PST configuration for PULSAR TIMING scan 3.1) + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 mid_pst_scan_df + + Example (MID PST configuration for DETECTED FILTERBANK scan 3.1) + + .. ska-schema-example:: https://schema.skao.int/ska-pst-configure/3.1 mid_pst_scan_vr + + Example (MID PST configuration for VOLTAGE RECORDER scan 3.1) diff --git a/docs/src/schemas/pst/ska-pst-configure.rst b/docs/src/schemas/pst/ska-pst-configure.rst index 39f8b6e975887b15f537507ae26a49e89e169488..75c3ab2b755fddf3d269d6bf357316ca9641cce2 100644 --- a/docs/src/schemas/pst/ska-pst-configure.rst +++ b/docs/src/schemas/pst/ska-pst-configure.rst @@ -6,6 +6,7 @@ Examples for the different versions of the configure schema :maxdepth: 1 :caption: PST configure examples + ska-pst-configure-3.1 ska-pst-configure-3.0 ska-pst-configure-2.5 ska-pst-configure-2.4 diff --git a/src/ska_telmodel/csp/examples.py b/src/ska_telmodel/csp/examples.py index 2b3db6fddd51585993258d6bfcf4c0a7ee640894..d04b1ac8453e814f8d32ca997a9e27f926cad131 100644 --- a/src/ska_telmodel/csp/examples.py +++ b/src/ska_telmodel/csp/examples.py @@ -1108,6 +1108,13 @@ def get_csp_config_scan_8_3_example(version: str, scan: str = None) -> dict: return csp_config_8_3 +def get_csp_config_scan_8_4_example(version: str, scan: str = None) -> dict: + csp_config_8_3 = get_csp_config_scan_8_3_example(version, scan) + csp_config_8_3["interface"] = version + + return csp_config_8_3 + + def delete_config_pst_keys(json_example): """Remove PST schema attributes that are not needed in the csp schema.""" @@ -1199,6 +1206,8 @@ def get_csp_config_example(version: str, scan: str = None) -> dict: example = get_csp_config_scan_8_2_example(version, scan) elif version_number == "8.3": example = get_csp_config_scan_8_3_example(version, scan) + elif version_number == "8.4": + example = get_csp_config_scan_8_4_example(version, scan) else: raise ValueError(f"Could not generate example for schema {version}!") diff --git a/src/ska_telmodel/csp/low_examples.py b/src/ska_telmodel/csp/low_examples.py index 655258b412e95dca9cb0c29c62c3e1b046a3250c..674286ba9b09ffd8d83442b8c823e43552ec4342 100644 --- a/src/ska_telmodel/csp/low_examples.py +++ b/src/ska_telmodel/csp/low_examples.py @@ -338,6 +338,9 @@ def get_low_csp_assignresources_example(version: str): elif version.startswith(lowcsp_assignresources_uri(7, 3)): example = update_interface(LOW_CSP_ASSIGNRESOURCES_6_0, "7.3") return copy.deepcopy(example) + elif version.startswith(lowcsp_assignresources_uri(7, 4)): + example = update_interface(LOW_CSP_ASSIGNRESOURCES_6_0, "7.4") + return copy.deepcopy(example) raise ValueError(f"Could not generate example for schema {version})!") @@ -387,6 +390,9 @@ def get_low_csp_configure_example(version: str, scan_type=None): elif version.startswith(lowcsp_configure_uri(7, 3)): example = copy.deepcopy(LOW_CSP_CONFIGURE_5_0) csp_base_example = update_interface(example, "7.3") + elif version.startswith(lowcsp_configure_uri(7, 4)): + example = copy.deepcopy(LOW_CSP_CONFIGURE_5_0) + csp_base_example = update_interface(example, "7.4") else: raise ValueError(f"Could not generate example for schema {version})!") @@ -559,6 +565,9 @@ def get_low_csp_releaseresources_example(version: str): elif version.startswith(lowcsp_releaseresources_uri(7, 3)): example = update_interface(LOW_CSP_RELEASERESOURCES_6_0, "7.3") return copy.deepcopy(example) + elif version.startswith(lowcsp_releaseresources_uri(7, 4)): + example = update_interface(LOW_CSP_RELEASERESOURCES_6_0, "7.4") + return copy.deepcopy(example) raise ValueError(f"Could not generate example for schema {version})!") @@ -596,4 +605,7 @@ def get_low_csp_scan_example(version: str): elif version.startswith(lowcsp_scan_uri(7, 3)): example = update_interface(LOW_CSP_SCAN_4_0, "7.3") return copy.deepcopy(example) + elif version.startswith(lowcsp_scan_uri(7, 4)): + example = update_interface(LOW_CSP_SCAN_4_0, "7.4") + return copy.deepcopy(example) raise ValueError(f"Could not generate example for schema {version})!") diff --git a/src/ska_telmodel/csp/low_version.py b/src/ska_telmodel/csp/low_version.py index 6746c4333ccec1b816e66cfdd285dc03dceb84a4..3576fca4dc0f276c0b7257f8ebdf396b99c499c1 100644 --- a/src/ska_telmodel/csp/low_version.py +++ b/src/ska_telmodel/csp/low_version.py @@ -38,6 +38,7 @@ CompatibilityMap = { "7.1": {"lowcbf": "0.4", "pss": "1.2", "pst": "3.0"}, "7.2": {"lowcbf": "0.4", "pss": "1.3", "pst": "3.0"}, "7.3": {"lowcbf": "0.4", "pss": "1.4", "pst": "3.0"}, + "7.4": {"lowcbf": "0.4", "pss": "1.4", "pst": "3.1"}, } # note: v4.0 is not used by CBF device yet _ALLOWED_LOW_URI_PREFIXES = [ diff --git a/src/ska_telmodel/csp/version.py b/src/ska_telmodel/csp/version.py index e1d8af0957baa90522537c470c941d267c4eb73d..bd398c0ca86c6182257b1a3a5760dbfe61f99274 100644 --- a/src/ska_telmodel/csp/version.py +++ b/src/ska_telmodel/csp/version.py @@ -57,6 +57,7 @@ CSP_CONFIG_VER8_0 = CSP_CONFIGSCAN_PREFIX + "8.0" CSP_CONFIG_VER8_1 = CSP_CONFIGSCAN_PREFIX + "8.1" CSP_CONFIG_VER8_2 = CSP_CONFIGSCAN_PREFIX + "8.2" CSP_CONFIG_VER8_3 = CSP_CONFIGSCAN_PREFIX + "8.3" +CSP_CONFIG_VER8_4 = CSP_CONFIGSCAN_PREFIX + "8.4" # CSP configuration versions, chronologically sorted CSP_CONFIG_VERSIONS = sorted( @@ -82,6 +83,7 @@ CSP_CONFIG_VERSIONS = sorted( CSP_CONFIG_VER8_1, CSP_CONFIG_VER8_2, CSP_CONFIG_VER8_3, + CSP_CONFIG_VER8_4, ], key=split_interface_version, ) @@ -273,4 +275,9 @@ ConfigCompatibilityMap = { "pss": "1.4", "pst": "3.0", }, # PSS not supported by CBF + "8.4": { + "midcbf": "8.3", + "pss": "1.4", + "pst": "3.1", + }, # PSS not supported by CBF } diff --git a/src/ska_telmodel/pst/examples.py b/src/ska_telmodel/pst/examples.py index ec9f211c8f8ccfb027ace48143fe240478f1f5fa..5d9fb78c24ef49592a6dff9922557f014dab5bff 100644 --- a/src/ska_telmodel/pst/examples.py +++ b/src/ska_telmodel/pst/examples.py @@ -1,11 +1,12 @@ import copy -from typing import Any, Callable, Dict +from typing import Any, Callable from .._common import split_interface_version from .version import ( PST_CONFIG_VER2_4, PST_CONFIG_VER2_5, PST_CONFIG_VER3_0, + PST_CONFIG_VER3_1, check_interface_version, ) @@ -156,6 +157,13 @@ MID_PST_CONFIGURE_SCAN_COMMON = { ], } +VERSION_PST_INTERFACE: dict[tuple[int, int], str] = { + (2, 4): PST_CONFIG_VER2_4, + (2, 5): PST_CONFIG_VER2_5, + (3, 0): PST_CONFIG_VER3_0, + (3, 1): PST_CONFIG_VER3_1, +} + def _get_base_example( version: str, pst_processing_mode: str, frequency_band: str @@ -168,12 +176,9 @@ def _get_base_example( example["common"]["config_id"] += f"-{config_id_suffix}" example["common"]["frequency_band"] = frequency_band - if (major, minor) == (2, 4): - example["interface"] = PST_CONFIG_VER2_4 - elif (major, minor) == (2, 5): - example["interface"] = PST_CONFIG_VER2_5 - else: - example["interface"] = PST_CONFIG_VER3_0 + example["interface"] = VERSION_PST_INTERFACE.get( + (major, minor), PST_CONFIG_VER3_1 + ) return example @@ -205,6 +210,30 @@ def _get_scan_common_example( }, } + if (major, minor) >= (3, 1): + example["destinations"] = { + "dashboards": [ + { + "data_type": "pst_bandpass", + "host": "10.0.0.2", + "port": "9092", + "topic": "pst-bandpass-pb-mvp01-20251105-00001", + }, + { + "data_type": "pst_timeseries", + "host": "10.0.0.2", + "port": "9092", + "topic": "pst-timeseries-pb-mvp01-20251105-00001", + }, + { + # this example shows using the default port number + "data_type": "pst_histogram", + "host": "10.0.0.2", + "topic": "pst-histogram-pb-mvp01-20251105-00001", + }, + ] + } + # remove deprecated fields del example["observation_mode"] del example["activation_time"] @@ -340,7 +369,7 @@ def _get_df_example( return example -SCAN_TYPE_MAP: Dict[str, Callable[..., dict]] = { +SCAN_TYPE_MAP: dict[str, Callable[..., dict]] = { "pst_scan_vr": _get_vr_example, "pst_scan_pt": _get_pt_example, "pst_scan_ft": _get_ft_example, diff --git a/src/ska_telmodel/pst/schema.py b/src/ska_telmodel/pst/schema.py index 42fc848afaa052a7b0dbcc43e88ef57795e0beb8..e8d8770f413c6d48cdeae8b9a608dd4282894259 100644 --- a/src/ska_telmodel/pst/schema.py +++ b/src/ska_telmodel/pst/schema.py @@ -1286,6 +1286,7 @@ def _get_pst_scan_config_schema( elems.add_opt_field("pt", _get_pst_pt_mode_schema(version, strict)) elems.add_opt_field("df", _get_pst_df_mode_schema(version, strict)) elems.add_opt_field("ft", _get_pst_ft_mode_schema(version, strict)) + elems.add_opt_field("destinations", _get_pst_destinations(version, strict)) return elems @@ -2007,6 +2008,8 @@ def _get_pst_requantisation_schema(version: str, strict: bool) -> TMSchema: default=1.0, ) + return elems + def _get_pst_ft_mode_schema(version: str, strict: bool) -> TMSchema: """ @@ -2113,3 +2116,132 @@ def _get_pst_equatorial_coordinates(version: str, strict: bool) -> TMSchema: ) return elems + + +def _get_pst_destinations(version: str, strict: bool) -> TMSchema: + """ + Returns the schema for destination configuration for PST scans. + + This schema is designed to be extensible and all the fields are + optional. PST will treat the absence of a destination configuration + as that not send any data other than by the Data Lifecycle Management + (DLM) process does. + + The sort of destinations to be added here are: + + * SDP dashboard Kafka destinations + * SDP pipeline destinations + + :param version: Interface version + :param strict: Schema strictness + :return: The JSON schema for destination configuration for PST scans.. + """ + elems = TMSchema.new( + "PST destinations configuration", + version, + strict, + description=cleandoc( + """ + This is the configuration of destinations that PST can send + data to. This is designed to be extensible and all fields + are optional. + """, + ), + as_reference=True, + ) + elems.add_opt_field( + "dashboards", + [_get_pst_data_dashboard_config(version, strict)], + description=cleandoc( + """ + An optional list of PST data dashboard configurations. + + If field is not set or the list is empty, then PST will + not attempt to send any messages the data dashboards. + """ + ), + ) + + return elems + + +def _get_pst_data_dashboard_config(version: str, strict: bool) -> TMSchema: + """ + Returns the schema for configuration for a PST data dashboard. + + The schema defines the following fields: + + * data_type - the type of data, and data dashboard, the config is for. + * host - the Kafka hostname or IP address to send messages to. + * port - the Kafka port number to send messages to. + * topic - the Kafka topic to send messages to. + + :param version: Interface version + :param strict: Schema strictness + :return: The JSON Schema for the PST statistic dashboard destination. + """ + elems = TMSchema.new( + "PST dashboard destination configuration", + version, + strict, + description=cleandoc( + "Configuration for a PST data dashboard destination.", + ), + as_reference=True, + ) + + elems.add_field( + "data_type", + str, + description=cleandoc( + """ + The data type of the dashboard the configuration is for. + + This field should map with an agreed data type between the + SDP dashboards and PST. PST will ignore data types that + it does not know about rather that raising a semantic validation + error. + """ + ), + ) + elems.add_field( + "host", + str, + description=cleandoc( + """ + The Kafka destination host address for the PST dashboard data. + + This should either be the fully-qualified domain name or an IP + address that the PST beam deployment can reach. + + PST will log a warning if it is unable to connect to the Kafka + server and will not raise a semantic validation error. + """ + ), + ) + elems.add_opt_field( + "port", + str, + description=cleandoc( + """ + The Kafka destination port number for the PST dashboard data. + + This field is optional and if not supplied PST will use the + default Kafka port of 9092. + + This is the port address of the Kafka instance that PST will + send dashboard messages to. + + PST will log a warning if it is unable to connect to the Kafka + server and will not raise a semantic validation error. + """ + ), + default="9092", + ) + elems.add_field( + "topic", + str, + description="The Kafka topic to send the dashboard message to.", + ) + + return elems diff --git a/src/ska_telmodel/pst/version.py b/src/ska_telmodel/pst/version.py index 032cbb5a4450f09cb743394cf447f36c4755b623..b9d0995015743c6f823be124214d74697058d2ee 100644 --- a/src/ska_telmodel/pst/version.py +++ b/src/ska_telmodel/pst/version.py @@ -1,5 +1,4 @@ from functools import partial -from typing import List, Union from .._common import interface_uri, split_interface_version @@ -9,9 +8,15 @@ PST_CONFIG_VER0 = PST_CONFIGURE_PREFIX + "0" PST_CONFIG_VER2_4 = PST_CONFIGURE_PREFIX + "2.4" PST_CONFIG_VER2_5 = PST_CONFIGURE_PREFIX + "2.5" PST_CONFIG_VER3_0 = PST_CONFIGURE_PREFIX + "3.0" +PST_CONFIG_VER3_1 = PST_CONFIGURE_PREFIX + "3.1" PST_CONFIG_VERSIONS = sorted( - [PST_CONFIG_VER2_4, PST_CONFIG_VER2_5, PST_CONFIG_VER3_0], + [ + PST_CONFIG_VER2_4, + PST_CONFIG_VER2_5, + PST_CONFIG_VER3_0, + PST_CONFIG_VER3_1, + ], key=split_interface_version, ) @@ -25,7 +30,7 @@ pst_configure_uri = partial(interface_uri, PST_CONFIGURE_PREFIX) def check_interface_version( version: str, - allowed_prefixes: Union[str, List[str]] = _ALLOWED_URI_PREFIXES, + allowed_prefixes: str | list[str] = _ALLOWED_URI_PREFIXES, ) -> str: """ Check PST interface version. diff --git a/tests/test_csp_low_schemas.py b/tests/test_csp_low_schemas.py index 8f9352cef248fa97bdcf94241cd606566195dca4..c11816ecb6543d8230739338a0dd1a831910d190 100644 --- a/tests/test_csp_low_schemas.py +++ b/tests/test_csp_low_schemas.py @@ -33,6 +33,7 @@ from tests.test_csp_schemas import ( "7.1", "7.2", "7.3", + "7.4", ], ) def test_low_csp_assignresources(uri_version): @@ -98,6 +99,7 @@ def test_low_csp_assignresources_invalid(): "7.1", "7.2", "7.3", + "7.4", ], ) def test_low_csp_releaseresources(uri_version): @@ -136,7 +138,9 @@ def test_low_csp_releaseresources(uri_version): @pytest.mark.parametrize( "prefix", [LOWCSP_RELEASERESOURCES_PREFIX, LOWCSP_ASSIGNRESOURCES_PREFIX] ) -@pytest.mark.parametrize("csp_ver", ["5.0", "6.0", "7.0", "7.1", "7.2", "7.3"]) +@pytest.mark.parametrize( + "csp_ver", ["5.0", "6.0", "7.0", "7.1", "7.2", "7.3", "7.4"] +) @pytest.mark.parametrize( "csp_field", [ @@ -176,7 +180,8 @@ def test_low_csp_releaseresources_invalid(): @pytest.mark.parametrize( - "csp_ver", ["3.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3"] + "csp_ver", + ["3.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3", "7.4"], ) def test_low_csp_pst_scan_pulsar_timing_schema(csp_ver): """ @@ -190,7 +195,9 @@ def test_low_csp_pst_scan_pulsar_timing_schema(csp_ver): validate(uri_low_csp, csp_config_pst_pt, 2) -@pytest.mark.parametrize("csp_ver", ["5.0", "6.0", "7.0", "7.1", "7.2", "7.3"]) +@pytest.mark.parametrize( + "csp_ver", ["5.0", "6.0", "7.0", "7.1", "7.2", "7.3", "7.4"] +) def test_low_csp_configure_with_scan_detected_filter(csp_ver): """ Test DETECT FILTER BANK configuration for (CSP => 5.0, PST => 3.0) @@ -203,7 +210,8 @@ def test_low_csp_configure_with_scan_detected_filter(csp_ver): @pytest.mark.parametrize( - "csp_ver", ["3.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3"] + "csp_ver", + ["3.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3", "7.4"], ) def test_low_csp_pst_scan_flow_through_schema(csp_ver): """ @@ -226,7 +234,8 @@ def test_low_csp_pst_scan_flow_through_schema(csp_ver): @pytest.mark.parametrize( - "csp_ver", ["2.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3"] + "csp_ver", + ["2.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3", "7.4"], ) def test_low_csp_pst_scan_voltage_recorder_schema(csp_ver): """ @@ -252,7 +261,8 @@ def test_low_csp_pst_scan_voltage_recorder_schema(csp_ver): @pytest.mark.parametrize( - "csp_ver", ["3.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3"] + "csp_ver", + ["3.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3", "7.4"], ) def test_low_csp_pst_scan_dynamic_spectrum_schema(csp_ver): """ @@ -299,6 +309,7 @@ def test_low_csp_pst_scan_dynamic_spectrum_schema(csp_ver): "7.1", "7.2", "7.3", + "7.4", ], ) def test_low_csp_scan(uri_version): @@ -350,6 +361,7 @@ def test_low_csp_invalid_scan(): "7.1", "7.2", "7.3", + "7.4", ], ) def test_low_csp_configure(uri_version): @@ -400,7 +412,19 @@ def test_low_csp_invalid_configure(): @pytest.mark.parametrize( "uri_version", - ["3.0", "3.1", "3.2", "4.0", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3"], + [ + "3.0", + "3.1", + "3.2", + "4.0", + "5.0", + "6.0", + "7.0", + "7.1", + "7.2", + "7.3", + "7.4", + ], ) def test_low_csp_configure_beam_id(uri_version): """Consistency check of the beam_ids attribute in CBF and PST examples""" @@ -578,7 +602,7 @@ def test_csp_low_delaymodel_station_beam_delays_key(uri_version, omitted_key): validate(low_delaymodel_uri, csp_low_delaymodel_erroneous, 2) -@pytest.mark.parametrize("csp_ver", ["7.0", "7.1"]) +@pytest.mark.parametrize("csp_ver", ["7.0", "7.1", "7.2", "7.3", "7.4"]) def test_low_csp_pss_pst_scan_voltage_recorder_schema(csp_ver): """ Test FLOW THROUGH configuration for (CSP 3.0, PST 2.4, CBF 0.3/0.4 @@ -599,7 +623,8 @@ def test_low_csp_pss_pst_scan_voltage_recorder_schema(csp_ver): @pytest.mark.parametrize( - "csp_ver", ["2.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3"] + "csp_ver", + ["2.0", "3.1", "3.2", "5.0", "6.0", "7.0", "7.1", "7.2", "7.3", "7.4"], ) def test_low_csp_pss_schema(csp_ver): """ diff --git a/tests/test_pst_schema.py b/tests/test_pst_schema.py index 604e92753cf61f566a7e245a080c26765aaa3431..fadd42ee135b1b278f74e4090ec0d4b4c14ca98c 100644 --- a/tests/test_pst_schema.py +++ b/tests/test_pst_schema.py @@ -1,5 +1,6 @@ import pytest +from ska_telmodel._common import split_interface_version from ska_telmodel.pst.examples import get_pst_config_example from ska_telmodel.pst.version import ( PST_CONFIGURE_PREFIX, @@ -47,12 +48,18 @@ from ska_telmodel.schema import validate ("3.0", "mid_pst_scan_ft", "FLOW_THROUGH"), ("3.0", "mid_pst_scan_df", "DETECTED_FILTERBANK"), ("3.0", "mid_pst_scan_pt", "PULSAR_TIMING"), + ("3.1", "mid_pst_scan_vr", "VOLTAGE_RECORDER"), + ("3.1", "mid_pst_scan_ft", "FLOW_THROUGH"), + ("3.1", "mid_pst_scan_df", "DETECTED_FILTERBANK"), + ("3.1", "mid_pst_scan_pt", "PULSAR_TIMING"), ], ) def test_pst_configure_schema( pst_ver: str, scan_type: str, expected_pst_processing_mode: str ) -> None: uri = PST_CONFIGURE_PREFIX + pst_ver + (major, minor) = split_interface_version(uri) + scan_config = get_pst_config_example(uri, scan_type) assert ( scan_config["interface"] == uri @@ -73,6 +80,11 @@ def test_pst_configure_schema( else: assert scan_config["common"]["frequency_band"] == "low" + if (major, minor) >= (3, 1): + assert "destinations" in scan_config["pst"]["scan"] + else: + assert "destinations" not in scan_config["pst"]["scan"] + @pytest.mark.parametrize("pst_ver", ["1.0"]) def test_pst_schema_validation_with_invalid_version_low(pst_ver: str): @@ -109,7 +121,7 @@ def test_pst_schema_validation_with_invalid_prefix(pst_ver): validate(invalid_uri, pst_config_beam_ft, 2) -@pytest.mark.parametrize("pst_ver", ["2.4", "2.5", "3.0"]) +@pytest.mark.parametrize("pst_ver", ["2.4", "2.5", "3.0", "3.1"]) def test_pst_check_interface_version(pst_ver): """ Test to verify invalid PST version