250 likes | 355 Views
Internet Measurement Under Edge-Transit Separation. Dept. of Electrical and Computer Eng. George Mason University Fairfax, VA 22030-4444, USA Kunpeng Liu. Feb 2011. Introduction (Transit-Edge Separation). On BGP level, the Internet can be separated into two parts:
E N D
Internet Measurement Under Edge-Transit Separation Dept. of Electrical and Computer Eng. George Mason UniversityFairfax, VA 22030-4444, USA Kunpeng Liu Feb 2011
Introduction (Transit-Edge Separation) • On BGP level, the Internet can be separated into two parts: • Edge: The set of ASes act as destination-only or appear at most at the third last position of any AS path. Edge ASes count 97% of all the Ases • Transit: The set of the rest Ases
Tools Introduction • Route Views are captured from an AS that peers with many big ISPs (bias) • Clean scripts are used to clean some specific characters, like [ , { } ( ) ] as well as to add space to IP prefixes. (pay attention to AS4) • Java tools are used to parse the routing tables. • MyLib is the libraries used in other java tools. • RouTabParse reads tables to create the link object • DrawGraph reads tables to create the graph • ReadResult reads the link object and graph to calculate the statistics we need.
Tools Introduction (Link object) • The link object SimpleAS a SimpleAS b SimpleAS c LinkSimpleAS • SimpleAS and LinkSimpleAS are defined in MyLib • SimpleAS is used to store the information of an AS, including AS number, IP prefix, if use AS path prepending or not, in which position does the AS appear and so on • LinkSimpleAS is the link of SimpleAS, implementing serialization operation.
Tools Introduction (Graph) • Java Universal Network/Graph Framework (JUNG) http://jung.sourceforge.net/ • ASLink is edges of the graph, used to record the AS path prepending times, the usage frequency of a link and so on. • ASNode is vertex of the graph. • ASLInk and ASNode are defined in MyLib
Java Code-RouTabParse public static void main(String[] args) throws IOException { System.out.println((new Date())); RouTabParse rtParse = new RouTabParse(args[0]); try { rtParse.read(); } catch (Exception e) { e.printStackTrace(); } SimpleAS current = rtParse.totalASList.first; while(current!=null) { current.findLevel(); current = current.next; } FileOutputStream f_out = new FileOutputStream(args[0]+".total"); ObjectOutputStream obj_out = new ObjectOutputStream(f_out); rtParse.totalASList.writeExternal(obj_out); obj_out.flush(); obj_out.close(); f_out.close(); }
Java Code-RouTabParse (Cont.) void read() throws IOException { log("Reading from file."); int cout = 0; // Scanner scanner = new Scanner(new File(rTabName)); try { String text = br.readLine(); while (text != null) { parseline(text.trim()); text = br.readLine(); cout++; } } finally { System.out.println("The total lines of routing table: "+cout); br.close(); } }
Java Code-RouTabParse (Cont.) int i=2; boolean isASprepended = false; while(i < length) { int tmp=Integer.parseInt(list[length - i]); list[length - i] = null; if(as==tmp){ isASprepended = true; i++; continue; } else{ as=tmp; i++; simpleAS.setASPathPrepended(isASprepended); simpleAS = new SimpleAS(as); position++; simpleAS.addPosition(position); isASprepended = false; totalASList.insert(simpleAS); } } void parseline(String text) { String[] list = text.split(" "); text = null; int length = list.length; SimpleAS simpleAS = null; int as=0; //use to eliminate AS path prepending int position=0; try { as=Integer.parseInt(list[length - 1]); simpleAS = new SimpleAS(as); list[length - 1] = null; position++; simpleAS.addPosition(position); simpleAS.addAddr(list[0].trim()); totalASList.insert(simpleAS); } catch (Exception e) { System.out.println(list[length - 1]); }
Java Code-DrawGraph public static void main(String[] args) { System.out.println((new Date())); String filename = args[0]; DrawGraph drawGraph = new DrawGraph(filename); drawGraph.init(); try { drawGraph.readSingleLine(); FileOutputStream fos = new FileOutputStream(filename + ".graph"); ObjectOutputStream out = new ObjectOutputStream(fos); out.writeObject(drawGraph.g); out.close(); fos.close(); System.out.println((new Date())); } catch (Exception ex) { ex.printStackTrace(); } }
Java Code-DrawGraph (Cont.) void readSingleLine() throws IOException { System.out.print("Reading from file."); int cout = 0; try { String text = br.readLine(); while (text != null) { drawSingleLine(text.trim()); text = br.readLine(); cout++; } finally { System.out.println("The total lines of routing table: " + cout); br.close(); } }
Java Code-DrawGraph (Cont.) void drawSingleLine(String rTabEntry) { String[] list = rTabEntry.split(" "); rTabEntry = null; int length = list.length; try { ASNode previousAS = null; ASNode currentAS = null; int previousASNo = 0; int currentASNo = 0; int weight = 1; for (int i = 1; i < length; i++) { currentASNo = Integer.parseInt(list[i]); if (previousASNo == currentASNo){ weight++; continue; } currentAS = findASNode(currentASNo); if (currentAS == null) { currentAS = new ASNode(currentASNo); g.addVertex(currentAS); } if (previousAS != null) { ASLink link = findASLink(previousAS, currentAS); if (link == null) { link = new ASLink(linkCount++); link.setWeight(weight); g.addEdge(link, previousAS, currentAS, EdgeType.UNDIRECTED); } else { int tmp = link.getWeight(); if(weight>tmp) link.setWeight(weight); link.addReferCount(); } weight = 1; } previousAS = currentAS; previousASNo = currentASNo; } } catch (Exception e) { e.printStackTrace(); }