static void Main(string[] args) { var counter = 0; ScamperTraceroute currentTraceroute = null; foreach (var traceroute in TracerouteTextDumpParser.ParseFile(@"D:\Downloads\daily.txt")) { ////Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0} - {1} - {2}", traceroute.Source, traceroute.Destination, traceroute.Hops.Count)); counter++; currentTraceroute = traceroute; if (counter % 10000 == 0) { Console.WriteLine(counter); } } foreach (var neighborPair in currentTraceroute.FindLatencyNeighbors()) { Console.WriteLine(neighborPair); } Console.WriteLine("Done!"); Console.ReadKey(); }
public void TestNeighborsMaxHopDiff() { ScamperTraceroute currentTraceroute = null; foreach (var traceroute in TracerouteTextDumpParser.ParseFile(@"App_Data\ScamperSample1.txt")) { currentTraceroute = traceroute; } var neighborPairs = currentTraceroute.FindLatencyNeighbors(maxHopDifference: 2); Assert.AreEqual(9, neighborPairs.Count); }
public void TestNeighbors() { ScamperTraceroute currentTraceroute = null; foreach (var traceroute in TracerouteTextDumpParser.ParseFile(@"App_Data\ScamperSample1.txt")) { currentTraceroute = traceroute; } var neighborPairs = currentTraceroute.FindLatencyNeighbors(); Assert.AreEqual(10, neighborPairs.Count); var lastPair = neighborPairs[neighborPairs.Count - 1]; Assert.AreEqual(IPAddress.Parse("195.229.4.97"), lastPair.Neighbor1); Assert.AreEqual(IPAddress.Parse("10.246.250.98"), lastPair.Neighbor2); Assert.AreEqual(12, lastPair.Neighbor1HopIndex); Assert.AreEqual(13, lastPair.Neighbor2HopIndex); Assert.AreEqual(1, lastPair.DiffDistanceInHops); Assert.AreEqual((decimal)0.1, lastPair.LatencyDiff); }