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.2.0.tar.gz (63.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mobly_wifi-1.2.0-py3-none-any.whl (83.4 kB view details)

Uploaded Python 3

File details

Details for the file mobly_wifi-1.2.0.tar.gz.

File metadata

  • Download URL: mobly_wifi-1.2.0.tar.gz
  • Upload date:
  • Size: 63.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mobly_wifi-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6c0dc36ec76b85bfcf88423b4c392a93c12f9fad737ea53b725b32b1f1fc84f8
MD5 a36fdc4e324d00892bcf146149a4c0f9
BLAKE2b-256 ef531bcac1a1965c4c8faa856d7f6deb4b8466a1dae1b8f9a4459315f1d082a0

See more details on using hashes here.

File details

Details for the file mobly_wifi-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: mobly_wifi-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 83.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mobly_wifi-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a04f9c1272f8dbadf40ce7d30f9ec451f221b5c0f6fadff356d3107e8303e61d
MD5 247c86e0087330d0ef08494e05bf3964
BLAKE2b-256 ab84fb3542111d0ee3114a5aedbfbc1a430af0e932bf2009b7a295ce0edd5394

See more details on using hashes here.

Supported by

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