Legrand / Raritan / Server Technology Xerus™ JSON-RPC API

Loading...
Searching...
No Matches
Cascading and Linking

# Terminology

Cascading allows multiple devices to share one physical network connection, and optionally one IP address. There are two modes of cascading: bridging and port forwarding.

Linking means that one device (the primary unit) aggregates data from multiple others (link units). Link units run a reduced set of services and have a lower level of autonomy. On the upside it becomes possible to define e.g. outlet groups with outlets from multiple PDUs, or event rules that work with resources from multiple devices.

Cascading and linking can be used in combination.

# Bridging

In bridging mode all network ports of the device appear on the same physical subnet. All ports use the same IPv4/IPv6 settings.

Bridging is configured by enabling or disabling the interface `br0` in the net.Settings structure:

from raritan.rpc import net
net_proxy = net.Net("/net", agent)
settings = net_proxy.getSettings()
settings.ifMap["br0"].enabled = True
net_proxy.setSettings(settings)
net::Net
Network configuration interface.
Definition Net.idl:367

# Port Forwarding

In port forwarding mode only the primary unit is visible on the network and has an IP address. Network services of downstream devices can be accessed at custom port numbers (pos is 0 for the primary, 1..31 for expansion units):

Service | Protocol | Port Number
--- | --- | ---
HTTPS | TCP | 50000 + pos
HTTP | TCP | 50100 + pos
SSH | TCP | 50200 + pos
Telnet | TCP | 50300 + pos
SNMP | UDP | 50500 + pos
Modbus | TCP | 50600 + pos

Port forwarding is configured in the `common.portForwarding` structure of the net.Settings structure.

from raritan.rpc import net
net_proxy = net.Net("/net", agent)
settings = net_proxy.getSettings()
settings.common.portForwarding.enabled = True
# primary unit:
settings.common.portForwarding.role = net.PortForwardingRole.PRIMARY_UNIT
settings.common.portForwarding.primaryUnitDownstreamIfName = "usb"
# expansion unit:
settings.common.portForwarding.role = net.PortForwardingRole.EXPANSION_UNIT
settings.common.portForwarding.primaryUnitDownstreamIfName = ""
net_proxy.setSettings(settings)

# Linking

Link units are managed with the cascading.CascadeManager interface.

Link unit resources can be accessed through the primary unit's JSON-RPC interface by prepending `/link/<n>` to the resource ID. There are also well-known RIDs for PDU resources starting with `/model/pdu/<n>`:

from raritan.rpc import cascading, firmware, pdumodel
# adding a new link unit:
cm = cascading.CascadeManager("/cascade", agent)
cm.addLinkUnit(2, "192.168.2.123", "admin", "legrand", "")
time.sleep(2)
# accessing link unit resources:
link_firmware = firmware.Firmware("/link/2/firmware", agent)
print(link_firmware.getVersion())
# well-known link unit RIDs for PDU resources:
link_outlet = pdumodel.Outlet("/model/pdu/2/outlet/1", agent)
link_outlet.cyclePowerState()
cascading::CascadeManager
JSON-RPC Cascade Manager.
Definition CascadeManager.idl:12
firmware::Firmware
Firmware management methods
Definition Firmware.idl:121
pdumodel::Outlet
Outlet interface
Definition Outlet.idl:30