Skip to content

Commit

Permalink
[uss_qualifier/scenarios/utm] Refactor op intent validation; Remove o…
Browse files Browse the repository at this point in the history
…p intent ID from injection result
  • Loading branch information
mickmis committed Sep 29, 2023
1 parent ca7c10e commit 6ead69a
Show file tree
Hide file tree
Showing 10 changed files with 726 additions and 521 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class InjectFlightResponse(ImplicitDict):

result: InjectFlightResult
notes: Optional[str]
operational_intent_id: Optional[str]


class DeleteFlightResult(str, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Notably the following requirements:
- **[astm.f3548.v21.OPIN0040](../../../../requirements/astm/f3548/v21.md)**
- **[astm.f3548.v21.GEN0500](../../../../requirements/astm/f3548/v21.md)**


## Resources
### flight_intents
FlightIntentsResource that provides the following flight intents:
Expand All @@ -26,7 +25,6 @@ FlightPlannerResource that will be tested for its validation of operational inte
### dss
DSSInstanceResource that provides access to a DSS instance where flight creation/sharing can be verified.


## Setup test case
### Check for necessary capabilities test step
The USSs is queried for its capabilities to ensure this test can proceed.
Expand All @@ -45,7 +43,6 @@ The tested USS is requested to remove all flights from the area under test.
#### Area cleared successfully check
**[interuss.automated_testing.flight_planning.ClearArea](../../../../requirements/interuss/automated_testing/flight_planning.md)**


## Attempt to plan invalid flight intents test case
### Attempt to plan flight intent too far ahead of time test step
The user flight intent that the test driver attempts to plan has a reference time that is more than
Expand All @@ -63,7 +60,6 @@ to reject or accept the flight. If the USS indicates that the injection attempt

### [Validate flight intent too far ahead of time not planned test step](../validate_not_shared_operational_intent.md)


## Attempt to specify off-nominal volume in Accepted and Activated states test case
### Attempt to plan flight with an off-nominal volume test step
The user flight intent that the test driver attempts to plan has an off-nominal volume.
Expand All @@ -84,6 +80,8 @@ to reject or accept the flight. If the USS indicates that the injection attempt
### [Plan valid flight intent test step](../../../flight_planning/plan_flight_intent.md)
The valid flight intent should be successfully planned by the flight planner.

### [Validate flight sharing test step](../validate_shared_operational_intent.md)

### Attempt to modify planned flight with an off-nominal volume test step
The user flight intent that the test driver attempts to modify has an off-nominal volume and is in the `Accepted` state.
As such, the modification attempt should be rejected.
Expand All @@ -104,6 +102,8 @@ Validate that the planned flight intent was not modified with an off-nominal vol
### [Activate valid flight intent test step](../../../flight_planning/activate_flight_intent.md)
The valid flight intent should be successfully activated by the flight planner.

### [Validate flight sharing test step](../validate_shared_operational_intent.md)

### Attempt to modify activated flight with an off-nominal volume test step
The user flight intent that the test driver attempts to modify has an off-nominal volume and is in the `Activated` state.
As such, the modification attempt should be rejected.
Expand All @@ -123,7 +123,6 @@ Validate that the activated flight intent was not modified with an off-nominal v

### [Delete valid flight intent test step](../../../flight_planning/delete_flight_intent.md)


## Validate transition to Ended state after cancellation test case
### [Plan flight intent test step](../../../flight_planning/plan_flight_intent.md)
The valid flight intent should be successfully planned by the flight planner.
Expand All @@ -135,11 +134,14 @@ Validate that the flight intent was shared correctly and is discoverable.
The flight intent should be successfully transition to Ended state by the flight planner.

### Validate flight intent is non-discoverable test step

#### DSS responses check
**[astm.f3548.v21.DSS0005](../../../../requirements/astm/f3548/v21.md)**

#### Operational intent not shared check
If the operational intent is still discoverable after it was transitioned to Ended,
this check will fail per **[astm.f3548.v21.OPIN0040](../../../../requirements/astm/f3548/v21.md)**.


## Validate precision of intersection computations test case
### [Plan control flight intent test step](../../../flight_planning/plan_flight_intent.md)
The valid control flight intent should be successfully planned by the flight planner.
Expand All @@ -159,7 +161,6 @@ to reject or accept the flight. If the USS indicates that the injection attempt

### [Validate conflicting flight not planned test step](../validate_not_shared_operational_intent.md)


## Cleanup
### Successful flight deletion check
**[interuss.automated_testing.flight_planning.DeleteFlightSuccess](../../../../requirements/interuss/automated_testing/flight_planning.md)**
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from uas_standards.astm.f3548.v21.constants import OiMaxPlanHorizonDays

from monitoring.monitorlib import scd
from monitoring.monitorlib.scd import bounding_vol4
from monitoring.monitorlib.scd_automated_testing.scd_injection_api import (
Capability,
InjectFlightResult,
Expand All @@ -21,8 +22,7 @@
FlightPlannerResource,
)
from monitoring.uss_qualifier.scenarios.astm.utm.test_steps import (
validate_shared_operational_intent,
ValidateNotSharedOperationalIntent,
OpIntentValidator,
)
from monitoring.uss_qualifier.scenarios.scenario import TestScenario
from monitoring.uss_qualifier.scenarios.flight_planning.test_steps import (
Expand Down Expand Up @@ -62,6 +62,13 @@ def __init__(
self.dss = dss.dss

flight_intents = flight_intents.get_flight_intents()

extents = []
for intent in flight_intents.values():
extents.extend(intent.request.operational_intent.volumes)
extents.extend(intent.request.operational_intent.off_nominal_volumes)
self._intents_extent = bounding_vol4(extents)

try:
(
self.valid_flight,
Expand Down Expand Up @@ -200,14 +207,14 @@ def _setup(self) -> bool:
return True

def _attempt_invalid(self):
with ValidateNotSharedOperationalIntent(
with OpIntentValidator(
self,
self.tested_uss,
self.dss,
"Validate flight intent too far ahead of time not planned",
self.invalid_too_far_away.request,
):
resp, _ = submit_flight_intent(
self._intents_extent,
) as validator:
submit_flight_intent(
self,
"Attempt to plan flight intent too far ahead of time",
"Incorrectly planned",
Expand All @@ -216,16 +223,17 @@ def _attempt_invalid(self):
self.tested_uss,
self.invalid_too_far_away.request,
)
validator.expect_not_shared()

def _attempt_invalid_offnominal(self):
with ValidateNotSharedOperationalIntent(
with OpIntentValidator(
self,
self.tested_uss,
self.dss,
"Validate flight intent with an off-nominal volume not planned",
self.invalid_accepted_offnominal.request,
):
resp, _ = submit_flight_intent(
self._intents_extent,
) as validator:
submit_flight_intent(
self,
"Attempt to plan flight with an off-nominal volume",
"Incorrectly planned",
Expand All @@ -234,84 +242,115 @@ def _attempt_invalid_offnominal(self):
self.tested_uss,
self.invalid_accepted_offnominal.request,
)
validator.expect_not_shared()

resp, valid_flight_id = plan_flight_intent(
self, "Plan valid flight intent", self.tested_uss, self.valid_flight.request
)
valid_flight_op_intent_id = resp.operational_intent_id

resp, _ = submit_flight_intent(
with OpIntentValidator(
self,
"Attempt to modify planned flight with an off-nominal volume",
"Incorrectly modified",
{InjectFlightResult.Rejected},
{InjectFlightResult.Failed: "Failure"},
self.tested_uss,
self.invalid_accepted_offnominal.request,
)
validate_shared_operational_intent(
self.dss,
"Validate flight sharing",
self._intents_extent,
) as validator:
_, valid_flight_id = plan_flight_intent(
self,
"Plan valid flight intent",
self.tested_uss,
self.valid_flight.request,
)
valid_flight_op_intent_ref = validator.expect_shared(
self.valid_flight.request
)

with OpIntentValidator(
self,
self.tested_uss,
self.dss,
"Validate planned flight not modified",
self.valid_flight.request,
valid_flight_op_intent_id,
)
self._intents_extent,
valid_flight_op_intent_ref,
) as validator:
submit_flight_intent(
self,
"Attempt to modify planned flight with an off-nominal volume",
"Incorrectly modified",
{InjectFlightResult.Rejected},
{InjectFlightResult.Failed: "Failure"},
self.tested_uss,
self.invalid_accepted_offnominal.request,
)
valid_flight_op_intent_ref = validator.expect_shared(
self.valid_flight.request
)

resp = activate_flight_intent(
with OpIntentValidator(
self,
"Activate valid flight intent",
self.tested_uss,
self.valid_activated.request,
valid_flight_id,
)
valid_flight_op_intent_id = resp.operational_intent_id
self.dss,
"Validate flight sharing",
self._intents_extent,
valid_flight_op_intent_ref,
) as validator:
activate_flight_intent(
self,
"Activate valid flight intent",
self.tested_uss,
self.valid_activated.request,
valid_flight_id,
)
valid_flight_op_intent_ref = validator.expect_shared(
self.valid_activated.request
)

resp, _ = submit_flight_intent(
self,
"Attempt to modify activated flight with an off-nominal volume",
"Incorrectly modified",
{InjectFlightResult.Rejected},
{InjectFlightResult.Failed: "Failure"},
self.tested_uss,
self.invalid_activated_offnominal.request,
)
validate_shared_operational_intent(
with OpIntentValidator(
self,
self.tested_uss,
self.dss,
"Validate activated flight not modified",
self.valid_activated.request,
valid_flight_op_intent_id,
)
self._intents_extent,
valid_flight_op_intent_ref,
) as validator:
submit_flight_intent(
self,
"Attempt to modify activated flight with an off-nominal volume",
"Incorrectly modified",
{InjectFlightResult.Rejected},
{InjectFlightResult.Failed: "Failure"},
self.tested_uss,
self.invalid_activated_offnominal.request,
)
validator.expect_shared(self.valid_flight.request)

_ = delete_flight_intent(
self, "Delete valid flight intent", self.tested_uss, valid_flight_id
)

def _validate_ended_cancellation(self):
with ValidateNotSharedOperationalIntent(
with OpIntentValidator(
self,
self.tested_uss,
self.dss,
"Validate flight intent is non-discoverable",
self.valid_flight.request,
):
resp, flight_id = plan_flight_intent(
self, "Plan flight intent", self.tested_uss, self.valid_flight.request
)
validate_shared_operational_intent(
self._intents_extent,
) as cancelled_validator:
with OpIntentValidator(
self,
self.tested_uss,
self.dss,
"Validate flight intent shared correctly",
self.valid_flight.request,
resp.operational_intent_id,
)
self._intents_extent,
) as planned_validator:
_, flight_id = plan_flight_intent(
self,
"Plan flight intent",
self.tested_uss,
self.valid_flight.request,
)
planned_validator.expect_shared(self.valid_flight.request)

_ = delete_flight_intent(
self, "Cancel flight intent", self.tested_uss, flight_id
)
cancelled_validator.expect_not_shared()

def _validate_precision_intersection(self):
_, _ = plan_flight_intent(
Expand All @@ -321,14 +360,14 @@ def _validate_precision_intersection(self):
self.valid_flight.request,
)

with ValidateNotSharedOperationalIntent(
with OpIntentValidator(
self,
self.tested_uss,
self.dss,
"Validate conflicting flight not planned",
self.valid_conflict_tiny_overlap.request,
):
resp, _ = submit_flight_intent(
self._intents_extent,
) as validator:
submit_flight_intent(
self,
"Attempt to plan flight conflicting by a tiny overlap",
"Incorrectly planned",
Expand All @@ -337,6 +376,7 @@ def _validate_precision_intersection(self):
self.tested_uss,
self.valid_conflict_tiny_overlap.request,
)
validator.expect_not_shared()

def cleanup(self):
self.begin_cleanup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Both USSs are requested to remove all flights from the area under test.
### [Plan flight 2 test step](../../../../flight_planning/plan_flight_intent.md)
Flight 2 on time range B should be successfully planned by the control USS.

### [Validate flight 2 sharing test step](../../validate_shared_operational_intent.md)

### [Activate flight 2 test step](../../../../flight_planning/activate_flight_intent.md)
Flight 2 on time range B should be successfully activated by the control USS.

Expand Down
Loading

0 comments on commit 6ead69a

Please sign in to comment.