Skip to main content

Python API to interact with Ruckus Unleashed and ZoneDirector devices.

Project description

aioruckus

A Python API which interacts with Ruckus Unleashed and ZoneDirector devices via their AJAX Web Service interface.
Configuration information can also be queried from Ruckus Unleashed and ZoneDirector backup files.

Compatible with all Ruckus Unleashed versions, and Ruckus ZoneDirector versions 9.10 onwards.

How to install

pip install aioruckus

Usage

Functions are defined within an async context manager, so you will have to use asyncio rather than calling the functions directly in a shell.

from aioruckus import AjaxSession, BackupSession, SystemStat
import asyncio

async def test_aioruckus():
    
    async with AjaxSession.async_create("<ruckus ip>", "<ruckus user>", "<ruckus password>") as session:
        ruckus = session.api

        #
        # viewing configuration
        # note: configuration functions resolve all related objects, so may be slower than stats functions
        #
        aps = await ruckus.get_aps()
        ap_groups = await ruckus.get_ap_groups()
        wlans = await ruckus.get_wlans()
        wlan_groups = await ruckus.get_wlan_groups() # WLAN Groups are CLI-only on Unleashed
        dpsks = await ruckus.get_dpsks()
        mesh = await ruckus.get_mesh_info()
        default_system_info = await ruckus.get_system_info()
        all_system_info = await ruckus.get_system_info(SystemStat.ALL)

        #
        # working with with client devices
        #
        active_clients = await ruckus.get_active_clients()
        inactive_clients = await ruckus.get_inactive_clients() # always empty on Unleashed
        blocked_clients = await ruckus.get_blocked_client_macs()
        #
        await ruckus.do_block_client("60:ab:de:ad:be:ef")
        await ruckus.do_unblock_client("60:ab:de:ad:be:ef")
        #
        new_rogues = await ruckus.get_active_rogues()
        known_rogues = await ruckus.get_known_rogues()
        blocked_rogues = await ruckus.get_blocked_rogues()

        #
        # working with APs
        #
        ap_stats = await ruckus.get_ap_stats()
        ap_group_stats = await ruckus.get_ap_group_stats()
        #
        await ruckus.do_hide_ap_leds("24:79:de:ad:be:ef")
        await ruckus.do_show_ap_leds("24:79:de:ad:be:ef")
        #
        await ruckus.do_restart_ap("24:79:de:ad:be:ef")

        #
        # working with WLANs / VAPs
        #
        vap_stats = await ruckus.get_vap_stats()
        wlan_group_stats = await ruckus.get_wlan_group_stats()
        #
        await ruckus.do_disable_wlan("my ssid")
        await ruckus.do_enable_wlan("my ssid")
        #
        await ruckus.do_set_wlan_password("my ssid", "blah>blah<")

        #
        # viewing events / alarms / logs
        #
        all_alarms = await ruckus.get_all_alarms(limit=15)
        #
        all_events = await ruckus.get_all_events(limit=1000)
        ap_events = await ruckus.get_ap_events()
        ap_group_events = await ruckus.get_ap_events("24:79:de:ad:be:ef", "24:59:de:ad:be:ef")
        wlan_events = await ruckus.get_wlan_events()
        wlan_group_events = await ruckus.get_wlan_events("my ssid", "my other ssid", "my third ssid")
        client_events = await ruckus.get_client_events(limit=50)
        wired_client_events = await ruckus.get_wired_client_events()
        #
        syslog = await ruckus.get_syslog()

        #
        # modifying configuration
        #
        await ruckus.do_add_wlan_group("new empty wlangroup", "empty group added by aioruckus")
        await ruckus.do_add_wlan_group("new full wlangroup", "group added by aioruckus", wlans)
        #
        wlan_group_template = next((wlang for wlang in wlan_groups if wlang["name"] == "Default"), None)
        await ruckus.do_clone_wlan_group(wlan_group_template, "Copy of Default")
        #
        await ruckus.do_delete_wlan_group("Copy of Default")
        #
        await ruckus.do_add_wlan("my new sid", passphrase="mypassphrase" )
        await ruckus.do_edit_wlan("my new sid", {"ofdm-rate-only": True})
        #
        template_wlan = next((wlan for wlan in wlans if wlan["name"] == "my ssid"), None)
        await ruckus.do_clone_wlan(template_wlan, "my newer sid")
        await ruckus.do_delete_wlan("my newer sid")

    # viewing backed-up configuration
    with BackupSession.create("<ruckus backup filename>") as session:
        ruckus = session.api

        aps = await ruckus.get_aps()
        ap_groups = await ruckus.get_ap_groups()
        wlans = await ruckus.get_wlans()
        wlan_groups = await ruckus.get_wlan_groups()
        dpsks = await ruckus.get_dpsks()
        blocked = await ruckus.get_blocked_client_macs()
        mesh = await ruckus.get_mesh_info()
        all_system_info = await ruckus.get_system_info(SystemStat.ALL)

asyncio.run(test_aioruckus())

Other APIs for Ruckus Unleashed

This project was originally a fork of pyruckus, which provides similar Python query functionality by controlling an SSH CLI session.

There is a Go client for the latest releases of Unleashed.
Since it's strongly typed, has good quality comments, and doesn't (yet) contain the large collection of tweaks and hacks needed to work over a wide range of Unleashed and ZoneDirector releases, the ruckus-go source code is a great place to understand the required requests and responses you should expect to receive from the AJAX API.

There is also scrapli support for the Ruckus Unleashed SSH CLI via scrapli community.
Authentication and privilege levels are implemented, but no templates are implemented as of August 2023.

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

aioruckus-0.40.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

aioruckus-0.40-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file aioruckus-0.40.tar.gz.

File metadata

  • Download URL: aioruckus-0.40.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for aioruckus-0.40.tar.gz
Algorithm Hash digest
SHA256 f4456db0985c82bdfdbb3856c936674a7f20e8da7aed72a3fcce4924d5ca7950
MD5 2b78a178b54cf52b137e0fdb57cdee50
BLAKE2b-256 9d40b5ab7538b9cea68bdcb21e1a735130766ca63f2b9e57ad2e27b384860b6d

See more details on using hashes here.

File details

Details for the file aioruckus-0.40-py3-none-any.whl.

File metadata

  • Download URL: aioruckus-0.40-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for aioruckus-0.40-py3-none-any.whl
Algorithm Hash digest
SHA256 5bcd0c83cf3bd408f392420711767186e04754f57d13d8f0f7d68e205ea335f7
MD5 1792a069de05d853321a1bb161196b29
BLAKE2b-256 a69b290aab94eed9f66adc75f3d55edd685253621d2db6325bbf8bc6862e693e

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