Skip to content

Commit

Permalink
[uss_qualifier] Verify area is clear before nominal planning equal pr…
Browse files Browse the repository at this point in the history
…iority (#593)

Verify area is clear before nominal planning equal priority
  • Loading branch information
BenjaminPelletier authored Mar 25, 2024
1 parent 179d780 commit bc3fb8b
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Clear area validation test step fragment

uss_qualifier verifies with the DSS that there are no operational intents remaining in the area.

## 🛑 DSS responses check

If the DSS fails to reply to a query concerning operational intent references in a given area, or fails to allow the deletion of
an operational intent from its own creator, it is in violation of **[astm.f3548.v21.DSS0005,1](../../../requirements/astm/f3548/v21.md)**
or **[astm.f3548.v21.DSS0005,2](../../../requirements/astm/f3548/v21.md)**, and this check will fail.

## 🛑 Area is clear of op intents check

If operational intents exist in the 4D area(s) that should be clear, then the current state of the test environment is not suitable to conduct tests so this check will fail.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from typing import List

from monitoring.monitorlib.fetch import QueryError
from monitoring.monitorlib.geotemporal import Volume4D
from monitoring.uss_qualifier.resources.astm.f3548.v21.dss import DSSInstance
from monitoring.uss_qualifier.scenarios.scenario import TestScenario
from uas_standards.astm.f3548.v21.api import OperationalIntentReference


def validate_clear_area(
scenario: TestScenario,
dss: DSSInstance,
areas: List[Volume4D],
ignore_self: bool,
) -> List[OperationalIntentReference]:
found_intents = []
for area in areas:
with scenario.check("DSS responses", [dss.participant_id]) as check:
try:
op_intents, query = dss.find_op_intent(area.to_f3548v21())
scenario.record_query(query)
except QueryError as e:
scenario.record_queries(e.queries)
query = e.queries[0]
check.record_failed(
summary="Error querying DSS for operational intents",
details=f"See query; {e}",
query_timestamps=[query.request.timestamp],
)
found_intents.extend(op_intents)

with scenario.check("Area is clear of op intents") as check:
if ignore_self:
uss_qualifier_sub = dss.client.auth_adapter.get_sub()
op_intents = [
oi for oi in op_intents if oi.manager != uss_qualifier_sub
]
if op_intents:
summary = f"{len(op_intents)} operational intent{'s' if len(op_intents) > 1 else ''} found in test area"
details = (
"The following operational intents were observed even though the area was expected to be clear:\n"
+ "\n".join(
f"* {oi.id} managed by {oi.manager}" for oi in op_intents
)
)
check.record_failed(
summary=summary,
details=details,
query_timestamps=[query.request.timestamp],
)

return found_intents
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ CMSA role in order to transition to the `Nonconforming` state in order to create
DSSInstanceResource that provides access to a DSS instance where flight creation/sharing can be verified.


## Prerequisites check test case

### [Verify area is clear test step](../../clear_area_validation.md)

While this scenario assumes that the area used is already clear of any pre-existing flights (using, for instance, PrepareFlightPlanners scenario) in order to avoid a large number of area-clearing operations, the scenario will not proceed correctly if the area was left in a dirty state following a previous scenario that was supposed to leave the area clear. This test step verifies that the area is clear.

## Attempt to plan flight into conflict test case
![Test case summary illustration](assets/attempt_to_plan_flight_into_conflict.svg)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
validate_flight_intent_templates,
ExpectedFlightIntent,
)
from monitoring.uss_qualifier.scenarios.astm.utm.clear_area_validation import (
validate_clear_area,
)
from monitoring.uss_qualifier.suites.suite import ExecutionContext
from uas_standards.astm.f3548.v21.api import (
OperationalIntentReference,
)
from uas_standards.astm.f3548.v21.constants import Scope
from monitoring.monitorlib.geotemporal import Volume4DCollection
from monitoring.monitorlib.geotemporal import Volume4DCollection, Volume4D

from monitoring.uss_qualifier.resources.astm.f3548.v21 import DSSInstanceResource
from monitoring.uss_qualifier.resources.astm.f3548.v21.dss import DSSInstance
Expand Down Expand Up @@ -192,6 +195,17 @@ def run(self, context: ExecutionContext):
f"{self.control_uss.config.participant_id}",
)

