Skip to content

Commit a2dbc13

Browse files
committed
DSS0210,A2-7-2,7 OIR
1 parent 46c020a commit a2dbc13

File tree

5 files changed

+741
-4
lines changed

5 files changed

+741
-4
lines changed

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: 381
103+
# Next code: 382
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/scenarios/astm/utm/dss/authentication/authentication_validation.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,138 @@ it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../require
173173
If the DSS does not allow searching for subscriptions when valid credentials are presented,
174174
it is in violation of **[astm.f3548.v21.DSS0005,5](../../../../../requirements/astm/f3548/v21.md)**.
175175

176+
### Operational intents endpoints authentication test step
177+
178+
#### 🛑 Unauthorized requests return the proper error message body check
179+
180+
If the DSS under test does not return a proper error message body when an unauthorized request is received,
181+
it fails to properly implement the OpenAPI specification that is part of **[astm.f3548.v21.DSS0005,1](../../../../../requirements/astm/f3548/v21.md)**.
182+
183+
#### 🛑 Create operational intent reference with missing credentials check
184+
185+
If the DSS under test allows the creation of an operational intent without any credentials being presented,
186+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
187+
188+
#### 🛑 Create operational intent reference with invalid credentials check
189+
190+
If the DSS under test allows the creation of an operational intent with credentials that are well-formed but invalid,
191+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
192+
193+
#### 🛑 Create operational intent reference with missing scope check
194+
195+
If the DSS under test allows the creation of an operational intent with valid credentials but a missing scope,
196+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
197+
198+
#### 🛑 Create operational intent reference with incorrect scope check
199+
200+
If the DSS under test allows the creation of an operational intent with valid credentials but an incorrect scope,
201+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
202+
203+
#### 🛑 Create operational intent reference with valid credentials check
204+
205+
If the DSS does not allow the creation of an operational intent when valid credentials are presented,
206+
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../../requirements/astm/f3548/v21.md)**.
207+
208+
#### 🛑 Get operational intent reference with missing credentials check
209+
210+
If the DSS under test allows the fetching of an operational intent without any credentials being presented,
211+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
212+
213+
#### 🛑 Get operational intent reference with invalid credentials check
214+
215+
If the DSS under test allows the fetching of an operational intent with credentials that are well-formed but invalid,
216+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
217+
218+
#### 🛑 Get operational intent reference with missing scope check
219+
220+
If the DSS under test allows the fetching of an operational intent with valid credentials but a missing scope,
221+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
222+
223+
#### 🛑 Get operational intent reference with incorrect scope check
224+
225+
If the DSS under test allows the fetching of an operational intent with valid credentials but an incorrect scope,
226+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
227+
228+
#### 🛑 Get operational intent reference with valid credentials check
229+
230+
If the DSS does not allow fetching an operational intent when valid credentials are presented,
231+
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../../requirements/astm/f3548/v21.md)**.
232+
233+
#### 🛑 Mutate operational intent reference with missing credentials check
234+
235+
If the DSS under test allows the mutation of an operational intent without any credentials being presented,
236+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
237+
238+
#### 🛑 Mutate operational intent reference with invalid credentials check
239+
240+
If the DSS under test allows the mutation of an operational intent with credentials that are well-formed but invalid,
241+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
242+
243+
#### 🛑 Mutate operational intent reference with missing scope check
244+
245+
If the DSS under test allows the mutation of an operational intent with valid credentials but a missing scope,
246+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
247+
248+
#### 🛑 Mutate operational intent reference with incorrect scope check
249+
250+
If the DSS under test allows the mutation of an operational intent with valid credentials but an incorrect scope,
251+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
252+
253+
#### 🛑 Mutate operational intent reference with valid credentials check
254+
255+
If the DSS does not allow the mutation of an operational intent when valid credentials are presented,
256+
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../../requirements/astm/f3548/v21.md)**.
257+
258+
#### 🛑 Delete operational intent reference with missing credentials check
259+
260+
If the DSS under test allows the deletion of an operational intent without any credentials being presented,
261+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
262+
263+
#### 🛑 Delete operational intent reference with invalid credentials check
264+
265+
If the DSS under test allows the deletion of an operational intent with credentials that are well-formed but invalid,
266+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
267+
268+
#### 🛑 Delete operational intent reference with missing scope check
269+
270+
If the DSS under test allows the deletion of an operational intent with valid credentials but a missing scope,
271+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
272+
273+
#### 🛑 Delete operational intent reference with incorrect scope check
274+
275+
If the DSS under test allows the deletion of an operational intent with valid credentials but an incorrect scope,
276+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
277+
278+
#### 🛑 Delete operational intent reference with valid credentials check
279+
280+
If the DSS does not allow the deletion of an operational intent when valid credentials are presented,
281+
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../../requirements/astm/f3548/v21.md)**.
282+
283+
#### 🛑 Search operational intent references with missing credentials check
284+
285+
If the DSS under test allows searching for operational intents without any credentials being presented,
286+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
287+
288+
#### 🛑 Search operational intent references with invalid credentials check
289+
290+
If the DSS under test allows searching for operational intents with credentials that are well-formed but invalid,
291+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
292+
293+
#### 🛑 Search operational intent references with missing scope check
294+
295+
If the DSS under test allows searching for operational intents with valid credentials but a missing scope,
296+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
297+
298+
#### 🛑 Search operational intent references with incorrect scope check
299+
300+
If the DSS under test allows searching for operational intents with valid credentials but an incorrect scope,
301+
it is in violation of **[astm.f3548.v21.DSS0210,A2-7-2,7](../../../../../requirements/astm/f3548/v21.md)**.
302+
303+
#### 🛑 Search operational intent references with valid credentials check
304+
305+
If the DSS does not allow searching for operational intents when valid credentials are presented,
306+
it is in violation of **[astm.f3548.v21.DSS0005,1](../../../../../requirements/astm/f3548/v21.md)**.
307+
176308
## [Cleanup](../clean_workspace.md)
177309

