Version information
released May 30th 2017
This version is compatible with:
- ,
Start using this module
Add this module to your Puppetfile:
mod 'bibigon812-quagga', '1.0.4'
Learn more about managing modules with a PuppetfileDocumentation
bibigon812/quagga — version 1.0.4 May 30th 2017
Overview
This module provides management of network protocols, such as BGP, OSPF without restarting daemons.
At the beginning
quagga
Describe quagga class.
class { 'quagga': }
Reference
enable
: Manages quagga servicesowner
: User of quagga configuration filesgroup
: Group of quagga configuration filesmode
: Mode of quagga configuration filespackage_name
: Name of the quagga packagepackage_ensure
: Ensure for the quagga packagecontent
: Initial content of configuration files
The most fat
bgp
bgp { '65000':
ensure => present,
import_check => 'enabled',
ipv4_unicast => 'enabled',
maximum_paths_ebgp => 10,
maximum_paths_ibgp => 10,
router_id => '10.0.0.1',
}
Reference
name
: AS numberimport_check
: Check BGP network route exists in IGPipv4_unicast
: Activate ipv4-unicast for a peer by defaultmaximum_paths_ebgp
: Forward packets over multiple paths ebgpmaximum_paths_ibgp
: Forward packets over multiple paths ibgprouter_id
: Override configured router identifier
bgp_neighbor
bgp_neighbor { '65000 internal':
ensure => present,
activate => 'enabled',
next_hop_self => 'enabled',
peer_group => 'enabled',
remote_as => 65000,
}
bgp_neighbor { '65000 10.0.0.2':
ensure => present,
peer_group => 'internal',
}
bgp_neighbor { '65000 10.0.0.3':
ensure => present,
peer_group => 'internal',
}
Reference
name
: It's consists of a AS number and a neighbor IP address or a peer-group nameactivate
: Enable the Address Family for this Neighborallow_as_in
: Accept as-path with my AS present in itdefault_originate
: Originate default route to this neighborlocal_as
: Specify a local-as numbernext_hop_self
: Disable the next hop calculation for this neighborpassive
: Don't send open messages to this neighborpeer_group
: Member of the peer-groupprefix_list_in
: Filter updates from this neighborprefix_list_out
: Filter updates to this neighborremote_as
: Specify a BGP neighbor asroute_map_export
: Apply map to routes coming from a Route-Server clientroute_map_import
: Apply map to routes going into a Route-Server client's tableroute_map_in
: Apply map to incoming routesroute_map_out
: Apply map to outbound routesroute_reflector_client
: Configure a neighbor as Route Reflector clientroute_server_client
: Configure a neighbor as Route Server clientshutdown
: Administratively shut down this neighbor
bgp_network
bgp_network { '65000 192.168.1.0/24':
ensure => present,
}
Reference
name
: It's consists of a AS number and a network IP address
ospf
ospf { 'ospf':
ensure => present,
abr_type => 'cisco',
opaque => 'disabled',
rfc1583 => 'disabled',
router_id => '10.0.0.1',
}
Reference
name
: Name must be 'ospf'abr_type
: Set OSPF ABR typeopaque
: Enable the Opaque-LSA capability (rfc2370)rfc1583
: Enable the RFC1583Compatibility flagrouter_id
: Router-id for the OSPF process
ospf_area
ospf_area { '0.0.0.0':
network => [ '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16' ],
}
ospf_area { '0.0.0.1':
stub => 'enabled',
}
ospf_area { '0.0.0.2':
stub => 'no-summary',
}
Reference
name
: OSPF areadefault_cost
: Set the summary-default cost of a NSSA or stub areaaccess_list_expor
: Set the filter for networks announced to other areasaccess_list_import
: Set the filter for networks from other areas announced to the specified oneprefix_list_export
: Filter networks sent from this areaprefix_list_import
: Filter networks sent to this areanetworks
: Enable routing on an IP networkshortcut
: Configure the area's shortcutting modestub
: Configure OSPF area as stub
ospf_interface
ospf_interface { 'eth0':
mtu_ignore => 'enabled',
hello_interval => 2,
dead_interval => 8,
}
Reference
name
: The friendly name of the network interfacecost
: Interface cosdead_interval
: Interval after which a neighbor is declared deadhello_interval
: Time between HELLO packetsmtu_ignore
: Disable mtu mismatch detectionnetwork
: Network typepriority
: Router priorityretransmit_interval
: Time between retransmitting lost link state advertisementstransmit_delay
: Link state transmit delay
redistribution
redistribution { 'ospf::connected':
metric => 100,
metric_type => 2,
route_map => 'CONNECTED',
}
redistribution { 'bgp:65000:ospf':
metric => 100,
route_map => 'WORD',
}
Reference
name
: The name contains the main protocol, the id and the protocol for redistributionmetric
: Metric for redistributed routesmetric_type
: OSPF exterior metric type for redistributed routesroute_map
: Route map reference
route_map
The route_map resource is a single sequence. You can use a chain of resources to describe complex route maps, for example:
route_map { 'bgp_out:permit:10':
ensure => present,
match => 'ip address prefix-list ADVERTISED-PREFIXES'
on_match => 'goto 65000',
}
route_map { 'bgp_out:deny:99':
ensure => present,
}
route_map { 'bgp_out:permit:65000':
ensure => present,
set => 'community 0:666',
}
Reference
name
: Name of the route-map, action and sequence number of rulematch
: Match values from routing tableon_match
: Exit policy on matchesset
: Set values in destination routing protocol
prefix_list
The prefix_list resource is a single sequence. You can use a chain of resources to describe compex prefix lists, for example:
prefix_list {'ADVERTISED_PREFIXES:10':
ensure => present,
action => 'permit',
prefix => '192.168.0.0/16',
le => 24,
}
prefix_list {'ADVERTISED_PREFIXES:20':
ensure => present,
action => 'permit',
prefix => '172.16.0.0/12',
le => 24,
}
Reference
name
: Name of the prefix-list and sequence number of ruleaction
: Action can be permit or denyge
: Minimum prefix length to be matchedle
: Maximum prefix length to be matchedprefix
: IP prefix /proto
: IP protocol version
community_list
community_list { '100':
rules => [
permit => 65000:50952,
permit => 65000:31500,
],
}
Reference
name
: Community list numberrules
: Action and community { action => community }
as_path
as_path { 'TEST_AS_PATH':
ensure => present,
rules => [
permit => '_100$',
permit => '_100_',
],
}
Reference
name
: The name of the as-path access-listrules
: Rules of the as-path access-list { action => regex }
Hiera
If Hierea is in your mind you can use something like this.
bgp proxy
---
site::profiles::bgp:
65000:
import_check: enabled
ipv4_unicast: disabled
router_id: 172.16.32.103
neighbor:
INTERNAL:
activate: enabled
allow_as_in: 1
next_hop_self: enabled
peer_group: enabled
remote_as: 197888
172.16.32.105:
peer_group: INTERNAL
network:
- 172.16.32.0/24
- 192.168.0.0/24
class site::profiles::bgp {
$bgp = hiera_hash('site::profiles::bgp', {}).reduce({}) |$bgp, $bgp_config| {
$as = $bgp_config[0]
$bgp_configs = $bgp_config[1].reduce({}) |$params, $param| {
if $param[0] == 'network' {
if $param[1] {
any2array($param[1]).each |$network| {
create_resources('bgp_network', { "${as} ${network}" => { ensure => present, } })
}
}
$hash = {}
} elsif $param[0] == 'neighbor' {
if $param[1] {
$param[1].each |$neighbor, $neighbor_config| {
create_resources('bgp_neighbor', { "${as} ${neighbor}" => $neighbor_config })
}
}
$hash = {}
} else {
$hash = { $param[0] => $param[1] }
}
merge($params, $hash)
}
merge($bgp, { $as => $bgp_configs })
}
create_resources('bgp', $bgp)
}
ospf proxy
---
site::profiles::ospf:
area:
0.0.0.0:
networks:
- 10.0.10.0/24
- 10.0.100.0/24
0.0.0.10:
stub: enabled
networks:
- 192.168.1.0/24
- 10.0.0.0/24
- 172.16.100.0/24
redistribute:
- bgp:
metric: 100
route_map: ROUTE_MAP
- connected
site::profiles::interface:
eth1:
ip:
ospf:
dead_interval: 8
hello_interval: 2
mtu_ignore: enabled
network: broadcast
priority: 100
retransmit_interval: 4
transmit_delay: 1
class site::profiles::ospf {
$config = hiera_hash('site::profiles::ospf', {})
$ospf = { 'ospf' => delete(delete($config, 'redistribute'), 'area') }
$ospf_areas = $config['area'].reduce({}) |$memo, $value| {
$area = $value[0]
$options = $value[1].reduce({}) |$memo, $value| {
if $value[0] == 'networks' {
$options = sort($value[1])
} else {
$options = $value[1]
}
merge($memo, { $value[0] => $options })
}
merge($memo, { $area => $options })
}
$redistribution = $config['redistribute'].reduce({}) |$memo, $value| {
$name = $value ? {
Hash => $value.keys[0],
default => $value,
}
$config = $value ? {
Hash => $value[$name],
default => {},
}
merge($memo, { "ospf::${name}" => $config })
}
$defaults = {
ensure => present,
}
$ospf_interface = hiera_hash('site::profiles::interface', {}).reduce({}) |$memo, $iface| {
$iface_name = $iface[0]
$ospf_interface = try_get_value($iface[1], 'ip/ospf')
if $ospf_interface {
merge($memo, { $iface_name => $ospf_interface })
}
}
create_resources('ospf', $ospf)
create_resources('ospf_interface', $ospf_interface)
create_resources('redistribution', $redistribution)
create_resources('ospf_area', $ospf_areas)
}
prefix_list proxy
---
site::profiles::prefix_list:
ADVERTISED_ROUTES:
rules:
10:
action: 'permit'
prefix: '192.168.0.0/24'
1000:
action: 'deny'
le: 32
prefix: '0.0.0.0/0'
class site::profiles::prefix_list {
$prefix_lists = hiera_hash('site::profiles::prefix_list', {}).reduce({}) |$memo, $value| {
$name = $value[0]
$ensure = $value[1]['ensure'] ? {
'absent' => 'absent',
default => 'present',
}
$prefix_list = $value[1]['rules'].reduce({}) |$memo, $value| {
merge($memo, {"${name}:${value[0]}" => merge({ensure => $ensure}, $value[1])})
}
merge($memo, $prefix_list)
}
create_resources('prefix_list', $prefix_lists)
}
route_map proxy
---
site::profiles::route_map:
AS1234_in:
1:
action: deny
match: ip address prefix-list AS_LOCAL
31:
action: permit
match: as-path FROM_AS2345
set: local-preference 800
60:
action: permit
match: ip address prefix-list ABCD_1
on_match: goto 100
set: local-preference 800
63:
action: permit
match: ip address prefix-list ABCD_2
on_match: goto 100
set: local-preference 800
100:
action: permit
on_match: goto 200
set: local-preference 200
200:
action: permit
set: community 65000:1234 additive
class site::profiles::route_map {
$route_maps = hiera_hash('site::profiles::route_map', {}).reduce({}) |$route_maps, $route_map| {
$name = $route_map[0]
$new_route_map = $route_map[1].reduce({}) |$route_map, $sequence| {
$index = $sequence[0]
$action = $sequence[1]['action']
$params = $sequence[1].reduce({}) |$params, $param| {
$new_param = $param[1] ? {
Array => sort($param[1]),
default => $param[1],
}
unless $param[0] == 'action' {
merge($params, {$param[0] => $new_param})
}
}
merge($route_map, {"${name}:${action}:${index}" => $params})
}
merge($route_maps, $new_route_map)
}
create_resources('route_map', $route_maps)
}
Types in this module release
[1.0.4] - 30-05-2017
Fixed
- an instantiation of the ospf resource
Removed
- a default value of the activate property of the bgp_neighbor resource
[1.0.3] - 30-05-2017
Fixed
- typos
- autorequires in bgp_netighbor and bgp_network resources
Updated
- docs
- changelog
[1.0.2] - 30-05-2017
Added
- proxy classes to use hiera
Updated
- changelog
- docs
Fixed
- a control of services
[1.0.1] - 29-05-2017
Changed
- values of the stub property
Updated
- changelog
- docs
[1.0.0] - 29-05-2017
Added
- the ospf_interface type
- the quagga provider of the ospf_interface type
- the ospf type
- the quagga provider of the ospf type
- the ospf_area type and a provider for it
- the redistribution type and a provider for it
- the as_path type and a provider for it
- the community_list type and a provider for it
- the prefix_list type and a provider for it
- the route_map type and a provider for it
- the bgp type and a provider for it
- the bgp_neighbor type and a provider for it
- the bgp_network type and a provider for it
Updated
- changelog
- docs
Dependencies
- puppetlabs-stdlib (>=3.2.0 <5.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.