diff --git a/monitoring/uss_qualifier/resources/astm/f3548/v21/dss.py b/monitoring/uss_qualifier/resources/astm/f3548/v21/dss.py index f54f8669d5..4ec77c6ef1 100644 --- a/monitoring/uss_qualifier/resources/astm/f3548/v21/dss.py +++ b/monitoring/uss_qualifier/resources/astm/f3548/v21/dss.py @@ -32,6 +32,7 @@ VehicleTelemetry, ExchangeRecord, ErrorReport, + AirspaceConflictResponse, ) from uas_standards.astm.f3548.v21.constants import Scope @@ -302,14 +303,14 @@ def put_op_intent( ): result = query.parse_json_result(ChangeOperationalIntentReferenceResponse) return result.operational_intent_reference, result.subscribers, query + elif query.status_code == 409: + result = query.parse_json_result(AirspaceConflictResponse) + raise QueryError( + f"Received code 409 when attempting to {'create' if create else 'update'} operational intent with ID {oi_uuid}; error message: `{result.message}`; missing operational intent IDs: {[oi.id for oi in result.missing_operational_intents]}", + query, + ) else: err_msg = query.error_message if query.error_message is not None else "" - if ( - query.status_code == 409 - and "missing_operational_intents" in query.response.json - ): - err_msg += f" (missing_operational_intents: {query.response.json['missing_operational_intents']})" - raise QueryError( f"Received code {query.status_code} when attempting to {'create' if create else 'update'} operational intent with ID {oi_uuid}; error message: `{err_msg}`", query, diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.md b/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.md index 31aeb3947b..eab95740e3 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.md +++ b/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.md @@ -37,9 +37,13 @@ This step ensures that no subscriptions and OIRs with the known test IDs exists This test case verifies that newly created OIRs will receive the relevant subscriptions to notify from the DSS instance, regardless of which instance was used to create the entity. -### [Create background subscriptions test step](./fragments/sub/crud/create_query.md) +### [Create first background subscription test step](./fragments/sub/crud/create_query.md) -Sets up two subscriptions that cover the planning area at different times, and which will be used as part of the interaction tests. +Sets up the first subscription that cover the planning area from 'now' to 20 minutes in the future, and which will be used as part of the interaction tests. + +### [Create second background subscription test step](./fragments/sub/crud/create_query.md) + +Sets up the second subscription that cover the planning area from 20 minutes after the first starts and that lasts for 1 hour, and which will be used as part of the interaction tests. ### Create an OIR at every DSS in sequence test step @@ -75,6 +79,4 @@ If the DSS omits any of the implicit subscriptions belonging to an OIR previousl any of the DSSes at which an earlier OIR was created, or the DSS at which the current OIR has been created, are in violation of **[astm.f3548.v21.DSS0210,A2-7-2,4b](../../../../requirements/astm/f3548/v21.md)**. -More specifically, they are breaking the above requirement by failing one or both of the following requirements: - ## [Cleanup](./clean_workspace.md) diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.py b/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.py index 565d921b07..67f8ddcebe 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/dss/subscription_interactions.py @@ -45,8 +45,8 @@ class SubscriptionInteractions(TestScenario): """ SUB_TYPES = [ - register_resource_type(386, "Subscription"), - register_resource_type(387, "Subscription"), + register_resource_type(386, "First Subscription"), + register_resource_type(387, "Second Subscription"), ] OIR_TYPE = register_resource_type(388, "Operational Intent References") @@ -82,7 +82,7 @@ def __init__( """ super().__init__() scopes = { - Scope.StrategicCoordination: "create and delete subscriptions and entities" + Scope.StrategicCoordination: "create and delete subscriptions and operational intents" } self._dss = dss.get_instance(scopes) self._pid = [self._dss.participant_id] @@ -104,14 +104,6 @@ def __init__( for i in range(len(self._secondary_instances) + 1) ] - # First subscription from now to 20 minutes in the future - self._sub_1_start = datetime.utcnow() - self._sub_1_end = self._sub_1_start + timedelta(minutes=20) - - # Second subscription starts 20 minutes after the first ends and lasts for 1 hour - self._sub_2_start = self._sub_1_end + timedelta(minutes=20) - self._sub_2_end = self._sub_2_start + timedelta(hours=1) - self._manager = utm_client_identity.subject() def run(self, context: ExecutionContext): @@ -119,10 +111,7 @@ def run(self, context: ExecutionContext): self._setup_case() self.begin_test_case("OIR creation triggers relevant notifications") - self.begin_test_step("Create background subscriptions") self._step_create_background_subs() - self.end_test_step() - self._steps_create_oirs_at_each_dss() self.end_test_case() @@ -133,6 +122,8 @@ def _step_create_background_subs(self): and one that starts one hour after the first ends""" # Create the first subscription + self.begin_test_step("Create first background subscription") + sub_now_params = self._planning_area.get_new_subscription_params( subscription_id=self._sub_ids[0], start_time=self._sub_1_start, @@ -144,8 +135,11 @@ def _step_create_background_subs(self): sub_now = self._create_sub_with_params(sub_now_params) self._current_subs[sub_now_params.sub_id] = sub_now + self.end_test_step() # Create the second subscription, that starts later + self.begin_test_step("Create second background subscription") + sub_later_params = self._planning_area.get_new_subscription_params( subscription_id=self._sub_ids[1], start_time=self._sub_2_start, @@ -157,6 +151,7 @@ def _step_create_background_subs(self): sub_later = self._create_sub_with_params(sub_later_params) self._current_subs[sub_later_params.sub_id] = sub_later + self.end_test_step() def _steps_create_oirs_at_each_dss(self): """Creates an OIR at each DSS instance""" @@ -273,6 +268,14 @@ def _create_sub_with_params(self, params: SubscriptionParams) -> Subscription: def _setup_case(self): self.begin_test_case("Setup") + # First subscription from now to 20 minutes in the future + self._sub_1_start = datetime.utcnow() + self._sub_1_end = self._sub_1_start + timedelta(minutes=20) + + # Second subscription starts 20 minutes after the first ends and lasts for 1 hour + self._sub_2_start = self._sub_1_end + timedelta(minutes=20) + self._sub_2_end = self._sub_2_start + timedelta(hours=1) + # Multiple runs of the scenario seem to rely on the same instance: # thus we need to reset the state of the scenario before running it. self._current_subs = {}