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

[Fix] Created possible fix for issue #229: Remove PICS from python PWRTL tests #34094

Merged
merged 16 commits into from
Oct 29, 2024
Merged
Changes from 5 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
47 changes: 27 additions & 20 deletions src/python_testing/TC_PWRTL_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,43 @@ async def test_TC_PWRTL_2_1(self):

attributes = Clusters.PowerTopology.Attributes

endpoint = self.user_params.get("endpoint", 1)
endpoint = 1

self.print_step(1, "Commissioning, already done")
powertop_attr_list = Clusters.Objects.PowerTopology.Attributes.AttributeList
powertop_cluster = Clusters.Objects.PowerTopology
attribute_list = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=powertop_cluster, attribute=powertop_attr_list)
avail_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.ActiveEndpoints.attribute_id
act_endpoints_attr_id = Clusters.Objects.PowerTopology.Attributes.AvailableEndpoints.attribute_id

if not self.check_pics("PWRTL.S.A0000"):
logging.info("Test skipped because PICS PWRTL.S.A0000 is not set")
return
self.print_step(1, "Commissioning, already done")

self.print_step(2, "Read AvailableAttributes attribute")
available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints)

if available_endpoints == NullValue:
logging.info("AvailableEndpoints is null")
else:
logging.info("AvailableEndpoints: %s" % (available_endpoints))
if avail_endpoints_attr_id in attribute_list:
available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints)

asserts.assert_less_equal(len(available_endpoints), 21,
"AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))
if available_endpoints == NullValue or available_endpoints == []:
logging.info("AvailableEndpoints is null or an empty list")
else:
logging.info("AvailableEndpoints: %s" % (available_endpoints))
asserts.assert_less_equal(len(available_endpoints), 21,
"AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))

if not self.check_pics("PWRTL.S.A0001"):
logging.info("Test skipped because PICS PWRTL.S.A0001 is not set")
else:
logging.info('Skipping test as available endpoints attribute ID not in attribute list on DUT')
return

self.print_step(3, "Read ActiveEndpoints attribute")
active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.ActiveEndpoints)
logging.info("ActiveEndpoints: %s" % (active_endpoints))
if act_endpoints_attr_id in attribute_list:
active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.ActiveEndpoints)
logging.info("ActiveEndpoints: %s" % (active_endpoints))

if available_endpoints == NullValue or available_endpoints == []:
asserts.assert_true(active_endpoints == NullValue or active_endpoints == [],
"ActiveEndpoints should be null when AvailableEndpoints is null: %s" % active_endpoints)

if available_endpoints == NullValue:
asserts.assert_true(active_endpoints == NullValue,
"ActiveEndpoints should be null when AvailableEndpoints is null: %s" % active_endpoints)
else:
logging.info('Skipping test as active endpoints attribute ID not in attribute list on DUT')
return


if __name__ == "__main__":
Expand Down
Loading