Skip to main content

IPC Protocol

JSON-RPC 2.0 protocol for inter-process communication with abngd.

Overview

All components communicate with abngd via JSON-RPC 2.0 over Unix domain socket at /opt/athena-bng/run/abngd.sock.

Protocol

Request Format

{
"jsonrpc": "2.0",
"method": "show.subscribers",
"params": {},
"id": 1
}

Response Format

{
"jsonrpc": "2.0",
"result": [...],
"id": 1
}

Error Response

{
"jsonrpc": "2.0",
"error": {
"code": -32600,
"message": "Invalid Request"
},
"id": 1
}

Methods

show.subscribers

List active subscriber sessions.

Request:

{
"jsonrpc": "2.0",
"method": "show.subscribers",
"params": {},
"id": 1
}

Response:

{
"jsonrpc": "2.0",
"result": [
{
"id": 1,
"type": "pppoe",
"username": "user1",
"ip_address": "203.0.113.10",
"interface": "eth1.111.500.100",
"ppp_interface": "ppp0",
"speed_down": "100mbit",
"speed_up": "40mbit",
"bytes_in": 1234567890,
"bytes_out": 987654321,
"acct_session_id": "abng-1709312400-1"
}
],
"id": 1
}

show.interfaces

List network interfaces.

Request:

{
"jsonrpc": "2.0",
"method": "show.interfaces",
"params": {},
"id": 1
}

show.vlans

List dynamic VLAN interfaces.

Request:

{
"jsonrpc": "2.0",
"method": "show.vlans",
"params": {},
"id": 1
}

show.routes

Show routing table.

Request:

{
"jsonrpc": "2.0",
"method": "show.routes",
"params": {},
"id": 1
}

show.bgp

Show BGP state.

Request:

{
"jsonrpc": "2.0",
"method": "show.bgp",
"params": {},
"id": 1
}

show.qos

Show QoS status.

Request:

{
"jsonrpc": "2.0",
"method": "show.qos",
"params": {},
"id": 1
}

show.system

Show system information.

Request:

{
"jsonrpc": "2.0",
"method": "show.system",
"params": {},
"id": 1
}

show.configuration

Show running configuration.

Request:

{
"jsonrpc": "2.0",
"method": "show.configuration",
"params": {},
"id": 1
}

request.subscriber.disconnect

Disconnect a subscriber session.

Request:

{
"jsonrpc": "2.0",
"method": "request.subscriber.disconnect",
"params": {
"session_id": 1
},
"id": 1
}

request.radius.test

Test RADIUS authentication.

Request:

{
"jsonrpc": "2.0",
"method": "request.radius.test",
"params": {
"username": "testuser",
"password": "testpass"
},
"id": 1
}

config.set

Set configuration value.

Request:

{
"jsonrpc": "2.0",
"method": "config.set",
"params": {
"path": "pppoe.enabled",
"value": true
},
"id": 1
}

config.delete

Delete configuration value.

Request:

{
"jsonrpc": "2.0",
"method": "config.delete",
"params": {
"path": "pppoe.enabled"
},
"id": 1
}

config.commit

Commit candidate configuration.

Request:

{
"jsonrpc": "2.0",
"method": "config.commit",
"params": {},
"id": 1
}

monitor.subscribe

Subscribe to real-time events.

Request:

{
"jsonrpc": "2.0",
"method": "monitor.subscribe",
"params": {
"events": ["session"]
},
"id": 1
}

Events:

{"event": "session_up", "id": 1, "username": "user1", ...}
{"event": "session_down", "id": 1, "username": "user1", ...}
{"event": "rate_change", "id": 1, "down": "50mbit", "up": "20mbit", ...}

Error Codes

CodeMessageDescription
-32700Parse errorInvalid JSON
-32600Invalid RequestRequest format invalid
-32601Method not foundUnknown method
-32602Invalid paramsInvalid parameters
-32603Internal errorServer error
-32000Server errorCustom error

Examples

List Sessions (CLI)

/opt/athena-bng/bin/abng -c "show subscribers"

Internally:

{
"jsonrpc": "2.0",
"method": "show.subscribers",
"params": {},
"id": 1
}

Disconnect Session (CLI)

/opt/athena-bng/bin/abng -c "request subscriber disconnect 1"

Internally:

{
"jsonrpc": "2.0",
"method": "request.subscriber.disconnect",
"params": {
"session_id": 1
},
"id": 1
}

Socket Communication

Unix Domain Socket

Connect to /opt/athena-bng/run/abngd.sock:

nc -U /opt/athena-bng/run/abngd.sock

Send Request

echo '{"jsonrpc":"2.0","method":"show.system","params":{},"id":1}' | nc -U /opt/athena-bng/run/abngd.sock

Receive Response

Response is sent back on the same socket.

Next Steps