Extension:RtConfig

What can this extension do?
This extensions allows you to use RtConfig syntax within MediaWiki inside 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
Simply download, install and configure the extension. Then on any MediaWiki page insert RtConfig syntax inside tags, see examples.

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

Place the RtConfig.php file found inside in

Please cut and paste the code found below and place it in. Note: stands for the root directory of your MediaWiki installation, the same directory that holds .

Installation
To install this extension, add the following to :

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

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...

Where the actual RtConfig binary is on your system usually (and defaults to) /usr/local/bin/RtConfig
 * $wgRtConfigSettings->Command

An array of paths to IRR cache files you want to include. Defaults to none. 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. 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. The host to establish a whois connection to, the default is whois.radb.net The port on the whois server to connect to, the default is 43 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. Whether to report errors in whois database/parsing, the default is false, see RtConfig manual page for more info. Whether to ignore errors in whois database/parsing, the default is false, set RtConfig manual page for more info 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. 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->Files
 * $wgRtConfigSettings->SourceList
 * $wgRtConfigSettings->Format
 * $wgRtConfigSettings->WhoisHost
 * $wgRtConfigSettings->WhoisPort
 * $wgRtConfigSettings->WhoisProtocol
 * $wgRtConfigSettings->ReportErrors
 * $wgRtConfigSettings->IgnoreErrors
 * $wgRtConfigSettings->NoMatchIPInbound
 * $wgRtConfigSettings->DisableAccessListCache

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. 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. 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. 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 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. 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. 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. Turns on some debugging output for the extension, defaults to false.
 * $wgRtConfigSettings->SupressMartians
 * $wgRtConfigSettings->CiscoNoCompressACLs
 * $wgRtConfigSettings->CiscoUsePrefixLists
 * $wgRtConfigSettings->CiscoEliminateDupMapParts
 * $wgRtConfigSettings->CiscoSkipRouteMaps
 * $wgRtConfigSettings->CiscoForceTilde
 * $wgRtConfigSettings->CiscoEmptyLists
 * $wgRtConfigSettings->Debug

Examples
The following entry in a wiki page 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 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