Automating BGP - for real this time

Ever since I started an Autonomous System on the internet a few years ago, I've dealt with the monotonous task of configuring new neighbor sessions. Don't get me wrong, peering is a great thing and I always enjoy turning up new peers - but manually writing the config each time is tedious, requires repeated work to update filters, and is prone to errors. So I automated the problem away!

I use BIRD for a lot of my BGP routers (Especially with the CDN where everything is software defined, but that might change in favor of GoBGP) so the first thing to do was write a Python script to parse a YAML file and pull IRR data from bgpq4 to assemble BIRD protocol definitions. It was a crude solution but it worked for the most part. I had a single YAML file where I could enter config data into, and the script would take care of the rest. It had it's flaws, notably this absolutely horrendous line written at 1AM:

{{ "\n ".join(os.popen("bgpq3 -Ab " + import_filter + " -" + family|string).read().lstrip().split("\n")[1:-2])[2:] }}

Now that I'm running almost 20 routers under AS34553 and many BGP sessions on each, it was time for a rewrite. The new system, dubbed "bcg" for the BIRD Configuration Generator is written in Go and automates the process of configuring BGP sessions with automatic RPKI, IRR, bogon, and max-prefix limits. Just enter your config in your favorite config format (YAML, TOML, or JSON) and bcg takes care of the rest. The project is still very much in alpha stages but it's open source on GitHub and feedback is greatly appreciated!

natesales/bcg
BIRD BGP Configuration Generator. Contribute to natesales/bcg development by creating an account on GitHub.
Show Comments