1. Getting started¶
1.1. Installing exabgpctl¶
exabgpctl is available on PyPI, so you can use pip:
$ pip install exabgpctl
Alternatively, if you don’t have setuptools installed, download it from PyPi and run
$ python setup.py install
To use the bleeding-edge version of exabgpctl, you can get the source from GitHub and install it as above:
$ git clone git://github.com/ahmet2mir/exabgpctl
$ cd exabgpctl
$ python setup.py install
1.2. Configuration¶
exabgpctl will not use any “self” configuration, we will only read the real exabgp conf and extend features.
By default it will read the file under /etc/exabgp/exabgp.conf
.
To override it, set environment variable
EXABGPCTL_CONF
: exabgp.conf path (default /etc/exabgp/exabgp.conf)EXABGPCTL_STATE
: where state files should be stored (for process state command) (default /var/lib/exabgp/status)
All examples using here will use conf from examples
folder.
1.4. Output format¶
You could choose which output format you wan’t, by default it will be json
$ exabgpctl -o, --output [flat|json|yaml]
Where flat is key/value output.
1.5. Process Status¶
Check all process statuses, exabgpctl will read state and run the healthcheck command defined in exabgp.conf
$ exabgpctl process status
{
"service1.exabgp.lan": {
"state": "UP",
"command_check": "/bin/true",
"command": true,
"state_path": "/var/lib/exabgp/status/service1.exabgp.lan"
}
...
1.6. Enable / Disable process maintenance¶
ExaBGP support a maintenance flag, if the file exists, the route will be unannounced.
Disable
$ exabgpctl process disable service1.exabgp.lan
True
$ exabgpctl process status
{
"service1.exabgp.lan": {
"state": "DISABLED",
"command_check": "/bin/true",
"command": true,
"state_path": "/var/lib/exabgp/status/service1.exabgp.lan"
}
...
Enable
$ exabgpctl process enable service1.exabgp.lan
True
$ exabgpctl process status
{
"service1.exabgp.lan": {
"state": "UP",
"command_check": "/bin/true",
"command": true,
"state_path": "/var/lib/exabgp/status/service1.exabgp.lan"
}
...
1.7. List process¶
List all process (with any state)
$ exabgpctl process list
[
"service1.exabgp.lan",
"service2.exabgp.lan",
"service3.exabgp.lan"
]
List only disabled (maintenance) process
$ exabgpctl process disable service1.exabgp.lan
True
$ exabgpctl process list -d
[
"service1.exabgp.lan"
]
1.8. Change state¶
exabgp could update the state of the process using --execute
flag in healthcheck.
And set an environment variable with the current state.
You could use exabgctl to manage this state
$ STATE='DOWN' exabgpctl process state service1.exabgp.lan
DOWN
$ exabgpctl process status
{
"service1.exabgp.lan": {
"state": "DOWN",
"command_check": "/bin/true",
"command": true,
"state_path": "/var/lib/exabgp/status/service1.exabgp.lan"
}
1.9. Show process¶
Get process details
$ exabgpctl process show service1.exabgp.lan
{
"consolidate": false,
"receive-keepalives": false,
"receive-packets": false,
"receive-opens": false,
"receive-refresh": false,
"receive-notifications": false,
"neighbor-changes": false,
"encoder": "text",
"receive-parsed": false,
"neighbor": "*",
"receive-operational": false,
"run": {
...
1.10. List neighbors¶
List all process (with any state)
$ exabgpctl neighbor list
[
"192.168.0.1",
"192.168.0.2"
]
1.11. Show neighbor¶
Get neighbor details
$ exabgpctl neighbor show 192.168.0.1
{
"group_updates": false,
"add_path": 0,
"flush": true,
"api": {},
"connect": 0,
"ttl": null,
"peer_address": "192.168.0.1",
...
1.12. Status neighbor¶
Get neighbor statuses, it will try to connect to neighbor on port 179.
$ exabgpctl neighbor status
{
"192.168.0.2": {
"status": false,
"status_addressport": [
"192.168.0.2",
179
]
},
"192.168.0.1": {
"status": false,
"status_addressport": [
"192.168.0.1",
179
]
}
}