From fc2b77643577dd525d3088f30698d4da8948bfbb Mon Sep 17 00:00:00 2001 From: Michael Barroco Date: Tue, 31 Dec 2024 14:31:52 +0100 Subject: [PATCH] format --- .../astm/netrid/common/misbehavior.py | 52 +++++++++++++------ .../scenarios/astm/netrid/v19/misbehavior.md | 2 +- .../suites/astm/netrid/f3411_19.md | 2 +- .../suites/astm/netrid/f3411_22a.md | 2 +- .../suites/uspace/network_identification.md | 2 +- .../suites/uspace/required_services.md | 2 +- 6 files changed, 40 insertions(+), 22 deletions(-) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common/misbehavior.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common/misbehavior.py index 3163d41394..a1e71b199d 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common/misbehavior.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common/misbehavior.py @@ -20,7 +20,10 @@ injection, display_data_evaluator, ) -from monitoring.uss_qualifier.scenarios.astm.netrid.display_data_evaluator import _rect_str, TelemetryMapping +from monitoring.uss_qualifier.scenarios.astm.netrid.display_data_evaluator import ( + _rect_str, + TelemetryMapping, +) from monitoring.uss_qualifier.scenarios.astm.netrid.injected_flight_collection import ( InjectedFlightCollection, ) @@ -81,19 +84,26 @@ def run(self, context: ExecutionContext): self.begin_test_step("Invalid search area") - self._poll_during_flights([ - self._rid_version.max_diagonal_km * 1000 - 100, # valid diagonal required for sps urls discovery - ], self._evaluate_and_test_too_large_area_requests) + self._poll_during_flights( + [ + self._rid_version.max_diagonal_km * 1000 + - 100, # valid diagonal required for sps urls discovery + ], + self._evaluate_and_test_too_large_area_requests, + ) self.end_test_step() self.begin_test_step("Unauthenticated requests") - self._poll_during_flights([ - self._rid_version.max_diagonal_km * 1000 + 500, # too large - self._rid_version.max_diagonal_km * 1000 - 100, # clustered - self._rid_version.max_details_diagonal_km * 1000 - 100, # details - ], self._evaluate_and_test_invalid_requests) + self._poll_during_flights( + [ + self._rid_version.max_diagonal_km * 1000 + 500, # too large + self._rid_version.max_diagonal_km * 1000 - 100, # clustered + self._rid_version.max_details_diagonal_km * 1000 - 100, # details + ], + self._evaluate_and_test_invalid_requests, + ) self.end_test_step() @@ -105,7 +115,11 @@ def _inject_flights(self): self, self._flights_data, self._service_providers ) - def _poll_during_flights(self, diagonals_m: List[float], evaluation_func: Callable[[LatLngRect], Set[str]]): + def _poll_during_flights( + self, + diagonals_m: List[float], + evaluation_func: Callable[[LatLngRect], Set[str]], + ): config = self._evaluation_configuration.configuration virtual_observer = VirtualObserver( injected_flights=InjectedFlightCollection(self._injected_flights), @@ -185,7 +199,9 @@ def _evaluate_and_test_too_large_area_requests( return set(mapping_by_injection_id.keys()) - def _evaluate_too_large_area(self, rect: s2sphere.LatLngRect, injection_id: str, mapping: TelemetryMapping): + def _evaluate_too_large_area( + self, rect: s2sphere.LatLngRect, injection_id: str, mapping: TelemetryMapping + ): participant_id = mapping.injected_flight.uss_participant_id flights_url = mapping.observed_flight.query.flights_url session = self._dss.client @@ -200,9 +216,7 @@ def _evaluate_too_large_area(self, rect: s2sphere.LatLngRect, injection_id: str, ) if diagonal_km > self._rid_version.max_diagonal_km: - with self.check( - "Area too large", [participant_id] - ) as check: + with self.check("Area too large", [participant_id]) as check: # check uss flights query uss_flights_query = rid.uss_flights( @@ -222,15 +236,19 @@ def _evaluate_too_large_area(self, rect: s2sphere.LatLngRect, injection_id: str, details=f"{participant_id} was queried for flights in {_rect_str(rect)} with a diagonal of {diagonal_km} which is larger than the maximum allowed diagonal of {self._rid_version.max_diagonal_km}. The expected error code is 413, but instead code {uss_flights_query.status_code} was received.", ) - if uss_flights_query.flights is not None and len(uss_flights_query.flights) != 0: + if ( + uss_flights_query.flights is not None + and len(uss_flights_query.flights) != 0 + ): check.record_failed( summary="Received Remote ID data while an empty response was expected because the requested area was too large", severity=Severity.High, details=f"{participant_id} was queried for flights in {_rect_str(rect)} with a diagonal of {diagonal_km} which is larger than the maximum allowed diagonal of {self._rid_version.max_diagonal_km}. The Remote ID data shall be empty, instead, the following payload was received: {uss_flights_query.query.response.content}", ) - - def _evaluate_unauthenticated(self, rect: s2sphere.LatLngRect, injection_id: str, mapping: TelemetryMapping): + def _evaluate_unauthenticated( + self, rect: s2sphere.LatLngRect, injection_id: str, mapping: TelemetryMapping + ): participant_id = mapping.injected_flight.uss_participant_id flights_url = mapping.observed_flight.query.flights_url unauthenticated_session = UTMClientSession( diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/misbehavior.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/misbehavior.md index c190f23525..c72dc894bf 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/misbehavior.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/misbehavior.md @@ -45,7 +45,7 @@ This step will attempt to search for flights in a rectangular area with a diagon #### Area too large check -**[astm.f3411.v19.NET0250](../../../../requirements/astm/f3411/v22a.md)** requires that a NetRID Service Provider rejects a request for a very large view area with a diagonal greater than *NetMaxDisplayAreaDiagonal*. If such a large view is requested and a 413 error code is not received or the response contains Remote ID data, then this check will fail. +**[astm.f3411.v19.NET0250](../../../../requirements/astm/f3411/v19.md)** requires that a NetRID Service Provider rejects a request for a very large view area with a diagonal greater than *NetMaxDisplayAreaDiagonal*. If such a large view is requested and a 413 error code is not received or the response contains Remote ID data, then this check will fail. ### Unauthenticated requests test step diff --git a/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md b/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md index 11bcf644ac..a4ea98ca37 100644 --- a/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md +++ b/monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md @@ -249,7 +249,7 @@ NET0250 Implemented - ASTM NetRID nominal behavior + ASTM NetRID SP clients misbehavior handling
ASTM NetRID nominal behavior NET0260,NearRealTime diff --git a/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md b/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md index 654452ad8c..33474c15c4 100644 --- a/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md +++ b/monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md @@ -254,7 +254,7 @@ NET0250 Implemented - ASTM NetRID nominal behavior + ASTM NetRID SP clients misbehavior handling
ASTM NetRID nominal behavior NET0260,NearRealTime diff --git a/monitoring/uss_qualifier/suites/uspace/network_identification.md b/monitoring/uss_qualifier/suites/uspace/network_identification.md index c01bf40411..68babb57ca 100644 --- a/monitoring/uss_qualifier/suites/uspace/network_identification.md +++ b/monitoring/uss_qualifier/suites/uspace/network_identification.md @@ -250,7 +250,7 @@ NET0250 Implemented - ASTM NetRID nominal behavior + ASTM NetRID SP clients misbehavior handling
ASTM NetRID nominal behavior NET0260,NearRealTime diff --git a/monitoring/uss_qualifier/suites/uspace/required_services.md b/monitoring/uss_qualifier/suites/uspace/required_services.md index efcfd7fdfb..64eeddea0e 100644 --- a/monitoring/uss_qualifier/suites/uspace/required_services.md +++ b/monitoring/uss_qualifier/suites/uspace/required_services.md @@ -251,7 +251,7 @@ NET0250 Implemented - ASTM NetRID nominal behavior + ASTM NetRID SP clients misbehavior handling
ASTM NetRID nominal behavior NET0260,NearRealTime