Class MakePairs

java.lang.Object
  |
  +--MakePairs

public class MakePairs
extends java.lang.Object

MakePairs.java Jim Gast, jgast@cs.wisc.edu MakePairs takes command-line arguments. See: usage() This program extracts all ASN neighbor pairs from a BGP table The output can be redirected to a file (typically ASNNeighbors.txt). ASNNeighbor Pairs file format: Each line consists of the lower ASN and the higher ASN in any BGP entry AS701 AS7018 The input file is expected to already be sorted by IP address. The output file should be sorted and run through uniq to eliminate duplicates MakePairs is the main class which gets input from BGP routing tables and starts everything out.


Field Summary
static java.text.DecimalFormat commas
           
static int debugLevel
          drives debugging output debugLevel = 5 traces actions in methods 4 logs method entry / exit 3 dumps structures 2 displays internal statistics 1 dumps final statistics
static int linesRead
           
static int pairsWritten
           
 
Constructor Summary
MakePairs()
           
 
Method Summary
static void main(java.lang.String[] args)
          main method starts off with empty tables and builds the mapping of IP addresses to AS numbers
static void readRoutingFile(java.io.InputStream sysIn)
          readRoutingFile reads lines of a BGP routing file until EOF.
static void readRoutingLine(java.lang.String str)
          readRoutingLine finds all pairs of ASNumbers whether on best paths or worst.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

linesRead

public static int linesRead

pairsWritten

public static int pairsWritten

debugLevel

public static int debugLevel
drives debugging output debugLevel = 5 traces actions in methods 4 logs method entry / exit 3 dumps structures 2 displays internal statistics 1 dumps final statistics


commas

public static java.text.DecimalFormat commas
Constructor Detail

MakePairs

public MakePairs()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
main method starts off with empty tables and builds the mapping of IP addresses to AS numbers

Parameters:
args - options bgpRoutingTable
java.io.IOException

readRoutingFile

public static void readRoutingFile(java.io.InputStream sysIn)
readRoutingFile reads lines of a BGP routing file until EOF. The routing file is expected to have: # Lines that start with "#" are comments * Routings start with "*" *> Best routes start with "*>" The only tricky part is that the destination IP address is not repeated if it is the same as the prior line. Example: 24.0.101.0/24 193.0.0.56 0 3333 1103 6453 1239 6172 ? 134.55.24.6 0 293 1800 1239 6172 ? > 144.228.240.93 35 0 1239 6172 ? The example shows 3 routes to 24.0.101.0/24. The third is the "best route".


readRoutingLine

public static void readRoutingLine(java.lang.String str)
readRoutingLine finds all pairs of ASNumbers whether on best paths or worst. This routine parses the line and prints out one line for each adjacent pair of ASNumbers. By implication, there is a route that directly connects those Autonomous Systems in a single hop.