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

* Created possible fix for issue #229:
- Removed PICS if statements from TC_PWRTL_2_1 test module
- Added if statements to check if attribute ID's for available and active endpoints gathered from DUT's are contained in attribute list
- Updated method from NullValue to also include checking for empty lists from DUT's for available and active endpoints

* Restyled by autopep8

* Updated TC_PWRTL_2_1.py:
- Added else condition to return for cases where active or available attribute ID's were not in attibute list on DUT

* Restyled by autopep8

* Updated TC_PWRTL_2_1 test module:
- Replaced method for setting endpoint variable
- Removed null check for available endpoints in test step 2.
- Reworded verbiage for skipping test step 3 if condition is not met.

* Restyled by autopep8

* Updated TC_PWRTL_2_1 test module

- Fixed found linting errors

* Updated TC_PWRTL_2_1 test module:
- Resolved new found linting errors.

* Restyled by autopep8

* Apply suggestions from code review

Co-authored-by: C Freeman <cecille@google.com>

* Update src/python_testing/TC_PWRTL_2_1.py

Co-authored-by: C Freeman <cecille@google.com>

---------

Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: C Freeman <cecille@google.com>
diff --git a/src/python_testing/TC_PWRTL_2_1.py b/src/python_testing/TC_PWRTL_2_1.py
index 3de09c6..9d4b3de 100644
--- a/src/python_testing/TC_PWRTL_2_1.py
+++ b/src/python_testing/TC_PWRTL_2_1.py
@@ -53,30 +53,43 @@
 
         endpoint = self.user_params.get("endpoint", 1)
 
+        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
+
         self.print_step(1, "Commissioning, already done")
 
-        if not self.check_pics("PWRTL.S.A0000"):
-            logging.info("Test skipped because PICS PWRTL.S.A0000 is not set")
-            return
-
         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 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), 20,
-                                  "AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))
+            if available_endpoints == []:
+                logging.info("AvailableEndpoints is an empty list")
+            else:
+                logging.info("AvailableEndpoints: %s" % (available_endpoints))
+                asserts.assert_less_equal(len(available_endpoints), 20,
+                                          "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")
-            return
+        else:
+            self.mark_current_step_skipped()
 
         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))
-        asserts.assert_less_equal(len(active_endpoints), 20,
-                                  "ActiveEndpoints length %d must be less than 21!" % len(active_endpoints))
-        # Verify that ActiveEndpoints is a subset of AvailableEndpoints
-        asserts.assert_true(set(active_endpoints).issubset(set(available_endpoints)),
-                            "ActiveEndpoints should be a subset of AvailableEndpoints")
+
+        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))
+            asserts.assert_less_equal(len(active_endpoints), 20,
+                                      "ActiveEndpoints length %d must be less than 21!" % len(active_endpoints))
+
+            if available_endpoints == []:
+                # Verify that ActiveEndpoints is a subset of AvailableEndpoints
+                asserts.assert_true(set(active_endpoints).issubset(set(available_endpoints)),
+                                    "ActiveEndpoints should be a subset of AvailableEndpoints")
+
+        else:
+            self.mark_current_step_skipped()
 
 
 if __name__ == "__main__":