diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/isa_subscription_interactions.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/isa_subscription_interactions.py index 22ab4cf477..8cfd51ffb9 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/isa_subscription_interactions.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/isa_subscription_interactions.py @@ -298,7 +298,7 @@ def _delete_isa_if_exists(self): ) def _clean_any_sub(self): - utils.delete_any_subscription(self, self._dss_wrapper, self._isa.footprint) + self._dss_wrapper.cleanup_subs_in_area(self._isa_area) def cleanup(self): self.begin_cleanup() diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/subscription_validation.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/subscription_validation.py index b2ef5419c3..296e7f748e 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/subscription_validation.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/subscription_validation.py @@ -1,12 +1,7 @@ -from datetime import timedelta - -import arrow import datetime +from typing import Dict -from monitoring.monitorlib import schema_validation -from monitoring.monitorlib.fetch import rid as fetch -from monitoring.monitorlib.mutate import rid as mutate -from monitoring.monitorlib.rid import RIDVersion +from monitoring.monitorlib.mutate.rid import ChangedSubscription from monitoring.prober.infrastructure import register_resource_type from monitoring.uss_qualifier.common_data_definitions import Severity from monitoring.uss_qualifier.resources.astm.f3411.dss import DSSInstanceResource @@ -18,10 +13,6 @@ GenericTestScenario, PendingCheck, ) -from monitoring.monitorlib.mutate.rid import ChangedSubscription - -from typing import Dict - _24H_MIN_TOLERANCE_S = 23 * 3600 + 59 * 60 # 23 hours and 59 minutes _24H_MAX_TOLERANCE_S = 24 * 3600 + 1 # 24 hours sharp, plus a second @@ -54,6 +45,7 @@ def __init__( # for creating different subscriptions this probably won't do. self._sub_id = id_generator.id_factory.make_id(self.SUB_TYPE) self._isa = isa.specification + self._isa_area = [vertex.as_s2sphere() for vertex in self._isa.footprint] def run(self): self.begin_test_scenario() @@ -78,7 +70,7 @@ def _setup_case(self): self.end_test_case() def _clean_any_sub(self): - utils.delete_any_subscription(self, self._dss_wrapper, self._isa.footprint) + self._dss_wrapper.cleanup_subs_in_area(self._isa_area) def _ensure_clean_workspace_step(self): self.begin_test_step("Ensure clean workspace") @@ -218,7 +210,7 @@ def _check_properly_truncated( query_timestamps=[changed.query.request.timestamp], ) # If a subscription was created, we want to delete it before continuing: - self._dss_wrapper.cleanup_sub(check, sub_id=self._sub_id) + self._dss_wrapper.cleanup_sub(sub_id=self._sub_id) def _default_subscription_params(self, duration: datetime.timedelta) -> Dict: now = datetime.datetime.utcnow() diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/utils.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/utils.py index 3a9627f86c..ed2fa86ca2 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/utils.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/utils.py @@ -63,29 +63,3 @@ def delete_isa_if_exists( f"Attempting to notify subscriber for ISA {isa_id} at {subscriber_url} resulted in {notification.status_code}", query_timestamps=[notification.query.request.timestamp], ) - - -def delete_any_subscription( - scenario: GenericTestScenario, - dss_wrapper: DSSWrapper, - area: List[LatLngPoint], -): - """ - Deletes any subscription that is returned for the passed area. - - Args: - scenario: the scenario instance that will provide the checks - dss_wrapper: the dss on which to delete subscriptions - area: the area for which subscriptions are to be deleted - """ - with scenario.check( - "Successful subscription query", [dss_wrapper.participant_id] - ) as check: - fetched = dss_wrapper.search_subs( - check, [vertex.as_s2sphere() for vertex in area] - ) - for sub_id in fetched.subscriptions.keys(): - with scenario.check( - "Successful subscription deletion", [dss_wrapper.participant_id] - ) as check: - dss_wrapper.cleanup_sub(check, sub_id=sub_id) diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py index e10e3bad75..485e2fa61f 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/common/dss_interoperability.py @@ -767,14 +767,9 @@ def cleanup(self): ) elif entity.type == EntityType.Sub: - with self.check( - "Subscription deleted with proper response", - [self._dss_primary.participant_id], - ) as check: - _ = self._dss_primary.cleanup_sub( - check, - sub_id=entity.uuid, - ) + _ = self._dss_primary.cleanup_sub( + sub_id=entity.uuid, + ) else: raise RuntimeError(f"Unknown Entity type: {entity.type}") diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py b/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py index e49500a326..1a300f51c9 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py @@ -839,9 +839,45 @@ def del_sub( "DSS query was not successful, but a High Severity issue didn't interrupt execution" ) + def cleanup_subs_in_area( + self, + area: List[s2sphere.LatLng], + ): + """Cleanup any subscription that is returned for the search in the provided area""" + + with self._scenario.check( + "Successful subscription search query", [self.participant_id] + ) as check: + found_subs = self.search_subs(check, area) + + try: + for sub_id, sub in found_subs.subscriptions.items(): + with self._scenario.check( + "Subscription can be deleted", [self.participant_id] + ) as check: + del_sub = mutate.delete_subscription( + subscription_id=sub_id, + subscription_version=sub.version, + rid_version=self._dss.rid_version, + utm_client=self._dss.client, + participant_id=self._dss.participant_id, + ) + + self._handle_query_result( + check, + del_sub, + f"Failed to delete subscription {sub}", + {404, 200}, + Severity.Medium, + ) + except QueryError as e: + self._handle_query_error(check, e) + raise RuntimeError( + "DSS query was not successful, but a High Severity issue didn't interrupt execution" + ) + def cleanup_sub( self, - check: PendingCheck, sub_id: str, ) -> Optional[ChangedSubscription]: """Cleanup a subscription at the DSS. Does not fail if it is not found. @@ -850,39 +886,45 @@ def cleanup_sub( :return: the DSS response if the subscription exists """ try: - sub = fetch.subscription( - subscription_id=sub_id, - rid_version=self._dss.rid_version, - session=self._dss.client, - participant_id=self._dss.participant_id, - ) + with self._scenario.check( + "Subscription can be queried by ID", [self.participant_id] + ) as check: + sub = fetch.subscription( + subscription_id=sub_id, + rid_version=self._dss.rid_version, + session=self._dss.client, + participant_id=self._dss.participant_id, + ) - self._handle_query_result( - check, - sub, - f"Failed to get subscription {sub_id}", - {404, 200}, - Severity.Medium, - ) + self._handle_query_result( + check, + sub, + f"Failed to get subscription {sub_id}", + {404, 200}, + Severity.Medium, + ) if sub.status_code == 404: return None - del_sub = mutate.delete_subscription( - subscription_id=sub_id, - subscription_version=sub.subscription.version, - rid_version=self._dss.rid_version, - utm_client=self._dss.client, - participant_id=self._dss.participant_id, - ) + with self._scenario.check( + "Subscription can be deleted", [self.participant_id] + ) as check: + del_sub = mutate.delete_subscription( + subscription_id=sub_id, + subscription_version=sub.subscription.version, + rid_version=self._dss.rid_version, + utm_client=self._dss.client, + participant_id=self._dss.participant_id, + ) - self._handle_query_result( - check, - del_sub, - f"Failed to delete subscription {sub_id}", - {404, 200}, - Severity.Medium, - ) + self._handle_query_result( + check, + del_sub, + f"Failed to delete subscription {sub_id}", + {404, 200}, + Severity.Medium, + ) return del_sub diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/isa_subscription_interactions.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/isa_subscription_interactions.md index db583beff8..fc6414d0fb 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/isa_subscription_interactions.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/isa_subscription_interactions.md @@ -38,7 +38,7 @@ If an ISA with the intended ID is already present in the DSS, it needs to be rem When a pre-existing ISA needs to be deleted to ensure a clean workspace, any subscribers to ISAs in that area must be notified (as specified by the DSS). If a notification cannot be delivered, then the **[astm.f3411.v19.NET0730](../../../../../requirements/astm/f3411/v19.md)** requirement to implement the POST ISAs endpoint isn't met. -#### Successful subscription query check +#### Successful subscription search query check **[astm.f3411.v19.DSS0030,f](../../../../../requirements/astm/f3411/v19.md)** requires the implementation of the DSS endpoint to allow callers to retrieve the subscriptions they created. @@ -139,7 +139,7 @@ If an ISA with the intended ID is already present in the DSS, it needs to be rem When a pre-existing ISA needs to be deleted to ensure a clean workspace, any subscribers to ISAs in that area must be notified (as specified by the DSS). If a notification cannot be delivered, then the **[astm.f3411.v19.NET0730](../../../../../requirements/astm/f3411/v19.md)** requirement to implement the POST ISAs endpoint isn't met. -#### Successful subscription query check +#### Successful subscription search query check **[astm.f3411.v19.DSS0030,f](../../../../../requirements/astm/f3411/v19.md)** requires the implementation of the DSS endpoint to allow callers to retrieve the subscriptions they created. diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/subscription_validation.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/subscription_validation.md index 7b987cc193..c4dbf8e447 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/subscription_validation.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss/subscription_validation.md @@ -24,11 +24,11 @@ Perform basic operations on a single DSS instance to create subscriptions and ch This step ensures that we remove any subscription that may already exist for the service area. First, the DSS is queried for any applicable existing subscriptions, and then any subscriptions found are deleted. -#### Successful subscription query check +#### Successful subscription search query check -If the query for subscriptions fails, **[astm.f3411.v19.DSS0030,f](../../../../../requirements/astm/f3411/v19.md)** was not met. +If the search query for subscriptions fails, **[astm.f3411.v19.DSS0030,f](../../../../../requirements/astm/f3411/v19.md)** was not met. -#### Successful subscription deletion +#### Subscription can be deleted check If the deletion attempt fails, **[astm.f3411.v19.DSS0030,d](../../../../../requirements/astm/f3411/v19.md)** was not met. @@ -56,11 +56,11 @@ it will not have performed the Subscription count validation as defined in **[as Clean up any subscriptions created. -#### Successful subscription query check +#### Successful subscription search query check If the query for subscriptions fails, **[astm.f3411.v19.DSS0030,f](../../../../../requirements/astm/f3411/v19.md)** was not met. -#### Successful subscription deletion check +#### Subscription can be deleted check If the deletion attempt fails, **[astm.f3411.v19.DSS0030,d](../../../../../requirements/astm/f3411/v19.md)** was not met. @@ -101,10 +101,10 @@ The ability to delete an existing subscription is required in **[astm.f3411.v19. The cleanup phase of this test scenario will remove any subscription that may have been created during the test and that intersects with the test ISA. -### Successful subscription query check +### Successful subscription search query check If the query for subscriptions fails, the "GET Subscriptions" portion of **[astm.f3411.v19.DSS0030,f](../../../../../requirements/astm/f3411/v19.md)** was not met. -### Successful subscription deletion +### Subscription can be deleted check If the deletion attempt fails, the "DELETE Subscription" portion of **[astm.f3411.v19.DSS0030,d](../../../../../requirements/astm/f3411/v19.md)** was not met. diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss_interoperability.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss_interoperability.md index ed3aa4be6e..0c42bf65a8 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss_interoperability.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v19/dss_interoperability.md @@ -331,6 +331,10 @@ Any entities (ISAs or Subscriptions) not deleted normally will be deleted here. **[astm.f3411.v19.DSS0130,A2-6-1,2a](../../../../requirements/astm/f3411/v19.md)** -### Subscription deleted with proper response check +### Subscription can be queried by ID check + +**[astm.f3411.v19.DSS0130,A2-6-1,4a](../../../../requirements/astm/f3411/v19.md)** + +### Subscription can be deleted check **[astm.f3411.v19.DSS0130,A2-6-1,4a](../../../../requirements/astm/f3411/v19.md)** diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/isa_subscription_interactions.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/isa_subscription_interactions.md index f4e9e86e40..5ce9cfedaf 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/isa_subscription_interactions.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/isa_subscription_interactions.md @@ -38,7 +38,7 @@ If an ISA with the intended ID is already present in the DSS, it needs to be rem When a pre-existing ISA needs to be deleted to ensure a clean workspace, any subscribers to ISAs in that area must be notified (as specified by the DSS). If a notification cannot be delivered, then the **[astm.f3411.v22a.NET0730](../../../../../requirements/astm/f3411/v22a.md)** requirement to implement the POST ISAs endpoint isn't met. -#### Successful subscription query check +#### Successful subscription search query check **[astm.f3411.v22a.DSS0030,f](../../../../../requirements/astm/f3411/v22a.md)** requires the implementation of the DSS endpoint to allow callers to retrieve the subscriptions they created. @@ -139,7 +139,7 @@ If an ISA with the intended ID is already present in the DSS, it needs to be rem When a pre-existing ISA needs to be deleted to ensure a clean workspace, any subscribers to ISAs in that area must be notified (as specified by the DSS). If a notification cannot be delivered, then the **[astm.f3411.v22a.NET0730](../../../../../requirements/astm/f3411/v22a.md)** requirement to implement the POST ISAs endpoint isn't met. -#### Successful subscription query check +#### Successful subscription search query check **[astm.f3411.v22a.DSS0030,f](../../../../../requirements/astm/f3411/v22a.md)** requires the implementation of the DSS endpoint to allow callers to retrieve the subscriptions they created. diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/subscription_validation.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/subscription_validation.md index d92aa31975..e3067824b0 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/subscription_validation.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss/subscription_validation.md @@ -24,11 +24,11 @@ Perform basic operations on a single DSS instance to create subscriptions and ch This step ensures that we remove any subscription that may already exist for the service area. First, the DSS is queried for any applicable existing subscriptions, and then any subscriptions found are deleted. -#### Successful subscription query check +#### Successful subscription search query check -If the query for subscriptions fails, **[astm.f3411.v22a.DSS0030,f](../../../../../requirements/astm/f3411/v22a.md)** was not met. +If the search query for subscriptions fails, **[astm.f3411.v22a.DSS0030,f](../../../../../requirements/astm/f3411/v22a.md)** was not met. -#### Successful subscription deletion +#### Subscription can be deleted check If the deletion attempt fails, **[astm.f3411.v22a.DSS0030,d](../../../../../requirements/astm/f3411/v22a.md)** was not met. @@ -56,11 +56,11 @@ it will not have performed the Subscription count validation as defined in **[as Clean up any subscriptions created. -#### Successful subscription query check +#### Successful subscription search query check If the query for subscriptions fails, **[astm.f3411.v22a.DSS0030,f](../../../../../requirements/astm/f3411/v22a.md)** was not met. -#### Successful subscription deletion check +#### Subscription can be deleted check If the deletion attempt fails, **[astm.f3411.v22a.DSS0030,d](../../../../../requirements/astm/f3411/v22a.md)** was not met. @@ -101,10 +101,10 @@ The ability to delete an existing subscription is required in **[astm.f3411.v22a The cleanup phase of this test scenario will remove any subscription that may have been created during the test and that intersects with the test ISA. -### Successful subscription query check +### Successful subscription search query check If the query for subscriptions fails, the "GET Subscriptions" portion of **[astm.f3411.v22a.DSS0030,f](../../../../../requirements/astm/f3411/v22a.md)** was not met. -### Successful subscription deletion +### Subscription can be deleted check If the deletion attempt fails, the "DELETE Subscription" portion of **[astm.f3411.v22a.DSS0030,d](../../../../../requirements/astm/f3411/v22a.md)** was not met. diff --git a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss_interoperability.md b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss_interoperability.md index 7c03d9a41c..2e1cd00015 100644 --- a/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss_interoperability.md +++ b/monitoring/uss_qualifier/scenarios/astm/netrid/v22a/dss_interoperability.md @@ -330,6 +330,10 @@ Any entities (ISAs or Subscriptions) not deleted normally will be deleted here. **[astm.f3411.v22a.DSS0130,A2-6-1,2a](../../../../requirements/astm/f3411/v22a.md)** -### Subscription deleted with proper response check +### Subscription can be queried by ID check + +**[astm.f3411.v22a.DSS0130,A2-6-1,4a](../../../../requirements/astm/f3411/v22a.md)** + +### Subscription can be deleted check **[astm.f3411.v22a.DSS0130,A2-6-1,4a](../../../../requirements/astm/f3411/v22a.md)**