Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature protocol cmd (restart, reload, enable and disable) #228

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Dennis-de-Houx
Copy link

As ask in "[Request] Restart Command #219" I made a PR for this.

Example use of this "module/feature":

# pathvector -t -v protocol reload device1
*******************************************************************************
WARNING: This is a development build. It is not recommended for production use.
Please submit any bugs to https://github.com/natesales/pathvector/issues
*******************************************************************************
DEBU[0000] Loading config from /etc/pathvector.yml
DEBU[0000] Setting PeeringDB endpoint to https://peeringdb.com/api/
DEBU[0000] Loaded 0 ASNs and 0 prefixes into global blocklist
DEBU[0000] Finished loading config
INFO[0000] Starting bird protocol command
DEBU[0000] Connecting to BIRD socket
DEBU[0000] Connected to BIRD socket
DEBU[0000] BIRD init response: BIRD 2.0.12 ready.
DEBU[0000] Sending BIRD command: reload device1
DEBU[0000] Sent BIRD command: reload device1
DEBU[0000] Reading from socket
DEBU[0000] Done reading from socket
DEBU[0000] Command Output: device1: reloading
Command reload succeeded for protocol: device1

And when session doesn't exists (with debug info)

# pathvector -t -v protocol reload device100
*******************************************************************************
WARNING: This is a development build. It is not recommended for production use.
Please submit any bugs to https://github.com/natesales/pathvector/issues
*******************************************************************************
DEBU[0000] Loading config from /etc/pathvector.yml
DEBU[0000] Setting PeeringDB endpoint to https://peeringdb.com/api/
DEBU[0000] Loaded 0 ASNs and 0 prefixes into global blocklist
DEBU[0000] Finished loading config
INFO[0000] Starting bird protocol command
DEBU[0000] Connecting to BIRD socket
DEBU[0000] Connected to BIRD socket
DEBU[0000] BIRD init response: BIRD 2.0.12 ready.
DEBU[0000] Sending BIRD command: reload device100
DEBU[0000] Sent BIRD command: reload device100
DEBU[0000] Reading from socket
DEBU[0000] Done reading from socket
FATA[0000] The protocol name was not found!

And when session doesn't exists (normal run)

# pathvector protocol reload device100
*******************************************************************************
WARNING: This is a development build. It is not recommended for production use.
Please submit any bugs to https://github.com/natesales/pathvector/issues
*******************************************************************************
INFO[0000] Starting bird protocol command
FATA[0000] The protocol name was not found!

And the help message:

*******************************************************************************
WARNING: This is a development build. It is not recommended for production use.
Please submit any bugs to https://github.com/natesales/pathvector/issues
*******************************************************************************
With this command you can restart, reload, enable or disable a protocol, if you want you can use "all" as the protocol name to for example restart all protocol sessions.

Usage:
  pathvector protocol <(r)estart|re(l)oad|(e)nable|(d)isable> <protocol name> [flags]

Aliases:
  protocol, p, protocols

Flags:
  -h, --help             help for protocol
  -m, --message string   enable/disable custom message

Global Flags:
  -c, --config string   YAML configuration file (default "/etc/pathvector.yml")
  -d, --dry-run         Don't modify configuration
      --lock string     Lock file (check disabled if empty)
  -n, --no-configure    Don't configure BIRD
  -t, --trace           Show trace log messages
  -v, --verbose         Show verbose log messages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant