liberps

ITU-T G.8032/Y.1344 (03/2020) · single ring · C11 · Apache-2.0

liberps

Ethernet Ring Protection Switching for one ring, as a small, deterministic C library. Received R-APS frames, link state and operator commands go in. Port blocks, R-APS transmissions and FDB flushes come out through callbacks you implement for your dataplane.

  • 71 / 71 Table 10-2 rows
  • 86 unit and 24 scenario tests
  • 300,000 random ring histories, no loop
  • ~403 M fuzz executions
CI status License Apache-2.0 Language C11
Appendix III, scenario A, on the simulator
RPL A ID 81 · neighbour B ID 26 C ID 89 D ID 62 E ID 71 F ID 31 G ID 75 · owner
ring linkblocked portfailed link

Idle (A) on every node. RPL blocked at both ends.

300.000  G  Pending -> Idle      row 66  WTR expires: Tx R-APS(NR,RB,DNF)
300.000  A..F  Pending -> Idle   row 70  R-APS(NR,RB)
         A keeps its RPL end blocked (neighbour)
         G repeats R-APS(NR,RB) every 5 s

What you get

The whole protocol, and the tools around it

The state machine, row by row

All 71 rows of Table 10-2 are transcribed with the Recommendation's row numbers, so every transition in a trace can be checked against the standard. Priority logic, WTR, WTB, guard and hold-off timers, flush logic with DNF, FOP alarms and compatible-version 1 are all included.

Pure and pluggable

The core does no I/O, reads no clock and starts no threads. You pass the time with each call and implement three callbacks. The same library runs on a switch NOS, a Linux bridge or a simulator, with no allocation after creation.

Built to be debugged

Every executed row is recorded with its trigger, actions and port states. Counters cover each message kind and every drop reason. Status, counters and history are available as text or JSON, and the simulator writes pcap.

A command layer for any CLI

erps_cli_exec() runs configuration, operator commands and show views from a text line, and exports its grammar for host CLI frameworks. A configuration file is a command script.

A ring simulator

erps-sim runs rings of any size on a virtual clock with link delay, loss, one-way failures and node failures, checking for forwarding loops after every event.

A Linux daemon

erpsd runs the protocol on kernel bridges, blocking by VLAN membership and flushing the FDB over netlink; erpsctl controls it.

Quick start

Build it and watch a ring protect itself

git clone https://github.com/harshithsunku/liberps && cd liberps
make                                           # library, erps-sim, erpsd, erpsctl, examples
make test                                      # unit, scenario and chaos tests
build/cc/erps-sim -f examples/appendix3.erps   # the scenario shown above, with every row

Next

Where to go from here