self.begin_test_case("Prerequisites check")
self.begin_test_step("Verify area is clear")
validate_clear_area(
self,
self.dss,
[Volume4D.from_f3548v21(self._intents_extent)],
ignore_self=True,
)
self.end_test_step()
self.end_test_case()

self.begin_test_case("Attempt to plan flight into conflict")
_ = self._attempt_plan_flight_conflict()
self.end_test_case()
Expand Down
27 changes: 4 additions & 23 deletions monitoring/uss_qualifier/scenarios/astm/utm/prep_planners.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,9 @@ All USSs are requested to remove all flights from the area under test.

**[interuss.automated_testing.flight_planning.ClearArea](../../../requirements/interuss/automated_testing/flight_planning.md)**

### Clear area validation test step
### [Clear area validation test step](clear_area_validation.md)

uss_qualifier verifies with the DSS that there are no operational intents remaining in the area

#### 🛑 DSS responses check

If the DSS fails to reply to a query concerning operational intent references in a given area, or fails to allow the deletion of
an operational intent from its own creator, it is in violation of **[astm.f3548.v21.DSS0005,1](../../../requirements/astm/f3548/v21.md)**
or **[astm.f3548.v21.DSS0005,2](../../../requirements/astm/f3548/v21.md)**, and this check will fail.

#### 🛑 Area is clear of foreign op intents check

If operational intents from foreign (non-uss_qualifier) users remain in the 4D area(s) following the preceding area clearing, then the current state of the test environment is not suitable to conduct tests so this check will fail.
This step examines whether any operational intents remain. If any foreign (other than uss_qualifier-owned) operational intents remain, then this step's checks will fail. If any uss_qualifier-owned operational intents remain, the checks for this step do not fail but instead we proceed to the next test case. If the area is clear, we skip the next test case.

## uss_qualifier preparation test case

Expand All @@ -84,15 +74,6 @@ In addition to foreign flight planners, uss_qualifier may have left operational

The operational intent references managed by uss_qualifier discovered in the previous test case are removed.

### Clear area validation test step

uss_qualifier verifies with the DSS that there are no operational intents remaining in the area.

#### 🛑 DSS responses check

If the DSS fails to reply to a query concerning operational intent references in a given area, it is in violation of **[astm.f3548.v21.DSS0005,1](../../../requirements/astm/f3548/v21.md)**
or **[astm.f3548.v21.DSS0005,2](../../../requirements/astm/f3548/v21.md)**, and this check will fail.

#### 🛑 Area is clear check
### [Clear area validation test step](clear_area_validation.md)

If any operational intents remain in the 4D area(s) following the preceding area clearing, then the current state of the test environment is not suitable to conduct tests so this check will fail.
After removing the operational intents of all flight planning participants previously, and just having attempted to remove uss_qualifier-owned operational intents, the area should now be fully clear.
53 changes: 9 additions & 44 deletions monitoring/uss_qualifier/scenarios/astm/utm/prep_planners.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
FlightPlannersResource,
FlightIntentsResource,
)
from monitoring.uss_qualifier.scenarios.astm.utm.clear_area_validation import (
validate_clear_area,
)
from monitoring.uss_qualifier.scenarios.astm.utm.dss.test_step_fragments import (
remove_op_intent,
)
Expand Down Expand Up @@ -63,8 +66,11 @@ def run(self, context):
self.end_test_step()

