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

Some more hiera work #15

Merged
merged 3 commits into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,28 @@ lookup_options:
quagga::prefix_lists:
merge:
strategy: deep
quagga::route_maps:
merge:
strategy: deep
quagga::bgp::router:
merge:
strategy: hash
quagga::bgp::peers:
merge:
strategy: deep
quagga::bgp::route_maps:
merge:
strategy: deep
quagga::bgp::as_paths:
merge:
strategy: deep
quagga::bgp::community_lists:
merge:
strategy: deep
quagga::bgp::address_families:
merge:
strategy: deep
quagga::global_opts: {}
quagga::interfaces: {}
quagga::prefix_lists: {}
quagga::route_maps: {}
quagga::default_owner: "quagga"
quagga::default_group: "quagga"
quagga::default_mode: "0600"
Expand Down Expand Up @@ -59,9 +63,9 @@ quagga::bgp::service_ensure: "running"
quagga::bgp::service_opts: "-P 0"
quagga::bgp::router: {}
quagga::bgp::peers: {}
quagga::bgp::route_maps: {}
quagga::bgp::as_paths: {}
quagga::bgp::community_lists: {}
quagga::bgp::address_families: {}
quagga::ospf::config_file: "%{lookup('quagga::config_dir')}/ospfd.conf"
quagga::ospf::config_file_manage: true
quagga::ospf::service_name: "ospfd"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Puppet::Type.type(:quagga_as_path).provide :quagga do
Puppet::Type.type(:quagga_bgp_as_path).provide :quagga do
@doc = %q{
Manages as-path access-list using quagga.
}
Expand Down Expand Up @@ -104,4 +104,4 @@ def rules=(value)

@property_hash[:rules] = value
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Puppet::Type.type(:quagga_community_list).provide :quagga do
Puppet::Type.type(:quagga_bgp_community_list).provide :quagga do
@doc = 'Manages a community-list using quagga.'

commands :vtysh => 'vtysh'
Expand Down Expand Up @@ -108,4 +108,4 @@ def rules=(value)

@property_hash[:rules] = value
end
end
end
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Puppet::Type.newtype(:quagga_as_path) do
Puppet::Type.newtype(:quagga_bgp_as_path) do
@doc = %q{
This type provides the capabilities to manage as-path access-list within puppet.
This type provides the capabilities to manage BGP as-path access-list within puppet.

Examples:

quagga_as_path { 'as100':
quagga_bgp_as_path { 'as100':
ensure => present,
rules => [
'permit _100$',
Expand Down Expand Up @@ -42,4 +42,4 @@ def should_to_s(newvalue = @should)
autorequire(:service) do
%w{zebra bgpd}
end
end
end
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
Puppet::Type.newtype(:quagga_community_list) do
Puppet::Type.newtype(:quagga_bgp_community_list) do
@doc = %q{

This type provides the capability to manage community-list
within puppet.
This type provides the capability to manage BGP community-list within puppet.

Examples:

quagga_community_list { '100':
quagga_bgp_community_list { '100':
ensure => present,
rules => [
'permit 65000:50952',
Expand Down Expand Up @@ -51,4 +50,4 @@ def should_to_s(value = @should)
autorequire(:service) do
%w{zebra bgpd}
end
end
end
45 changes: 25 additions & 20 deletions manifests/bgp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
Boolean $service_manage,
Enum["running", "stopped"] $service_ensure,
String $service_opts,
Optional[Integer] $as_number = undef,
Hash $router,
Hash $peers,
Hash $route_maps,
Hash $as_paths,
Hash $community_lists
Hash $community_lists,
Hash $address_families
) {
include quagga::bgp::config
include quagga::bgp::service
Expand All @@ -20,33 +21,37 @@
fail("Quagga only supports a single BGP router instance in ${title}")
}

$router.each |String $router_name, Hash $router| {
quagga_bgp {$router_name:
if $service_enable and $service_ensure == 'running' {
unless $as_number {
fail("Must specify BGP AS router number when service is enabled")
}

quagga_bgp {$as_number:
* => $router
}
}

$peers.each |String $peer_name, Hash $peer| {
quagga_bgp_peer {$peer_name:
* => $peer
$peers.each |String $peer_name, Hash $peer| {
quagga_bgp_peer {"$as_number $peer_name":
* => $peer
}
}
}

$route_maps.each |String $route_map_name, Hash $route_map| {
quagga_route_map {$route_map_name:
* => $route_map
$as_paths.each |String $as_path_name, Hash $as_path| {
quagga_bgp_as_path {$as_path_name:
* => $as_path
}
}
}

$as_paths.each |String $as_path_name, Hash $as_path| {
quagga_as_path {$as_path_name:
* => $as_path
$community_lists.each |String $community_list_name, Hash $community_list| {
quagga_bgp_community_list {$community_list_name:
* => $community_list
}
}
}

$community_lists.each |String $community_list_name, Hash $community_list| {
quagga_community_list {$community_list_name:
* => $community_list
$address_families.each |String $address_family_name, Hash $address_family| {
quagga_bgp_address_family {"$as_number $address_family_name":
* => $address_family
}
}
}
}
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Hash $global_opts,
Hash $interfaces,
Hash $prefix_lists,
Hash $route_maps,
String $default_owner,
String $default_group,
String $default_mode,
Expand Down Expand Up @@ -56,4 +57,10 @@
* => $prefix_list
}
}

$route_maps.each |String $route_map_name, Hash $route_map| {
quagga_route_map {$route_map_name:
* => $route_map
}
}
}