Skip to content

Commit

Permalink
[uss_qualifier] simplify dependencies of op-intent ref access control…
Browse files Browse the repository at this point in the history
…, move to dss dir
  • Loading branch information
Shastick committed Mar 14, 2024
1 parent 91dffe2 commit c0b4223
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 80 deletions.
4 changes: 3 additions & 1 deletion monitoring/uss_qualifier/scenarios/astm/utm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
from .off_nominal_planning.down_uss_equal_priority_not_permitted import (
DownUSSEqualPriorityNotPermitted,
)
from .op_intent_ref_access_control import OpIntentReferenceAccessControl
from monitoring.uss_qualifier.scenarios.astm.utm.dss.op_intent_ref_access_control import (
OpIntentReferenceAccessControl,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ This scenario ensures that a DSS will only let the owner of an operational inten

## Resources

### flight_intents

A `resources.flight_planning.FlightIntentsResource` containing the flight intents to be used in this scenario:

This scenario expects to find at least two separate flight intents in this resource, as it will use their extent
to create two operational intents references.

### dss

A `resources.astm.f3548.v21.DSSInstanceResource` pointing to the DSS instance to test for this scenario.
Expand All @@ -26,6 +19,14 @@ the resources exposed by the DSS.

The participant under test is responsible for providing this second set of credentials along the primary ones used in most other scenarios.

### id_generator

[`IDGeneratorResource`](../../../../resources/interuss/id_generator.py) providing the operational intent reference IDs for this scenario.

### planning_area

[`PlanningAreaResource`](../../../../resources/astm/f3548/v21/planning_area.py) describes the 3D volume in which operational intents will be created

#### Credential requirements

In general, these test credentials may be in all points equal to the ones used by the `AuthAdapterResource` that is
Expand Down Expand Up @@ -56,7 +57,7 @@ Makes sure that the DSS is in a clean and expected state before running the test

The setup will create two separate operational intent references: one for each set of the available credentials.

### [Ensure clean workspace](./dss/clean_workspace.md) test step
### [Ensure clean workspace](clean_workspace.md) test step

#### ⚠️ Any existing operational intent reference has been removed check

Expand All @@ -79,7 +80,7 @@ To verify that the second credentials are valid, it will also create an operatio
#### 🛑 Can create an operational intent with valid credentials check

If the DSS does not allow the creation of operation intents when the required parameters and credentials are provided,
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../requirements/astm/f3548/v21.md)**.
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**.

#### 🛑 Passed sets of credentials are different check

Expand All @@ -98,16 +99,16 @@ using the credentials provided in the `second_utm_auth` resource, and expect all
#### 🛑 Operational intent references can be queried directly by their ID check

