Skip to content

Commit 96c825c

Browse files
committed
DSS02120,A2-7-2,7
Implement comments
1 parent 5ebbaab commit 96c825c

File tree

22 files changed

+1192
-46
lines changed

22 files changed

+1192
-46
lines changed

monitoring/monitorlib/mutate/scd.py

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
import s2sphere
55
import yaml
66
from implicitdict import ImplicitDict
7-
from uas_standards.astm.f3548.v21.api import OPERATIONS, OperationID, Subscription
7+
from uas_standards.astm.f3548.v21.api import (
8+
OPERATIONS,
9+
OperationID,
10+
Subscription,
11+
PutSubscriptionParameters,
12+
)
813
from yaml.representer import Representer
914

1015
from monitoring.monitorlib import fetch
@@ -74,18 +79,16 @@ def upsert_subscription(
7479
path = op.path.format(subscriptionid=subscription_id, version=version)
7580
query_type = QueryType.F3548v21DSSUpdateSubscription
7681

77-
body = {
78-
"extents": Volume4D.from_values(
79-
start_time,
80-
end_time,
81-
min_alt_m,
82-
max_alt_m,
83-
polygon=Polygon.from_latlng_rect(latlngrect=area),
84-
).to_f3548v21(),
85-
"uss_base_url": base_url,
86-
"notify_for_operational_intents": notify_for_op_intents,
87-
"notify_for_constraints": notify_for_constraints,
88-
}
82+
body = build_upsert_subscription_params(
83+
area_vertices=area,
84+
start_time=start_time,
85+
end_time=end_time,
86+
base_url=base_url,
87+
notify_for_op_intents=notify_for_op_intents,
88+
notify_for_constraints=notify_for_constraints,
89+
min_alt_m=min_alt_m,
90+
max_alt_m=max_alt_m,
91+
)
8992

9093
result = MutatedSubscription(
9194
fetch.query_and_describe(
@@ -102,6 +105,30 @@ def upsert_subscription(
102105
return result
103106

104107

108+
def build_upsert_subscription_params(
109+
area_vertices: s2sphere.LatLngRect,
110+
start_time: datetime.datetime,
111+
end_time: datetime.datetime,
112+
base_url: str,
113+
notify_for_op_intents: bool,
114+
notify_for_constraints: bool,
115+
min_alt_m: float,
116+
max_alt_m: float,
117+
) -> PutSubscriptionParameters:
118+
return PutSubscriptionParameters(
119+
extents=Volume4D.from_values(
120+
start_time,
121+
end_time,
122+
min_alt_m,
123+
max_alt_m,
124+
polygon=Polygon.from_latlng_rect(latlngrect=area_vertices),
125+
).to_f3548v21(),
126+
uss_base_url=base_url,
127+
notify_for_operational_intents=notify_for_op_intents,
128+
notify_for_constraints=notify_for_constraints,
129+
)
130+
131+
105132
def delete_subscription(
106133
utm_client: infrastructure.UTMClientSession,
107134
subscription_id: str,

monitoring/monitorlib/schema_validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class F3411_22a(str, Enum):
5050

5151
class F3548_21(str, Enum):
5252
OpenAPIPath = "interfaces/astm-utm/Protocol/utm.yaml"
53+
ErrorResponse = "components.schemas.ErrorResponse"
5354
GetOperationalIntentDetailsResponse = (
5455
"components.schemas.GetOperationalIntentDetailsResponse"
5556
)

monitoring/prober/infrastructure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def wrapper_default_scope(*args, **kwargs):
100100
resource_type_code_descriptions: Dict[ResourceType, str] = {}
101101

102102

103-
# Next code: 380
103+
# Next code: 381
104104
def register_resource_type(code: int, description: str) -> ResourceType:
105105
"""Register that the specified code refers to the described resource.
106106

monitoring/uss_qualifier/configurations/dev/f3548_self_contained.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ v1:
4949
# ASTM F3548-21 USS emulation roles
5050
- utm.strategic_coordination
5151
- utm.availability_arbitration
52+
# For authentication test purposes.
53+
# Remove if the authentication provider pointed to by AUTH_SPEC does not support it.
54+
- ""
5255

5356
# Means by which uss_qualifier can discover which subscription ('sub' claim of its tokes) it is described by
5457
utm_client_identity:

monitoring/uss_qualifier/configurations/dev/library/environment_containers.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ utm_auth:
2929
- utm.availability_arbitration
3030
# InterUSS versioning automated testing
3131
- interuss.versioning.read_system_versions
32+
# For authentication test purposes.
33+
# Remove if the authentication provider pointed to by AUTH_SPEC does not support it.
34+
- ""
3235

3336
second_utm_auth:
3437
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json

monitoring/uss_qualifier/configurations/dev/library/environment_localhost.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ utm_auth:
2929
- utm.availability_arbitration
3030
# InterUSS versioning automated testing
3131
- interuss.versioning.read_system_versions
32+
# For authentication test purposes
33+
- ""
3234

3335
second_utm_auth:
3436
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json

monitoring/uss_qualifier/resources/astm/f3548/v21/dss.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ def __init__(
446446
def can_use_scope(self, scope: str) -> bool:
447447
return scope in self._auth_adapter.scopes
448448

449+
def get_authorized_scopes(self) -> Set[str]:
450+
return self._auth_adapter.scopes.copy()
451+
449452
def get_instance(self, scopes_required: Dict[str, str]) -> DSSInstance:
450453
"""Get a client object ready to be used.
451454

monitoring/uss_qualifier/resources/astm/f3548/v21/planning_area.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,18 @@ def get_new_operational_intent_ref_params(
6868
uss_base_url: UssBaseURL,
6969
time_start: datetime.datetime,
7070
time_end: datetime.datetime,
71-
subscription_id: Optional[EntityID] = None,
71+
subscription_id: Optional[EntityID],
7272
implicit_sub_base_url: Optional[UssBaseURL] = None,
7373
implicit_sub_for_constraints: Optional[bool] = None,
7474
) -> PutOperationalIntentReferenceParameters:
7575
"""
7676
Builds a PutOperationalIntentReferenceParameters object that can be used against the DSS OIR API.
77+
7778
The extents contained in these parameters contain a single 4DVolume, which may not be entirely realistic,
7879
but is sufficient in situations where the content of the OIR is irrelevant as long as it is valid, such
7980
as for testing authentication or parameter validation.
80-
Note that this method allows building inconsistent parameters.
81+
82+
Note that this method allows building inconsistent parameters:
8183
"""
8284
return PutOperationalIntentReferenceParameters(
8385
extents=[

monitoring/uss_qualifier/resources/astm/f3548/v21/subscription_params.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import datetime
22
from typing import List, Optional, Self
33

4+
import s2sphere
45
from implicitdict import ImplicitDict
6+
from uas_standards.astm.f3548.v21.api import PutSubscriptionParameters
57

68
from monitoring.monitorlib.geo import LatLngPoint
9+
from monitoring.monitorlib.mutate import scd as mutate
710

811

912
class SubscriptionParams(ImplicitDict):
@@ -44,3 +47,28 @@ class SubscriptionParams(ImplicitDict):
4447

4548
def copy(self) -> Self:
4649
return SubscriptionParams(super().copy())
50+
51+
def to_upsert_subscription_params(
52+
self, area: s2sphere.LatLngRect
53+
) -> PutSubscriptionParameters:
54+
"""
55+
Prepares the subscription parameters to be used in the body of an HTTP request
56+
to create or update a subscription on the DSS in the SCD context.
57+
58+
Args:
59+
area: area to include in the subscription parameters
60+
61+
Returns:
62+
A dict to be passed as the request body when calling the subscription creation or update API.
63+
64+
"""
65+
return mutate.build_upsert_subscription_params(
66+
area_vertices=area,
67+
start_time=self.start_time,
68+
end_time=self.end_time,
69+
base_url=self.base_url,
70+
notify_for_op_intents=self.notify_for_op_intents,
71+
notify_for_constraints=self.notify_for_constraints,
72+
min_alt_m=self.min_alt_m,
73+
max_alt_m=self.max_alt_m,
74+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .authentication_validation import AuthenticationValidation
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# ASTM SCD DSS: Interfaces authentication test scenario
2+
3+
## Overview
4+
5+
Ensures that a DSS properly authenticates requests to all its endpoints.
6+
7+
Note that this does not cover authorization.
8+
9+
## Resources
10+
11+
### dss
12+
13+
[`DSSInstanceResource`](../../../../../resources/astm/f3548/v21/dss.py) to be tested in this scenario.
14+
15+
Note that to benefit from the maximum coverage, the DSS' AuthAdapterResource must be able to obtain credentials
16+
for multiple scopes (so that a wrong scope may be used in place of the correct one) as well as an empty scope (that is, provide credentials where the scope is an empty string).
17+
18+
This scenario will check for the scope's availability and transparently ignore checks that can't be conducted.
19+
20+
Required scopes for running this scenario:
21+
22+
- `utm.strategic_coordination`
23+
24+
Optional scopes that will allow the scenario to provide additional coverage:
25+
26+
- `utm.availability_arbitration`
27+
- `""` (empty string)
28+
29+
### id_generator
30+
31+
[`IDGeneratorResource`](../../../../../resources/interuss/id_generator.py) providing the Subscription ID for this scenario.
32+
33+
### planning_area
34+
35+
[`PlanningAreaResource`](../../../../../resources/astm/f3548/v21/planning_area.py) describes the 3D volume in which entities will be created.
36+
37+
## Setup test case
38+
39+
### [Ensure clean workspace test step](../clean_workspace.md)
40+
41+
This step ensures that no entity with the known test IDs exists in the DSS.
42+
43+
## Endpoint authorization test case
44+
45+
This test case ensures that the DSS properly authenticates requests to all its endpoints.
46+
47+
### Subscription endpoints authentication test step
48+
49+
#### 🛑 Unauthorized requests return the proper error message body check
50+
51+
If the DSS under test does not return a proper error message body when an unauthorized request is received, it fails to properly implement the OpenAPI specification that is part of **[astm.f3548.v21.DSS0005,5](../../../../../requirements/astm/f3548/v21.md)**.
52+
53+
#### 🛑 Create subscription with missing credentials check
54+
55+
If the DSS under test allows the creation of a subscription without any credentials being presented, it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
56+
57+
#### 🛑 Create subscription with invalid credentials check
58+
59+
If the DSS under test allows the creation of a subscription with credentials that are well-formed but invalid,
60+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
61+
62+
#### 🛑 Create subscription with missing scope check
63+
64+
If the DSS under test allows the creation of a subscription with valid credentials but a missing scope,
65+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
66+
67+
#### 🛑 Create subscription with incorrect scope check
68+
69+
If the DSS under test allows the creation of a subscription with valid credentials but an incorrect scope,
70+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
71+
72+
#### 🛑 Create subscription with valid credentials check
73+
74+
If the DSS does not allow the creation of a subscription when valid credentials are presented,
75+
it is in violation of **[astm.f3548.v21.DSS0005,5](../../../../../requirements/astm/f3548/v21.md)**.
76+
77+
#### 🛑 Get subscription with missing credentials check
78+
79+
If the DSS under test allows the fetching of a subscription without any credentials being presented, it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
80+
81+
#### 🛑 Get subscription with invalid credentials check
82+
83+
If the DSS under test allows the fetching of a subscription with credentials that are well-formed but invalid,
84+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
85+
86+
#### 🛑 Get subscription with missing scope check
87+
88+
If the DSS under test allows the fetching of a subscription with valid credentials but a missing scope,
89+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
90+
91+
#### 🛑 Get subscription with incorrect scope check
92+
93+
If the DSS under test allows the fetching of a subscription with valid credentials but an incorrect scope,
94+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
95+
96+
#### 🛑 Get subscription with valid credentials check
97+
98+
If the DSS does not allow fetching a subscription when valid credentials are presented,
99+
it is in violation of **[astm.f3548.v21.DSS0005,5](../../../../../requirements/astm/f3548/v21.md)**.
100+
101+
#### 🛑 Mutate subscription with missing credentials check
102+
103+
If the DSS under test allows the mutation of a subscription without any credentials being presented,
104+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
105+
106+
#### 🛑 Mutate subscription with invalid credentials check
107+
108+
If the DSS under test allows the mutation of a subscription with credentials that are well-formed but invalid,
109+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
110+
111+
#### 🛑 Mutate subscription with missing scope check
112+
113+
If the DSS under test allows the mutation of a subscription with valid credentials but a missing scope,
114+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
115+
116+
#### 🛑 Mutate subscription with incorrect scope check
117+
118+
If the DSS under test allows the mutation of a subscription with valid credentials but an incorrect scope,
119+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
120+
121+
#### 🛑 Mutate subscription with valid credentials check
122+
123+
If the DSS does not allow the mutation of a subscription when valid credentials are presented,
124+
it is in violation of **[astm.f3548.v21.DSS0005,5](../../../../../requirements/astm/f3548/v21.md)**.
125+
126+
#### 🛑 Delete subscription with missing credentials check
127+
128+
If the DSS under test allows the deletion of a subscription without any credentials being presented,
129+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
130+
131+
#### 🛑 Delete subscription with invalid credentials check
132+
133+
If the DSS under test allows the deletion of a subscription with credentials that are well-formed but invalid,
134+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
135+
136+
#### 🛑 Delete subscription with missing scope check
137+
138+
If the DSS under test allows the deletion of a subscription with valid credentials but a missing scope,
139+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
140+
141+
#### 🛑 Delete subscription with incorrect scope check
142+
143+
If the DSS under test allows the deletion of a subscription with valid credentials but an incorrect scope,
144+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
145+
146+
#### 🛑 Delete subscription with valid credentials check
147+
148+
If the DSS does not allow the deletion of a subscription when valid credentials are presented,
149+
it is in violation of **[astm.f3548.v21.DSS0005,5](../../../../../requirements/astm/f3548/v21.md)**.
150+
151+
#### 🛑 Search subscriptions with missing credentials check
152+
153+
If the DSS under test allows searching for subscriptions without any credentials being presented,
154+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
155+
156+
#### 🛑 Search subscriptions with invalid credentials check
157+
158+
If the DSS under test allows searching for subscriptions with credentials that are well-formed but invalid,
159+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
160+
161+
#### 🛑 Search subscriptions with missing scope check
162+
163+
If the DSS under test allows searching for subscriptions with valid credentials but a missing scope,
164+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
165+
166+
#### 🛑 Search subscriptions with incorrect scope check
167+
168+
If the DSS under test allows searching for subscriptions with valid credentials but an incorrect scope,
169+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
170+
171+
#### 🛑 Search subscriptions with valid credentials check
172+
173+
If the DSS does not allow searching for subscriptions when valid credentials are presented,
174+
it is in violation of **[astm.f3548.v21.DSS0005,5](../../../../../requirements/astm/f3548/v21.md)**.
175+
176+
## [Cleanup](../clean_workspace.md)
177+
178+
The cleanup phase of this test scenario removes the subscription with the known test ID if it has not been removed before.

0 commit comments

Comments
 (0)