From dce6c8a23a22ead062d389cad199ae7b6cee7389 Mon Sep 17 00:00:00 2001 From: Julien Perrochet Date: Sun, 24 Mar 2024 19:44:29 +0100 Subject: [PATCH] [uss_qualifier] check mutated OIRs properly propagate to every DSS (dss0210,2a-f slice 2/n) (#578) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DSS0210,2 sync OIRs – mutations --- .../op_intent_ref_synchronization.md | 37 +++++++++ .../op_intent_ref_synchronization.py | 83 +++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md b/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md index e6b7a13c97..0fca155e90 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md +++ b/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.md @@ -69,4 +69,41 @@ Verify that the operational intent reference returned by every DSS is correctly Verify that the operational intent reference's version fields are as expected. +### Mutate OIR test step + +This test step mutates the previously created operational intent reference to verify that the DSS reacts properly: notably, it checks that the operational intent reference version is updated, +including for changes that are not directly visible, such as changing the operational intent reference's footprint. + +#### [Update OIR](../fragments/oir/crud/update.md) + +Confirm that the operational intent reference can be mutated. + +#### [Validate OIR](../fragments/oir/validate/correctness.md) + +Verify that the operational intent reference returned by the DSS is properly formatted and contains the correct content. + +#### [OIR Versions are correct](../fragments/oir/validate/mutated.md) + +Verify that the operational intent reference's version fields have been updated. + +### Query updated OIR test step + +Query the updated operational intent reference at every DSS provided in `dss_instances`. + +#### [OIR is synchronized](../fragments/oir/sync.md) + +Confirm that the operational intent reference that was just mutated is properly synchronized across all DSS instances. + +#### [Get OIR](../fragments/oir/crud/read.md) + +Confirms that the operational intent reference that was just mutated can be retrieved from any DSS. + +#### [Validate OIR](../fragments/oir/validate/correctness.md) + +Verify that the operational intent reference returned by every DSS is correctly formatted and corresponds to what was mutated earlier. + +#### [OIR Versions are correct](../fragments/oir/validate/non_mutated.md) + +Verify that the operational intent reference's version fields are as expected. + ## [Cleanup](../clean_workspace.md) diff --git a/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.py b/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.py index d6a893404b..dabbff1ebf 100644 --- a/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.py +++ b/monitoring/uss_qualifier/scenarios/astm/utm/dss/synchronization/op_intent_ref_synchronization.py @@ -139,6 +139,14 @@ def run(self, context: ExecutionContext): self._query_secondaries_and_compare(self._oir_params) self.end_test_step() + self.begin_test_step("Mutate OIR") + self._test_mutate_oir_shift_time() + self.end_test_step() + + self.begin_test_step("Query updated OIR") + self._query_secondaries_and_compare(self._oir_params) + self.end_test_step() + self.end_test_case() self.end_test_scenario() @@ -326,6 +334,81 @@ def _validate_oir_from_secondary( expected_ovn=self._current_oir.ovn, ) + def _test_mutate_oir_shift_time(self): + """Mutate the OIR by adding 10 seconds to its start and end times. + This is achieved by updating the first and last element of the extents. + """ + op = self._oir_params + + new_extents = self._shift_extents(op.extents, timedelta(seconds=10)) + + new_params = PutOperationalIntentReferenceParameters( + extents=new_extents, + key=op.key + [self._current_oir.ovn], + state=op.state, + uss_base_url=op.uss_base_url, + subscription_id=op.subscription_id if "subscription_id" in op else None, + new_subscription=op.new_subscription if "new_subscription" in op else None, + ) + + with self.check( + "Mutate operational intent reference query succeeds", [self._primary_pid] + ) as check: + try: + oir, subs, q = self._dss.put_op_intent( + extents=new_extents, + key=new_params.key, + state=new_params.state, + base_url=new_params.uss_base_url, + oi_id=self._oir_id, + ovn=self._current_oir.ovn, + ) + self.record_query(q) + except QueryError as qe: + self.record_queries(qe.queries) + check.record_failed( + summary="Operational intent reference mutation failed", + details=qe.msg, + query_timestamps=qe.query_timestamps, + ) + return + + with self.check( + "Mutate operational intent reference response content is correct", + [self._primary_pid], + ) as check: + OIRValidator( + main_check=check, + scenario=self, + expected_manager=self._expected_manager, + participant_id=[self._primary_pid], + oir_params=new_params, + ).validate_mutated_oir( + expected_oir_id=self._oir_id, + mutated_oir=q, + previous_ovn=self._current_oir.ovn, + previous_version=self._current_oir.version, + ) + + self._oir_params = new_params + self._current_oir = oir + + def _shift_extents( + self, extents: List[api.Volume4D], delta: timedelta + ) -> List[api.Volume4D]: + return [ + api.Volume4D( + volume=ext.volume, + time_start=api.Time( + value=StringBasedDateTime(ext.time_start.value.datetime + delta) + ), + time_end=api.Time( + value=StringBasedDateTime(ext.time_end.value.datetime + delta) + ), + ) + for ext in extents + ] + def cleanup(self): self.begin_cleanup() self._ensure_clean_workspace_step()