Remove netstack_controller
Replace netstack_controller with its direct SL4F call since it was only
being used once.
Change-Id: I2123eb679250b6c39d208e81a369102d0f147265
Reviewed-on: https://fuchsia-review.googlesource.com/c/antlion/+/887876
Reviewed-by: Patrick Lu <patricklu@google.com>
Fuchsia-Auto-Submit: Sam Balana <sbalana@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
diff --git a/BUILD.gn b/BUILD.gn
index a044311..069a06f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -107,7 +107,6 @@
"controllers/fuchsia_lib/ffx.py",
"controllers/fuchsia_lib/hardware_power_statecontrol_lib.py",
"controllers/fuchsia_lib/lib_controllers/__init__.py",
- "controllers/fuchsia_lib/lib_controllers/netstack_controller.py",
"controllers/fuchsia_lib/lib_controllers/wlan_controller.py",
"controllers/fuchsia_lib/lib_controllers/wlan_policy_controller.py",
"controllers/fuchsia_lib/location/__init__.py",
diff --git a/packages/antlion/controllers/fuchsia_device.py b/packages/antlion/controllers/fuchsia_device.py
index 41b9cbd..3ff3e0a 100644
--- a/packages/antlion/controllers/fuchsia_device.py
+++ b/packages/antlion/controllers/fuchsia_device.py
@@ -28,9 +28,6 @@
from antlion.capabilities.ssh import DEFAULT_SSH_PORT, SSHConfig, SSHError
from antlion.controllers import pdu
from antlion.controllers.fuchsia_lib.ffx import FFX
-from antlion.controllers.fuchsia_lib.lib_controllers.netstack_controller import (
- NetstackController,
-)
from antlion.controllers.fuchsia_lib.lib_controllers.wlan_controller import (
WlanController,
)
@@ -427,9 +424,6 @@
file.write(content)
def init_controllers(self):
- # Contains Netstack functions
- self.netstack_controller = NetstackController(self)
-
# Contains WLAN core functions
self.wlan_controller = WlanController(self)
diff --git a/packages/antlion/controllers/fuchsia_lib/lib_controllers/netstack_controller.py b/packages/antlion/controllers/fuchsia_lib/lib_controllers/netstack_controller.py
deleted file mode 100644
index aa3e642..0000000
--- a/packages/antlion/controllers/fuchsia_lib/lib_controllers/netstack_controller.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright 2022 The Fuchsia Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from antlion import logger, signals
-
-
-class NetstackControllerError(signals.ControllerError):
- pass
-
-
-class NetstackController:
- """Contains methods related to netstack, to be used in FuchsiaDevice object"""
-
- def __init__(self, fuchsia_device):
- self.device = fuchsia_device
- self.log = logger.create_tagged_trace_logger(
- f"NetstackController for FuchsiaDevice | {self.device.ip}"
- )
-
- def list_interfaces(self):
- """Retrieve netstack interfaces from netstack facade
-
- Returns:
- List of dicts, one for each interface, containing interface
- information
- """
- response = self.device.sl4f.netstack_lib.netstackListInterfaces()
- if response.get("error"):
- raise NetstackControllerError(
- f"Failed to get network interfaces list: {response['error']}"
- )
- return response["result"]
diff --git a/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py b/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py
index 6e2ce6d..6f4e56d 100644
--- a/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py
+++ b/packages/antlion/controllers/fuchsia_lib/lib_controllers/wlan_controller.py
@@ -115,7 +115,13 @@
# because only netstack has that information. The bug linked here is
# to reconcile some of the information between the two perspectives, at
# which point we can eliminate step.
- net_ifaces = self.device.netstack_controller.list_interfaces()
+ net_ifaces_response = self.device.sl4f.netstack_lib.netstackListInterfaces()
+ if net_ifaces_response.get("error"):
+ raise WlanControllerError(
+ f"Failed to get network interfaces list: {net_ifaces_response['error']}"
+ )
+ net_ifaces = net_ifaces_response["result"]
+
wlan_ifaces_by_role: WlanInterfaces = {"client": {}, "ap": {}}
for iface in net_ifaces:
try: