@@ -93,42 +93,14 @@ def __init__(self, test_instance):
9393
9494class IDMBaseTest (MatterBaseTest ):
9595 """Base test class for IDM tests with shared functionality."""
96-
96+
9797 ROOT_NODE_ENDPOINT_ID = 0
98-
99- # ========================================================================
100- # Type Validators
101- # ========================================================================
102-
103- @staticmethod
104- def is_valid_uint32_value (var ):
105- """Check if a value is a valid uint32.
106-
107- Args:
108- var: Value to check
109-
110- Returns:
111- True if value is a valid uint32, False otherwise
112- """
113- return isinstance (var , int ) and 0 <= var <= 0xFFFFFFFF
114-
115- @staticmethod
116- def is_valid_uint16_value (var ):
117- """Check if a value is a valid uint16.
118-
119- Args:
120- var: Value to check
121-
122- Returns:
123- True if value is a valid uint16, False otherwise
124- """
125- return isinstance (var , int ) and 0 <= var <= 0xFFFF
126-
98+
12799 # ========================================================================
128100 # Descriptor and Cluster Reading Utilities
129101 # ========================================================================
130102
131- async def get_descriptor_server_list (self , ctrl : ChipDeviceCtrl , ep : int = None ):
103+ async def get_descriptor_server_list (self , ctrl : ChipDeviceCtrl , ep : int = ROOT_NODE_ENDPOINT_ID ):
132104 """Read ServerList attribute from Descriptor cluster.
133105
134106 Args:
@@ -138,16 +110,14 @@ async def get_descriptor_server_list(self, ctrl: ChipDeviceCtrl, ep: int = None)
138110 Returns:
139111 ServerList attribute value
140112 """
141- if ep is None :
142- ep = self .ROOT_NODE_ENDPOINT_ID
143113 return await self .read_single_attribute_check_success (
144114 endpoint = ep ,
145115 dev_ctrl = ctrl ,
146116 cluster = Clusters .Descriptor ,
147117 attribute = Clusters .Descriptor .Attributes .ServerList
148118 )
149119
150- async def get_descriptor_parts_list (self , ctrl : ChipDeviceCtrl , ep : int = None ):
120+ async def get_descriptor_parts_list (self , ctrl : ChipDeviceCtrl , ep : int = ROOT_NODE_ENDPOINT_ID ):
151121 """Read PartsList attribute from Descriptor cluster.
152122
153123 Args:
@@ -157,16 +127,14 @@ async def get_descriptor_parts_list(self, ctrl: ChipDeviceCtrl, ep: int = None):
157127 Returns:
158128 PartsList attribute value
159129 """
160- if ep is None :
161- ep = self .ROOT_NODE_ENDPOINT_ID
162130 return await self .read_single_attribute_check_success (
163131 endpoint = ep ,
164132 dev_ctrl = ctrl ,
165133 cluster = Clusters .Descriptor ,
166134 attribute = Clusters .Descriptor .Attributes .PartsList
167135 )
168136
169- async def get_idle_mode_duration_sec (self , ctrl : ChipDeviceCtrl , ep : int = None ):
137+ async def get_idle_mode_duration_sec (self , ctrl : ChipDeviceCtrl , ep : int = ROOT_NODE_ENDPOINT_ID ):
170138 """Read IdleModeDuration attribute from ICD Management cluster.
171139
172140 Args:
@@ -176,8 +144,6 @@ async def get_idle_mode_duration_sec(self, ctrl: ChipDeviceCtrl, ep: int = None)
176144 Returns:
177145 IdleModeDuration attribute value in seconds
178146 """
179- if ep is None :
180- ep = self .ROOT_NODE_ENDPOINT_ID
181147 return await self .read_single_attribute_check_success (
182148 endpoint = ep ,
183149 dev_ctrl = ctrl ,
@@ -189,7 +155,7 @@ async def get_idle_mode_duration_sec(self, ctrl: ChipDeviceCtrl, ep: int = None)
189155 # ACL Management Functions
190156 # ========================================================================
191157
192- async def get_dut_acl (self , ctrl : ChipDeviceCtrl , ep : int = None ):
158+ async def get_dut_acl (self , ctrl : ChipDeviceCtrl , ep : int = ROOT_NODE_ENDPOINT_ID ):
193159 """Read the ACL attribute from the DUT.
194160
195161 Args:
@@ -199,8 +165,6 @@ async def get_dut_acl(self, ctrl: ChipDeviceCtrl, ep: int = None):
199165 Returns:
200166 ACL list from the DUT
201167 """
202- if ep is None :
203- ep = self .ROOT_NODE_ENDPOINT_ID
204168 sub = await ctrl .ReadAttribute (
205169 nodeid = self .dut_node_id ,
206170 attributes = [(ep , Clusters .AccessControl .Attributes .Acl )],
@@ -210,16 +174,14 @@ async def get_dut_acl(self, ctrl: ChipDeviceCtrl, ep: int = None):
210174 acl_list = sub [ep ][Clusters .AccessControl ][Clusters .AccessControl .Attributes .Acl ]
211175 return acl_list
212176
213- async def write_dut_acl (self , ctrl : ChipDeviceCtrl , acl , ep : int = None ):
177+ async def write_dut_acl (self , ctrl : ChipDeviceCtrl , acl , ep : int = ROOT_NODE_ENDPOINT_ID ):
214178 """Write an ACL to the DUT.
215179
216180 Args:
217181 ctrl: Controller to use for writing
218182 acl: ACL list to write
219183 ep: Endpoint to write to (default: ROOT_NODE_ENDPOINT_ID)
220184 """
221- if ep is None :
222- ep = self .ROOT_NODE_ENDPOINT_ID
223185 result = await ctrl .WriteAttribute (self .dut_node_id , [(ep , Clusters .AccessControl .Attributes .Acl (acl ))])
224186 asserts .assert_equal (result [ep ].Status , Status .Success , "ACL write failed" )
225187
@@ -240,7 +202,7 @@ async def add_ace_to_dut_acl(self, ctrl: ChipDeviceCtrl, ace, dut_acl_original):
240202 # ========================================================================
241203
242204 @staticmethod
243- def get_typed_attribute_path (attribute , ep : int = None ):
205+ def get_typed_attribute_path (attribute , ep : int = ROOT_NODE_ENDPOINT_ID ):
244206 """Create a TypedAttributePath from an attribute.
245207
246208 Args:
@@ -250,8 +212,6 @@ def get_typed_attribute_path(attribute, ep: int = None):
250212 Returns:
251213 TypedAttributePath object
252214 """
253- if ep is None :
254- ep = IDMBaseTest .ROOT_NODE_ENDPOINT_ID
255215 return TypedAttributePath (
256216 Path = AttributePath .from_attribute (
257217 EndpointId = ep ,
@@ -264,7 +224,7 @@ def get_typed_attribute_path(attribute, ep: int = None):
264224 # ========================================================================
265225
266226 @staticmethod
267- def verify_attribute_exists (sub , cluster , attribute , ep : int = None ):
227+ def verify_attribute_exists (sub , cluster , attribute , ep : int = ROOT_NODE_ENDPOINT_ID ):
268228 """Verify that an attribute exists in a subscription or read response.
269229
270230 Args:
@@ -273,8 +233,6 @@ def verify_attribute_exists(sub, cluster, attribute, ep: int = None):
273233 attribute: Attribute to check for
274234 ep: Endpoint to check (default: ROOT_NODE_ENDPOINT_ID)
275235 """
276- if ep is None :
277- ep = IDMBaseTest .ROOT_NODE_ENDPOINT_ID
278236 sub_attrs = sub
279237 if isinstance (sub , Clusters .Attribute .SubscriptionTransaction ):
280238 sub_attrs = sub .GetAttributes ()
0 commit comments