2 releases
new 0.1.1 | Mar 26, 2025 |
---|---|
0.1.0 | Mar 26, 2025 |
#8 in #collector
Used in risotto
25KB
531 lines
Risotto
Risotto 😋 is a BGP updates collector that gathers BGP updates from routers via the BMP protocol. This repository contains the Risotto collector application and the Risotto library.
The application streams the BGP updates to a Kafka topic, which can be consumed by other components downstream. The library provides all the necessary components to decode BMP messages and produce BGP updates.
State Management
Risotto maintains a state representing connected routers and their associated BGP peers and announced prefixes. This state addresses two challenges when handling BMP data:
- Duplicate announcements from BMP session resets, where the router resends all active prefixes to the collector after a restart or connectivity issue.
- Missing withdraws when Peer Down notifications occur or when the collector is offline, resulting in incorrect BGP state downstream.
Duplicate announcements could, in theory, be handled by the database, but less data manipulation is better. Instead, Risotto checks each incoming update against its state. If the prefix is already present, the update is discarded.
For Peer Down notifications, Risotto leverages its state to generate synthetic withdraws for the prefixes announced by the downed peer.
For persistance, Risotto dumps its state at specified interval, and fetches it at startup. Risotto is able to infer any missing withdraws that would have occured during downtime, from the initial peer up flow. This ensures the database remains accurate, even if the collector is restarted. On the other hand, a restart may result in duplicate announcements. In other words, Risotto guaranties that the database is always in a consistent state, but may contain some duplicate announcements.
Conversely, Risotto can be configured to stream updates as is to the event pipeline without any state management. It is useful if there are other components downstream that can handle the state management.
Quick Start
The easiest way to use risotto is using Docker.
- Create a
risotto.yml
configuration file
api:
address: 0.0.0.0
port: 3000
bmp:
address: 0.0.0.0
port: 4000
kafka:
enable: true
brokers: "kafka.example.com:9092"
auth_protocol: PLAINTEXT
topic: bgp-updates
state:
enable: true
path: /app/dump.json
save_interval: 10
- Run your Docker container
docker run \
-v $(PWD)/risotto.yml:/config/risotto.yml \
-p 3000:3000 \
-p 4000:4000 \
ghcr.io/nxthdr/risotto:main -c /config/risotto.yml
An HTTP API provides the ability to retrieve the current state of the collector, including the list of connected routers and their BGP data.
curl -s http://localhost:3000
Contributing
Refer to the Docker Compose integration tests to try Risotto locally. The setup includes two Bird routers that connect to Risotto, sharing updates announced between them.
Dependencies
~6–13MB
~139K SLoC