-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[uss_qualifier/scenarios/utm/dss] Add (partially implemented) availab…
…ility arbitration scenario
- Loading branch information
Showing
10 changed files
with
135 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .subscription_validation import SubscriptionValidation | ||
from .subscription_simple import SubscriptionSimple | ||
from .crdb_access import CRDBAccess | ||
from .availability_arbitration import AvailabilityArbitration |
25 changes: 25 additions & 0 deletions
25
monitoring/uss_qualifier/scenarios/astm/utm/dss/availability_arbitration.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# ASTM SCD DSS: Availability Arbitration test scenario | ||
|
||
## Overview | ||
|
||
Ensures that a DSS properly enforces limitations on created subscriptions | ||
|
||
## Resources | ||
|
||
### dss | ||
|
||
[`DSSInstanceResource`](../../../../resources/astm/f3548/v21/dss.py) to be tested in this scenario. | ||
|
||
## DSS Report test case | ||
|
||
This test attempts to submit to the DSS a report about a communication issue with a USS that might otherwise go unnoticed. | ||
A dummy `getOperationalIntentDetails` query is made to a non-existent USS in order to produce a realistic report, as if a USS was not reachable when trying to retrieve one of its operational intent. | ||
|
||
### Make valid DSS report test step | ||
|
||
#### [Make report to DSS](../make_dss_report.md) | ||
|
||
|
||
## USS Availability test case | ||
|
||
TODO: migrate [`test_uss_availability` prober test](../../../../../prober/scd/test_uss_availability.py) |
68 changes: 68 additions & 0 deletions
68
monitoring/uss_qualifier/scenarios/astm/utm/dss/availability_arbitration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from uas_standards.astm.f3548.v21.api import ExchangeRecord | ||
from uas_standards.astm.f3548.v21.constants import ( | ||
Scope, | ||
) | ||
|
||
from monitoring.monitorlib.fetch import QueryError | ||
from monitoring.uss_qualifier.resources.astm.f3548.v21.dss import DSSInstanceResource | ||
from monitoring.uss_qualifier.scenarios.astm.utm.test_steps import make_report | ||
|
||
from monitoring.uss_qualifier.scenarios.scenario import ( | ||
TestScenario, | ||
ScenarioCannotContinueError, | ||
) | ||
from monitoring.uss_qualifier.suites.suite import ExecutionContext | ||
|
||
from monitoring.monitorlib.clients import scd as scd_client | ||
from monitoring.monitorlib import scd as scd_lib | ||
|
||
|
||
class AvailabilityArbitration(TestScenario): | ||
def __init__( | ||
self, | ||
dss: DSSInstanceResource, | ||
): | ||
super().__init__() | ||
scopes = { | ||
Scope.AvailabilityArbitration: "get/set USS availability and submit DSS reports" | ||
} | ||
self._dss = dss.get_instance(scopes) | ||
|
||
def run(self, context: ExecutionContext): | ||
self.begin_test_scenario(context) | ||
|
||
self.begin_test_case("DSS Report") | ||
self._dss_report_case() | ||
self.end_test_case() | ||
|
||
self.begin_test_case("USS Availability") | ||
self._uss_availability_case() | ||
self.end_test_case() | ||
|
||
self.end_test_scenario() | ||
|
||
def _dss_report_case(self): | ||
def gen_record() -> ExchangeRecord: | ||
try: | ||
op_intent, _ = scd_client.get_operational_intent_details( | ||
self._dss.client, "http://dummy.interuss.org", "dummy_id" | ||
) | ||
except QueryError as qe: | ||
return scd_lib.make_exchange_record( | ||
qe.queries[0], "this is a dummy record created by the USS qualifier" | ||
) | ||
|
||
# we are not supposed to reach this state | ||
raise ScenarioCannotContinueError( | ||
"illegal state: get_operational_intent_details to a dummy USS did not raise a QueryError" | ||
) | ||
|
||
self.begin_test_step("Make valid DSS report") | ||
dummy_record = gen_record() | ||
report_id = make_report(self, self._dss, dummy_record) | ||
self.record_note(f"{self._dss.participant_id}/report_id", report_id) | ||
self.end_test_step() | ||
|
||
def _uss_availability_case(self): | ||
# TODO: implement me | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters