Skip to content

Commit c9d1631

Browse files
Add docstrings to classes missing documentation (#273)
Signed-off-by: Andriy Kokhan <[email protected]>
1 parent 00afb8d commit c9d1631

File tree

9 files changed

+55
-0
lines changed

9 files changed

+55
-0
lines changed

common/sai.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ def process_command(self, command):
219219

220220

221221
class Sai():
222+
"""
223+
Main SAI interface class for interacting with SAI objects.
224+
225+
Provides methods to create, remove, get, and set SAI objects and attributes.
226+
Handles metadata loading and command processing through CommandProcessor.
227+
"""
222228
metadata = None
223229

224230
def __init__(self, cfg):

common/sai_dataplane/sai_dataplane.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
class SaiDataPlane():
2+
"""
3+
Base class for SAI dataplane implementations.
4+
5+
Provides interface for packet transmission and reception in SAI test scenarios.
6+
"""
27
def __init__(self, cfg):
38
self.config = cfg
49
# used by dataplane_redirect() from ptf_testutils

common/sai_dataplane/snappi/sai_snappi_dataplane.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
BASE_TENGINE_PORT = 5555
99

1010
class SaiSnappiDataPlane(SaiDataPlane):
11+
"""
12+
Snappi-based dataplane implementation for SAI testing.
13+
14+
Uses the Snappi API for traffic generation and packet capture in SAI test scenarios.
15+
"""
1116

1217
def __init__(self, cfg):
1318
self.alias = cfg['alias']

common/sai_dataplane/utils/ptf_testutils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313

1414

1515
class SnappiDataPlaneUtilsWrapper:
16+
"""
17+
Wrapper for Snappi dataplane utilities.
18+
19+
Provides a singleton pattern wrapper around Snappi dataplane instances
20+
for packet verification and testing utilities.
21+
"""
1622

1723
_instances = {}
1824

common/sai_dpu.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66

77
class SaiDpu(Sai):
8+
"""
9+
SAI DPU (Data Processing Unit) interface.
10+
11+
Extends the base Sai class for managing DPU-specific SAI objects.
12+
"""
813

914
def __init__(self, cfg):
1015
cfg["client"]["config"]["asic_type"] = "dpu"

common/sai_dut.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99

1010
class SaiDut:
11+
"""
12+
Base class for SAI Device Under Test (DUT) implementations.
13+
14+
Manages connections and operations for devices being tested with SAI.
15+
"""
1116
def __init__(self, cfg):
1217
self.alias = cfg.get("alias", "default")
1318
self.server_ip = cfg.get("ip", "localhost")
@@ -70,6 +75,12 @@ def spawn(cfg) -> 'SaiDut':
7075

7176

7277
class SaiDutSonic(SaiDut):
78+
"""
79+
SONiC-specific SAI DUT implementation.
80+
81+
Extends SaiDut with SONiC-specific functionality for managing and testing
82+
SAI operations on SONiC network operating system.
83+
"""
7384
def __init__(self, cfg):
7485
super().__init__(cfg)
7586
self.port = cfg.get("port", "6379")

common/sai_npu.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88

99
class SaiNpu(Sai):
10+
"""
11+
SAI NPU (Network Processing Unit) interface.
12+
13+
Extends the base Sai class with NPU-specific functionality for managing
14+
network forwarding elements like FDB entries, VLAN members, and routes.
15+
"""
1016

1117
def __init__(self, cfg):
1218
cfg["client"]["config"]["asic_type"] = "npu"

common/sai_phy.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55

66
class SaiPhy(Sai):
7+
"""
8+
SAI PHY (Physical Layer) interface.
9+
10+
Extends the base Sai class for managing physical layer SAI objects.
11+
"""
712

813
def __init__(self, cfg):
914
cfg["client"]["config"]["asic_type"] = "phy"

common/sai_testbed.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313

1414

1515
class SaiTestbedMeta():
16+
"""
17+
Metadata container for SAI testbed configuration.
18+
19+
Loads and manages testbed configuration files including topology, SKU-specific
20+
settings, and test parameters.
21+
"""
1622

1723
def __init__(self, base_dir, name):
1824
self.base_dir = base_dir

0 commit comments

Comments
 (0)