Skip to main content

Mobly WiFi controller module for using Python code to operate network devices in Mobly tests.

Project description

Mobly WiFi Controller

Mobly WiFi controller module for using Python code to operate network devices in Mobly tests.

Requirements

  • Python 3.11+
  • Mobly 1.12.2+

Installation

pip install mobly-wifi

Start to Use

Mobly WiFi controller is an add-on module to control OpenWrt AP devices in Mobly. To learn more about Mobly, visit Getting started with Mobly.

One-Time Setup on Host

Get the SSH identity key to OpenWrt devices here, put it at ~/.ssh/testing_rsa.

Write Mobly Device Configs

To use an OpenWrt AP device in Mobly tests, first you need to write a config to specify the information of the device under test. For example:

sample_config.yaml

TestBeds:
- Name: SampleOpenWrtTestbed
  Controllers:
    OpenWrtDevice:
    -  hostname: 'IP_ADDRESS'

NOTE: Replace IP_ADDRESS with your device information.

Write a Hello World Mobly Test

hello_world_test.py

"""A basic Mobly Test with OpenWrt AP device."""

import time

from mobly import base_test
from mobly import test_runner
from mobly.controllers.wifi import openwrt_device
from mobly.controllers.wifi.lib import wifi_configs

 
class HelloWorldTest(base_test.BaseTestClass):
 
  def setup_class(self):
    self.openwrt = self.register_controller(openwrt_device)[0]
 
  def test_start_5g_wifi(self):
    config = wifi_configs.WiFiConfig(channel=36)
    wifi_info = self.openwrt.start_wifi(config=config)
    self.openwrt.log.info(
        'Now you can connect your device to WiFi "%s" with password "%s"!',
        wifi_info.ssid,
        wifi_info.password,
    )
    # Sleep a while, you can manually connect your device to the WiFi.
    time.sleep(60)
 
if __name__ == '__main__':
  test_runner.main()

Execute the Test

python hello_world_test.py -c sample_config.yaml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mobly_wifi-1.1b2.tar.gz (62.4 kB view details)

Uploaded Source

Built Distribution

mobly_wifi-1.1b2-py3-none-any.whl (82.5 kB view details)

Uploaded Python 3

File details

Details for the file mobly_wifi-1.1b2.tar.gz.

File metadata

  • Download URL: mobly_wifi-1.1b2.tar.gz
  • Upload date:
  • Size: 62.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for mobly_wifi-1.1b2.tar.gz
Algorithm Hash digest
SHA256 bb44ac0a709d2144cb00d7997ba5f2f5a9435bb2ad053bfa2cc4df0af16ec157
MD5 e82e65f6ed0e2b22d0ab76a52be71f19
BLAKE2b-256 cffa12d4444669fd352e09db0dc69adb08298cc9e9ed21c5cd597259915b847f

See more details on using hashes here.

File details

Details for the file mobly_wifi-1.1b2-py3-none-any.whl.

File metadata

  • Download URL: mobly_wifi-1.1b2-py3-none-any.whl
  • Upload date:
  • Size: 82.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for mobly_wifi-1.1b2-py3-none-any.whl
Algorithm Hash digest
SHA256 21f59ca46db16b774fc2f35fa0e2af6998ed11e1f07c127970c0f7fb493b8717
MD5 e5a9040eac6ea056133867c4117c2419
BLAKE2b-256 d386a6abcfcc6ce8eca028b57de2a0565cb1ec1bba6b314c800f8c73feb8ea97

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page