Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Flock Routing Suite Client: flockc

flockc is the CLI client bundled with flockd for monitoring and configuring the router. It talks to flockd over gRPC (Protocol Buffers over HTTP/2) and supports both read operations (querying operational state) and write operations (applying configuration updates, e.g. BGP neighbor and VRF configuration).

flockc connects to the gRPC endpoint (default http://[::1]:50051) and supports multiple output formats.

Global Options

flockc [OPTIONS] <COMMAND>

Options:
  -e, --endpoint <ENDPOINT>  gRPC endpoint [env: FLOCK_ENDPOINT=] [default: http://[::1]:50051]
  -f, --format <FORMAT>      Output format [default: json]
                              [possible values: debug, debug-pretty, json, json-pretty, yaml]

Connecting to a Remote Router

By default, flockc connects to the local flockd instance via IPv6 loopback. To connect to a remote router, set the endpoint:

flockc -e http://10.0.1.1:50051 sys overview

Or via the FLOCK_ENDPOINT environment variable:

export FLOCK_ENDPOINT=http://10.0.1.1:50051
flockc sys overview

System Commands

System Overview

Returns system information including hostname, software version, uptime, enabled protocols, and software error count.

$ flockc -f json-pretty sys overview
{
  "host_info": {
    "hostname": "R01",
    "domain": null,
    ...
  },
  "system_info": {
    "name": "flockd",
    "description": "The Flock Networks Ltd Routing Suite Daemon",
    "version": "0.0.2"
  },
  "fire_info": {
    "name": "fire",
    "description": "Flock Internet Routing Engine (FIRE)",
    "version": "0.1.0"
  },
  "pid": 12345,
  "uptime": "days: 1, hours: 3, mins: 22, secs: 15",
  "enabled_protocols": ["BGPv4", "OSPFv2", "Static"],
  "software_errors": 0,
  "global_thread_pool_size": 10
}

List VRFs

Returns all VRFs configured on the system.

$ flockc sys list-vrfs
[{"vrf_id":254,"vrf_name":"default","underlay_vrf_name":null,...}]

BGP Commands

BGP Overview

Returns the BGP instance overview including BGP ID, ASN, route counts per VRF, and neighbor summary.

$ flockc -f json-pretty bgp overview
{
  "id": "70.0.100.70",
  "asn": 70,
  "route_server": false,
  "route_reflector": false,
  "total_event_loops": 571,
  "routes": {
    "unicast_routes": {
      "default": {
        "ipv4_unicast": { "route_count": 3, "attr_list_store_count": 1 },
        "ipv6_unicast": { "route_count": 0, "attr_list_store_count": 0 }
      }
    },
    "vpn_routes": {}
  },
  "neighbor_summary": {
    "default": {
      "count": 4,
      "established": 4,
      "send_converged": 4,
      "recv_converged": 4
    }
  }
}

List BGP VRFs

$ flockc bgp list-vrfs
[{"vrf_id":254,"vrf_name":"default","vrf_info":{"neighs":["90.0.93.61","70.0.100.73 70.0.100.70",...]},...}]

BGP Event Log

Returns the BGP event log showing neighbor state changes.

$ flockc -f json-pretty bgp event-log
{
  "object_oper": {
    "db": [
      {
        "event": "AddOrUpdate",
        "object_desc": "BGP Peer VrfId(254) 90.0.93.61",
        "time": "2026-02-27T13:42:00.015Z"
      },
      {
        "event": "Up",
        "object_desc": "BGP Peer VrfId(254) 90.0.93.61",
        "time": "2026-02-27T13:42:00.185Z"
      },
      ...
    ]
  }
}

BGP VRF Commands

All VRF-scoped commands use the form flockc bgp vrf <name> <command>.

Unicast RIB Lookup

Look up a single prefix in the BGP unicast RIB.

$ flockc bgp vrf default rib lookup 50.0.0.0/8

Unicast RIB Walk

Walk the BGP unicast RIB starting from a root prefix. Supports pagination via --start-from and --max-entries.

# Walk all routes
$ flockc bgp vrf default rib walk 0.0.0.0/0

# Walk with pagination (1 entry at a time)
$ flockc bgp vrf default rib walk 0.0.0.0/0 --max-entries 1

# Continue from a specific prefix
$ flockc bgp vrf default rib walk 0.0.0.0/0 --start-from 60.0.0.0/8 --max-entries 1

Each entry in the walk response includes a finished field indicating whether there are more entries to retrieve.

Unicast RIB Statistics

# Basic counters
$ flockc bgp vrf default rib stats

# Include memory usage details
$ flockc bgp vrf default rib stats --memory

Returns IPv4 and IPv6 counters: total prefixes, path counts by type (iBGP, eBGP, originated, redistributed, VPN-imported), and optionally memory usage per RIB entry.

De-aggregation Labels

$ flockc bgp vrf default rib deagg-labels

Redistribution Policy

$ flockc bgp vrf default redist-policy

Returns the redistribution policy status and statistics including hit counts and accept/reject counters.

VPN Policy Statistics

$ flockc bgp vrf default vpn policy-stats

BGP Neighbor Commands

Neighbor commands use the form flockc bgp vrf <vrf> neigh <addr> <command>.

The neighbor address can be a simple IP (90.0.93.61) or include a source IP (70.0.100.72 70.0.100.70, space-separated and quoted).

Show Neighbor

# Basic neighbor info
$ flockc bgp vrf default neigh 90.0.93.61 show

# Include detailed statistics
$ flockc bgp vrf default neigh 90.0.93.61 show --stats

Returns neighbor state (Established/Idle/etc.), capabilities, timers, keepalive counters, and optionally per-AFI statistics including policy hit counts and adj-rib prefix counts.

Reset Neighbor

$ flockc bgp vrf default neigh 90.0.93.61 reset soft-in
$ flockc bgp vrf default neigh 90.0.93.61 reset soft-out
$ flockc bgp vrf default neigh 90.0.93.61 reset hard
$ flockc bgp vrf default neigh 90.0.93.61 reset refresh-in
$ flockc bgp vrf default neigh 90.0.93.61 reset refresh-out

Adjacency RIB Walk

Walk routes received from or advertised to a specific neighbor.

# Routes received from neighbor (adj-rib-in)
$ flockc bgp vrf default neigh 90.0.93.61 adj-rib-unicast in walk 0.0.0.0/0

# Routes advertised to neighbor (adj-rib-out)
$ flockc bgp vrf default neigh 90.0.93.61 adj-rib-unicast out walk 0.0.0.0/0

# RTC adj-rib
$ flockc bgp vrf default neigh 90.0.93.61 adj-rib-rtc in walk

BGP VPN RIB Commands

VPN RIB Lookup

$ flockc bgp vpn-rib lookup <rd> <ip-net>

VPN RIB Walk

$ flockc bgp vpn-rib walk <rd> <ip-net> [--start-from-rd <rd>] [--start-from-ip-net <ip-net>] [--max-entries N] [--walk-rds]

VPN RIB Statistics

$ flockc bgp vpn-rib stats [--ip-version <4|6>] [--memory]

BGP RTC RIB Commands

RTC RIB Lookup

$ flockc bgp rtc-rib lookup <rtc-net>

RTC RIB Walk

$ flockc bgp rtc-rib walk

BGP AFI RIB Commands

Query AFI-specific RIBs (e.g., EVPN).

$ flockc bgp vrf default afi-rib <afi> lookup <prefix>
$ flockc bgp vrf default afi-rib <afi> walk <root> [--start-from <prefix>] [--max-entries N]

BGP Configuration Commands

The gRPC API supports reading and updating BGP configuration. Configuration changes use a pending-config workflow: changes are staged locally in a .bgp_pending_config file, then applied atomically to the running router.

Show Current Configuration

# Full configuration
$ flockc bgp config show

# Configuration for a specific VRF
$ flockc -f json-pretty bgp config show --vrf default
[
  {
    "name": "default",
    "multipath": false,
    "neighs": [
      {
        "key": { "dst": { "version": { "V4": 1509973309 } }, "src": null },
        "asn": 60,
        "local_as": 70,
        "route_reflector_client": false,
        "next_hop_self": false,
        "disabled": false,
        "connect_mode": "Both",
        ...
      }
    ],
    "networks": [
      { "prefix": "70.0.0.0/8", "originate_always": false }
    ],
    ...
  }
]

Pending Configuration Workflow

Configuration changes follow a four-step workflow: initialize, stage, review, apply.

Step 1: Initialize

Create a fresh pending configuration staging file:

$ flockc bgp config init
initialized .bgp_pending_config

Step 2: Stage Changes

Stage one or more changes. Multiple changes can be staged before applying:

$ flockc bgp config set --asn 65001
$ flockc bgp config vrf default set --multipath
$ flockc bgp config vrf default neigh 10.0.0.1 set --asn 65002

Step 3: Review Pending Changes

Inspect what will be applied before committing:

$ flockc bgp config show-pending

Step 4: Apply

Apply all staged changes atomically to the running router:

$ flockc bgp config apply
config applied

Example: Adding a BGP Neighbor

# Initialize pending config
$ flockc bgp config init
initialized .bgp_pending_config

# Stage the new neighbor
$ flockc bgp config vrf default neigh 10.99.99.1 set --asn 65099 --local-as 70

# Review - the pending config shows the staged addition
$ flockc bgp config show-pending
{"asn":null,...,"vrfs":{"clear":false,"ops":[{"name":"default","delete":false,
  "neighs":{"clear":false,"ops":[{"key":{"dst":{"version":{"V4":174285569}},
  "src":null,"zone":null},"delete":false,"asn":{"v":{"Set":65099}},
  "local_as":{"v":{"Set":70}},...}]}}]}}

# Apply to the running router
$ flockc bgp config apply
config applied

# Verify - neighbor count increased and the new neighbor is visible
$ flockc bgp overview
{...,"neighbor_summary":{"default":{"count":5,"established":4,...}}}

$ flockc bgp vrf default neigh 10.99.99.1 show
{"common":{"neigh_key":"10.99.99.1","asn":65099,"local_as":70,
  "neigh_type":"External","connect_mode":"Both",...},...}

Example: Deleting a BGP Neighbor

# Initialize pending config
$ flockc bgp config init
initialized .bgp_pending_config

# Stage the deletion
$ flockc bgp config vrf default neigh 10.99.99.1 delete

# Review - the pending config shows delete:true
$ flockc bgp config show-pending
{"asn":null,...,"vrfs":{"clear":false,"ops":[{"name":"default","delete":false,
  "neighs":{"clear":false,"ops":[{"key":{"dst":{"version":{"V4":174285569}},
  "src":null,"zone":null},"delete":true,...}]}}]}}

# Apply to the running router
$ flockc bgp config apply
config applied

# Verify - neighbor count decreased and the neighbor is gone
$ flockc bgp overview
{...,"neighbor_summary":{"default":{"count":4,"established":4,...}}}

$ flockc bgp vrf default neigh 10.99.99.1 show
null

Configuration Set Options

Global BGP settings:

$ flockc bgp config set [--asn <ASN>] [--route-server] [--route-reflector]

VRF settings:

$ flockc bgp config vrf <name> set [--multipath] [--redist-policy <policy>]
$ flockc bgp config vrf <name> delete

Neighbor settings:

$ flockc bgp config vrf <name> neigh <addr> set \
    [--asn <ASN>] [--local-as <ASN>] \
    [--route-reflector-client] [--next-hop-self] \
    [--disabled] [--connect-mode <mode>]
$ flockc bgp config vrf <name> neigh <addr> delete

Output Formats

flockc supports five output formats via the -f flag:

FormatDescription
jsonCompact JSON (default)
json-prettyPretty-printed JSON
yamlYAML format
debugRust debug format
debug-prettyRust debug format, pretty-printed

Example using YAML:

$ flockc -f yaml bgp vrf default rib stats
v4:
  counters:
    total_prefixes: 3
    num_ibgp_regular_paths: 0
    num_ebgp_regular_paths: 2
    num_originated_paths: 1
    ...
v6:
  counters:
    total_prefixes: 0
    ...

3rd Party gRPC Clients

Since the gRPC API uses standard Protocol Buffers and HTTP/2, any gRPC client library can connect to flockd. The .proto service definitions are located in the flock_grpc/proto/ directory.

Available Services

ServiceProto FileDescription
SysServicesys.protoSystem overview and VRF listing
BgpOperServicebgp_oper.protoBGP operational state queries
BgpConfigServicebgp_config.protoBGP configuration read/write

Example: Connecting with grpcurl

# List available services
grpcurl -plaintext [::1]:50051 list

# Get system overview
grpcurl -plaintext [::1]:50051 sys.SysService/GetOverview

# Get BGP overview
grpcurl -plaintext -d '{}' [::1]:50051 bgp_oper.BgpOperService/GetOverview

Example: Connecting with Python

import grpc
# Generated from proto files using grpc_tools.protoc
import sys_pb2, sys_pb2_grpc

channel = grpc.insecure_channel('[::1]:50051')
stub = sys_pb2_grpc.SysServiceStub(channel)
response = stub.GetOverview(sys_pb2.GetOverviewRequest())
print(response)

gRPC Command Reference

System Service RPCs

RPCDescription
GetOverviewSystem overview (hostname, version, uptime, protocols, errors)
ListVrfsList all VRFs

BGP Operational Service RPCs

RPCDescription
GetOverviewBGP instance overview (ASN, BGP ID, route counts, neighbor summary)
ListVrfsList BGP VRFs with neighbor info
GetNeighborNeighbor details with optional statistics
ResetNeighborReset a BGP neighbor session
GetEventLogBGP event log
GetRedistPolicyRoute redistribution policy and stats
GetVpnPolicyStatsVPN import/export policy stats
UnicastRibLookupLook up a single unicast route
UnicastRibWalkWalk the unicast RIB with pagination
UnicastRibStatsUnicast RIB statistics with optional memory
GetSourceDeAggLabelsDe-aggregation label information
VpnRibLookupLook up a single VPN route
VpnRibWalkWalk the VPN RIB with pagination
VpnRibStatsVPN RIB statistics
RtcRibLookupLook up a single RTC route
RtcRibWalkWalk the entire RTC RIB
AfiRibLookupAFI-specific RIB lookup
AfiRibWalkAFI-specific RIB walk
AdjRibUnicastLookupAdjacency RIB unicast lookup
AdjRibUnicastWalkAdjacency RIB unicast walk
AdjRibVpnLookupAdjacency RIB VPN lookup
AdjRibVpnWalkAdjacency RIB VPN walk
AdjRibRtcLookupAdjacency RIB RTC lookup
AdjRibRtcWalkAdjacency RIB RTC walk
AdjRibPrivateLookupAdjacency RIB private lookup
AdjRibPrivateWalkAdjacency RIB private walk

BGP Configuration Service RPCs

RPCDescription
GetBgpConfigRead the full BGP configuration
UpdateBgpConfigApply a configuration update