Using ARouteServer as a library¶
External programs can take advantage of ARouteServer’s features to automatically build route server configurations by using the following builder classes:
- BIRDConfigBuilder
- OpenBGPDConfigBuilder
How to use it¶
The __init__
method takes care of initializing the builder object; this method also gathers any external information needed by the input route server configuration.
The render_template
method generates the output configuration.
Example:
import sys
from pierky.arouteserver.builder import BIRDConfigBuilder
builder = BIRDConfigBuilder(
template_dir="~/arouteserver/templates/bird",
template_name="main.j2",
cfg_general="~/arouteserver/config.d/general.yml",
cfg_clients="~/arouteserver/config.d/clients.yml",
cfg_bogons="~/arouteserver/config.d/bogons.yml",
cache_dir="~/arouteserver/var",
ip_ver=4
)
builder.render_template(sys.stdout)