[170593] in North American Network Operators' Group

home help back first fref pref prev next nref lref last post

Re: Calculator written in route-map

daemon@ATHENA.MIT.EDU (Jennifer Rexford)
Tue Apr 1 23:33:27 2014

From: Jennifer Rexford <jrex@CS.Princeton.EDU>
In-Reply-To: <20140401151100.GA33460@Eleanor.local>
Date: Tue, 1 Apr 2014 11:22:08 -0400
To: Job Snijders <job@instituut.net>
Cc: nanog@nanog.org
Errors-To: nanog-bounces+nanog.discuss=bloom-picayune.mit.edu@nanog.org

Job,

Fun!  More generally, BGP has the same computing power as a Turing =
Machine:

  Marco Chiesa, Luca Cittadini, Guiseppe Di Battista, Laurent Vanbever, =
and Stefano Vissicchio
  Using routers to build logic circuits: How powerful is BGP? (ICNP'13)
  http://vanbever.eu/pdfs/vanbever_turing_icnp_2013.pdf

-- Jen


On Apr 1, 2014, at 11:11 AM, Job Snijders <job@instituut.net> wrote:

> Hi all,
>=20
> Do you often find yourself in need of a simple calculator, and all you =
have
> available to you is a Brocade or Cisco IOS router?  No longer will you
> experience the horror and dread of mental arithmetics. The route-map =
calculator
> is here!
>=20
> Brocade   : http://instituut.net/~job/calculator-route-map.brocade.txt
> Cisco IOS : =
http://instituut.net/~job/calculator-route-map.ioscisco.txt
>            (file size ~ 12 megabyte)
>=20
> In general I don't find route-maps useful to accomplish, well, =
anything.
> However, this is a striking example of re-usable configuration that =
has
> a measurable impact on daily operations!=20
>=20
> Calculations can be performed with integers between 1 and 256. The
> answer will be presented as a rounded positive integer. In case the
> calculation would result in a negative integer, larger than 2^16
> (65536), an helpful error message is generated: 65000:7777. For
> divisions and substractions the order of the BGP communities is
> relevant, one must always place the operator first!
>=20
> arithmetic operators:
>=20
>  'add' operator community:        65000:1
>  'multiply' operator community:   65000:2
>  'substract' operator community:  65000:3
>  'divide' operator community:     65000:4
>=20
> example output:
>=20
>  telnet@input-router#show ip bgp routes detail 10.1.1.1 | i =
COMMUNITIES
>              COMMUNITIES: 65000:2 0:63 0:113    ! calculate 63 * 113=20=

>  telnet@input-router#
>=20
>  telnet@calculator#show ip bgp routes detail 10.1.1.1 | i COMMUNITIES
>              COMMUNITIES: 0:7119                ! result: 7119
>  telnet@calculator#
>=20
> Super convenient right?!
>=20
> WARNING: due to IOS/Ironware architecture this route-map consumes =
quite
> some memory. Always test in a lab before deploying in production!
>=20
> Kind regards,
>=20
> Job
>=20


home help back first fref pref prev next nref lref last post