Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[uss_qualifier] Use FlightIntentsResource in general flight authorization scenario #317

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ v1:
resources:
resource_declarations:
example_flight_check_table: {$ref: 'library/resources.yaml#/example_flight_check_table'}
flight_intents: {$ref: 'library/resources.yaml#/che_general_flight_auth_flights'}

utm_auth: {$ref: 'library/environment.yaml#/utm_auth'}
uss1_flight_planner: {$ref: 'library/environment.yaml#/uss1_flight_planner'}
Expand All @@ -15,6 +16,7 @@ v1:
scenario_type: scenarios.interuss.flight_authorization.GeneralFlightAuthorization
resources:
table: example_flight_check_table
flight_intents: flight_intents
planner: uss1_flight_planner
execution:
stop_fast: true
Expand Down
115 changes: 12 additions & 103 deletions monitoring/uss_qualifier/configurations/dev/library/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ che_invalid_flight_auth_flights:
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json
resource_type: resources.flight_planning.FlightIntentsResource
specification:
planning_time: '0:05:00'
file:
path: file://./test_data/che/flight_intents/invalid_flight_auths.yaml

Expand All @@ -124,20 +123,25 @@ che_conflicting_flights:
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json
resource_type: resources.flight_planning.FlightIntentsResource
specification:
planning_time: '0:05:00'
file:
path: file://./test_data/che/flight_intents/conflicting_flights.yaml
# Note that this hash_sha512 field can be safely deleted if the content changes
hash_sha512: 86b7172de3a6029efdb5c39dff00f96578f81d25b65b4a0a9d731a42a1e260ef632a0891b744b6d1f62fd7bec61cdad3cb8e6b6811a16cbc17ec2dbd081cbbf6
hash_sha512: 381b6a75e66f2f4ead4cc637744a3c6594d0cdcabf80e13acef087acf3d9195a8dfb521b1f997824b5c0f9dd83167263695b99bdb4fd3e604ac6ac513dad54ab

che_invalid_flight_intents:
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json
resource_type: resources.flight_planning.FlightIntentsResource
specification:
planning_time: '0:05:00'
file:
path: test_data.che.flight_intents.invalid_flight_intents

che_general_flight_auth_flights:
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json
resource_type: resources.flight_planning.FlightIntentsResource
specification:
file:
path: file://./test_data/che/flight_intents/general_flight_auth_flights.yaml

# ===== General flight authorization =====

example_flight_check_table:
Expand All @@ -152,112 +156,17 @@ example_flight_check_table:
- REQ_007
description: The first test step defined by the test designer
acceptance_expectation: MustBeAccepted
flight_info:
basic_information:
usage_state: Planned
uas_state: Nominal
area:
- outline_circle:
center:
lng: 7.4774
lat: 46.9749
radius:
value: 100
units: M
altitude_lower:
value: 550
units: M
# TODO: Change to SFC once mock_uss can process that datum
reference: W84
altitude_upper:
value: 650
units: M
# TODO: Change to SFC once mock_uss can process that datum
reference: W84
start_time:
start_of_test: { }
use_timezone: Europe/Berlin
end_time:
offset_from:
starting_from:
next_day:
time_zone: Europe/Zurich
starting_from:
start_of_test: { }
days_of_the_week: [ "Tu", "Th" ]
offset: 12h
additional_information:
new_jurisdiction_x:
operation_rule_set: Rules1
# TODO: Remove once mock_uss is fixed to not require U-space flight auth
uspace_flight_authorisation:
uas_serial_number: 1AF49UL5CC5J6K
operation_category: Open
operation_mode: Vlos
uas_class: C0
identification_technologies:
- ASTMNetRID
connectivity_methods:
- cellular
endurance_minutes: 30
emergency_procedure_url: https://example.interussplatform.org/emergency
operator_id: CHEo5kut30e0mt01-qwe
uas_id: ''
uas_type_certificate: ''
flight_intent: flight1
execution_style: IfAllowed
- flight_check_id: TEST_002
requirement_ids:
- REQ_001
- REQ_003
- REQ_004
description: The second test step defined by the test designer
acceptance_expectation: MustBeAccepted
flight_info:
basic_information:
usage_state: Planned
uas_state: Nominal
area:
- outline_circle:
center:
lng: 7.4774
lat: 46.9749
radius:
value: 100
units: M
altitude_lower:
value: 1424
units: M
reference: W84
altitude_upper:
value: 5000
units: FT
reference: W84
start_time:
next_day:
time_zone: +02:00
starting_from:
offset_from:
starting_from:
start_of_test: { }
offset: 12h
duration: 5m
additional_information:
new_jurisdiction_x:
operation_rule_set: Rules1
# TODO: Remove once mock_uss is fixed to not require U-space flight auth
uspace_flight_authorisation:
uas_serial_number: 1AF49UL5CC5J6K
operation_category: Open
operation_mode: Vlos
uas_class: C0
identification_technologies:
- ASTMNetRID
connectivity_methods:
- cellular
endurance_minutes: 30
emergency_procedure_url: https://example.interussplatform.org/emergency
operator_id: CHEo5kut30e0mt01-qwe
uas_id: ''
uas_type_certificate: ''
flight_intent: flight2
execution_style: IfAllowed