If an existing operational intent cannot directly be queried by its ID, the DSS implementation is in violation of
**[astm.f3548.v21.DSS0005,1](../../../requirements/astm/f3548/v21.md)**.
**[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**.

#### 🛑 Non-owning credentials cannot modify operational intent check

If an operational intent reference can be modified by a client which did not create it, the DSS implementation is
in violation of **[astm.f3548.v21.OPIN0035](../../../requirements/astm/f3548/v21.md)**.
in violation of **[astm.f3548.v21.OPIN0035](../../../../requirements/astm/f3548/v21.md)**.

#### 🛑 Non-owning credentials cannot delete operational intent check

If an operational intent reference can be deleted by a client which did not create it, the DSS implementation is
in violation of **[astm.f3548.v21.OPIN0035](../../../requirements/astm/f3548/v21.md)**.
in violation of **[astm.f3548.v21.OPIN0035](../../../../requirements/astm/f3548/v21.md)**.

## [Cleanup](./dss/clean_workspace.md)
## [Cleanup](clean_workspace.md)
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from datetime import datetime, timedelta
from typing import List

from uas_standards.astm.f3548.v21 import api as f3548v21
from uas_standards.astm.f3548.v21.api import OperationalIntentState
from uas_standards.astm.f3548.v21.constants import Scope

from monitoring.monitorlib.fetch import QueryError
from monitoring.monitorlib.geotemporal import Volume4DCollection
from monitoring.monitorlib.geotemporal import Volume4DCollection, Volume4D
from monitoring.monitorlib.temporal import Time
from monitoring.prober.infrastructure import register_resource_type
from monitoring.uss_qualifier.resources.astm.f3548.v21 import DSSInstanceResource
from monitoring.uss_qualifier.resources.astm.f3548.v21 import (
DSSInstanceResource,
PlanningAreaResource,
)
from monitoring.uss_qualifier.resources.astm.f3548.v21.dss import (
DSSInstance,
DUMMY_USS_BASE_URL,
Expand Down Expand Up @@ -37,29 +42,20 @@ class OpIntentReferenceAccessControl(TestScenario):
_dss: DSSInstance
_pid: List[str]

# Participant IDs of users using this DSS instance
_uids: List[str]

# The same DSS, available via a separate auth adapter
_dss_separate_creds: DSSInstance

_flight1_planned: FlightIntent
_flight2_planned: FlightIntent

_volumes1: Volume4DCollection
_volumes2: Volume4DCollection

_intents_extent: f3548v21.Volume4D

_current_ref_1: f3548v21.OperationalIntentReference
_current_ref_2: f3548v21.OperationalIntentReference

def __init__(
self,
flight_intents: FlightIntentsResource,
dss: DSSInstanceResource,
second_utm_auth: AuthAdapterResource,
id_generator: IDGeneratorResource,
planning_area: PlanningAreaResource,
):
super().__init__()
scopes = {
Expand All @@ -78,29 +74,19 @@ def __init__(
second_utm_auth, scopes
)

try:
(self._intents_extent, planned_flights) = unpack_flight_intents(
flight_intents, ["flight_1", "flight_2"]
)
self._flight1_planned = planned_flights["flight_1"]
self._flight2_planned = planned_flights["flight_2"]

self._volumes1 = Volume4DCollection.from_interuss_scd_api(
self._flight1_planned.request.operational_intent.volumes
)
self._planning_area = planning_area.specification

self._volumes2 = Volume4DCollection.from_interuss_scd_api(
self._flight2_planned.request.operational_intent.volumes
)
# Build a ready-to-use 4D volume with no specified time for searching
# the currently active subscriptions
self._planning_area_volume4d = Volume4D(
volume=self._planning_area.volume,
).to_f3548v21()

except KeyError as e:
raise ValueError(
f"`{self.me()}` TestScenario requirements for flight_intents not met: missing flight intent {e}"
)
except AssertionError as e:
raise ValueError(
f"`{self.me()}` TestScenario requirements for flight_intents not met: {e}"
)
self._oir_extents = [Volume4D(
volume=self._planning_area.volume,
time_start=Time(datetime.utcnow()),
time_end=Time(datetime.utcnow() + timedelta(minutes=10))
).to_f3548v21()]

def run(self, context: ExecutionContext):
self.begin_test_scenario(context)
Expand Down Expand Up @@ -222,7 +208,7 @@ def _attempt_to_delete_remaining_op_intents(self):
) as check:
try:
# Also check for any potential other op_intents and delete them
(op_intents_1, q) = self._dss.find_op_intent(self._intents_extent)
(op_intents_1, q) = self._dss.find_op_intent(self._planning_area_volume4d)
self.record_query(q)
except QueryError as e:
self.record_queries(e.queries)
Expand Down Expand Up @@ -260,7 +246,7 @@ def _attempt_to_delete_remaining_op_intents(self):
) as check:
try:
(op_intents_2, q) = self._dss_separate_creds.find_op_intent(
self._intents_extent
self._planning_area_volume4d
)
self.record_query(q)
except QueryError as e:
Expand Down Expand Up @@ -320,7 +306,7 @@ def _ensure_clean_workspace(self) -> bool:
) as check:
try:
# We can't delete anything that would be left.
(stray_oir, q) = self._dss.find_op_intent(self._intents_extent)
(stray_oir, q) = self._dss.find_op_intent(self._planning_area_volume4d)
self.record_query(q)
except QueryError as e:
self.record_queries(e.queries)
Expand Down Expand Up @@ -351,7 +337,7 @@ def _create_op_intents(self):
try:
(self._current_ref_1, subscribers1, q1) = self._dss.put_op_intent(
oi_id=self._oid_1,
extents=self._volumes1.to_f3548v21(),
extents=self._oir_extents,
key=[],
state=OperationalIntentState.Accepted,
base_url=DUMMY_USS_BASE_URL,
Expand All @@ -376,7 +362,7 @@ def _create_op_intents(self):
q2,
) = self._dss_separate_creds.put_op_intent(
oi_id=self._oid_2,
extents=self._volumes2.to_f3548v21(),
extents=self._oir_extents,
key=[self._current_ref_1.ovn],
state=OperationalIntentState.Accepted,
base_url=DUMMY_USS_BASE_URL,
Expand Down Expand Up @@ -417,7 +403,7 @@ def _check_mutation_on_non_owned_intent_fails(self):
# Attempt to update the state of the intent created with the main credentials using the second credentials
(ref, notif, q) = self._dss_separate_creds.put_op_intent(
oi_id=self._oid_1,
extents=self._volumes1.to_f3548v21(),
extents=self._oir_extents,
key=[self._current_ref_2.ovn],
state=OperationalIntentState.Accepted,
base_url=self._current_ref_1.uss_base_url,
Expand Down Expand Up @@ -447,7 +433,7 @@ def _check_mutation_on_non_owned_intent_fails(self):
# Attempt to update the base_url of the intent created with the main credentials using the second credentials
(ref, notif, q) = self._dss_separate_creds.put_op_intent(
oi_id=self._oid_1,
extents=self._volumes1.to_f3548v21(),
extents=self._oir_extents,
key=[self._current_ref_2.ovn],
state=self._current_ref_1.state,
base_url="https://another-url.uss/down",
Expand Down
10 changes: 5 additions & 5 deletions monitoring/uss_qualifier/suites/astm/utm/dss_probing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

1. Scenario: [ASTM SCD DSS: Subscription Simple](../../../scenarios/astm/utm/dss/subscription_simple.md) ([`scenarios.astm.utm.dss.SubscriptionSimple`](../../../scenarios/astm/utm/dss/subscription_simple.py))
2. Scenario: [ASTM SCD DSS: Subscription Validation](../../../scenarios/astm/utm/dss/subscription_validation.md) ([`scenarios.astm.utm.dss.SubscriptionValidation`](../../../scenarios/astm/utm/dss/subscription_validation.py))
3. Scenario: [ASTM F3548-21 UTM DSS Operational Intent Reference Access Control](../../../scenarios/astm/utm/op_intent_ref_access_control.md) ([`scenarios.astm.utm.OpIntentReferenceAccessControl`](../../../scenarios/astm/utm/op_intent_ref_access_control.py))
3. Scenario: [ASTM F3548-21 UTM DSS Operational Intent Reference Access Control](../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md) ([`scenarios.astm.utm.OpIntentReferenceAccessControl`](../../../scenarios/astm/utm/dss/op_intent_ref_access_control.py))
4. Scenario: [ASTM F3548-21 UTM DSS interoperability](../../../scenarios/astm/utm/dss_interoperability.md) ([`scenarios.astm.utm.DSSInteroperability`](../../../scenarios/astm/utm/dss_interoperability.py))
5. Scenario: [ASTM SCD DSS: Subscription Synchronization](../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md) ([`scenarios.astm.utm.dss.synchronization.SubscriptionSynchronization`](../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.py))
6. Scenario: [ASTM UTM DSS: Direct CRDB access](../../../scenarios/astm/utm/dss/crdb_access.md) ([`scenarios.astm.utm.dss.CRDBAccess`](../../../scenarios/astm/utm/dss/crdb_access.py))
Expand All @@ -24,17 +24,17 @@
<td rowspan="16" style="vertical-align:top;"><a href="../../../requirements/astm/f3548/v21.md">astm<br>.f3548<br>.v21</a></td>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0005,1</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a></td>
<td><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0005,2</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a></td>
<td><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0005,5</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a></td>
<td><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a><br><a href="../../../scenarios/astm/utm/dss/subscription_simple.md">ASTM SCD DSS: Subscription Simple</a><br><a href="../../../scenarios/astm/utm/dss/synchronization/subscription_synchronization.md">ASTM SCD DSS: Subscription Synchronization</a><br><a href="../../../scenarios/astm/utm/dss/subscription_validation.md">ASTM SCD DSS: Subscription Validation</a></td>
</tr>
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">DSS0015</a></td>
Expand Down Expand Up @@ -99,6 +99,6 @@
<tr>
<td><a href="../../../requirements/astm/f3548/v21.md">OPIN0035</a></td>
<td>Implemented</td>
<td><a href="../../../scenarios/astm/utm/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a></td>
<td><a href="../../../scenarios/astm/utm/dss/op_intent_ref_access_control.md">ASTM F3548-21 UTM DSS Operational Intent Reference Access Control</a></td>
</tr>
</table>
2 changes: 1 addition & 1 deletion monitoring/uss_qualifier/suites/astm/utm/dss_probing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ actions:
resources:
dss: dss
second_utm_auth: second_utm_auth
flight_intents: flight_intents
id_generator: id_generator
planning_area: planning_area
- test_scenario:
scenario_type: scenarios.astm.utm.DSSInteroperability
resources:
Expand Down
Loading

0 comments on commit c0b4223

Please sign in to comment.