Lazy initialize wlan_policy_controller

Fix an issue where SSH and SL4F was not being verified after a hard
reboot due to a failed test. This was due to WlanPolicyController
storing its own reference to the FuchsiaDevice's ssh and sl4f
properties. When the device is rebooted, the FuchsiaDevice's references
are deleted and recreated. This however did not delete or recreate the
references stored within WlanPolicyController. This caused Python not to
garbage collect the old ssh and sl4f modules, thus bypassing the initial
connectivity checks in their __init__ functions when used by
WlanPolicyController.

Fixed: b/292146900
Change-Id: I5ccb3954a568459b9ea5fdf2b2f48a8be09a52a4
Reviewed-on: https://fuchsia-review.googlesource.com/c/antlion/+/887874
Fuchsia-Auto-Submit: Sam Balana <sbalana@google.com>
Reviewed-by: Patrick Lu <patricklu@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/packages/antlion/controllers/fuchsia_device.py b/packages/antlion/controllers/fuchsia_device.py
index 0914f6e..41b9cbd 100644
--- a/packages/antlion/controllers/fuchsia_device.py
+++ b/packages/antlion/controllers/fuchsia_device.py
@@ -383,6 +383,19 @@
         self._ffx.clean_up()
         del self._ffx
 
+    @property
+    def wlan_policy_controller(self):
+        if not hasattr(self, "_wlan_policy_controller"):
+            self._wlan_policy_controller = WlanPolicyController(self.sl4f, self.ssh)
+        return self._wlan_policy_controller
+
+    @wlan_policy_controller.deleter
+    def wlan_policy_controller(self):
+        if not hasattr(self, "_wlan_policy_controller"):
+            return
+        self.log.debug("Cleaning up wlan_policy_controller")
+        del self._wlan_policy_controller
+
     def _generate_ssh_config(self, file_path: str):
         """Generate and write an SSH config for Fuchsia to disk.
 
@@ -420,9 +433,6 @@
         # Contains WLAN core functions
         self.wlan_controller = WlanController(self)
 
-        # Contains WLAN policy functions like save_network, remove_network, etc
-        self.wlan_policy_controller = WlanPolicyController(self.sl4f, self.ssh)
-
     def start_package_server(self):
         if not self.packages_archive_path:
             self.log.warn(
@@ -863,8 +873,13 @@
             return False
 
     def stop_services(self):
-        """Stops ffx daemon, deletes SSH property, and deletes SL4F property."""
+        """Stops all host-side clients to the Fuchsia device.
+
+        This is necessary whenever the device's state is unknown. These cases can be
+        found after device reboots, for example.
+        """
         self.log.info("Stopping host device services.")
+        del self.wlan_policy_controller
         del self.sl4f
         del self.ssh
         del self.ffx