# ===== Geospatial feature comprehension =====

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ def resolve(self) -> Dict[FlightIntentID, FlightInfoTemplate]:
unprocessed_intent.delta.mutation,
)
else:
raise ValueError(f"{intent_id} is invalid")
raise ValueError(
f"{intent_id} flight intent in FlightIntentCollection is invalid; must specify `full` or `delta`"
)

nb_processed += 1
processed_intents[intent_id] = processed_intent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from typing import List

from implicitdict import ImplicitDict
from monitoring.monitorlib.clients.flight_planning.flight_info_template import (
FlightInfoTemplate,
from monitoring.monitorlib.clients.flight_planning.flight_info import ExecutionStyle
from monitoring.uss_qualifier.resources.flight_planning.flight_intent import (
FlightIntentID,
)


Expand Down Expand Up @@ -39,8 +40,11 @@ class FlightCheck(ImplicitDict):
description: str
"""Human-readable test step description to aid in the debugging and traceability."""

flight_info: FlightInfoTemplate
"""Information about the flight, as a user would provide it to the USS."""
flight_intent: FlightIntentID
"""ID of the flight intent, as a user would provide it to the USS, referring to one of the flight intents provided in a separate dictionary relating FlightIntentID to FlightInfoTemplate."""

execution_style: ExecutionStyle
"""The manner in which the USS should be instructed to plan the flight."""

acceptance_expectation: AcceptanceExpectation = AcceptanceExpectation.Irrelevant
"""Expected outcome when authorizing a flight as described."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ This test acts as a user using a USS's flight planning/authorization interface a

[Flight Check Table](../../../resources/interuss/flight_authorization/flight_check_table.py) consisting of a list of Flight Check rows. Each Flight Check row will cause this test to attempt to plan/authorize a flight using the planning/authorization interfaces of each USS under test according to the information in that Flight Check row. This test will then perform checks according to the expected outcomes from those planning/authorization attempts, according to the Flight Check row.

### flight_intents

[FlightIntentsResource](../../../resources/flight_planning/flight_intents_resource.py) defining all flight intents referenced by `table` above.

### planner

[Flight planner](../../../resources/flight_planning/flight_planners.py) providing access to the flight-planning USS under test in this scenario.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from monitoring.monitorlib.temporal import Time
from monitoring.uss_qualifier.common_data_definitions import Severity
from monitoring.uss_qualifier.configurations.configuration import ParticipantID
from monitoring.uss_qualifier.resources.flight_planning import FlightPlannerResource
from monitoring.uss_qualifier.resources.flight_planning import (
FlightPlannerResource,
FlightIntentsResource,
)
from monitoring.uss_qualifier.resources.interuss.flight_authorization.definitions import (
FlightCheckTable,
AcceptanceExpectation,
Expand Down Expand Up @@ -53,12 +56,14 @@ class GeneralFlightAuthorization(TestScenario):
def __init__(
self,
table: FlightCheckTableResource,
flight_intents: FlightIntentsResource,
planner: FlightPlannerResource,
):
super().__init__()
self.table = table.table
self.flight_planner = planner.client
self.participant_id = planner.participant_id
self.flight_intents = flight_intents.get_flight_intents()

def run(self, context: ExecutionContext):
self.begin_test_scenario(context)
Expand All @@ -72,6 +77,7 @@ def run(self, context: ExecutionContext):
def _plan_flights(self):
start_time = Time(arrow.utcnow().datetime)
for row in self.table.rows:
# Collect checks applicable to this row/test step
checks = [
_get_check_by_name(self._current_case.steps[0], name)
for name in (_VALID_API_RESPONSE_NAME, _SUCCESSFUL_CLOSURE_NAME)
Expand Down Expand Up @@ -110,6 +116,7 @@ def _plan_flights(self):
f"conditions_expectation value of {row.conditions_expectation} is not yet supported"
)

# Construct documentation for this test step
# Note that we are duck-typing a List[str] into a List[RequirementID] for applicable_requirements, but this
# should be ok as the requirements are only used as strings from this point.
step_checks = [
Expand All @@ -126,14 +133,16 @@ def _plan_flights(self):
url=self._current_case.steps[0].url,
checks=step_checks,
)

# Officially begin the test step
self.begin_dynamic_test_step(doc)

# Attempt planning action
info = row.flight_info.resolve(start_time)
info = self.flight_intents[row.flight_intent].resolve(start_time)
with self.check(_VALID_API_RESPONSE_NAME, [self.participant_id]) as check:
try:
resp = self.flight_planner.try_plan_flight(
info, ExecutionStyle.IfAllowed
info, row.execution_style
)
except PlanningActivityError as e:
for q in e.queries:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$content_schema: monitoring/uss_qualifier/resources/flight_planning/flight_intent/FlightIntentCollection.json
intents:
flight_1_planned_vol_A:
full:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
$content_schema: monitoring/uss_qualifier/resources/flight_planning/flight_intent/FlightIntentCollection.json
intents:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to reference the $schema here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $schema elements are really just human-readable comments, but makes sense to have them in the intents; added.

flight1:
full:
basic_information:
usage_state: Planned
uas_state: Nominal
area:
- outline_circle:
center:
lng: 7.4774
lat: 46.9749
radius:
value: 100
units: M
altitude_lower:
value: 550
units: M
# TODO: Change to SFC once mock_uss can process that datum
reference: W84
altitude_upper:
value: 650
units: M
# TODO: Change to SFC once mock_uss can process that datum
reference: W84
start_time:
start_of_test: {}
use_timezone: Europe/Berlin
end_time:
offset_from:
starting_from:
next_day:
time_zone: Europe/Zurich
starting_from:
start_of_test: {}
days_of_the_week: ["Tu", "Th"]
offset: 12h
additional_information:
new_jurisdiction_x:
operation_rule_set: Rules1
# TODO: Remove once mock_uss is fixed to not require U-space flight auth
uspace_flight_authorisation:
uas_serial_number: 1AF49UL5CC5J6K
operation_category: Open
operation_mode: Vlos
uas_class: C0
identification_technologies:
- ASTMNetRID
connectivity_methods:
- cellular
endurance_minutes: 30
emergency_procedure_url: https://example.interussplatform.org/emergency
operator_id: CHEo5kut30e0mt01-qwe
uas_id: ''
uas_type_certificate: ''

flight2:
full:
basic_information:
usage_state: Planned
uas_state: Nominal
area:
- outline_circle:
center:
lng: 7.4774
lat: 46.9749
radius:
value: 100
units: M
altitude_lower:
value: 1424
units: M
reference: W84
altitude_upper:
value: 5000
units: FT
reference: W84
start_time:
next_day:
time_zone: +02:00
starting_from:
offset_from:
starting_from:
start_of_test: {}
offset: 12h
duration: 5m
additional_information:
new_jurisdiction_x:
operation_rule_set: Rules1
# TODO: Remove once mock_uss is fixed to not require U-space flight auth
uspace_flight_authorisation:
uas_serial_number: 1AF49UL5CC5J6K
operation_category: Open
operation_mode: Vlos
uas_class: C0
identification_technologies:
- ASTMNetRID
connectivity_methods:
- cellular
endurance_minutes: 30
emergency_procedure_url: https://example.interussplatform.org/emergency
operator_id: CHEo5kut30e0mt01-qwe
uas_id: ''
uas_type_certificate: ''
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$content_schema: monitoring/uss_qualifier/resources/flight_planning/flight_intent/FlightIntentCollection.json
intents:
invalid_flight_auth:
full:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$content_schema: monitoring/uss_qualifier/resources/flight_planning/flight_intent/FlightIntentCollection.json
intents:
valid_flight:
full:
Expand Down
Loading
Loading