uci_ubus_jsonrpc

Salt proxy module for OpenWrt devices via ubus JSON-RPC.

Connects to the device’s uhttpd JSON-RPC endpoint and provides OpenWrt configuration management through the ubus API.

# /srv/salt/pillar/router.sls
proxy:
  proxytype: uci_ubus_jsonrpc
  host: 10.35.24.1
  password: secret
  # username: salt-agent      (default)
  # scheme: https             (auto-detected by default: tries plain
  # port: 443                  HTTP on 80 first, falls back to HTTPS on
  #                            443 — set both explicitly to skip probing,
  #                            e.g. for a device behind Caddy/ACME)
  # verify_ssl: false         (default)
  # timeout: 30               (default, HTTP request timeout)
  # session_timeout: 300      (default, rpcd session lifetime)
  # rpcd_timeout: 300         (default, rpcd ubus invoke timeout)
saltext.uci_ubus.proxy.ubus_jsonrpc.init(opts)[source]

Create JSON-RPC client from proxy pillar and authenticate.

saltext.uci_ubus.proxy.ubus_jsonrpc.alive(opts)[source]

Return True if the proxy was initialized and no transport error has occurred.

This is a flag-based check (no network I/O). Transport errors in call() or ping() flip initialized to False so that Salt triggers init() on the next cycle.

saltext.uci_ubus.proxy.ubus_jsonrpc.ping()[source]

Return True if the device responds to a system.board call.

saltext.uci_ubus.proxy.ubus_jsonrpc.shutdown(opts)[source]

Clean up proxy state.

saltext.uci_ubus.proxy.ubus_jsonrpc.grains()[source]

Return cached device grains.

saltext.uci_ubus.proxy.ubus_jsonrpc.grains_refresh()[source]

Re-fetch grains from the device.

saltext.uci_ubus.proxy.ubus_jsonrpc.call(ubus_object, ubus_method, params=None)[source]

Forward a ubus call through the proxy’s RPC client.