Skip to content

Commit

Permalink
Merge remote-tracking branch 'interuss/main' into dss-0020-encrypted-…
Browse files Browse the repository at this point in the history
…connection
  • Loading branch information
mickmis committed Dec 11, 2024
2 parents 963c5a0 + 08ca207 commit 0982bdb
Show file tree
Hide file tree
Showing 36 changed files with 212 additions and 154 deletions.
3 changes: 2 additions & 1 deletion monitoring/mock_uss/ridsp/routes_ridsp_v19.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from uas_standards.interuss.automated_testing.rid.v1 import injection

from monitoring.monitorlib import geo
from monitoring.monitorlib.rid import RIDVersion
from monitoring.monitorlib.rid_automated_testing.injection_api import TestFlight
from monitoring.mock_uss import webapp
from monitoring.mock_uss.auth import requires_scope
Expand Down Expand Up @@ -70,7 +71,7 @@ def _get_report(
recent_states.sort(key=lambda p: p.timestamp)
result = RIDFlight(
id=details.id,
aircraft_type="NotDeclared", # TODO: Include aircraft_type in TestFlight API
aircraft_type=flight.get_aircraft_type(RIDVersion.f3411_19),
current_state=_make_state(recent_states[-1]),
simulated=True,
)
Expand Down
6 changes: 3 additions & 3 deletions monitoring/mock_uss/ridsp/routes_ridsp_v22a.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
from uas_standards.interuss.automated_testing.rid.v1 import injection

from monitoring.monitorlib import geo
from monitoring.monitorlib.rid import RIDVersion
from monitoring.monitorlib.rid_automated_testing.injection_api import TestFlight
from monitoring.monitorlib.rid_v2 import make_time
from monitoring.mock_uss import webapp
from monitoring.mock_uss.auth import requires_scope
from . import behavior
from .database import db
from ...monitorlib.rid_v2 import make_time


def _make_position(p: injection.RIDAircraftPosition) -> RIDAircraftPosition:
Expand Down Expand Up @@ -124,7 +124,7 @@ def _get_report(
recent_states.sort(key=lambda p: p.timestamp)
result = RIDFlight(
id=details.id,
aircraft_type="NotDeclared", # TODO: Include aircraft_type in TestFlight API
aircraft_type=flight.get_aircraft_type(RIDVersion.f3411_22a),
current_state=_make_state(recent_states[-1]),
simulated=True,
)
Expand Down
18 changes: 18 additions & 0 deletions monitoring/monitorlib/rid_automated_testing/injection_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
from uas_standards.interuss.automated_testing.rid.v1.injection import (
RIDFlightDetails,
RIDAircraftState,
UAType,
)

from monitoring.monitorlib.rid import RIDVersion

SCOPE_RID_QUALIFIER_INJECT = "rid.inject_test_data"


Expand Down Expand Up @@ -50,6 +53,21 @@ def get_id(self, t_now: datetime.datetime) -> Optional[str]:
details = self.get_details(t_now)
return details.id if details else None

def get_aircraft_type(self, rid_version: RIDVersion) -> UAType:
if not self.has_field_with_value("aircraft_type"):
return UAType.NotDeclared

# there exists a small difference in the enums between both versions of RID, this ensures we always return the expected one
if (
rid_version == RIDVersion.f3411_19
and self.aircraft_type == UAType.HybridLift
):
return UAType.VTOL
if rid_version == RIDVersion.f3411_22a and self.aircraft_type == UAType.VTOL:
return UAType.HybridLift

return self.aircraft_type

def order_telemetry(self):
self.telemetry = sorted(
self.telemetry, key=lambda telemetry: telemetry.timestamp.datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,21 +586,28 @@ def _update_links(element: marko.element.Element, origin_filename: str) -> None:
def _add_section_numbers(elements: Sequence[marko.element.Element]) -> None:
heading_level = 2
levels = [0]
headings = [None]
prev_heading = None
for i, element in enumerate(elements):
if isinstance(element, marko.block.Heading):
if element.level < heading_level:
levels = levels[0 : element.level - heading_level]
headings = headings[0 : element.level - heading_level]
heading_level = element.level
levels[-1] += 1
headings[-1] = text_of(element)
elif element.level == heading_level:
levels[-1] += 1
headings[-1] = text_of(element)
elif element.level == heading_level + 1:
levels.append(1)
headings.append(text_of(element))
heading_level += 1
else:
headings.append(text_of(element))
heading_trace = " -> ".join(headings)
raise ValueError(
f"Encountered a level {element.level} heading ({text_of(element)}) at element {i} following a level {heading_level} heading ({prev_heading}); expected heading levels to increase by 1 level at a time"
f"Encountered a level {element.level} heading ({text_of(element)}) at element {i} following a level {heading_level} heading ({prev_heading}); expected heading levels to increase by 1 level at a time. Trace: {heading_trace}"
)
prev_heading = text_of(element)
section_number = ".".join(str(level) for level in levels) + ". "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ def get_test_flights(self) -> List[TestFlight]:
details = TestFlightDetails(
effective_after=StringBasedDateTime(t0),
details=flight.flight_details,
aircraft_type=flight.aircraft_type,
)

test_flights.append(
TestFlight(
injection_id=str(uuid.uuid4()),
telemetry=telemetry,
details_responses=[details],
aircraft_type=flight.aircraft_type,
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ Optional scopes that will allow the scenario to provide additional coverage:

## Setup test case

### [Ensure clean workspace test step](../clean_workspace.md)
To perform this scenario, the area must be clear of test entities with the IDs we intend to use.

### Ensure clean workspace test step

#### [Clean any existing OIRs with known test IDs](../clean_workspace_op_intents.md)

#### [Clean any existing subscriptions with known test IDs](../clean_workspace_subs.md)

#### [Clean any existing constraint references with known test IDs](../clean_workspace_constraints.md)

This step ensures that the availability for the test identifier is set to `Unknown`.

Expand Down Expand Up @@ -540,7 +548,13 @@ it is in violation of **[astm.f3548.v21.DSS0005,4](../../../../../requirements/a

Check response format of a search.

## [Cleanup](../clean_workspace.md)
## Cleanup

### [Clean any existing OIRs with known test IDs](../clean_workspace_op_intents.md)

### [Clean any existing subscriptions with known test IDs](../clean_workspace_subs.md)

### [Clean any existing constraint references with known test IDs](../clean_workspace_constraints.md)

### [Availability can be requested](../fragments/availability/read.md)

Expand Down
45 changes: 0 additions & 45 deletions monitoring/uss_qualifier/scenarios/astm/utm/dss/clean_workspace.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ensure clean workspace test step fragment

Ensure a clean workspace for testing interactions with a DSS by removing any constraint references from the DSS that may have been left behind from testing efforts.

## 🛑 Constraint references can be queried by ID check

If an existing constraint reference cannot directly be queried by its ID, or if for a non-existing one the DSS replies with a status code different than 404,
the DSS implementation is in violation of **[astm.f3548.v21.DSS0005,3](../../../../requirements/astm/f3548/v21.md)**.

## 🛑 Constraint references can be searched for check

A client with valid credentials should be allowed to search for constraint references in a given area.
Otherwise, the DSS is not in compliance with **[astm.f3548.v21.DSS0005,4](../../../../requirements/astm/f3548/v21.md)**.

## 🛑 Constraint reference removed check

If an existing constraint cannot be deleted by its manager when providing the proper ID and OVN, the DSS implementation is in violation of
**[astm.f3548.v21.DSS0005,3](../../../../requirements/astm/f3548/v21.md)**.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ensure clean workspace test step fragment

Ensure a clean workspace for testing interactions with a DSS by removing any operational intent references from the DSS that may have been left behind from testing efforts.

## 🛑 Operational intent references can be queried by ID check

If an existing operational intent reference cannot directly be queried by its ID, or if for a non-existing one the DSS replies with a status code different than 404,
the DSS implementation is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**.

## 🛑 Operational intent references can be searched for check

A client with valid credentials should be allowed to search for operational intents in a given area.
Otherwise, the DSS is not in compliance with **[astm.f3548.v21.DSS0005,2](../../../../requirements/astm/f3548/v21.md)**.

## 🛑 Operational intent reference removed check

If an existing operational intent cannot be deleted when providing the proper ID and OVN, the DSS implementation is in violation of
**[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Ensure clean workspace test step fragment

Ensure a clean workspace for testing interactions with a DSS by removing any subscriptions from the DSS that may have been left behind from testing efforts.

## 🛑 Successful subscription search query check

**[astm.f3548.v21.DSS0005,5](../../../../requirements/astm/f3548/v21.md)** requires the implementation of the DSS endpoint to allow callers to retrieve the subscriptions they created.

## 🛑 Subscription can be queried by ID check

If the DSS cannot be queried for the existing test ID, the DSS is likely not implementing **[astm.f3548.v21.DSS0005,5](../../../../requirements/astm/f3548/v21.md)** correctly.

## 🛑 Subscription can be deleted check

**[astm.f3548.v21.DSS0005,5](../../../../requirements/astm/f3548/v21.md)** requires the implementation of the DSS endpoint to allow callers to delete subscriptions they created.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Verifies the behavior of a DSS for simple interactions pertaining to constraint

## Setup test case

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

This step ensures that no entities with the known test IDs exists in the DSS.

Expand Down Expand Up @@ -76,4 +76,4 @@ This step verifies that an existing CR cannot be mutated with an incorrect OVN.
If the DSS under test allows the qualifier to mutate an existing CR with a request that provided an incorrect OVN,
it is in violation of **[astm.f3548.v21.DSS0005,3](../../../../requirements/astm/f3548/v21.md)**

## [Cleanup](./clean_workspace.md)
## [Cleanup](./clean_workspace_constraints.md)
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ Checks that implicit subscriptions are properly created, mutated and cleaned up.

## Setup test case

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

This step ensures that no OIRs with the known test IDs exists in the DSS.
#### [Clean any existing OIRs with known test IDs](clean_workspace_op_intents.md)

#### [Clean any existing subscriptions with known test IDs](clean_workspace_subs.md)

## Single OIR implicit subscription is removed upon OIR deletion test case

Expand Down Expand Up @@ -142,9 +144,13 @@ the DSS is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements

This test case verifies that implicit subscriptions are properly removed if they become unnecessary following the mutation of an OIR.

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

<!-- TODO(Shastick): Why do we need to reclean the workspace at this point? We already ensured it was clean before starting the test; don't we know exactly what happened in the test and therefore know that it's already clean (or something failed)? If a previous test case created something that we don't need/want in later test cases, the original test case should clean up at the end of the test case. -->

#### [Clean any existing OIRs with known test IDs](clean_workspace_op_intents.md)

Reset the workspace for this test case.
#### [Clean any existing subscriptions with known test IDs](clean_workspace_subs.md)

### Create two OIRs with implicit subscription test step

Expand Down Expand Up @@ -190,9 +196,13 @@ the DSS is failing to properly manage implicit subscriptions for OIRs, and is th

This test case checks that a DSS will properly expand an implicit subscription to cover an OIR that is being attached to it.

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

<!-- TODO(Shastick): Why do we need to reclean the workspace at this point? We already ensured it was clean before starting the test; don't we know exactly what happened in the test and therefore know that it's already clean (or something failed)? If a previous test case created something that we don't need/want in later test cases, the original test case should clean up at the end of the test case. -->

#### [Clean any existing OIRs with known test IDs](clean_workspace_op_intents.md)

Reset the workspace for this test case.
#### [Clean any existing subscriptions with known test IDs](clean_workspace_subs.md)

### Create an OIR with implicit subscription test step

Expand Down Expand Up @@ -221,6 +231,8 @@ in which case the DSS is in violation of **[astm.f3548.v21.DSS0005,1](../../../.

Ensure that the attached implicit subscription has been expanded

## Cleanup

### [Remove OIRs created during this test](clean_workspace_op_intents.md)

## [Cleanup](./clean_workspace.md)
### [Remove subscriptions created during this test](clean_workspace_subs.md)
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ 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](clean_workspace.md) test step
### Ensure clean workspace test step

#### [Clean any existing OIRs](clean_workspace_op_intents.md)

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

Expand Down Expand Up @@ -110,4 +112,4 @@ in violation of **[astm.f3548.v21.OPIN0035](../../../../requirements/astm/f3548/
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)**.

## [Cleanup](clean_workspace.md)
## [Cleanup](clean_workspace_op_intents.md)
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ provide all OVNs for all currently relevant entities.

## Setup test case

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

This step ensures that no entities with the known test IDs exists in the DSS.
This step ensures that no operational intent references with the known test IDs exists in the DSS.

## Key validation on creation test case

Expand Down Expand Up @@ -141,4 +141,4 @@ The expectation is that the DSS will require the missing OVN.

#### [Non de-conflicted mutation request fails](fragments/oir/crud/update_conflict.md)

## [Cleanup](./clean_workspace.md)
## [Cleanup](./clean_workspace_op_intents.md)
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,6 @@ def _ensure_clean_workspace_step(self):
for oir_id in self._oir_ids:
test_step_fragments.cleanup_op_intent(self, self._dss, oir_id)

# Also drop any subs we might own and that could interfere
test_step_fragments.cleanup_active_subs(
self, self._dss, self._planning_area_volume4d.to_f3548v21()
)

def cleanup(self):
self.begin_cleanup()
self._ensure_clean_workspace_step()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ Verifies the behavior of a DSS for simple interactions pertaining to operational

## Setup test case

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

This step ensures that no entities with the known test IDs exists in the DSS.
#### [Clean any existing OIRs with known test IDs](clean_workspace_op_intents.md)

### [Create an operational intent reference test step](./fragments/oir/crud/create_query.md)
### Create an operational intent reference test step

Create an operational intent reference to be used in this scenario.
#### [Create an operational intent reference to be used in this scenario.](./fragments/oir/crud/create_query.md)

## Deletion requires correct OVN test case

Expand Down Expand Up @@ -76,4 +76,4 @@ This step verifies that an existing OIR cannot be mutated with an incorrect OVN.
If the DSS under test allows the qualifier to mutate an existing OIR with a request that provided an incorrect OVN,
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../requirements/astm/f3548/v21.md)**

## [Cleanup](./clean_workspace.md)
## [Cleanup](./clean_workspace_op_intents.md)
Loading

0 comments on commit 0982bdb

Please sign in to comment.