Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[uss_qualifier] Reduce check customization #403

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ v1:
artifacts:
output_path: output/message_signing
raw_report: {}
sequence_view: {}
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ def _evaluate_uas_id(self, value: Optional[UASID], participants: List[str]):
if not SerialNumber(serial_number).valid:
check.record_failed(
f"Invalid uas_id serial number: {serial_number}",
participants=participants,
severity=Severity.Medium,
)
else:
Expand Down Expand Up @@ -322,7 +321,7 @@ def _evaluate_arbitrary_uas_id(
self._test_scenario.check(
"UAS ID (Serial Number format) consistency with Common Dictionary",
participants,
).record_passed(participants)
).record_passed()

if value_obs is not None:
with self._test_scenario.check(
Expand Down Expand Up @@ -750,6 +749,7 @@ def _evaluate_operational_status(
if not value_obs == value_inj:
check.record_failed(
"Observed operational status inconsistent with injected one",
severity=Severity.Medium,
details=f"Injected operational status: {value_inj} - Observed {value_obs}",
)

Expand Down
5 changes: 0 additions & 5 deletions monitoring/uss_qualifier/scenarios/astm/netrid/dss_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def _handle_query_error(
self._scenario.record_query(q)
check.record_failed(
summary=f"Error when querying DSS",
participants=[self._dss.participant_id],
severity=Severity.High,
details=f"{str(e)}\n\nStack trace:\n{e.stacktrace}",
query_timestamps=[q.request.timestamp for q in e.queries],
Expand Down Expand Up @@ -115,7 +114,6 @@ def handle_query_result(
check.record_failed(
summary=fail_msg,
severity=severity,
participants=[self._dss.participant_id],
details=f"{fail_details}\n{q.status_code} response: "
+ "\n".join(q.errors)
if fail_details is not None
Expand Down Expand Up @@ -233,7 +231,6 @@ def get_isa(
check.record_failed(
summary=f"DSS did not return correct ISA",
severity=Severity.High,
participants=[self._dss.participant_id],
details=f"Expected ISA ID {isa_id} but got {isa.id}",
query_timestamps=[isa.query.request.timestamp],
)
Expand Down Expand Up @@ -692,7 +689,6 @@ def get_sub(
check.record_failed(
summary=f"DSS did not return correct subscription",
severity=Severity.High,
participants=[self._dss.participant_id],
details=f"Expected Subscription ID {sub_id} but got {sub.subscription.id}",
query_timestamps=[sub.query.request.timestamp],
)
Expand Down Expand Up @@ -892,7 +888,6 @@ def del_sub(
check.record_failed(
summary=f"Deleted subscription did not match",
severity=Severity.High,
participants=[self._dss.participant_id],
details=f"DSS reported deletion of version {sub_version} while expecting {del_sub.subscription.version}",
query_timestamps=[del_sub.query.request.timestamp],
)
Expand Down
28 changes: 5 additions & 23 deletions monitoring/uss_qualifier/scenarios/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,10 @@ def record_failed(
summary: str,
severity: Severity,
details: str = "",
participants: Optional[Union[ParticipantID, List[ParticipantID]]] = None,
query_timestamps: Optional[List[datetime]] = None,
additional_data: Optional[dict] = None,
requirements: Optional[Union[str, List[str]]] = None,
) -> None:
self._outcome_recorded = True
if isinstance(participants, str):
participants = [participants]
if participants is None:
participants = self._participants
if isinstance(requirements, str):
requirements = [requirements]
if requirements is None:
requirements = self._documentation.applicable_requirements

if (
self._stop_fast
Expand All @@ -126,9 +116,9 @@ def record_failed(
"timestamp": StringBasedDateTime(arrow.utcnow()),
"summary": summary,
"details": details,
"requirements": requirements,
"requirements": self._documentation.applicable_requirements,
"severity": severity,
"participants": participants,
"participants": self._participants,
}
if additional_data is not None:
kwargs["additional_data"] = additional_data
Expand All @@ -145,22 +135,14 @@ def record_failed(
if severity == Severity.Critical:
raise TestRunCannotContinueError(f"{severity}-severity issue: {summary}")

def record_passed(
self,
participants: Optional[List[ParticipantID]] = None,
requirements: Optional[List[str]] = None,
) -> None:
def record_passed(self) -> None:
self._outcome_recorded = True
if participants is None:
participants = self._participants
if requirements is None:
requirements = self._documentation.applicable_requirements

passed_check = PassedCheck(
name=self._documentation.name,
timestamp=StringBasedDateTime(arrow.utcnow()),
participants=participants,
requirements=requirements,
participants=self._participants,
requirements=self._documentation.applicable_requirements,
)
self._step_report.passed_checks.append(passed_check)

Expand Down
Loading