From 58d213e6b0940e45ba589813fe32a25aa5fa4084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Misbach?= Date: Wed, 11 Dec 2024 15:34:35 +0100 Subject: [PATCH] [uss_qualifier/scenarios/netrid/nominal_behavior] Add checks for UA type in SP (NET0260) --- .../netrid/common_dictionary_evaluator.py | 84 +++++++++++++++++++ .../astm/netrid/display_data_evaluator.py | 8 +- .../common_dictionary_evaluator_sp_flight.md | 10 +++ .../common_dictionary_evaluator_sp_flight.md | 10 +++ .../suites/astm/netrid/f3411_19.md | 7 +- .../suites/astm/netrid/f3411_22a.md | 7 +- .../suites/uspace/network_identification.md | 7 +- .../suites/uspace/required_services.md | 7 +- 8 files changed, 134 insertions(+), 6 deletions(-) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py index f4232bcda1..799c66213f 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common_dictionary_evaluator.py @@ -1,3 +1,4 @@ +import datetime import math from typing import List, Optional @@ -47,11 +48,20 @@ def __init__( def evaluate_sp_flight( self, + injected_flight: injection.TestFlight, observed_flight: Flight, participant_id: ParticipantID, + query_timestamp: datetime.datetime, ): """Implements fragment documented in `common_dictionary_evaluator_sp_flight.md`.""" + self._evaluate_ua_type( + injected_flight.get("aircraft_type"), + observed_flight.aircraft_type, + [participant_id], + query_timestamp, + ) + self._evaluate_operational_status( observed_flight.operational_status, [participant_id], @@ -651,3 +661,77 @@ def _evaluate_operational_status( key="skip_reason", message=f"Unsupported version {self._rid_version}: skipping Operational Status evaluation", ) + + def _evaluate_ua_type( + self, + injected_val: Optional[str], + observed_val: Optional[str], + participants: List[ParticipantID], + query_timestamp: datetime.datetime, + ): + with self._test_scenario.check( + "UA type is present and consistent with injected one", + participants, + ) as check: + if observed_val is None: + check.record_failed( + "UA type is missing", + details="USS did not return any UA type", + query_timestamps=[query_timestamp], + ) + elif not observed_val: + check.record_failed( + "UA type is empty", + details="USS returned an empty UA type", + query_timestamps=[query_timestamp], + ) + + equivalent = {injection.UAType.HybridLift, injection.UAType.VTOL} + if injected_val is None: + if observed_val != injection.UAType.NotDeclared: + check.record_failed( + "UA type is inconsistent, expected 'NotDeclared' since no value was injected", + details=f"USS returned the UA type {observed_val}, yet no value was injected, which should have been mapped to 'NotDeclared'.", + query_timestamps=[query_timestamp], + ) + + elif injected_val in equivalent: + if observed_val not in equivalent: + check.record_failed( + "UA type is inconsistent with injected value", + details=f"USS returned the UA type {observed_val}, yet the value {injected_val} was injected, given that {equivalent} are equivalent .", + query_timestamps=[query_timestamp], + ) + + elif injected_val != observed_val: + check.record_failed( + "UA type is inconsistent with injected value", + details=f"USS returned the UA type {observed_val}, yet the value {injected_val} was injected.", + query_timestamps=[query_timestamp], + ) + + with self._test_scenario.check( + "UA type is consistent with Common Data Dictionary", + participants, + ) as check: + try: + injection.UAType(observed_val) + except ValueError: + check.record_failed( + "UA type is invalid", + details=f"USS returned an invalid UA type: {observed_val}.", + query_timestamps=[query_timestamp], + ) + + if ( + self._rid_version == RIDVersion.f3411_19 + and observed_val == injection.UAType.HybridLift + ) or ( + self._rid_version == RIDVersion.f3411_22a + and observed_val == injection.UAType.VTOL + ): + check.record_failed( + "UA type is inconsistent RID version", + details=f"USS returned the UA type {observed_val} which is not supported by the RID version used ({self._rid_version}).", + query_timestamps=[query_timestamp], + ) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py b/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py index 628645ec7a..fda2ffc773 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/display_data_evaluator.py @@ -2,7 +2,7 @@ import math from dataclasses import dataclass -from typing import List, Optional, Dict, Union, Set, Tuple, cast +from typing import List, Optional, Dict, Union, Set, Tuple import arrow import s2sphere @@ -890,6 +890,7 @@ def _evaluate_normal_sp_observation( for mapping in mappings.values(): participant_id = mapping.injected_flight.uss_participant_id + injected_flight = mapping.injected_flight.flight observed_flight = mapping.observed_flight.flight flights_queries = [ q @@ -901,6 +902,7 @@ def _evaluate_normal_sp_observation( f"Found {len(flights_queries)} flights queries (instead of the expected 1) for flight {mapping.observed_flight.id} corresponding to injection ID {mapping.injected_flight.flight.injection_id} for {participant_id}" ) flights_query = flights_queries[0] + query_timestamp = flights_query.query.request.timestamp # Verify that flights queries returned correctly-formatted data errors = schema_validation.validate( @@ -920,7 +922,7 @@ def _evaluate_normal_sp_observation( f"At {e.json_path} in the response: {e.message}" for e in errors ), - query_timestamps=[flights_query.query.request.timestamp], + query_timestamps=[query_timestamp], ) # Check recent positions timings @@ -935,8 +937,10 @@ def _evaluate_normal_sp_observation( # Check flight consistency with common data dictionary self._common_dictionary_evaluator.evaluate_sp_flight( + injected_flight, observed_flight, participant_id, + query_timestamp, ) # Check that required fields are present and match for any observed flights matching injected flights diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/common_dictionary_evaluator_sp_flight.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/common_dictionary_evaluator_sp_flight.md index e1c7da0830..e716dc7462 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/common_dictionary_evaluator_sp_flight.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/common_dictionary_evaluator_sp_flight.md @@ -2,6 +2,16 @@ This fragment is implemented in `common_dictionary_evaluator.py:RIDCommonDictionaryEvaluator.evaluate_sp_flight`. +## ⚠️ UA type is present and consistent with injected one check + +**[astm.f3411.v19.NET0260,Table1,3](../../../../requirements/astm/f3411/v19.md)** requires that relevant Remote ID data, consistent with the common data dictionary, be reported by the Service Provider. +The UA type being a required field, this check will fail if it is missing or if it inconsistent with the injected value. + +## ⚠️ UA type is consistent with Common Data Dictionary check + +**[astm.f3411.v19.NET0260,Table1,3](../../../../requirements/astm/f3411/v19.md)** requires that relevant Remote ID data, consistent with the common data dictionary, be reported by the Service Provider. +This check will fail if the observed UA type has an invalid value. + ## Service Provider altitude check **[astm.f3411.v19.NET0260,Table1,11](../../../../requirements/astm/f3411/v19.md)** requires that relevant Remote ID data, consistent with the common data dictionary, be reported by the Service Provider. Injected flight data had known altitudes, but the altitude reported by the Service Provider did not match those known altitudes. diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/common_dictionary_evaluator_sp_flight.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/common_dictionary_evaluator_sp_flight.md index d4ffe022d9..e2451953b7 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/common_dictionary_evaluator_sp_flight.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/common_dictionary_evaluator_sp_flight.md @@ -2,6 +2,16 @@ This fragment is implemented in `common_dictionary_evaluator.py:RIDCommonDictionaryEvaluator.evaluate_sp_flight`. +## ⚠️ UA type is present and consistent with injected one check + +**[astm.f3411.v22a.NET0260,Table1,2](../../../../requirements/astm/f3411/v22a.md)** requires that relevant Remote ID data, consistent with the common data dictionary, be reported by the Service Provider. +The UA type being a required field, this check will fail if it is missing or if it inconsistent with the injected value. + +## ⚠️ UA type is consistent with Common Data Dictionary check + +**[astm.f3411.v22a.NET0260,Table1,2](../../../../requirements/astm/f3411/v22a.md)** requires that relevant Remote ID data, consistent with the common data dictionary, be reported by the Service Provider. +This check will fail if the observed UA type has an invalid value. + ## Service Provider altitude check **[astm.f3411.v22a.NET0260,Table1,12](../../../../requirements/astm/f3411/v22a.md)** requires that relevant Remote ID data, consistent with the common data dictionary, be reported by the Service Provider. Injected flight data had known altitudes, but the altitude reported by the Service Provider did not match those known altitudes. diff --git a/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md b/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md index 11bcf644ac..2a7626467a 100644 --- a/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md +++ b/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md @@ -21,7 +21,7 @@ Checked in - astm
.f3411
.v19
+ astm
.f3411
.v19
DSS0010 Implemented ASTM NetRID DSS: Token Validation @@ -311,6 +311,11 @@ Implemented ASTM NetRID nominal behavior + + NET0260,Table1,3 + Implemented + ASTM NetRID nominal behavior + NET0260,Table1,5 Implemented diff --git a/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md b/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md index 654452ad8c..510bba04b3 100644 --- a/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md +++ b/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md @@ -21,7 +21,7 @@ Checked in - astm
.f3411
.v22a
+ astm
.f3411
.v22a
DSS0010 Implemented ASTM NetRID DSS: Token Validation @@ -321,6 +321,11 @@ Implemented ASTM NetRID nominal behavior + + NET0260,Table1,2 + Implemented + ASTM NetRID nominal behavior + NET0260,Table1,20 Implemented diff --git a/monitoring/uss_qualifier/suites/uspace/network_identification.md b/monitoring/uss_qualifier/suites/uspace/network_identification.md index c01bf40411..08a156e73b 100644 --- a/monitoring/uss_qualifier/suites/uspace/network_identification.md +++ b/monitoring/uss_qualifier/suites/uspace/network_identification.md @@ -17,7 +17,7 @@ Checked in - astm
.f3411
.v22a
+ astm
.f3411
.v22a
DSS0010 Implemented ASTM NetRID DSS: Token Validation @@ -317,6 +317,11 @@ Implemented ASTM NetRID nominal behavior + + NET0260,Table1,2 + Implemented + ASTM NetRID nominal behavior + NET0260,Table1,20 Implemented diff --git a/monitoring/uss_qualifier/suites/uspace/required_services.md b/monitoring/uss_qualifier/suites/uspace/required_services.md index efcfd7fdfb..1f6d148780 100644 --- a/monitoring/uss_qualifier/suites/uspace/required_services.md +++ b/monitoring/uss_qualifier/suites/uspace/required_services.md @@ -18,7 +18,7 @@ Checked in - astm
.f3411
.v22a
+ astm
.f3411
.v22a
DSS0010 Implemented ASTM NetRID DSS: Token Validation @@ -318,6 +318,11 @@ Implemented ASTM NetRID nominal behavior + + NET0260,Table1,2 + Implemented + ASTM NetRID nominal behavior + NET0260,Table1,20 Implemented