-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement custom configuration for daemons and bgp.session password f…
…or bird Implementing custom configuration templates for daemons is a bit harder than expected: * As we're assuming we cannot deploy extra stuff to daemons with Ansible playbooks, we have to add custom configuration templates into daemon_config dictionary so they get rendered as files and deployed to the container (and later VM) * The custom configuration templates can be in the usual places, but have to be registered in the daemon.daemon_config early in the process (for example, during the plugin initialization) * As Box aggresively creates hierarchies out of dotted keys, we have to use '@' instead of '.' in the daemon_config dictionary (example: 'bgp@session' instead of 'bgp.session') With this in mind, the following changes were made to the code: * The daemon_config dictionary can be copied from devices to nodes only after plugins have been initialized. The copy operation is done in the augment_node_device_data * The node _daemon_config dictionary is further cleaned in a new augment.nodes.cleanup function -- all entries referring to inactive modules or extra config templates are removed. This cleanup was previously done in the modules.augment_node_module, which is executed too early (before the plugins did their job) * The mapping of clab binds has to be done as late as possible (when the _daemon_config dictionary has been cleaned up) and has been moved to a new node_post_transform clab hook. * As there's no call to a node-specific provider post_transform hook, the main post_transform hook calls node_post_transform hooks (please note that every node could use a different provider) * The 'find_extra_template' function uses different paths, path suffixes and file names when searching for templates that are listed in the node.config list. To make that work, we have to pass lab topology as an extra argument into that function. * 'initial-config.ansible' playbook does not start tasks to deploy custom configuration templates if the same template (potentially using @) is listed in node._daemon_config * 'create-config.yml' task list has to deal with '@'-means-'.' stupidity Sample implementation (bird): * Adds handling of MD5 password into the main bgp.j2 template because bird cannot have the same protocol defined (and merged) in two places * To simplify future additions, the main Bird config file includes everything from the _daemon_config as an include file * 'bird.j2' template in the extra/bgp.session directory is just a placeholder * Bird device data were added to the bgp.session/defaults.yml file, including a mapping of the related configuration template * There's a new integration test for the bgp.session MD5 password functionality. Similar tests will be added when we need them for further bird bgp.session features. Other minor fixes: * Add a few task/play headers in create-config.ansible, create-custom-config.yml
- Loading branch information
Showing
17 changed files
with
132 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Empty file, all configuration is done in bgp.j2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
message: | ||
This lab tests the BGP MD5 password functionality. The EBGP session | ||
between the probe and the lab device should be established. | ||
|
||
plugin: [ bgp.session ] | ||
module: [ bgp ] | ||
defaults.paths.validate: topology:../validate | ||
|
||
groups: | ||
probes: | ||
device: frr | ||
provider: clab | ||
members: [ x1 ] | ||
|
||
defaults.bgp.as: 65000 | ||
|
||
nodes: | ||
dut: | ||
x1: | ||
bgp.as: 65100 | ||
|
||
links: | ||
- dut: | ||
x1: | ||
bgp.password: Secret | ||
|
||
validate: | ||
wait: | ||
description: Wait for EBGP sessions to come up | ||
wait: 3 | ||
session: | ||
description: Check EBGP sessions with DUT | ||
nodes: [ x1 ] | ||
plugin: bgp_neighbor(node.bgp.neighbors,'dut') |