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

Uploaded Source

Built Distribution

aioruckus-0.39-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aioruckus-0.39.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.39.tar.gz
Algorithm Hash digest
SHA256 90e3aa6ed16a99c24ed7d6bc93f03083f1a963dae98424eceecf02bd70cff165
MD5 373d0f4057c207799fe9e09827073a85
BLAKE2b-256 f3f4887a2417022257a92908a753043b7913384af095180e2e24a7ab56038f16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aioruckus-0.39-py3-none-any.whl
  • Upload date:
  • Size: 30.2 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.39-py3-none-any.whl
Algorithm Hash digest
SHA256 a77b81b94d45074d73ad5ac047046e1d4da836e88c6ba3a90dfbb475cbb11116
MD5 664e0ee9214ee6eb2a05e63ec82eeec6
BLAKE2b-256 8f24182d6e480bc7ef34566865718d425fc5817f4faee1b8ed74a017da723f37

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