Skip to content
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
44 changes: 44 additions & 0 deletions tests/saitests/probe/observer_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""
Observer Configuration - Type-safe configuration using dataclass

Provides type-safe configuration for ProbingObserver instances.
Prevents field name typos and provides IDE autocomplete support.
"""

from dataclasses import dataclass
from typing import Dict, Optional


@dataclass
class ObserverConfig:
"""
Type-safe configuration for ProbingObserver

This dataclass ensures compile-time field validation and prevents
configuration errors through IDE autocomplete and type checking.

Attributes:
probe_target: Target type being probed (e.g., "pfc_xoff", "ingress_drop")
algorithm_name: Name of the probing algorithm
strategy: Algorithm strategy description
check_column_title: Check column title (e.g., "PfcXoff", "IngDrop")
context_template: Optional template for iteration context info
(e.g., " [{probe_target} upper bound: {window_upper}]")
completion_template: Template string for completion message
completion_format_type: Format type for completion message ("value" or "range")
table_column_mapping: Mapping of table columns to data fields
"""

probe_target: str
algorithm_name: str
strategy: str
check_column_title: str
context_template: Optional[str] = None
completion_template: Optional[str] = None
completion_format_type: str = "value"
table_column_mapping: Optional[Dict[str, Optional[str]]] = None

def __post_init__(self):
"""Initialize default values for mutable fields"""
if self.table_column_mapping is None:
self.table_column_mapping = {}
Loading
Loading