Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
barroco committed Dec 31, 2024
1 parent 4784186 commit fc2b776
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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()

Expand All @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/suites/astm/netrid/f3411_19.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
<tr>
<td><a href="../../../requirements/astm/f3411/v19.md">NET0250</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/netrid/v19/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
<td><a href="../../../scenarios/astm/netrid/v19/misbehavior.md">ASTM NetRID SP clients misbehavior handling</a><br><a href="../../../scenarios/astm/netrid/v19/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3411/v19.md">NET0260,NearRealTime</a></td>
Expand Down
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/suites/astm/netrid/f3411_22a.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
<tr>
<td><a href="../../../requirements/astm/f3411/v22a.md">NET0250</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/netrid/v22a/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
<td><a href="../../../scenarios/astm/netrid/v22a/misbehavior.md">ASTM NetRID SP clients misbehavior handling</a><br><a href="../../../scenarios/astm/netrid/v22a/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3411/v22a.md">NET0260,NearRealTime</a></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
<tr>
<td><a href="../../requirements/astm/f3411/v22a.md">NET0250</a></td>
<td>Implemented</td>
<td><a href="../../scenarios/astm/netrid/v22a/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
<td><a href="../../scenarios/astm/netrid/v22a/misbehavior.md">ASTM NetRID SP clients misbehavior handling</a><br><a href="../../scenarios/astm/netrid/v22a/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
</tr>
<tr>
<td><a href="../../requirements/astm/f3411/v22a.md">NET0260,NearRealTime</a></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<tr>
<td><a href="../../requirements/astm/f3411/v22a.md">NET0250</a></td>
<td>Implemented</td>
<td><a href="../../scenarios/astm/netrid/v22a/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
<td><a href="../../scenarios/astm/netrid/v22a/misbehavior.md">ASTM NetRID SP clients misbehavior handling</a><br><a href="../../scenarios/astm/netrid/v22a/nominal_behavior.md">ASTM NetRID nominal behavior</a></td>
</tr>
<tr>
<td><a href="../../requirements/astm/f3411/v22a.md">NET0260,NearRealTime</a></td>
Expand Down

0 comments on commit fc2b776

Please sign in to comment.