Skip to content

namesarnav/netmeta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

netmeta

Go Docker Kubernetes License

Network Intelligence and Auto-Remediation Platform

netmeta is a production-grade Go application that monitors and manages BGP, OSPF, and MPLS in multi-vendor network environments. It provides real-time monitoring, topology visualization, and automated remediation capabilities.

Features

  • πŸ” BGP Monitoring: Real-time peer state tracking, prefix counting, and flap detection using GoBGP
  • 🌐 OSPF Topology: Live packet parsing and in-memory topology graph construction
  • 🏷️ MPLS Validation: Label stack validation and corruption detection
  • πŸ€– Auto-Remediation: Rule-based engine for automatic network issue resolution
  • πŸ“Š Prometheus Metrics: Comprehensive metrics export for monitoring
  • πŸ–₯️ Web Dashboard: Real-time WebSocket-based UI with topology visualization
  • 🐳 Container Ready: Docker and Kubernetes deployment configurations
  • πŸ“ˆ Grafana Integration: Pre-configured dashboards for network metrics

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    netmeta Platform                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚  β”‚   BGP    β”‚  β”‚   OSPF   β”‚  β”‚   MPLS   β”‚             β”‚
β”‚  β”‚ Monitor  β”‚  β”‚  Parser  β”‚  β”‚Validator β”‚             β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜             β”‚
β”‚       β”‚             β”‚             β”‚                     β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β”‚                     β”‚                                   β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”                           β”‚
β”‚              β”‚ Auto-Remed  β”‚                           β”‚
β”‚              β”‚   Engine    β”‚                           β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                           β”‚
β”‚                     β”‚                                   β”‚
β”‚       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”‚
β”‚       β”‚             β”‚             β”‚                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”               β”‚
β”‚  β”‚Prometheusβ”‚  β”‚   Web   β”‚  β”‚   API   β”‚               β”‚
β”‚  β”‚ Exporter β”‚  β”‚   UI    β”‚  β”‚  Layer  β”‚               β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β”‚                                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Installation

Prerequisites

  • Go 1.21 or later
  • Docker (optional, for containerized deployment)
  • Kubernetes cluster (optional, for K8s deployment)

Build from Source

git clone https://github.com/namesarnav/netmeta.git
cd netmeta
go mod download
go build -o netmeta ./cmd/netmeta

Docker

docker build -t netmeta:latest -f deploy/docker/Dockerfile .
docker run -p 8080:8080 netmeta:latest serve

Kubernetes

kubectl apply -f deploy/k8s/deployment.yaml

Configuration

Create a config.yaml file (see config.yaml for example):

bgp:
  peers:
    - address: 10.0.0.1
      asn: 65001
      port: 179

ospf:
  interface: eth0
  pcap_file: capture.pcap

mpls:
  enabled: true

auto:
  enabled: true
  flap_threshold: 3
  flap_window_sec: 300

api:
  host: 0.0.0.0
  port: 8080

db:
  path: /var/lib/netmeta

Usage

CLI Commands

# Start the server (API + UI)
netmeta serve

# List BGP peers
netmeta bgp peers

# Show OSPF topology
netmeta ospf topology

# Trigger manual remediation
netmeta remediate --peer 10.0.0.1 --reason flap
netmeta remediate --prefix 203.0.113.0/24 --reason rpki

# Show version
netmeta version

Web Dashboard

Access the dashboard at: http://localhost:8080/dashboard

Features:

  • Real-time BGP peer status
  • Live OSPF topology graph
  • Remediation event stream
  • WebSocket-based updates

API Endpoints

  • GET /api/v1/bgp/peers - List all BGP peers
  • GET /api/v1/ospf/topology - Get OSPF topology
  • GET /api/v1/remediation/events - Get remediation events
  • GET /metrics - Prometheus metrics
  • GET /ws - WebSocket stream

Prometheus Metrics

Key metrics exported:

  • bgp_peer_up{peer="..."} - BGP peer up status (1=up, 0=down)
  • bgp_prefix_count{peer="...", afi="ipv4"} - Prefix count per peer
  • bgp_session_flaps_total{peer="..."} - Total session flaps
  • mpls_corruption_events_total - MPLS corruption events
  • netmeta_remediation_total{reason="...", success="..."} - Remediation actions

Auto-Remediation

The auto-remediation engine monitors network conditions and automatically triggers remediation actions:

  • BGP Flaps: If a peer flaps more than 3 times in 5 minutes, all prefixes are withdrawn
  • RPKI Invalid: Invalid prefixes are automatically withdrawn
  • OSPF Adjacency: Down adjacencies trigger interface restarts

Rules can be configured in config.yaml:

auto:
  enabled: true
  flap_threshold: 3
  flap_window_sec: 300

Demo

Run the demo script to see netmeta in action:

./scripts/demo.sh

This will:

  1. Start the netmeta server
  2. List BGP peers
  3. Show OSPF topology
  4. Trigger a remediation action
  5. Display access URLs

Development

Project Structure

netmeta/
β”œβ”€β”€ cmd/netmeta/          # Main application entry point
β”œβ”€β”€ pkg/
β”‚   β”œβ”€β”€ api/              # REST + gRPC handlers
β”‚   β”œβ”€β”€ auto/             # Auto-remediation logic
β”‚   β”œβ”€β”€ bgp/              # GoBGP wrapper + monitoring
β”‚   β”œβ”€β”€ mpls/             # MPLS label validation
β”‚   β”œβ”€β”€ ospf/             # OSPF packet parser + topology
β”‚   β”œβ”€β”€ monitor/          # Prometheus exporter
β”‚   └── ui/               # Gin + WebSocket dashboard
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ config/           # Viper config
β”‚   β”œβ”€β”€ db/               # BadgerDB for state
β”‚   └── telemetry/        # Event logging
β”œβ”€β”€ deploy/
β”‚   β”œβ”€β”€ docker/           # Dockerfile
β”‚   β”œβ”€β”€ k8s/              # Kubernetes manifests
β”‚   └── grafana/          # Grafana dashboard
└── scripts/              # Utility scripts

Testing with Real Peers

Use Containerlab or FRR in Docker to set up test BGP/OSPF peers:

# Example with FRR
docker run -d --name frr-router frrouting/frr

Deployment

Docker

docker build -t netmeta:latest -f deploy/docker/Dockerfile .
docker run -d -p 8080:8080 \
  -v $(pwd)/config.yaml:/etc/netmeta/config.yaml \
  netmeta:latest serve

Kubernetes

kubectl apply -f deploy/k8s/deployment.yaml

The deployment includes:

  • 3 replicas for high availability
  • Prometheus scraping annotations
  • Health checks (liveness/readiness probes)
  • ConfigMap for configuration

Grafana Dashboard

Import the dashboard from deploy/grafana/dashboard.json into your Grafana instance.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details

Author

Built for Meta NPE (Network Production Engineering) interview demonstration.


Note: This is a demonstration project showcasing production-grade network tooling capabilities in Go.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published