Flock Routing Suite Client flockc
flockc
is the client provided to query the current state of flockd
. By design flockc
can be run by a user with no special privileges. flockc
connects to a Read-Only connection on flockd
. flockd
state can be viewed but cannot be changed. All output is in JSON format, making it suitable for consumption by humans or machines.
flockc
connects to a REST API on flockd
. This REST API will talk to any HTTP based client. This means any HTTP based client can be used to monitor flockd
. Just connect the client to the same URL that flockc
uses. Use the flockc
--show-url
option to display the URL associated with the flockc
command.
For example:
$ flockc system --show-url
http://127.0.0.1:8000/system/sort/json-lines
See here for more information on using the REST API.
Local Connectivity
flockc
uses the REST API via the local IP Looback address to retrieve state information from the local flockd
.
This command shows all the IPv4 Prefixes in the RIB of the local flocknet1
router.
flock@flocknet1:~$ flockc ribv4 --prefix
{"ip_net":"0.0.0.0/0","origin":"Ospfv2","next_hops":[{"intf_id":2, "ip_addr":"10.0.1.168"},{"intf_id":3,"ip_addr":"10.0.2.203"}]}
{"ip_net":"10.0.1.0/24","origin":"Kernel","next_hops":[{"intf_id":2}]}
{"ip_net":"10.0.2.0/24","origin":"Kernel","next_hops":[{"intf_id":3}]}
...
Remote Connectivity
flockc
can connect and retrieve the same state information from a remote router. Just add the --host
option to any command. The host parameter can be a hostname or an IP Address.
This command shows all the IPv4 Prefixes in the RIB of the remote flocknet2
router.
flock@flocknet1:~$ flockc ribv4 --prefix --host flocknet2
{"ip_net":"0.0.0.0/0","origin":"Ospfv2","next_hops":[{"intf_id":2, "ip_addr":"10.0.11.168"},{"intf_id":3,"ip_addr":"10.0.22.203"}]}
{"ip_net":"10.0.11.0/24","origin":"Kernel","next_hops":[{"intf_id":2}]}
{"ip_net":"10.0.22.0/24","origin":"Kernel","next_hops":[{"intf_id":3}]}
...
flockc
is available on its own. Install this package if you want to remotely manage your network from a host.
# dpkg -i flockc_20.3.x_amd64.deb
General Command Flags
General Flags can be included in any flockc
command.
-d, --detail
-h, --help
-J, --json Output in JSON
-j, --json-pretty Output in Pretty Print JSON
-u, --unsorted Output in unsorted order
Changing the output format
By default the output is in JSON Lines format, which is JSON with newlines added to aid reading by a human. The output can also be changed to JSON Pretty or vanilla JSON.
JSON Lines format
flock@flocknet:~$ flockc ospfv2 --neigh 10.0.100.3
{"ospf_area_id":"0.0.0.0"}
{"ospf_intf":"enp1s0"}
{"id":"10.0.100.3","ip":"10.0.5.225","state":"Full","dr":"10.0.5.225","bdr":"10.0.5.204"}
JSON Pretty format
Using the -j
, --json-pretty
flag the output is pretty printed JSON.
flock@flocknet:~$ flockc ospfv2 --neigh 10.0.100.3 -j
[
{
"ospf_area_id": "0.0.0.0",
"ospf_intfs": [
{
"ospf_intf": "enp1s0",
"ospf_neighs": [
{
"id": "10.0.100.3",
"ip": "10.0.5.225",
"state": "Full",
"dr": "10.0.5.225",
"bdr": "10.0.5.204"
}
]
}
]
}
]
JSON format
Using the -J
, --json
flag the output is JSON. This is the flag to use when talking to another application which wants to deserialize the JSON string into its own representation.
flock@flocknet:~$ flockc ospfv2 --neigh 10.0.100.3 -J
[{"ospf_area_id":"0.0.0.0","ospf_intfs":[{"ospf_intf":"enp1s0","ospf_neighs":[{"id":"10.0.100.3","ip":"10.0.5.225","state":"Full","dr":"10.0.5.225","bdr":"10.0.5.204"}]}]}]