Extension:RtConfig

From mediawiki.org
MediaWiki extensions manual
RtConfig
Release status: unmaintained
Implementation Parser extension , Tag
Description Extension that allows you to use IRRPowerTools RtConfig syntax inside MediaWiki for documenting Router BGP setup with MediaWiki
Author(s) (sibbitalk)
Latest version 1.0 (2010-02-23)
MediaWiki
License GNU Free Documentation License
Download http://www.dot1q.org/RtConfig.zip

What can this extension do?[edit]

This extensions allows you to use RtConfig syntax within MediaWiki inside <rtconfig> tags. The tags are then parsed when submitting the page to display the output of the tags once parsed by RtConfig.

To use this extension you will obviously need to install RtConfig from the IRR Toolset. How to do that, and how to get the source is documented here http://irrtoolset.isc.org/wiki/IRRToolSetInstallation

Usage[edit]

Simply download, install and configure the extension. Then on any MediaWiki page insert RtConfig syntax inside <rtconfig> tags, see examples.

Download instructions[edit]

Fetch the ZIP file containing the extension from http://www.dot1q.org/RtConfig.zip

Place the RtConfig.php file found inside in $IP/extensions/RtConfig/RtConfig.php Please cut and paste the code found below and place it in $IP/extensions/ExtensionName/ExtensionName.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php .

Installation[edit]

To install this extension, add the following to LocalSettings.php :

require_once("$IP/extensions/RtConfig/RtConfig.php");

Configuration parameters[edit]

If you wish to configure the module (sensible defaults are provided for all options) please insert the following after require_once in LocalSettings.php

$wgRtConfigSettings = new RtConfigSettings();

You can then set the following options, based on your needs, by inserting, one or more, of these lines, after you have created the new RtConfigSettings() object. See explanation of each individiual configuration option below...

$wgRtConfigSettings->Debug = true;
$wgRtConfigSettings->Command = "/usr/local/bin/RtConfig";
$wgRtConfigSettings->IgnoreErrors = false;
$wgRtConfigSettings->ReportErrors = false;
$wgRtConfigSettings->Files = array("/home/someone/file1","/home/someone/file2");
$wgRtConfigSettings->SourceList = "/home/someone/file1,/home/someone/file2";
$wgRtConfigSettings->Format = "cisco";
$wgRtConfigSettings->WhoisHost="whois.radb.net";
$wgRtConfigSettings->WhoisPort=43;
$wgRtConfigSettings->WhoisProtocol="irrd";
$wgRtConfigSettings->NoMatchIPInbound=false;
$wgRtConfigSettings->DisableAccessListCache=false;
$wgRtConfigSettings->SupressMartians=false;
$wgRtConfigSettings->CiscoNOCompressACLs=false;
$wgRtConfigSettings->CiscoUsePrefixLists=false;
$wgRtConfigSettings->CiscoEliminateDupMapParts=false;
$wgRtConfigSettings->CiscoSkipRouteMaps=false;
$wgRtConfigSettings->CiscoForceTilda=false;
$wgRtConfigSettings->CiscoEmptyLists=false;
  • $wgRtConfigSettings->Command
Where the actual RtConfig binary is on your system usually (and defaults to) /usr/local/bin/RtConfig
  • $wgRtConfigSettings->Files
An array of paths to IRR cache files you want to include.  Defaults to none.  

  • $wgRtConfigSettings->SourceList
A comma seperated string of sources to consider.  If the same object is defined multiple times, 
the first match is used (from left to right), defaults to none, see RtConfig manual page for more info. 
 
  • $wgRtConfigSettings->Format
The configuration format for RtConfig, defaults to cisco, other options include junos, bcc (for bay), gated
or rsd, see RtConfig manual page for more info.

  • $wgRtConfigSettings->WhoisHost
The host to establish a whois connection to, the default is whois.radb.net

  • $wgRtConfigSettings->WhoisPort
The port on the whois server to connect to, the default is 43

  • $wgRtConfigSettings->WhoisProtocol
The protocol to used to establish a connection to the whois host The default is irrd.  Other options 
are ripe (bird) and ripe_perl for the old ripe server, see RtConfig manual page for more info.
 
  • $wgRtConfigSettings->ReportErrors
Whether to report errors in whois database/parsing , the default is false, see RtConfig manual page 
for more info.
  
  • $wgRtConfigSettings->IgnoreErrors
Whether to ignore errors in whois database/parsing, the default is false, set RtConfig manual page
for more info
 
  • $wgRtConfigSettings->NoMatchIPInbound
Legacy option to support old Cisco Routers which do not suppport ip access-list matches within route-map, 
defaults to false, see RtConfig manul page for more info.

  • $wgRtConfigSettings->DisableAccessListCache
