From ec93a8a0a218513f446c80c3b90c104c22929cf0 Mon Sep 17 00:00:00 2001 From: Maximilien Cuony Date: Mon, 5 Jan 2026 14:26:29 +0100 Subject: [PATCH] [mock_uss] Add uses_cmsa option --- .../mock_uss/scd_injection/routes_injection.py | 10 ++++++++++ monitoring/monitorlib/locality.py | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/monitoring/mock_uss/scd_injection/routes_injection.py b/monitoring/mock_uss/scd_injection/routes_injection.py index edf9ca71d5..69c38bfbc4 100644 --- a/monitoring/mock_uss/scd_injection/routes_injection.py +++ b/monitoring/mock_uss/scd_injection/routes_injection.py @@ -178,6 +178,16 @@ def unsuccessful( except PlanningError as e: return unsuccessful(PlanningActivityResult.Rejected, str(e)) + if not locality.uses_cmsa(): + if new_flight.op_intent.reference.state in [ + scd_api.OperationalIntentState.Nonconforming, + scd_api.OperationalIntentState.Contingent, + ]: + return unsuccessful( + PlanningActivityResult.NotSupported, + f"The current locality {locality} does not support CMSA, flight cannot transition to {new_flight.op_intent.reference.state}", + ) + step_name = "performing unknown operation" notes: str | None = None try: diff --git a/monitoring/monitorlib/locality.py b/monitoring/monitorlib/locality.py index a3b3fafb50..a9ceedb22b 100644 --- a/monitoring/monitorlib/locality.py +++ b/monitoring/monitorlib/locality.py @@ -37,6 +37,11 @@ def highest_priority(self) -> int: """Returns the highest priority level for ASTM F3548-21 defined by the regulator of this locality""" raise NotImplementedError(Locality._NOT_IMPLEMENTED_MSG) + @abstractmethod + def uses_cmsa(self) -> bool: + """Return true if the ecosystem supports CMSA operations""" + raise NotImplementedError(Locality._NOT_IMPLEMENTED_MSG) + def __str__(self): return self.__class__.__name__ @@ -69,6 +74,13 @@ def lowest_bound_priority(self) -> int: def highest_priority(self) -> int: return 100 + def uses_cmsa(self) -> bool: + # Return True for now as Switzerland didn't determined yet if CMSA is + # used. + # If switched to False, ensure tests have a locality with CMSA enabled. + # See https://github.com/interuss/monitoring/pull/1304#pullrequestreview-3594632974 + return True + class UnitedStatesIndustryCollaboration(Locality): @classmethod @@ -86,3 +98,6 @@ def lowest_bound_priority(self) -> int: def highest_priority(self) -> int: return 100 + + def uses_cmsa(self) -> bool: + return False