Skip to content

Commit 6f57e0d

Browse files
committed
[uss_qualifier] expand OIR implicit sub handling scenario
1 parent 6a92d38 commit 6f57e0d

File tree

2 files changed

+139
-16
lines changed

2 files changed

+139
-16
lines changed

monitoring/uss_qualifier/scenarios/astm/utm/dss/oir_implicit_sub_handling.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ If the newly created OIR does not mention the implicit subscription from the pre
9292
the DSS is either improperly managing implicit subscriptions, or failing to report the subscriptions relevant to an OIR,
9393
and therefore in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)** or **[astm.f3548.v21.DSS0005,5](../../../../requirements/astm/f3548/v21.md)** respectively.
9494

95-
#### 🛑 No implicit subscription was attached check
96-
97-
If the DSS attached an implicit subscription, by either creating or re-using an existing one, to the OIR that was created in this step,
98-
the DSS is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**.
95+
#### [OIR is not attached to an implicit subscription](./fragments/oir/oir_has_expected_subscription.md)
9996

10097
### Mutate OIR with implicit subscription to not overlap anymore test step
10198

@@ -135,11 +132,7 @@ that were present when the test case started.
135132
Otherwise, the DSS may be failing to properly implement **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**
136133
or **[astm.f3548.v21.DSS0005,5](../../../../requirements/astm/f3548/v21.md)**.
137134

138-
#### 🛑 No implicit subscription was attached check
139-
140-
If the DSS attached an implicit subscription, by either creating or re-using an existing one, to the OIR that was created in this step,
141-
the DSS is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**.
142-
135+
#### [OIR is not attached to an implicit subscription](./fragments/oir/oir_has_expected_subscription.md)
143136
## Implicit subscriptions are properly deleted when required by OIR mutation test case
144137

145138
This test case verifies that implicit subscriptions are properly removed if they become unnecessary following the mutation of an OIR.
@@ -271,10 +264,41 @@ Replace the first OIR's explicit subscription with the implicit one created in t
271264

272265
Confirm that the query to replace the second OIR's explicit subscription with the second OIR's implicit subscription succeeds.
273266

274-
#### 🛑 The first OIR is now attached to the specified implicit subscription check
267+
#### [First OIR is now attached to the specified implicit subscription](fragments/oir/oir_has_expected_subscription.md)
268+
269+
## Existing implicit subscription can be attached to OIR without subscription test case
270+
271+
This test case verifies that an implicit subscription can be attached to an OIR that is not currently attached to any subscription.
272+
273+
### Ensure clean workspace test step
274+
275+
Reset the workspace for this test case.
276+
277+
#### [Clean any existing OIRs with known test IDs](clean_workspace_op_intents.md)
278+
279+
#### [Clean any existing subscriptions with known test IDs](clean_workspace_subs.md)
280+
281+
### [Create OIR with no subscription test step](./fragments/oir/crud/create_query.md)
282+
283+
#### [OIR is not attached to an implicit subscription](./fragments/oir/oir_has_expected_subscription.md)
284+
285+
### [Create second OIR with an implicit subscription test step](./fragments/oir/crud/create_query.md)
286+
287+
#### [An implicit subscription was created](./fragments/sub/implicit_create.md)
288+
289+
### Attach OIR without subscription to implicit subscription test step
290+
291+
Attach the first OIR to the implicit subscription created with the second OIR.
292+
293+
#### [Attach OIR to implicit subscription](./fragments/oir/crud/update_query.md)
294+
295+
### Confirm OIR is now attached to implicit subscription test step
296+
297+
Confirms that the DSS properly attached the first OIR to the implicit subscription created with the second OIR.
298+
299+
#### [Get OIR query](./fragments/oir/crud/read_query.md)
275300

276-
If the OIR is not attached to the implicit subscription specified in a successful mutation query,
277-
the DSS is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**.
301+
#### [First OIR is now attached to the specified implicit subscription](fragments/oir/oir_has_expected_subscription.md)
278302

279303
## Cleanup
280304

monitoring/uss_qualifier/scenarios/astm/utm/dss/oir_implicit_sub_handling.py

Lines changed: 103 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from datetime import datetime, timedelta
2-
from typing import Dict, List, Optional, Set, Tuple
2+
from typing import List, Optional, Set, Tuple
33

