Collects running configuration via gNMI and publishes JSON payloads to Kafka.
In Go, the most common building blocks are:
github.com/openconfig/gnmifor gNMI protos and a basic gRPC client.github.com/openconfig/gnmicif you want a full-featured CLI and higher-level helpers.github.com/segmentio/kafka-goor Confluent's Go client for Kafka publishing.
This repo uses github.com/openconfig/gnmi plus github.com/segmentio/kafka-go.
- Copy the example config to a real config file:
cp config/config-pub.example.yaml config/config-pub.yaml
- Edit
config/config-pub.yamlwith your routers and Kafka brokers. - Run:
go run ./cmd/config-pub -config config/config-pub.yaml
Each Kafka message is a JSON payload with the target and a list of updates. Values from
gNMI json and json_ietf types are emitted as JSON, other values are emitted as their
native types.
Build the container:
docker build -t config-pub:dev -f Dockerfile.config-publish .
Build config-ingest:
docker build -t config-ingest:dev -f Dockerfile.config-ingest .
A simple deployment is under deploy/k8s/config-pub.yaml. It mounts a ConfigMap at
/etc/config-pub/config.yaml. You can mount TLS materials or credentials via Secrets.
Config ingest (Kafka -> Arango) is under deploy/k8s/config-ingest.yaml. It uses the
Jalapeno-style /credentials/.username + /credentials/.password secret.
See config/config-pub.example.yaml for full config options. Defaults:
- gNMI encoding:
json_ietf - gNMI type:
config - Dial timeout:
10s - Request timeout:
20s - Kafka topic auto-create:
true(when enabled, partitions and replication factor apply) - Interval:
5m(setrun_once: trueto run a single cycle)
config-ingest consumes gnmi-config and updates:
igp_nodewhen an/isisupdate is present (IGP-only or IGP+BGP nodes).bgp_nodewhen/bgpis present and/isisis not.
Matching priority:
router_idfrom Loopback0 IPv4 (preferred).namefrom/host-names(IGP fallback).
For BGP-only nodes, router_id and asn (from the BGP payload) are required.