By default RtConfig will cache access-lists (and in the future possibly other data as well, meaning it will 
re-use the same access-list number instead of generating a new list.  Turning this off saves a little memory
on the RtConfig server while using more resources on the router.  Default is false
  • $wgRtConfigSettings->SupressMartians
This option only affects cisco configurations.  All access-lists generated will deny the standard martians, 
default is false, see RtConfig manual page for more info.

  • $wgRtConfigSettings->CiscoNoCompressACLs
This option only affects cisco configurations.  Settings this option to true will disable combining multiple 
cisco access list lines into a single line using wildcards whenever possible, defaults to false, see RtConfig 
manual page for more info.

  • $wgRtConfigSettings->CiscoUsePrefixLists
This option only affects cisco configurations.  The options instructs RtConfig to output prefix-lists which yield 
higher performance than access-lists.  This flag automatically turns on -cisco_compress_acls, settings 
CiscoNoCompressACLs to true while also setting this option to true, does not make sense.  Defaults to false, 
see RtConfig manual page for more info.

  • $wgRtConfigSettings->CiscoEliminateDupMapParts
This option only affects cisco configuratiom.  The option instructs RtConfig to eliminate a later map part if it's 
filter is covered by earlier map parts.  Defaults to false, see RtConfig for more information

  • $wgRtConfigSettings->CiscoSkipRouteMaps
This option only affects cisco configurations.  The option instruct RtConfig to not print route-maps, hence it will 

only print access lists. Defaults to false, see RtConfig manual page for more info.

  • $wgRtConfigSettings->CiscoForceTilde
This option only affects cisco configurations.  The option forces * and + operators in AS-PATH regular expressions 

to be interpreted as ~* and ~+ operators. This is useful if you get as path access-lists with really long lines, since this will force them to multiple lines. Defaults to false, See RtConfig manual page for more information.

  • $wgRtConfigSettings->CiscoEmptyLists
This option only affects cisco configurations.  The option forces interpreting ANY/NOT ANY prefix filter as 

universal/empty set of prefixes, and produces access lists for them. Defaults to false, see RtConfig manual page for more info.

  • $wgRtConfigSettings->Debug
Turns on some debugging output for the extension, defaults to false.

Examples[edit]

The following entry in a wiki page

<rtconfig>
neighbor 198.32.162.2 remote-as 3701
neighbor 198.32.162.2 version 4
@RtConfig set cisco_map_name = "AS3701-EXPORT"
@RtConfig export AS1798 198.32.162.7 AS3701 198.32.162.2
@RtConfig set cisco_map_name = "AS3701-IMPORT"
@RtConfig import AS1798 198.32.162.7 AS3701 198.32.162.2
</rtconfig>

Will yield (with the default configuration)

neighbor 198.32.162.2 remote-as 3701
neighbor 198.32.162.2 version 4
!
no access-list 100
access-list 100 permit ip 158.104.0.0   0.0.0.0   255.255.0.0   0.0.0.0
access-list 100 permit ip 159.121.0.0   0.0.0.0   255.255.0.0   0.0.0.0
access-list 100 permit ip 167.131.0.0   0.0.0.0   255.255.0.0   0.0.0.0
access-list 100 permit ip 167.135.0.0   0.0.0.0   255.255.0.0   0.0.0.0
access-list 100 permit ip 170.104.0.0   0.0.0.0   255.255.0.0   0.0.0.0
access-list 100 permit ip 192.82.120.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 192.84.215.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 192.136.62.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 192.146.205.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 192.149.16.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 192.152.7.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 192.234.56.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 198.107.5.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 198.176.0.0   0.0.0.0   255.255.248.0   0.0.0.0
access-list 100 permit ip 198.176.229.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 198.177.16.0   0.0.0.0   255.255.248.0   0.0.0.0
access-list 100 permit ip 198.177.24.0   0.0.0.0   255.255.252.0   0.0.0.0
access-list 100 permit ip 198.200.220.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 198.232.198.0   0.0.0.0   255.255.254.0   0.0.0.0
access-list 100 permit ip 198.232.200.0   0.0.0.0   255.255.252.0   0.0.0.0
access-list 100 permit ip 198.237.192.0   0.0.0.0   255.255.252.0   0.0.0.0
access-list 100 permit ip 198.252.211.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 198.252.231.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 199.48.32.0   0.0.0.0   255.255.240.0   0.0.0.0
access-list 100 permit ip 199.74.0.0   0.0.0.0   255.255.248.0   0.0.0.0
access-list 100 permit ip 204.58.240.0   0.0.0.0   255.255.252.0   0.0.0.0
access-list 100 permit ip 204.144.80.0   0.0.0.0   255.255.255.0   0.0.0.0
access-list 100 permit ip 205.143.224.0   0.0.0.0   255.255.248.0   0.0.0.0
access-list 100 permit ip 205.167.156.0   0.0.0.0   255.255.254.0   0.0.0.0
access-list 100 permit ip 205.173.216.0   0.0.0.0   255.255.248.0   0.0.0.0
access-list 100 permit ip 205.235.192.0   0.0.0.0   255.255.240.0   0.0.0.0
access-list 100 deny ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255
!
no route-map AS3701-EXPORT
!
route-map AS3701-EXPORT permit 1
 match ip address 100
exit
!
router bgp 1798
!
 neighbor 198.32.162.2 remote-as 3701
 neighbor 198.32.162.2 route-map AS3701-EXPORT out
!
exit
!
no access-list 101
access-list 101 deny ip 0.0.0.0   0.0.0.0   0.0.0.0   0.0.0.0
access-list 101 deny ip 224.0.0.0   15.255.255.255   240.0.0.0   15.255.255.255
access-list 101 permit ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255
!
no route-map AS3701-IMPORT
!
route-map AS3701-IMPORT permit 1
 match ip address 101
 set local-preference 900
exit
!
router bgp 1798
!
 neighbor 198.32.162.2 remote-as 3701
 neighbor 198.32.162.2 route-map AS3701-IMPORT in
!
exit