diff --git a/monitoring/atproxy/requests.py b/monitoring/atproxy/requests.py index 3b93d0ccb6..155e950e18 100644 --- a/monitoring/atproxy/requests.py +++ b/monitoring/atproxy/requests.py @@ -2,10 +2,8 @@ from monitoring.monitorlib.rid_automated_testing import injection_api from implicitdict import ImplicitDict -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import \ - InjectFlightRequest from uas_standards.interuss.automated_testing.scd.v1.api import ( - ClearAreaRequest, + ClearAreaRequest, InjectFlightRequest, ) diff --git a/monitoring/mock_uss/atproxy_client/daemon.py b/monitoring/mock_uss/atproxy_client/daemon.py index 061711f751..4c6cbf32a8 100644 --- a/monitoring/mock_uss/atproxy_client/daemon.py +++ b/monitoring/mock_uss/atproxy_client/daemon.py @@ -7,6 +7,7 @@ import requests from uas_standards.interuss.automated_testing.scd.v1.api import ( ClearAreaRequest, + InjectFlightRequest, ) from implicitdict import ImplicitDict @@ -32,10 +33,6 @@ delete_flight, clear_area, ) -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - InjectFlightRequest, -) - from monitoring.monitorlib import fetch TASK_POLL_ATPROXY = "poll atproxy" diff --git a/monitoring/mock_uss/scdsc/database.py b/monitoring/mock_uss/scdsc/database.py index 156cdf2dd6..e836dd858b 100644 --- a/monitoring/mock_uss/scdsc/database.py +++ b/monitoring/mock_uss/scdsc/database.py @@ -2,7 +2,7 @@ from typing import Dict, Optional from monitoring.monitorlib.multiprocessing import SynchronizedValue -from monitoring.monitorlib.scd_automated_testing import scd_injection_api +from uas_standards.interuss.automated_testing.scd.v1 import api as scd_injection_api from implicitdict import ImplicitDict from uas_standards.astm.f3548.v21.api import ( OperationalIntentReference, diff --git a/monitoring/mock_uss/scdsc/routes_injection.py b/monitoring/mock_uss/scdsc/routes_injection.py index 7baf26db8f..53058bda70 100644 --- a/monitoring/mock_uss/scdsc/routes_injection.py +++ b/monitoring/mock_uss/scdsc/routes_injection.py @@ -13,6 +13,7 @@ from monitoring.mock_uss.scdsc.routes_scdsc import op_intent_from_flightrecord from monitoring.monitorlib.geo import Polygon from monitoring.monitorlib.geotemporal import Volume4D, Volume4DCollection +from uas_standards.astm.f3548.v21 import api from uas_standards.astm.f3548.v21.api import ( OperationalIntent, PutOperationalIntentDetailsParameters, @@ -28,20 +29,21 @@ from monitoring.monitorlib import scd, versioning from monitoring.monitorlib.clients import scd as scd_client from monitoring.monitorlib.fetch import QueryError -from monitoring.monitorlib.scd import op_intent_transition_valid -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( +from uas_standards.interuss.automated_testing.scd.v1.api import ( InjectFlightRequest, InjectFlightResponse, - SCOPE_SCD_QUALIFIER_INJECT, - InjectFlightResult, + InjectFlightResponseResult, DeleteFlightResponse, - DeleteFlightResult, + DeleteFlightResponseResult, ClearAreaRequest, ClearAreaOutcome, ClearAreaResponse, Capability, CapabilitiesResponse, ) +from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( + SCOPE_SCD_QUALIFIER_INJECT, +) from implicitdict import ImplicitDict, StringBasedDateTime from monitoring.mock_uss import webapp, require_config_value from monitoring.mock_uss.auth import requires_scope @@ -63,7 +65,7 @@ def _make_stacktrace(e) -> str: def query_operational_intents( - area_of_interest: scd.Volume4D, + area_of_interest: api.Volume4D, ) -> List[OperationalIntent]: """Retrieve a complete set of operational intents in an area, including details. @@ -187,7 +189,8 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, if problems: return ( InjectFlightResponse( - result=InjectFlightResult.Rejected, notes=", ".join(problems) + result=InjectFlightResponseResult.Rejected, + notes=", ".join(problems), ), 200, ) @@ -206,14 +209,14 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, if nb_vertices > OiMaxVertices: return ( InjectFlightResponse( - result=InjectFlightResult.Rejected, + result=InjectFlightResponseResult.Rejected, notes=f"Too many vertices across volumes of operational intent (max OiMaxVertices={OiMaxVertices})", ), 200, ) # Validate max planning horizon for creation - start_time = Volume4DCollection.from_f3548v21( + start_time = Volume4DCollection.from_interuss_scd_api( req_body.operational_intent.volumes ).time_start.datetime time_delta = start_time - datetime.now(tz=start_time.tzinfo) @@ -223,7 +226,7 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, ): return ( InjectFlightResponse( - result=InjectFlightResult.Rejected, + result=InjectFlightResponseResult.Rejected, notes=f"Operational intent to plan is too far away in time (max OiMaxPlanHorizonDays={OiMaxPlanHorizonDays})", ), 200, @@ -236,7 +239,7 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, ): return ( InjectFlightResponse( - result=InjectFlightResult.Rejected, + result=InjectFlightResponseResult.Rejected, notes=f"Operational intent specifies an off-nominal volume while being in {req_body.operational_intent.state} state", ), 200, @@ -278,10 +281,10 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, else None ) state_transition_to = OperationalIntentState(req_body.operational_intent.state) - if not op_intent_transition_valid(state_transition_from, state_transition_to): + if not scd.op_intent_transition_valid(state_transition_from, state_transition_to): return ( InjectFlightResponse( - result=InjectFlightResult.Rejected, + result=InjectFlightResponseResult.Rejected, notes=f"Operational intent state transition from {state_transition_from} to {state_transition_to} is invalid", ), 200, @@ -294,7 +297,7 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, logger.debug( f"[inject_flight/{pid}:{flight_id}] Obtaining latest operational intent information" ) - vol4 = Volume4DCollection.from_f3548v21( + vol4 = Volume4DCollection.from_interuss_scd_api( req_body.operational_intent.volumes ).bounding_volume.to_f3548v21() op_intents = query_operational_intents(vol4) @@ -304,7 +307,9 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, logger.debug( f"[inject_flight/{pid}:{flight_id}] Checking for intersections with {', '.join(op_intent.reference.id for op_intent in op_intents)}" ) - v1 = Volume4DCollection.from_f3548v21(req_body.operational_intent.volumes) + v1 = Volume4DCollection.from_interuss_scd_api( + req_body.operational_intent.volumes + ) for op_intent in op_intents: if ( existing_flight @@ -330,7 +335,7 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, ) continue - v2 = Volume4DCollection.from_f3548v21( + v2 = Volume4DCollection.from_interuss_scd_api( op_intent.details.volumes + op_intent.details.off_nominal_volumes ) @@ -353,7 +358,8 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, notes = f"Requested flight (priority {req_body.operational_intent.priority}) intersected {op_intent.reference.manager}'s operational intent {op_intent.reference.id} (priority {op_intent.details.priority})" return ( InjectFlightResponse( - result=InjectFlightResult.ConflictWithFlight, notes=notes + result=InjectFlightResponseResult.ConflictWithFlight, + notes=notes, ), 200, ) @@ -430,9 +436,9 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, result.operational_intent_reference.state == OperationalIntentState.Activated ): - injection_result = InjectFlightResult.ReadyToFly + injection_result = InjectFlightResponseResult.ReadyToFly else: - injection_result = InjectFlightResult.Planned + injection_result = InjectFlightResponseResult.Planned return ( InjectFlightResponse(result=injection_result, operational_intent_id=id), 200, @@ -442,17 +448,21 @@ def inject_flight(flight_id: str, req_body: InjectFlightRequest) -> Tuple[dict, f"{e.__class__.__name__} while {step_name} for flight {flight_id}: {str(e)}" ) return ( - InjectFlightResponse(result=InjectFlightResult.Failed, notes=notes), + InjectFlightResponse(result=InjectFlightResponseResult.Failed, notes=notes), 200, ) except requests.exceptions.ConnectionError as e: notes = f"Connection error to {e.request.method} {e.request.url} while {step_name} for flight {flight_id}: {str(e)}" - response = InjectFlightResponse(result=InjectFlightResult.Failed, notes=notes) + response = InjectFlightResponse( + result=InjectFlightResponseResult.Failed, notes=notes + ) response["stacktrace"] = _make_stacktrace(e) return response, 200 except QueryError as e: notes = f"Unexpected response from remote server while {step_name} for flight {flight_id}: {str(e)}" - response = InjectFlightResponse(result=InjectFlightResult.Failed, notes=notes) + response = InjectFlightResponse( + result=InjectFlightResponseResult.Failed, notes=notes + ) response["queries"] = e.queries response["stacktrace"] = e.stacktrace return response, 200 @@ -508,7 +518,7 @@ def delete_flight(flight_id) -> Tuple[dict, int]: if flight is None: return ( DeleteFlightResponse( - result=DeleteFlightResult.Failed, + result=DeleteFlightResponseResult.Failed, notes="Flight {} does not exist".format(flight_id), ), 200, @@ -547,25 +557,29 @@ def delete_flight(flight_id) -> Tuple[dict, int]: ) logger.debug(f"[delete_flight/{pid}:{flight_id}] {notes}") return ( - DeleteFlightResponse(result=DeleteFlightResult.Failed, notes=notes), + DeleteFlightResponse(result=DeleteFlightResponseResult.Failed, notes=notes), 200, ) except requests.exceptions.ConnectionError as e: notes = f"Connection error to {e.request.method} {e.request.url} while {step_name} for flight {flight_id}: {str(e)}" logger.debug(f"[delete_flight/{pid}:{flight_id}] {notes}") - response = DeleteFlightResponse(result=DeleteFlightResult.Failed, notes=notes) + response = DeleteFlightResponse( + result=DeleteFlightResponseResult.Failed, notes=notes + ) response["stacktrace"] = _make_stacktrace(e) return response, 200 except QueryError as e: notes = f"Unexpected response from remote server while {step_name} for flight {flight_id}: {str(e)}" logger.debug(f"[delete_flight/{pid}:{flight_id}] {notes}") - response = DeleteFlightResponse(result=DeleteFlightResult.Failed, notes=notes) + response = DeleteFlightResponse( + result=DeleteFlightResponseResult.Failed, notes=notes + ) response["queries"] = e.queries response["stacktrace"] = e.stacktrace return response, 200 logger.debug(f"[delete_flight/{pid}:{flight_id}] Complete.") - return DeleteFlightResponse(result=DeleteFlightResult.Closed), 200 + return DeleteFlightResponse(result=DeleteFlightResponseResult.Closed), 200 @webapp.route("/scdsc/v1/clear_area_requests", methods=["POST"]) @@ -607,7 +621,7 @@ def make_result(success: bool, msg: str) -> ClearAreaResponse: # Find operational intents in the DSS step_name = "constructing DSS operational intent query" # TODO: Simply use the req.extent 4D volume more directly - extent = Volume4D.from_f3548v21(req.extent) + extent = Volume4D.from_interuss_scd_api(req.extent) start_time = extent.time_start.datetime end_time = extent.time_end.datetime area = extent.rect_bounds diff --git a/monitoring/mock_uss/tracer/subscriptions.py b/monitoring/mock_uss/tracer/subscriptions.py index 305bb4e859..166c558fc1 100644 --- a/monitoring/mock_uss/tracer/subscriptions.py +++ b/monitoring/mock_uss/tracer/subscriptions.py @@ -14,9 +14,9 @@ import monitoring.monitorlib.mutate.scd from monitoring.mock_uss import config, webapp from monitoring.monitorlib.geo import make_latlng_rect, get_latlngrect_vertices +from monitoring.monitorlib.geotemporal import Volume4D from monitoring.monitorlib.infrastructure import UTMClientSession from monitoring.monitorlib.rid import RIDVersion -from monitoring.monitorlib.scd import Volume4D yaml.add_representer(StringBasedDateTime, Representer.represent_str) diff --git a/monitoring/monitorlib/geotemporal.py b/monitoring/monitorlib/geotemporal.py index 6b7301ef4f..3d38b90823 100644 --- a/monitoring/monitorlib/geotemporal.py +++ b/monitoring/monitorlib/geotemporal.py @@ -12,6 +12,7 @@ import s2sphere as s2sphere from uas_standards.astm.f3411.v22a.api import Polygon from uas_standards.astm.f3548.v21 import api as f3548v21 +from uas_standards.interuss.automated_testing.scd.v1 import api as interuss_scd_api from monitoring.monitorlib import geo from monitoring.monitorlib.geo import LatLngPoint, Circle, Altitude, Volume3D @@ -327,6 +328,11 @@ def from_f3548v21(vol: Union[f3548v21.Volume4D, dict]) -> Volume4D: kwargs["time_end"] = Time(vol.time_end.value) return Volume4D(**kwargs) + @staticmethod + def from_interuss_scd_api(vol: interuss_scd_api.Volume4D) -> Volume4D: + # InterUSS SCD API is field-compatible with ASTM F3548-21 + return Volume4D.from_f3548v21(vol) + def to_f3548v21(self) -> f3548v21.Volume4D: kwargs = {"volume": self.volume.to_f3548v21()} if "time_start" in self and self.time_start: @@ -335,6 +341,10 @@ def to_f3548v21(self) -> f3548v21.Volume4D: kwargs["time_end"] = self.time_end.to_f3548v21() return f3548v21.Volume4D(**kwargs) + def to_interuss_scd_api(self) -> interuss_scd_api.Volume4D: + # InterUSS SCD API is field-compatible with ASTM F3548-21 + return ImplicitDict.parse(self.to_f3548v21(), interuss_scd_api.Volume4D) + def resolve_volume4d(template: Volume4DTemplate, start_of_test: datetime) -> Volume4D: """Resolve Volume4DTemplate into concrete Volume4D.""" @@ -528,5 +538,12 @@ def from_f3548v21( volumes = [Volume4D.from_f3548v21(v) for v in vol4s] return Volume4DCollection(volumes=volumes) + @staticmethod + def from_interuss_scd_api( + vol4s: List[interuss_scd_api.Volume4D], + ) -> Volume4DCollection: + volumes = [Volume4D.from_interuss_scd_api(v) for v in vol4s] + return Volume4DCollection(volumes=volumes) + def to_f3548v21(self) -> List[f3548v21.Volume4D]: return [v.to_f3548v21() for v in self.volumes] diff --git a/monitoring/monitorlib/scd.py b/monitoring/monitorlib/scd.py index 0917fb6b88..efeb4d63db 100644 --- a/monitoring/monitorlib/scd.py +++ b/monitoring/monitorlib/scd.py @@ -1,25 +1,9 @@ -import math -from datetime import datetime, timedelta -from enum import Enum -from typing import Dict, List, Optional, Tuple, Literal -from implicitdict import ImplicitDict, StringBasedDateTime +from typing import Optional -import arrow -import s2sphere -import shapely.geometry - -from monitoring.monitorlib.geo import LatLngPoint, Radius from uas_standards.astm.f3548.v21.api import ( OperationalIntentState, - Polygon, - Volume4D, - Volume3D, - Time, - Altitude, - Circle, ) - -from monitoring.monitorlib import geo +from uas_standards.astm.f3548.v21.constants import Scope DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ" @@ -28,11 +12,11 @@ API_1_0_0 = "1.0.0" API_0_3_17 = API_1_0_0 -SCOPE_SC = "utm.strategic_coordination" -SCOPE_CM = "utm.constraint_management" -SCOPE_CP = "utm.constraint_processing" -SCOPE_CM_SA = "utm.conformance_monitoring_sa" -SCOPE_AA = "utm.availability_arbitration" +SCOPE_SC = Scope.StrategicCoordination +SCOPE_CM = Scope.ConstraintManagement +SCOPE_CP = Scope.ConstraintProcessing +SCOPE_CM_SA = Scope.ConformanceMonitoringForSituationalAwareness +SCOPE_AA = Scope.AvailabilityArbitration NO_OVN_PHRASES = {"", "Available from USS"} diff --git a/monitoring/monitorlib/scd_automated_testing/scd_injection_api.py b/monitoring/monitorlib/scd_automated_testing/scd_injection_api.py index d8023a2288..9c6f9f906f 100644 --- a/monitoring/monitorlib/scd_automated_testing/scd_injection_api.py +++ b/monitoring/monitorlib/scd_automated_testing/scd_injection_api.py @@ -1,135 +1 @@ -from enum import Enum -from uas_standards.ansi_cta_2063_a import SerialNumber -from uas_standards.en4709_02 import OperatorRegistrationNumber -from implicitdict import ImplicitDict, StringBasedDateTime -from typing import List, Optional -from monitoring.monitorlib.scd import Volume4D - SCOPE_SCD_QUALIFIER_INJECT = "utm.inject_test_data" - -## Definitions around operational intent data that need to be submitted to the test injection interface - - -class OperationalIntentTestInjection(ImplicitDict): - """A class to hold data for operational intent data that will be submitted to the SCD testing interface.""" - - state: str - priority: int = 0 - volumes: List[Volume4D] - off_nominal_volumes: List[Volume4D] = [] - - -### End of definitions around operational intent data - -## Definitions around flight authorisation data that need to be submitted to the test injection interface - - -class UASClass(str, Enum): - Other = "Other" - C0 = "C0" - C1 = "C1" - C2 = "C2" - C3 = "C3" - C4 = "C4" - C5 = "C5" - C6 = "C6" - - -class OperationMode(str, Enum): - Undeclared = "Undeclared" - Vlos = "Vlos" - Bvlos = "Bvlos" - - -class OperationCategory(str, Enum): - Unknown = "Unknown" - Open = "Open" - Specific = "Specific" - Certified = "Certified" - - -class FlightAuthorisationData(ImplicitDict): - """A class to hold information about Flight Authorisation Test""" - - uas_serial_number: SerialNumber - operation_mode: OperationMode - operation_category: Optional[OperationCategory] - uas_class: UASClass - identification_technologies: List[str] - uas_type_certificate: Optional[str] - connectivity_methods: List[str] - endurance_minutes: int - emergency_procedure_url: str - operator_id: OperatorRegistrationNumber - uas_id: Optional[str] - - -### End of definitions around flight authorisation data - - -class InjectFlightRequest(ImplicitDict): - """A class to hold the details of a test injection payload""" - - operational_intent: OperationalIntentTestInjection - flight_authorisation: FlightAuthorisationData - - -class InjectFlightResult(str, Enum): - Planned = "Planned" - ReadyToFly = "ReadyToFly" - Rejected = "Rejected" - ConflictWithFlight = "ConflictWithFlight" - Failed = "Failed" - - -class InjectFlightResponse(ImplicitDict): - """A class to hold test flight submission response""" - - result: InjectFlightResult - notes: Optional[str] - - -class DeleteFlightResult(str, Enum): - Closed = "Closed" - Failed = "Failed" - - -class DeleteFlightResponse(ImplicitDict): - result: DeleteFlightResult - notes: Optional[str] - - -class ClearAreaRequest(ImplicitDict): - request_id: str - extent: Volume4D - - -class ClearAreaOutcome(ImplicitDict): - success: bool - message: Optional[str] - timestamp: StringBasedDateTime - - -class ClearAreaResponse(ImplicitDict): - request: Optional[ClearAreaRequest] - outcome: ClearAreaOutcome - - -class Capability(str, Enum): - FlightAuthorisationValidation = "FlightAuthorisationValidation" - BasicStrategicConflictDetection = "BasicStrategicConflictDetection" - HighPriorityFlights = "HighPriorityFlights" - - -class CapabilitiesResponse(ImplicitDict): - capabilities: Optional[List[Capability]] - - -class Status(str, Enum): - Starting = "Starting" - Ready = "Ready" - - -class StatusResponse(ImplicitDict): - status: str - version: str diff --git a/monitoring/monitorlib/uspace.py b/monitoring/monitorlib/uspace.py index 2b776f01c9..28ccc4a144 100644 --- a/monitoring/monitorlib/uspace.py +++ b/monitoring/monitorlib/uspace.py @@ -1,23 +1,25 @@ from typing import List from urllib.parse import urlparse -from monitoring.monitorlib.scd_automated_testing import scd_injection_api -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - FlightAuthorisationData, -) +from uas_standards.interuss.automated_testing.scd.v1 import api as scd_injection_api +from uas_standards.ansi_cta_2063_a import SerialNumber +from uas_standards.en4709_02 import OperatorRegistrationNumber def problems_with_flight_authorisation( - flight_auth: FlightAuthorisationData, + flight_auth: scd_injection_api.FlightAuthorisationData, ) -> List[str]: problems: List[str] = [] - if not flight_auth.uas_serial_number.valid: + if not SerialNumber(flight_auth.uas_serial_number).valid: problems.append("Invalid serial number") - if not flight_auth.operator_id.valid: + if not OperatorRegistrationNumber(flight_auth.operator_id).valid: problems.append("Invalid operator ID") if flight_auth.uas_class == scd_injection_api.UASClass.Other: problems.append("Invalid UAS class") - if flight_auth.operation_category == scd_injection_api.OperationCategory.Unknown: + if ( + flight_auth.operation_category + == scd_injection_api.FlightAuthorisationDataOperationCategory.Unknown + ): problems.append("Invalid operation category") if ( flight_auth.endurance_minutes < 1 diff --git a/monitoring/uss_qualifier/resources/flight_planning/flight_intent.py b/monitoring/uss_qualifier/resources/flight_planning/flight_intent.py index bc7ede00d8..60662336d7 100644 --- a/monitoring/uss_qualifier/resources/flight_planning/flight_intent.py +++ b/monitoring/uss_qualifier/resources/flight_planning/flight_intent.py @@ -2,10 +2,8 @@ from implicitdict import ImplicitDict, StringBasedDateTime, StringBasedTimeDelta -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - InjectFlightRequest, -) from monitoring.uss_qualifier.fileio import FileReference +from uas_standards.interuss.automated_testing.scd.v1.api import InjectFlightRequest class FlightIntent(ImplicitDict): diff --git a/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py b/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py index 47c3fd2615..7b57506605 100644 --- a/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py +++ b/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py @@ -1,26 +1,26 @@ import uuid -from typing import Tuple, List, Optional, Set +from typing import Tuple, Optional, Set from urllib.parse import urlparse from implicitdict import ImplicitDict from monitoring.monitorlib import infrastructure, fetch from monitoring.monitorlib.fetch import QueryError, Query -from monitoring.monitorlib.scd import Volume4D -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - InjectFlightResult, - DeleteFlightResult, +from monitoring.monitorlib.geotemporal import Volume4D +from uas_standards.interuss.automated_testing.scd.v1.api import ( + InjectFlightResponseResult, + DeleteFlightResponseResult, InjectFlightResponse, DeleteFlightResponse, InjectFlightRequest, - Capability, ClearAreaResponse, ClearAreaRequest, +) +from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( SCOPE_SCD_QUALIFIER_INJECT, ) from uas_standards.interuss.automated_testing.scd.v1.api import ( StatusResponse, - CapabilitiesResponse, ) @@ -104,7 +104,7 @@ def request_flight( [query], ) - if result.result == InjectFlightResult.Planned: + if result.result == InjectFlightResponseResult.Planned: self.created_flight_ids.add(flight_id) return result, query, flight_id @@ -134,7 +134,7 @@ def cleanup_flight( [query], ) - if result.result == DeleteFlightResult.Closed: + if result.result == DeleteFlightResponseResult.Closed: self.created_flight_ids.remove(flight_id) return result, query @@ -163,7 +163,9 @@ def get_readiness(self) -> Tuple[Optional[str], Query]: return None, version_query def clear_area(self, extent: Volume4D) -> Tuple[ClearAreaResponse, fetch.Query]: - req = ClearAreaRequest(request_id=str(uuid.uuid4()), extent=extent) + req = ClearAreaRequest( + request_id=str(uuid.uuid4()), extent=extent.to_f3548v21() + ) url = f"{self.config.injection_base_url}/v1/clear_area_requests" query = fetch.query_and_describe( self.client, diff --git a/monitoring/uss_qualifier/resources/interuss/mock_uss.py b/monitoring/uss_qualifier/resources/interuss/mock_uss.py index c0a2df3b1b..e46c13ad18 100644 --- a/monitoring/uss_qualifier/resources/interuss/mock_uss.py +++ b/monitoring/uss_qualifier/resources/interuss/mock_uss.py @@ -1,5 +1,3 @@ -import arrow - from implicitdict import ImplicitDict from monitoring.monitorlib import fetch from monitoring.monitorlib.infrastructure import AuthAdapter, UTMClientSession diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/flight_intent_validation/flight_intent_validation.py b/monitoring/uss_qualifier/scenarios/astm/utm/flight_intent_validation/flight_intent_validation.py index b47add0750..226cb91a99 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/flight_intent_validation/flight_intent_validation.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/flight_intent_validation/flight_intent_validation.py @@ -3,9 +3,6 @@ from uas_standards.astm.f3548.v21.api import OperationalIntentState from uas_standards.astm.f3548.v21.constants import OiMaxPlanHorizonDays -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - InjectFlightResult, -) from monitoring.uss_qualifier.resources.astm.f3548.v21 import DSSInstanceResource from monitoring.uss_qualifier.resources.astm.f3548.v21.dss import DSSInstance from monitoring.uss_qualifier.resources.flight_planning import ( @@ -32,6 +29,9 @@ submit_flight_intent, delete_flight_intent, ) +from uas_standards.interuss.automated_testing.scd.v1.api import ( + InjectFlightResponseResult, +) class FlightIntentValidation(TestScenario): @@ -65,7 +65,7 @@ def __init__( 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 = Volume4DCollection.from_f3548v21( + self._intents_extent = Volume4DCollection.from_interuss_scd_api( extents ).bounding_volume.to_f3548v21() @@ -112,7 +112,7 @@ def __init__( ), "valid_conflict_tiny_overlap must have state Accepted" time_delta = ( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.invalid_too_far_away.request.operational_intent.volumes ).time_start.datetime - self.invalid_too_far_away.reference_time.datetime @@ -134,10 +134,10 @@ def __init__( > 0 ), "invalid_activated_offnominal must have at least one off-nominal volume" - assert Volume4DCollection.from_f3548v21( + assert Volume4DCollection.from_interuss_scd_api( self.valid_flight.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.valid_conflict_tiny_overlap.request.operational_intent.volumes ) ), "valid_flight and valid_conflict_tiny_overlap must intersect" @@ -229,8 +229,8 @@ def _attempt_invalid(self): self, "Attempt to plan flight intent too far ahead of time", "Incorrectly planned", - {InjectFlightResult.Rejected}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Rejected}, + {InjectFlightResponseResult.Failed: "Failure"}, self.tested_uss, self.invalid_too_far_away.request, ) @@ -248,8 +248,8 @@ def _attempt_invalid_offnominal(self): self, "Attempt to plan flight with an off-nominal volume", "Incorrectly planned", - {InjectFlightResult.Rejected}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Rejected}, + {InjectFlightResponseResult.Failed: "Failure"}, self.tested_uss, self.invalid_accepted_offnominal.request, ) @@ -284,8 +284,8 @@ def _attempt_invalid_offnominal(self): self, "Attempt to modify planned flight with an off-nominal volume", "Incorrectly modified", - {InjectFlightResult.Rejected}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Rejected}, + {InjectFlightResponseResult.Failed: "Failure"}, self.tested_uss, self.invalid_accepted_offnominal.request, ) @@ -324,8 +324,8 @@ def _attempt_invalid_offnominal(self): self, "Attempt to modify activated flight with an off-nominal volume", "Incorrectly modified", - {InjectFlightResult.Rejected}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Rejected}, + {InjectFlightResponseResult.Failed: "Failure"}, self.tested_uss, self.invalid_activated_offnominal.request, ) @@ -382,8 +382,8 @@ def _validate_precision_intersection(self): self, "Attempt to plan flight conflicting by a tiny overlap", "Incorrectly planned", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, self.tested_uss, self.valid_conflict_tiny_overlap.request, ) diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_equal_priority_not_permitted/conflict_equal_priority_not_permitted.py b/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_equal_priority_not_permitted/conflict_equal_priority_not_permitted.py index 61446f6a2e..938f66ec90 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_equal_priority_not_permitted/conflict_equal_priority_not_permitted.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_equal_priority_not_permitted/conflict_equal_priority_not_permitted.py @@ -7,9 +7,6 @@ from monitoring.uss_qualifier.common_data_definitions import Severity from uas_standards.astm.f3548.v21.api import OperationalIntentState -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - InjectFlightResult, -) from monitoring.uss_qualifier.resources.astm.f3548.v21 import DSSInstanceResource from monitoring.uss_qualifier.resources.astm.f3548.v21.dss import DSSInstance from monitoring.uss_qualifier.resources.flight_planning import ( @@ -44,6 +41,9 @@ activate_flight_intent, submit_flight_intent, ) +from uas_standards.interuss.automated_testing.scd.v1.api import ( + InjectFlightResponseResult, +) class ConflictEqualPriorityNotPermitted(TestScenario): @@ -89,7 +89,7 @@ def __init__( 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 = Volume4DCollection.from_f3548v21( + self._intents_extent = Volume4DCollection.from_interuss_scd_api( extents ).bounding_volume.to_f3548v21() @@ -151,31 +151,31 @@ def __init__( self.flight_2_equal_prio_planned_time_range_B.request.operational_intent.priority == self.flight_1_planned_time_range_A.request.operational_intent.priority ), "flight_2 must have priority equal to flight_1" - assert not Volume4DCollection.from_f3548v21( + assert not Volume4DCollection.from_interuss_scd_api( self.flight_1_planned_time_range_A.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.flight_2_equal_prio_planned_time_range_B.request.operational_intent.volumes ) ), "flight_1_planned_time_range_A and flight_2_equal_prio_planned_time_range_B must not intersect" - assert not Volume4DCollection.from_f3548v21( + assert not Volume4DCollection.from_interuss_scd_api( self.flight_1_planned_time_range_A.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.flight_1_activated_time_range_B.request.operational_intent.volumes ) ), "flight_1_planned_time_range_A and flight_1_activated_time_range_B must not intersect" - assert Volume4DCollection.from_f3548v21( + assert Volume4DCollection.from_interuss_scd_api( self.flight_1_activated_time_range_B.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.flight_2_equal_prio_activated_time_range_B.request.operational_intent.volumes ) ), "flight_1_activated_time_range_B and flight_2_equal_prio_activated_time_range_B must intersect" - assert Volume4DCollection.from_f3548v21( + assert Volume4DCollection.from_interuss_scd_api( self.flight_1_activated_time_range_A.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.flight_2_equal_prio_nonconforming_time_range_A.request.operational_intent.off_nominal_volumes ) ), "flight_1_activated_time_range_A.volumes and flight_2_equal_prio_nonconforming_time_range_A.off_nominal_volumes must intersect" @@ -471,13 +471,16 @@ def _modify_activated_flight_preexisting_conflict( self, "Declare flight 2 non-conforming", "Successful transition to non-conforming state", - {InjectFlightResult.Planned, InjectFlightResult.Rejected}, - {InjectFlightResult.Failed: "Failure"}, + { + InjectFlightResponseResult.Planned, + InjectFlightResponseResult.Rejected, + }, + {InjectFlightResponseResult.Failed: "Failure"}, self.control_uss, self.flight_2_equal_prio_nonconforming_time_range_A.request, self.flight_2_id, ) - if resp_flight_2.result == InjectFlightResult.Rejected: + if resp_flight_2.result == InjectFlightResponseResult.Rejected: msg = f"{self.control_uss.config.participant_id} rejected transition to a Nonconforming state because it does not support CMSA role, execution of the scenario was stopped without failure" self.record_note("Control USS does not support CMSA role", msg) raise ScenarioCannotContinueError(msg) @@ -498,18 +501,21 @@ def _modify_activated_flight_preexisting_conflict( self, "Attempt to modify activated flight 1 in conflict with nonconforming flight 2", "Successful modification or rejection", - {InjectFlightResult.ReadyToFly, InjectFlightResult.Rejected}, - {InjectFlightResult.Failed: "Failure"}, + { + InjectFlightResponseResult.ReadyToFly, + InjectFlightResponseResult.Rejected, + }, + {InjectFlightResponseResult.Failed: "Failure"}, self.tested_uss, self.flight_1_activated_time_range_A_extended.request, self.flight_1_id, ) - if resp_flight_1.result == InjectFlightResult.ReadyToFly: + if resp_flight_1.result == InjectFlightResponseResult.ReadyToFly: validator.expect_shared( self.flight_1_activated_time_range_A_extended.request ) - elif resp_flight_1.result == InjectFlightResult.Rejected: + elif resp_flight_1.result == InjectFlightResponseResult.Rejected: validator.expect_shared( self.flight_1_activated_time_range_A.request, skip_if_not_found=True ) diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_higher_priority/conflict_higher_priority.py b/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_higher_priority/conflict_higher_priority.py index 5ba3d6dccb..421c79982b 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_higher_priority/conflict_higher_priority.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/nominal_planning/conflict_higher_priority/conflict_higher_priority.py @@ -77,7 +77,7 @@ def __init__( 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 = Volume4DCollection.from_f3548v21( + self._intents_extent = Volume4DCollection.from_interuss_scd_api( extents ).bounding_volume.to_f3548v21() @@ -142,24 +142,24 @@ def __init__( self.flight_2_planned_time_range_A.request.operational_intent.priority > self.flight_1_planned_time_range_A.request.operational_intent.priority ), "flight_2 must have higher priority than flight_1" - assert Volume4DCollection.from_f3548v21( + assert Volume4DCollection.from_interuss_scd_api( self.flight_1_planned_time_range_A.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.flight_2_planned_time_range_A.request.operational_intent.volumes ) ), "flight_1_planned_time_range_A and flight_2_planned_time_range_A must intersect" - assert Volume4DCollection.from_f3548v21( + assert Volume4DCollection.from_interuss_scd_api( self.flight_1_planned_time_range_A.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.flight_1_planned_time_range_A_extended.request.operational_intent.volumes ) ), "flight_1_planned_time_range_A and flight_1_planned_time_range_A_extended must intersect" - assert not Volume4DCollection.from_f3548v21( + assert not Volume4DCollection.from_interuss_scd_api( self.flight_1_planned_time_range_A.request.operational_intent.volumes ).intersects_vol4s( - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( self.flight_1_activated_time_range_B.request.operational_intent.volumes ) ), "flight_1_planned_time_range_A and flight_1_activated_time_range_B must not intersect" diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/test_steps.py b/monitoring/uss_qualifier/scenarios/astm/utm/test_steps.py index 2347b330eb..ca7f590eed 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/test_steps.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/test_steps.py @@ -10,9 +10,6 @@ OperationalIntentReference, ) -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - InjectFlightRequest, -) from monitoring.uss_qualifier.common_data_definitions import Severity from monitoring.uss_qualifier.resources.astm.f3548.v21.dss import DSSInstance from monitoring.uss_qualifier.resources.flight_planning.flight_planner import ( @@ -25,6 +22,7 @@ TestScenarioType, TestRunCannotContinueError, ) +from uas_standards.interuss.automated_testing.scd.v1.api import InjectFlightRequest class OpIntentValidator(object): @@ -241,7 +239,7 @@ def expect_shared( error_text = validate_op_intent_details( oi_full.details, flight_intent.operational_intent.priority, - Volume4DCollection.from_f3548v21( + Volume4DCollection.from_interuss_scd_api( flight_intent.operational_intent.volumes + flight_intent.operational_intent.off_nominal_volumes ).bounding_volume.to_f3548v21(), diff --git a/monitoring/uss_qualifier/scenarios/flight_planning/prioritization_test_steps.py b/monitoring/uss_qualifier/scenarios/flight_planning/prioritization_test_steps.py index 5b6d9285a2..01a1f6ab61 100644 --- a/monitoring/uss_qualifier/scenarios/flight_planning/prioritization_test_steps.py +++ b/monitoring/uss_qualifier/scenarios/flight_planning/prioritization_test_steps.py @@ -2,9 +2,9 @@ from uas_standards.astm.f3548.v21.api import OperationalIntentState -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( +from uas_standards.interuss.automated_testing.scd.v1.api import ( InjectFlightRequest, - InjectFlightResult, + InjectFlightResponseResult, InjectFlightResponse, ) from monitoring.uss_qualifier.resources.flight_planning.flight_planner import ( @@ -38,8 +38,8 @@ def plan_priority_conflict_flight_intent( scenario, test_step, "Incorrectly planned", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, )[0] @@ -67,8 +67,8 @@ def modify_planned_priority_conflict_flight_intent( scenario, test_step, "Incorrectly modified", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -97,8 +97,8 @@ def activate_priority_conflict_flight_intent( scenario, test_step, "Incorrectly activated", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -127,8 +127,8 @@ def modify_activated_priority_conflict_flight_intent( scenario, test_step, "Incorrectly modified", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -156,8 +156,8 @@ def plan_conflict_flight_intent( scenario, test_step, "Incorrectly planned", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, )[0] @@ -185,8 +185,8 @@ def modify_planned_conflict_flight_intent( scenario, test_step, "Incorrectly modified", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -215,8 +215,8 @@ def activate_conflict_flight_intent( scenario, test_step, "Incorrectly activated", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -245,8 +245,8 @@ def modify_activated_conflict_flight_intent( scenario, test_step, "Incorrectly modified", - {InjectFlightResult.ConflictWithFlight}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ConflictWithFlight}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -276,8 +276,8 @@ def plan_permitted_conflict_flight_intent( scenario, test_step, "Successful planning", - {InjectFlightResult.Planned}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Planned}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, ) @@ -305,8 +305,8 @@ def modify_planned_permitted_conflict_flight_intent( scenario, test_step, "Successful modification", - {InjectFlightResult.Planned}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Planned}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -335,8 +335,8 @@ def activate_permitted_conflict_flight_intent( scenario, test_step, "Successful activation", - {InjectFlightResult.ReadyToFly}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ReadyToFly}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -365,8 +365,8 @@ def modify_activated_permitted_conflict_flight_intent( scenario, test_step, "Successful modification", - {InjectFlightResult.ReadyToFly}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ReadyToFly}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, diff --git a/monitoring/uss_qualifier/scenarios/flight_planning/test_steps.py b/monitoring/uss_qualifier/scenarios/flight_planning/test_steps.py index 9c9f48b9b1..93a53c425f 100644 --- a/monitoring/uss_qualifier/scenarios/flight_planning/test_steps.py +++ b/monitoring/uss_qualifier/scenarios/flight_planning/test_steps.py @@ -1,17 +1,15 @@ import inspect -from datetime import datetime -from typing import List, Union, Optional, Tuple, Iterable, Set, Dict +from typing import List, Optional, Tuple, Iterable, Set, Dict from monitoring.monitorlib.geotemporal import Volume4DCollection from uas_standards.astm.f3548.v21.api import OperationalIntentState from monitoring.monitorlib.fetch import QueryError -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( +from uas_standards.interuss.automated_testing.scd.v1.api import ( InjectFlightRequest, - Capability, - InjectFlightResult, + InjectFlightResponseResult, InjectFlightResponse, - DeleteFlightResult, + DeleteFlightResponseResult, DeleteFlightResponse, ) from monitoring.uss_qualifier.common_data_definitions import Severity @@ -48,7 +46,7 @@ def clear_area( for flight_intent in flight_intents: volumes += flight_intent.request.operational_intent.volumes volumes += flight_intent.request.operational_intent.off_nominal_volumes - extent = Volume4DCollection.from_f3548v21(volumes).bounding_volume.to_f3548v21() + extent = Volume4DCollection.from_f3548v21(volumes).bounding_volume for uss in flight_planners: with scenario.check("Area cleared successfully", [uss.participant_id]) as check: try: @@ -111,8 +109,8 @@ def plan_flight_intent( scenario, test_step, "Successful planning", - {InjectFlightResult.Planned}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Planned}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, ) @@ -140,8 +138,8 @@ def activate_flight_intent( scenario, test_step, "Successful activation", - {InjectFlightResult.ReadyToFly}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ReadyToFly}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -170,8 +168,8 @@ def modify_planned_flight_intent( scenario, test_step, "Successful modification", - {InjectFlightResult.Planned}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.Planned}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -200,8 +198,8 @@ def modify_activated_flight_intent( scenario, test_step, "Successful modification", - {InjectFlightResult.ReadyToFly}, - {InjectFlightResult.Failed: "Failure"}, + {InjectFlightResponseResult.ReadyToFly}, + {InjectFlightResponseResult.Failed: "Failure"}, flight_planner, flight_intent, flight_id, @@ -212,8 +210,8 @@ def submit_flight_intent( scenario: TestScenarioType, test_step: str, success_check: str, - expected_results: Set[InjectFlightResult], - failed_checks: Dict[InjectFlightResult, str], + expected_results: Set[InjectFlightResponseResult], + failed_checks: Dict[InjectFlightResponseResult, str], flight_planner: FlightPlanner, flight_intent: InjectFlightRequest, flight_id: Optional[str] = None, @@ -304,14 +302,14 @@ def delete_flight_intent( scenario.record_query(query) notes_suffix = f': "{resp.notes}"' if "notes" in resp and resp.notes else "" - if resp.result == DeleteFlightResult.Closed: + if resp.result == DeleteFlightResponseResult.Closed: scenario.end_test_step() return resp else: check.record_failed( summary=f"Flight deletion attempt unexpectedly {resp.result}", severity=Severity.High, - details=f"{flight_planner.participant_id} indicated {resp.result} rather than the expected {DeleteFlightResult.Closed}{notes_suffix}", + details=f"{flight_planner.participant_id} indicated {resp.result} rather than the expected {DeleteFlightResponseResult.Closed}{notes_suffix}", query_timestamps=[query.request.timestamp], ) @@ -350,7 +348,7 @@ def cleanup_flights( ) continue - if resp.result == DeleteFlightResult.Closed: + if resp.result == DeleteFlightResponseResult.Closed: removed.append(flight_id) else: check.record_failed( diff --git a/monitoring/uss_qualifier/scenarios/uspace/flight_auth/validation.py b/monitoring/uss_qualifier/scenarios/uspace/flight_auth/validation.py index 7793d30d0a..4adecdda32 100644 --- a/monitoring/uss_qualifier/scenarios/uspace/flight_auth/validation.py +++ b/monitoring/uss_qualifier/scenarios/uspace/flight_auth/validation.py @@ -1,14 +1,13 @@ from typing import List from monitoring.monitorlib.fetch import QueryError -from monitoring.monitorlib.scd_automated_testing.scd_injection_api import ( - InjectFlightResult, +from uas_standards.interuss.automated_testing.scd.v1.api import ( + InjectFlightResponseResult, ) from monitoring.monitorlib.uspace import problems_with_flight_authorisation from monitoring.uss_qualifier.common_data_definitions import Severity from monitoring.uss_qualifier.resources.flight_planning import ( FlightIntentsResource, - FlightPlannersResource, ) from monitoring.uss_qualifier.resources.flight_planning.flight_intent import ( FlightIntent, @@ -139,7 +138,7 @@ def _attempt_invalid_flights(self) -> bool: with self.check( "Incorrectly planned", [self.ussp.participant_id] ) as check: - if resp.result == InjectFlightResult.Planned: + if resp.result == InjectFlightResponseResult.Planned: problems = ", ".join( problems_with_flight_authorisation( flight_intent.request.flight_authorisation @@ -152,7 +151,7 @@ def _attempt_invalid_flights(self) -> bool: query_timestamps=[query.request.timestamp], ) - if resp.result == InjectFlightResult.Failed: + if resp.result == InjectFlightResponseResult.Failed: failure_check.record_failed( summary="Failed to create flight", severity=Severity.Medium,