blob: 225a397ce0f081f3f8272f0f02b27a884fc2ddb1 [file] [log] [blame]
#!/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 typing import Optional, TYPE_CHECKING
from antlion.libs.proc.job import Result
if TYPE_CHECKING:
from antlion.controllers.access_point import AccessPoint
class ApIwconfigError(Exception):
"""Error related to configuring the wireless interface via iwconfig."""
class ApIwconfig(object):
"""Class to configure wireless interface via iwconfig"""
PROGRAM_FILE = "/usr/local/sbin/iwconfig"
def __init__(self, ap: "AccessPoint") -> None:
"""Initialize the ApIwconfig class.
Args:
ap: the ap object within ACTS
"""
self.ssh = ap.ssh
def ap_iwconfig(
self, interface: str, arguments: Optional[str] = None
) -> Optional[Result]:
"""Configure the wireless interface using iwconfig.
Returns:
output: the output of the command, if any
"""
return self.ssh.run(f"{self.PROGRAM_FILE} {interface} {arguments}")