diff --git a/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py b/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py index 3ca0a44645..7b8b4a32ff 100644 --- a/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py +++ b/monitoring/uss_qualifier/resources/flight_planning/flight_planner.py @@ -1,7 +1,6 @@ -from typing import Tuple, Optional, Set +from typing import Tuple, Optional, Set, get_type_hints from urllib.parse import urlparse from implicitdict import ImplicitDict - from monitoring.monitorlib import infrastructure, fetch from monitoring.monitorlib.clients.flight_planning.client import ( PlanningActivityError, @@ -90,6 +89,13 @@ def to_client( ) +def _additional_fields_in_request(request: InjectFlightRequest) -> dict: + addl_fields = {} + for k, v in request.items(): + if k not in get_type_hints(InjectFlightRequest): + addl_fields[k] = v + return addl_fields + class FlightPlanner: """Manages the state and the interactions with flight planner USS. @@ -123,7 +129,6 @@ def request_flight( self, request: InjectFlightRequest, flight_id: Optional[str] = None, - additional_fields: Optional[dict] = None, ) -> Tuple[InjectFlightResponse, fetch.Query, str]: usage_states = { OperationalIntentState.Accepted: AirspaceUsageState.Planned, @@ -168,6 +173,13 @@ def request_flight( uspace_flight_authorisation=uspace_flight_authorisation, ) + # Extracting if any additional fields from subclasses of InjectFlightRequest + additional_fields = ( + None + if not _additional_fields_in_request(request) + else _additional_fields_in_request(request) + ) + if not flight_id: try: resp = self.client.try_plan_flight(