178310
The cleanup phase of this test scenario removes the subscription with the known test ID if it has not been removed before.

monitoring/uss_qualifier/scenarios/astm/utm/dss/authentication/authentication_validation.py

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
)
77

88
from monitoring.monitorlib.auth import InvalidTokenSignatureAuth
9+
from monitoring.monitorlib.fetch import QueryError
910
from monitoring.monitorlib.geotemporal import Volume4D
1011
from monitoring.monitorlib.infrastructure import UTMClientSession
1112
from monitoring.prober.infrastructure import register_resource_type
@@ -18,6 +19,9 @@
1819
from monitoring.uss_qualifier.scenarios.astm.utm.dss.authentication.generic import (
1920
GenericAuthValidator,
2021
)
22+
from monitoring.uss_qualifier.scenarios.astm.utm.dss.authentication.oir_api_validator import (
23+
OperationalIntentRefAuthValidator,
24+
)
2125
from monitoring.uss_qualifier.scenarios.astm.utm.dss.authentication.sub_api_validator import (
2226
SubscriptionAuthValidator,
2327
)
@@ -37,7 +41,7 @@ class AuthenticationValidation(TestScenario):
3741
"""
3842

3943
SUB_TYPE = register_resource_type(
40-
380, "Subscription, Operational Entity Id, Constraint"
44+
381, "Subscription, Operational Entity Id, Constraint"
4145
)
4246

4347
# Reuse the same ID for every type of entity.
@@ -132,6 +136,19 @@ def __init__(
132136
test_missing_scope=self._test_missing_scope,
133137
)
134138

139+
self._oir_validator = OperationalIntentRefAuthValidator(
140+
scenario=self,
141+
generic_validator=generic_validator,
142+
dss=self._dss,
143+
test_id=self._test_id,
144+
planning_area=self._planning_area,
145+
planning_area_volume4d=self._planning_area_volume4d,
146+
no_auth_session=self._no_auth_session,
147+
invalid_token_session=self._invalid_token_session,
148+
test_wrong_scope=self._wrong_scope,
149+
test_missing_scope=self._test_missing_scope,
150+
)
151+
135152
def run(self, context: ExecutionContext):
136153
self.begin_test_scenario(context)
137154
self._setup_case()
@@ -152,8 +169,15 @@ def run(self, context: ExecutionContext):
152169

153170
self.begin_test_step("Subscription endpoints authentication")
154171
self._sub_validator.verify_sub_endpoints_authentication()
172+
155173
self.end_test_step()
156174

175+
self.begin_test_step("Operational intents endpoints authentication")
176+
self._oir_validator.verify_oir_endpoints_authentication()
177+
self.end_test_step()
178+
179+
# TODO consider adding test cases for:
180+
# - valid credentials without the required scopes
157181
self.end_test_case()
158182
self.end_test_scenario()
159183

@@ -173,6 +197,44 @@ def _ensure_clean_workspace_step(self):
173197
self.end_test_step()
174198

175199
def _ensure_test_entities_dont_exist(self):
200+
201+
# Drop OIR's first: subscriptions may be tied to them and can't be deleted
202+
# as long as they exist
203+
# TODO cleanly move this into the test fragments once most of the open PRs are merged
204+
with self.check(
205+
"Operational intent references can be queried by ID", self._pid
206+
) as check:
207+
try:
208+
oir, q = self._dss.get_op_intent_reference(self._test_id)
209+
self.record_query(q)
210+
except QueryError as qe:
211+
self.record_queries(qe.queries)
212+
if qe.queries[0].response.status_code == 404:
213+
return # All is good
214+
else:
215+
query = qe.queries[0]
216+
check.record_failed(
217+
summary=f"Could not query OIR {self._test_id}",
218+
details=f"When attempting to query OIR {self._test_id} from the DSS, received {query.response.status_code}: {qe.msg}",
219+
query_timestamps=[query.request.timestamp],
220+
)
221+
222+
with self.check(
223+
"Operational intent references can be deleted by their owner", self._pid
224+
):
225+
try:
226+
oir, subs, q = self._dss.delete_op_intent(oir.id, oir.ovn)
227+
self.record_query(q)
228+
except QueryError as qe:
229+
self.record_queries(qe.queries)
230+
query = qe.queries[0]
231+
check.record_failed(
232+
summary=f"Could not remove op intent reference {self._test_id}",
233+
details=f"When attempting to remove op intent reference {self._test_id} from the DSS, received {query.status_code}: {qe.msg}",
234+
query_timestamps=[query.request.timestamp],
235+
)
236+
self._dss.delete_op_intent(oir.id, oir.ovn)
237+
176238
test_step_fragments.cleanup_sub(self, self._dss, self._test_id)
177239

178240
def _ensure_no_active_subs_exist(self):

0 commit comments

Comments
 (0)