blob: 01346b9682b285745d5d9e132950ec48daff1139 [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 TYPE_CHECKING
from antlion.runner import CompletedProcess
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: str | None = None
) -> CompletedProcess:
"""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}")