44
import arrow
55
from uas_standards.astm.f3548.v21.api import (
6-
EntityID,
76
OperationalIntentReference,
87
OperationalIntentState,
98
SubscriberToNotify,
@@ -191,6 +190,12 @@ def run(self, context: ExecutionContext):
191190
self._case_5_replace_explicit_sub_with_implicit()
192191
self.end_test_case()
193192

193+
self.begin_test_case(
194+
"Existing implicit subscription can be attached to OIR without subscription"
195+
)
196+
self._setup_case()
197+
self._case_6_attach_implicit_sub_to_oir_without_subscription()
198+
self.end_test_case()
194199
self.end_test_scenario()
195200

196201
def _case_1_step_create_oir_1(self):
@@ -435,7 +440,7 @@ def _create_oir(
435440
implicit_sub = sub.subscription
436441
elif subscription_id is None:
437442
with self.check(
438-
"No implicit subscription was attached", self._pid
443+
"OIR is attached to expected subscription", self._pid
439444
) as check:
440445
# The official DSS implementation will set the subscription ID to 00000000-0000-4000-8000-000000000000
441446
# Other implementations may use a different value, as the OpenAPI spec does not allow the value to be empty
@@ -777,7 +782,7 @@ def _case_5_replace_explicit_sub_with_implicit(self):
777782
self._oir_a_ovn = oir.ovn
778783

779784
with self.check(
780-
"The first OIR is now attached to the specified implicit subscription",
785+
"OIR is attached to expected subscription",
781786
self._pid,
782787
) as check:
783788
if sub_implicit.id != oir.subscription_id:
@@ -787,6 +792,100 @@ def _case_5_replace_explicit_sub_with_implicit(self):
787792
)
788793
self.end_test_step()
789794

795+
def _case_6_attach_implicit_sub_to_oir_without_subscription(self):
796+
self.begin_test_step("Create OIR with no subscription")
797+
oir_no_sub, _, _, _ = self._create_oir(
798+
oir_id=self._oir_a_id,
799+
time_start=self._time_2,
800+
time_end=self._time_3,
801+
relevant_ovns=[],
802+
with_implicit_sub=False,
803+
)
804+
self._oir_a_ovn = oir_no_sub.ovn
805+
self.end_test_step()
806+
807+
self.begin_test_step("Create second OIR with an implicit subscription")
808+
oir_implicit, _, sub_implicit, _ = self._create_oir(
809+
oir_id=self._oir_b_id,
810+
time_start=oir_no_sub.time_start.value.datetime,
811+
time_end=oir_no_sub.time_end.value.datetime,
812+
relevant_ovns=[oir_no_sub.ovn],
813+
with_implicit_sub=True,
814+
)
815+
self._oir_b_ovn = oir_implicit.ovn
816+
self._implicit_sub_1 = sub_implicit
817+
self.end_test_step()
818+
819+
self.begin_test_step("Attach OIR without subscription to implicit subscription")
820+
with self.check(
821+
"Mutate operational intent reference query succeeds", self._pid
822+
) as check:
823+
try:
824+
oir_updated, subs, q = self._dss.put_op_intent(
825+
extents=[
826+
self._planning_area.get_volume4d(
827+
oir_no_sub.time_start.value.datetime,
828+
oir_no_sub.time_end.value.datetime,
829+
).to_f3548v21()
830+
],
831+
key=[oir_implicit.ovn],
832+
state=OperationalIntentState.Accepted,
833+
base_url=DUMMY_BASE_URL,
834+
oi_id=self._oir_a_id,
835+
ovn=self._oir_a_ovn,
836+
subscription_id=sub_implicit.id,
837+
)
838+
self.record_query(q)
839+
except QueryError as e:
840+
self.record_queries(e.queries)
841+
check.record_failed(
842+
summary="OIR Creation failed",
843+
details=str(e),
844+
query_timestamps=e.query_timestamps,
845+
)
846+
847+
self._oir_a_ovn = oir_updated.ovn
848+
849+
self.end_test_step()
850+
851+
self.begin_test_step("Confirm OIR is now attached to implicit subscription")
852+
853+
# First, sanity check of the value reported by the DSS at the previous step
854+
with self.check(
855+
"OIR is attached to expected subscription",
856+
self._pid,
857+
) as check:
858+
if sub_implicit.id != oir_updated.subscription_id:
859+
check.record_failed(
860+
summary="Implicit subscription not attached to OIR",
861+
details=f"The subscription {sub_implicit.id} was attached to the OIR, but it reports being attached to subscription {oir_no_sub.subscription_id} instead.",
862+
)
863+
864+
# Then, do an actual query of the OIR
865+
with self.check("Get operational intent reference by ID", self._pid) as check:
866+
try:
867+
oir_queried, _ = self._dss.get_op_intent_reference(self._oir_a_id)
868+
869+
except QueryError as e:
870+
self.record_queries(e.queries)
871+
check.record_failed(
872+
summary="OIR query failed",
873+
details=str(e),
874+
query_timestamps=e.query_timestamps,
875+
)
876+
877+
with self.check(
878+
"OIR is attached to expected subscription",
879+
self._oir_a_id,
880+
) as check:
881+
if sub_implicit.id != oir_queried.subscription_id:
882+
check.record_failed(
883+
summary="Implicit subscription not attached to OIR",
884+
details=f"The subscription {sub_implicit.id} was attached to the OIR, but it reports being attached to subscription {oir_queried.subscription_id} instead.",
885+
)
886+
887+
self.end_test_step()
888+
790889
def _setup_case(self):
791890
# T0 corresponds to 'now'
792891
self._time_0 = arrow.utcnow().datetime

0 commit comments

Comments
 (0)