self.begin_test_step("Clear area validation")
remaining_op_intents = self._validate_clear_area(
"Area is clear of foreign op intents", ignore_self=True
remaining_op_intents = validate_clear_area(
self,
self.dss,
self.areas,
ignore_self=True,
)
self.end_test_step()

Expand All @@ -78,54 +84,13 @@ def run(self, context):
self.end_test_step()

self.begin_test_step("Clear area validation")
self._validate_clear_area("Area is clear", ignore_self=False)
validate_clear_area(self, self.dss, self.areas, ignore_self=False)
self.end_test_step()

self.end_test_case()

self.end_test_scenario()

def _validate_clear_area(
self, check_name: str, ignore_self: bool
) -> List[OperationalIntentReference]:
found_intents = []
for area in self.areas:
with self.check("DSS responses", [self.dss.participant_id]) as check:
try:
op_intents, query = self.dss.find_op_intent(area.to_f3548v21())
self.record_query(query)
except QueryError as e:
self.record_queries(e.queries)
query = e.queries[0]
check.record_failed(
summary="Error querying DSS for operational intents",
details=f"See query; {e}",
query_timestamps=[query.request.timestamp],
)
found_intents.extend(op_intents)

with self.check(check_name) as check:
if ignore_self:
uss_qualifier_sub = self.dss.client.auth_adapter.get_sub()
op_intents = [
oi for oi in op_intents if oi.manager != uss_qualifier_sub
]
if op_intents:
summary = f"{len(op_intents)} operational intent{'s' if len(op_intents) > 1 else ''} found in cleared area"
details = (
"The following operational intents were observed even after clearing the area:\n"
+ "\n".join(
f"* {oi.id} managed by {oi.manager}" for oi in op_intents
)
)
check.record_failed(
summary=summary,
details=details,
query_timestamps=[query.request.timestamp],
)

return found_intents

def _remove_my_op_intents(
self, my_op_intents: List[OperationalIntentReference]
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/suites/astm/utm/f3548_21.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<td rowspan="57" style="vertical-align:top;"><a href="../../../requirements/astm/f3548/v21.md">astm<br>.f3548<br>.v21</a></td>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0005,1</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/prep_planners.md">ASTM F3548 flight planners preparation</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/authentication/authentication_validation.md">ASTM SCD DSS: Interfaces authentication</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_key_validation.md">ASTM SCD DSS: Operational Intent Reference Key Validation</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a><br><a href="../../../scenarios/astm/utm/dss/subscription_interactions.md">ASTM SCD DSS: Subscription and entity interaction</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss.md">Off-Nominal planning: down USS</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss_equal_priority_not_permitted.md">Off-Nominal planning: down USS with equal priority conflicts not permitted</a></td>
<td><a href="../../../scenarios/astm/utm/prep_planners.md">ASTM F3548 flight planners preparation</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/authentication/authentication_validation.md">ASTM SCD DSS: Interfaces authentication</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_key_validation.md">ASTM SCD DSS: Operational Intent Reference Key Validation</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a><br><a href="../../../scenarios/astm/utm/dss/subscription_interactions.md">ASTM SCD DSS: Subscription and entity interaction</a><br><a href="../../../scenarios/astm/utm/nominal_planning/conflict_equal_priority_not_permitted/conflict_equal_priority_not_permitted.md">Nominal planning: not permitted conflict with equal priority</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss.md">Off-Nominal planning: down USS</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss_equal_priority_not_permitted.md">Off-Nominal planning: down USS with equal priority conflicts not permitted</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0005,2</a></td>
Expand Down
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/suites/faa/uft/message_signing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<td rowspan="57" style="vertical-align:top;"><a href="../../../requirements/astm/f3548/v21.md">astm<br>.f3548<br>.v21</a></td>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0005,1</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/prep_planners.md">ASTM F3548 flight planners preparation</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/authentication/authentication_validation.md">ASTM SCD DSS: Interfaces authentication</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_key_validation.md">ASTM SCD DSS: Operational Intent Reference Key Validation</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a><br><a href="../../../scenarios/astm/utm/dss/subscription_interactions.md">ASTM SCD DSS: Subscription and entity interaction</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss.md">Off-Nominal planning: down USS</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss_equal_priority_not_permitted.md">Off-Nominal planning: down USS with equal priority conflicts not permitted</a></td>
<td><a href="../../../scenarios/astm/utm/prep_planners.md">ASTM F3548 flight planners preparation</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/authentication/authentication_validation.md">ASTM SCD DSS: Interfaces authentication</a><br><a href="../../../scenarios/astm/utm/dss/op_intent_ref_key_validation.md">ASTM SCD DSS: Operational Intent Reference Key Validation</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md">ASTM SCD DSS: Operational Intent Reference Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a><br><a href="../../../scenarios/astm/utm/dss/subscription_interactions.md">ASTM SCD DSS: Subscription and entity interaction</a><br><a href="../../../scenarios/astm/utm/nominal_planning/conflict_equal_priority_not_permitted/conflict_equal_priority_not_permitted.md">Nominal planning: not permitted conflict with equal priority</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss.md">Off-Nominal planning: down USS</a><br><a href="../../../scenarios/astm/utm/off_nominal_planning/down_uss_equal_priority_not_permitted.md">Off-Nominal planning: down USS with equal priority conflicts not permitted</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0005,2</a></td>
Expand Down
Loading

0 comments on commit bc3fb8b

Please sign in to comment.