private async Task HandleExceptionAsync(HttpContext context, Exception exception) { context.Response.ContentType = "application/json"; context.Response.StatusCode = (int)HttpStatusCode.OK; //context.Request.Path; ExceptionLog exceptionLog = new ExceptionLog() { date = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc), exception = exception, message = exception.Message, ipAddress = context.Connection.RemoteIpAddress.ToString() }; #if !DEBUG exceptionLogService.AddExceptionLog(exceptionLog); #endif resultObject resultObject = new resultObject(); var splitPathInfo = context.Request.Path.Value.Split("/"); resultObject.serverErrors.Add(new ServerError() { hint = exception.Message, type = ConstErrorTypes.ServerError, controllerName = splitPathInfo[2], stackTrace = exception.StackTrace }); await context.Response.WriteAsync(Newtonsoft.Json.JsonConvert.SerializeObject(resultObject)); }
static void Main(string[] args) { //bunch of stuff to point it at the canonical sim results directory on my computer. ResultsExplorer res = new ResultsExplorer(); string[] simulationDirectories = Directory.GetDirectories(ResultsExplorer.defaultResultsDirectory); //just set directory to point to the canonical sim results folder. string directory = simulationDirectories[33]; resultObject canonical = res.loadSimulationNonInteractive(directory); for (int i = 0; i < canonical.state.Count; i++) { double numOn = 0; bool[] currS = canonical.state[i]; StreamWriter output = new StreamWriter("canonical-ASesON-" + i + ".txt"); for (int AS = 0; AS < currS.Count(); AS++) { if (currS[AS]) { output.WriteLine(AS); numOn++; } } Console.WriteLine(numOn / currS.Count() + " of ASes are ON " + numOn + " " + currS.Count()); output.Close(); } // TrafficEngineering.trafficThroughSecureProviders(canonical); }
public static void FindL2Diamonds(string[] commandPieces, resultObject Result) { if (commandPieces.Length < 2) { Console.WriteLine("usage: findl2diamonds [pointASN] [diamondsfile] [outputfile?]"); return; } UInt32 pointASN; if (!UInt32.TryParse(commandPieces[1], out pointASN)) { Console.WriteLine("invalid ASN"); return; } StreamWriter output; if (commandPieces.Length > 3) { output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[2]); Console.WriteLine("outputting to " + ResultsExplorer.defaultOutputDirectory + commandPieces[2]); } else { output = new StreamWriter(Console.OpenStandardOutput()); } Hashtable diamonds = readDiamonds(ResultsExplorer.defaultOutputDirectory + commandPieces[2]); foreach (var stub in diamonds.Keys) { } output.Close(); }
public static void countDiamonds(string[] commandPieces, resultObject Result) { StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); char sep = '\t'; if (commandPieces.Length > 1) { sep = ','; output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[1]); Console.WriteLine("outputting results to: " + ResultsExplorer.defaultOutputDirectory + commandPieces[1]); } foreach (UInt32 earlyAdopter in Result.earlyAdopters) { output.WriteLine(DateTime.Now + " :: Summarizing diamonds for: " + earlyAdopter); Hashtable diamonds = new Hashtable(); int customerDiamonds, peerDiamonds, providerDiamonds; getDiamonds(Result, earlyAdopter, _customerDiamonds, ref diamonds); customerDiamonds = diamonds.Count; diamonds = new Hashtable(); getDiamonds(Result, earlyAdopter, _peerDiamonds, ref diamonds); peerDiamonds = diamonds.Count; diamonds = new Hashtable(); getDiamonds(Result, earlyAdopter, _providerDiamonds, ref diamonds); providerDiamonds = diamonds.Count; output.WriteLine("{0}" + sep + "{1}" + sep + "{2}" + sep + "{3}", earlyAdopter, customerDiamonds, peerDiamonds, providerDiamonds); } output.Close(); }
public static bool isFirstIterationDiamond(UInt32 pointASN, UInt32 stub, List <UInt32> competitors, resultObject Result) { foreach (var competitor in competitors) { if (Result.state[0][competitor] == true)/* cannot be a L1 diamond with a * competitor who is an early adopter. */ { return(false); } } /** now we know all competitors for this diamond were off at the start. **/ foreach (var competitor in competitors) { if (!Result.state[0][competitor] && Result.state[1][competitor]) { //now being a bit pickier. want 1 competitor flipping in round 1. all the others in //round 2. foreach (var othercompetitor in competitors) { if (othercompetitor != competitor) { if (!Result.state[2][othercompetitor]) { return(false);//a competitor was not on in round 2. } } } return(true); } } return(false); }
public static void trafficThroughSecureProviders(resultObject results) { //get what the simulation state would look like. GlobalState GS = SimulatorLibrary.initGlobalState(results.g, results.earlyAdopters, results.weightedNodes, short.Parse(results.k)); /** First, get a list of multihomed stubs as destinations **/ var stubs = results.g.getStubs(); List <Destination> multihomedStubs = new List <Destination>(); foreach (UInt32 stubNum in stubs) { AsNode stub = results.g.GetNode(stubNum); if (stub.GetNeighborsByType(RelationshipType.CustomerOf).ToArray().Length > 1) { multihomedStubs.Add(new Destination(SimulatorLibrary.initMiniDestination(results.g, stub.NodeNum, true))); } } Console.WriteLine(multihomedStubs.Count + " stubs out of " + stubs.Count + " are multihomed."); /** Second, go through each iteration... **/ int iteration = 0; foreach (bool[] S in results.state) { DateTime IterationStart = DateTime.Now; Int32 finishedDests = 0; foreach (Destination multihomedStub in multihomedStubs) { /** for this multhomed stub, see how much traffic * goes through secure providers **/ multihomedStub.UpdatePaths(S); multihomedStub.ComputeU(GS.W); var Providers = results.g.GetNode(multihomedStub.destination).GetNeighborsByType(RelationshipType.CustomerOf); Int64 TotalU = 0; Int64 SecureProviderU = 0; Int32 TotalProviders = Providers.Count(); Int32 SecureProviders = 0; foreach (var Provider in Providers) { if (S[Provider.NodeNum]) { SecureProviderU += multihomedStub.U[Provider.NodeNum]; SecureProviders++; } TotalU += multihomedStub.U[Provider.NodeNum]; } // Console.WriteLine(iteration + " :: " + multihomedStub.destination + " " + SecureProviders + " " + TotalProviders + " " + SecureProviderU + " " + TotalU); finishedDests++; if ((finishedDests % 1000) == 0) { Console.WriteLine("Finished " + finishedDests + " at " + DateTime.Now + " iteration started at " + IterationStart); } } Console.WriteLine(DateTime.Now + " done iteration " + iteration + " it started at " + IterationStart); iteration++; } }
/// <summary> /// write out ASNs for nodes that flipped but had no utility at beginning or end. /// </summary> /// <param name="commandPieces"></param> /// <param name="Result"></param> public static void getOnNonStubsWithNoUtility(string[] commandPieces, resultObject Result) { var nonStubs = Result.g.getNonStubs(); StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); foreach (var nS in nonStubs) { if (Result.state[Result.state.Count - 1][nS] && Result.ubefore[0][nS] == 0 && Result.ubefore[Result.ubefore.Count - 1][nS] == 0) { output.WriteLine(nS); } } output.Close(); }
private static void printIsland(List <UInt32> island, resultObject Result, StreamWriter output) { List <string> writtenEdges = new List <string>(); foreach (var AS in island) { var thisAS = Result.g.GetNode(AS); var neighbors = thisAS.GetAllNeighbors(); foreach (var neighbor in neighbors) { if (island.Contains(neighbor.NodeNum) && !writtenEdges.Contains(makeEdge(neighbor.NodeNum, AS))) { writtenEdges.Add(makeEdge(neighbor.NodeNum, AS)); output.WriteLine(AS + " " + thisAS.GetRelationshipTypeOfNeighbor(neighbor) + " " + neighbor.NodeNum); } } } }
public static void normalizedStubIncrease(string[] commandPieces, resultObject Result) { if (commandPieces.Length == 2 && commandPieces[1] == "help") { Console.WriteLine("usage stubincrease [outputfile?]"); Console.WriteLine("this function tells you for each AS that flipped in the first iteration, " + " how many more paths to its stubs were created from the target set by it flipping. " + "this number is normalized by the number of stubs the AS has."); return; } StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); char sep = '\t'; if (commandPieces.Length > 1) { sep = ','; output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[1]); Console.WriteLine("outputting results to: " + ResultsExplorer.defaultOutputDirectory + commandPieces[1]); } List <UInt32> firstIterationFlippers = new List <UInt32>(); var allASes = Result.g.GetAllNodes(); var stubs = Result.g.getStubs(); foreach (var AS in allASes) { if (Result.state[0][AS.NodeNum] != Result.state[1][AS.NodeNum]) { //he flipped in first iteration. *woo* List <UInt32> newStubs = stubsThroughMeIncrease(Result.earlyAdopters, AS.NodeNum, Result.state, Result.g, output); int stubChildren = numStubChildren(stubs, AS); output.Write("{0}" + sep, AS.NodeNum); foreach (var stubCount in newStubs) { double fractionOfStubs = (double)stubCount / (double)stubChildren; output.Write("{0:0.0000}" + sep, fractionOfStubs); } output.Write("\n"); } } output.Close(); }
public static void edgeSummarize(string[] commandPieces, resultObject Result) { char sep = '\t'; StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); if (commandPieces.Length > 1) { output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[1]); Console.WriteLine("outputting results to: " + ResultsExplorer.defaultOutputDirectory + commandPieces[1]); sep = ','; } output.WriteLine("iter" + sep + "total" + sep + "cust" + sep + "peer" + sep + "prov" + sep + "total-ns" + sep + "cust-ns" + sep + "peer-ns" + sep + "prov-ns"); for (int i = 1; i < Result.state.Count; i++) { edgeIterationSummarize(Result, i, output, sep); } output.Close(); }
public static void printOnPerIteration(resultObject results) { for (int i = 0; i < results.state.Count; i++) { int numPrinted = 0; bool[] currentIteration = results.state[i]; StreamWriter output = new StreamWriter(ATTdir + "simulation-" + i + ".txt"); for (int j = 0; j < currentIteration.Length; j++) { if (currentIteration[j]) { output.WriteLine(j); numPrinted++; } } Console.WriteLine("printed " + numPrinted + " for iteration " + i); output.Close(); } }
public static void computeUtility(string[] commandPieces, resultObject Result) { //usage computeutility AS d iteration if (commandPieces.Length < 4) { Console.WriteLine("computeutility [ASN] [dest] [iteration]"); return; } UInt32 ASN, dest; Int32 iter; if (!UInt32.TryParse(commandPieces[1], out ASN) || !UInt32.TryParse(commandPieces[2], out dest) || !Int32.TryParse(commandPieces[3], out iter)) { Console.WriteLine("bad params"); return; } if (iter > Result.state.Count) { Console.WriteLine("iteration too large."); return; } bool[] iterState = Result.state[iter]; foreach (var stub in Result.g.getStubs()) { iterState[stub] = true;//turn on the stubs as in the sim } SimulatorLibrary.setUtilityComputation(UtilityComputationType.outgoing); GlobalState initial = SimulatorLibrary.initGlobalState(Result.g, Result.earlyAdopters, Result.weightedNodes, short.Parse(Result.k)); Destination d = new Destination(SimulatorLibrary.initMiniDestination(Result.g, dest, false)); d.UpdatePaths(iterState); d.ComputeU(initial.W); Console.WriteLine("Utility for " + ASN + " in iteration: " + iter + " is " + d.U[ASN]); Worker w = new Worker(); int afterFlip = w.ComputeUtility(d.BucketTable, d.Best, d.ChosenParent, d.SecP, iterState, ASN, d.L[ASN], d.BestRelation[ASN], initial.W); Console.WriteLine("Utility for " + ASN + " in iteration: " + iter + " if they flip is " + afterFlip); }
private static void edgeIterationSummarize(resultObject Result, int iteration, StreamWriter output, char sep) { if (iteration == 0) { return; } bool[] lastIteration = Result.state[iteration - 1]; bool[] currIteration = Result.state[iteration]; var ASNodes = Result.g.GetAllNodes(); int totalEdges = 0; int customerEdges = 0; int peerEdges = 0; int providerEdges = 0; int totalNonStubEdges = 0; int customerNonStubEdges = 0; int peerNonStubEdges = 0; int providerNonStubEdges = 0; var nonStubs = Result.g.getNonStubs(); foreach (var ASNode in ASNodes) { //this AS has flipped. if (currIteration[ASNode.NodeNum] != lastIteration[ASNode.NodeNum]) { var customers = ASNode.GetNeighborsByType(RelationshipType.ProviderTo); var peers = ASNode.GetNeighborsByType(RelationshipType.PeerOf); var providers = ASNode.GetNeighborsByType(RelationshipType.CustomerOf); foreach (var c in customers) { if (lastIteration[c.NodeNum]) { customerEdges++; totalEdges++; if (nonStubs.Contains(c.NodeNum)) { customerNonStubEdges++; totalNonStubEdges++; } } } foreach (var p in peers) { if (lastIteration[p.NodeNum]) { peerEdges++; totalEdges++; if (nonStubs.Contains(p.NodeNum)) { peerNonStubEdges++; totalNonStubEdges++; } } } foreach (var p in providers) { if (lastIteration[p.NodeNum]) { providerEdges++; totalEdges++; if (nonStubs.Contains(p.NodeNum)) { providerNonStubEdges++; totalNonStubEdges++; } } } } } output.WriteLine("{0}" + sep + "{1}" + sep + "{2}" + sep + "{3}" + sep + "{4}" + sep + "{5}" + sep + "{6}" + sep + "{7}" + sep + "{8}", iteration, totalEdges, customerEdges, peerEdges, providerEdges, totalNonStubEdges, customerNonStubEdges, peerNonStubEdges, providerNonStubEdges); }
public static void findFirstIterationDiamonds(string[] commandPieces, resultObject Result) { if (commandPieces.Length < 2) { Console.WriteLine("usage: firstiterationdiamonds [ASN]"); return; } UInt32 ASN; if (!UInt32.TryParse(commandPieces[1], out ASN)) { Console.WriteLine("invalid ASN. "); return; } if (Result.g.GetNode(ASN) == null) { Console.WriteLine("ASN not in graph. "); return; } Hashtable customerDiamonds = new Hashtable(); Hashtable providerDiamonds = new Hashtable(); Hashtable peerDiamonds = new Hashtable(); getDiamonds(Result, ASN, _customerDiamonds, ref customerDiamonds); getDiamonds(Result, ASN, _providerDiamonds, ref providerDiamonds); getDiamonds(Result, ASN, _peerDiamonds, ref peerDiamonds); StreamWriter output; if (commandPieces.Length > 2) { output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[2]); Console.WriteLine("outputting to " + ResultsExplorer.defaultOutputDirectory + commandPieces[2]); } else { output = new StreamWriter(Console.OpenStandardOutput()); } output.WriteLine("going through provider diamonds --------"); foreach (var stub in providerDiamonds.Keys) { if (isFirstIterationDiamond(ASN, (UInt32)stub, (List <UInt32>)providerDiamonds[stub], Result)) { output.WriteLine("---------------"); printDiamond(ASN, (UInt32)stub, (List <UInt32>)providerDiamonds[stub], Result.g, output); } } output.WriteLine("going through peer diamonds --------"); foreach (var stub in peerDiamonds.Keys) { if (isFirstIterationDiamond(ASN, (UInt32)stub, (List <UInt32>)peerDiamonds[stub], Result)) { output.WriteLine("---------------"); printDiamond(ASN, (UInt32)stub, (List <UInt32>)peerDiamonds[stub], Result.g, output); } } output.WriteLine("going through customer diamonds --------"); foreach (var stub in customerDiamonds.Keys) { if (isFirstIterationDiamond(ASN, (UInt32)stub, (List <UInt32>)customerDiamonds[stub], Result)) { output.WriteLine("---------------"); printDiamond(ASN, (UInt32)stub, (List <UInt32>)customerDiamonds[stub], Result.g, output); } } output.Close(); }
public static void getTieBreakSetSize(string[] commandPieces, resultObject Result) { if (commandPieces.Length < 2) { Console.WriteLine("usage: tiebreakset [AS+ASN | number to sample | b5t5 + number to sample ]"); return; } StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); string bucketTableFile = "C:\\Users\\phillipa\\Desktop\\adoptTraffic\\Code\\AzureSecureSimulator\\MakeAllBucketTables\\bin\\Debug\\destinations2010\\"; if (commandPieces.Length > 2) { output.Close(); output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[2]); Console.WriteLine("outputting results to: " + ResultsExplorer.defaultOutputDirectory + commandPieces[2]); } string arg = commandPieces[1]; List <AsNode> sampleASes = new List <AsNode>(); if (arg.IndexOf("AS") == 0) { //sampling on single AS } else if (arg.IndexOf("all") < 0) { if (arg.IndexOf("b5t5") == 0) { sampleASes.Add(Result.g.GetNode(22822)); sampleASes.Add(Result.g.GetNode(15169)); sampleASes.Add(Result.g.GetNode(8075)); sampleASes.Add(Result.g.GetNode(20940)); sampleASes.Add(Result.g.GetNode(32934)); sampleASes.Add(Result.g.GetNode(7018)); sampleASes.Add(Result.g.GetNode(701)); sampleASes.Add(Result.g.GetNode(174)); sampleASes.Add(Result.g.GetNode(1239)); sampleASes.Add(Result.g.GetNode(3356)); } arg = arg.Replace("b5t5", ""); int numSamples = 0; if (int.TryParse(arg, out numSamples)) { numSamples += sampleASes.Count; while (sampleASes.Count < numSamples) { AsNode rand = Result.g.GetRandomNode(); if (!sampleASes.Contains(rand)) { sampleASes.Add(rand); } } } } else if (arg.IndexOf("all") == 0) { sampleASes = Result.g.GetAllNodes().ToList(); } Console.WriteLine("initiated sample set of size : " + sampleASes.Count); List <double> stubBestSizes = new List <double>(); List <double> nonStubBestSizes = new List <double>(); List <double> BestSizes = new List <double>(); var stubs = Result.g.getStubs(); var nonstubs = Result.g.getNonStubs(); var allASNs = new List <UInt32>(); foreach (var node in Result.g.GetAllNodes()) { allASNs.Add(node.NodeNum); } foreach (var sample in sampleASes) { Destination curr = ObjectToText.destinationFromText(bucketTableFile + sample.NodeNum + ".csv"); //SimulatorLibrary.initMiniDestination(Result.g, sample.NodeNum, false); var bestSizes = getAverageBestSizes(curr, stubs, nonstubs, allASNs, output); var avgBest = bestSizes.all; var sBest = bestSizes.stubs; var nsBest = bestSizes.nonstubs; Console.WriteLine("{0} {1:0.00} {2:0.00}(stubs) {3:0.00}(nonstubs)", sample.NodeNum, avgBest, sBest, nsBest); stubBestSizes.Add(sBest); nonStubBestSizes.Add(nsBest); BestSizes.Add(avgBest); } Console.WriteLine("-------ALL ASes--------"); Console.WriteLine("AVG: {0:0.000} SD: {1:0.000} MIN: {2:0.000} MAX: {3:0.000}", getMean(BestSizes), getSD(BestSizes, getMean(BestSizes)), getMin(BestSizes), getMax(BestSizes)); Console.WriteLine("-------STUB ASes--------"); Console.WriteLine("AVG: {0:0.000} SD: {1:0.000} MIN: {2:0.000} MAX: {3:0.000}", getMean(stubBestSizes), getSD(stubBestSizes, getMean(stubBestSizes)), getMin(stubBestSizes), getMax(stubBestSizes)); Console.WriteLine("-------NONSTUB ASes--------"); Console.WriteLine("AVG: {0:0.000} SD: {1:0.000} MIN: {2:0.000} MAX: {3:0.000}", getMean(nonStubBestSizes), getSD(nonStubBestSizes, getMean(nonStubBestSizes)), getMin(nonStubBestSizes), getMax(nonStubBestSizes)); output.Close(); }
/// <summary> /// candidate to be deleted. /// </summary> /// <param name="Result"></param> /// <param name="pointASN"></param> /// <param name="output"></param> private static void countDiamonds(resultObject Result, UInt32 pointASN, StreamWriter output) { var nonStubs = Result.g.getNonStubs(); var Stubs = Result.g.getStubs(); var customersOfPoint = Result.g.GetNode(pointASN).GetNeighborsByType(SecureSimulator.RelationshipType.ProviderTo); var neighborASNs = new List <UInt32>(); foreach (var neighbor in Result.g.GetNode(pointASN).GetAllNeighbors()) { neighborASNs.Add(neighbor.NodeNum); } var customerDiamonds = new Hashtable(); foreach (var customer in customersOfPoint) { //my customers will only tell me about edges that pay them. foreach (var grandchild in customer.GetNeighborsByType(SecureSimulator.RelationshipType.ProviderTo))//customer edge will share all paths. { //this grandchild is a stub and is not directly connected to the point. if (Stubs.Contains(grandchild.NodeNum) && !neighborASNs.Contains(grandchild.NodeNum)) { if (customerDiamonds.ContainsKey(grandchild.NodeNum)) { ((List <UInt32>)customerDiamonds[grandchild.NodeNum]).Add(customer.NodeNum); } else { List <UInt32> toadd = new List <UInt32>(); toadd.Add(customer.NodeNum); customerDiamonds.Add(grandchild.NodeNum, toadd); } } } } var peersOfPoint = Result.g.GetNode(pointASN).GetNeighborsByType(SecureSimulator.RelationshipType.PeerOf); var peerDiamonds = new Hashtable(); foreach (var peer in peersOfPoint) { //this peer AS will only tell point about edges that pay it. foreach (var grandchild in peer.GetNeighborsByType(SecureSimulator.RelationshipType.ProviderTo)) { //this grandchild is a stub and is not directly connected to the point. if (Stubs.Contains(grandchild.NodeNum) && !neighborASNs.Contains(grandchild.NodeNum)) { if (peerDiamonds.ContainsKey(grandchild.NodeNum)) { ((List <UInt32>)peerDiamonds[grandchild.NodeNum]).Add(peer.NodeNum); } else { List <UInt32> toadd = new List <UInt32>(); toadd.Add(peer.NodeNum); peerDiamonds.Add(grandchild.NodeNum, toadd); } } } } var providersOfPoint = Result.g.GetNode(pointASN).GetNeighborsByType(SecureSimulator.RelationshipType.CustomerOf); var providerDiamonds = new Hashtable(); foreach (var provider in providersOfPoint) { //providers will tell us about all their edges. foreach (var grandchild in provider.GetAllNeighbors()) { //this grandchild is a stub and is not directly connected to the point. if (Stubs.Contains(grandchild.NodeNum) && !neighborASNs.Contains(grandchild.NodeNum)) { if (providerDiamonds.ContainsKey(grandchild.NodeNum)) { ((List <UInt32>)providerDiamonds[grandchild.NodeNum]).Add(provider.NodeNum); } else { List <UInt32> toadd = new List <UInt32>(); toadd.Add(provider.NodeNum); providerDiamonds.Add(grandchild.NodeNum, toadd); } } } } removeBadDiamonds(ref customerDiamonds, pointASN, _customerDiamonds, Result); removeBadDiamonds(ref peerDiamonds, pointASN, _peerDiamonds, Result); removeBadDiamonds(ref providerDiamonds, pointASN, _providerDiamonds, Result); output.WriteLine(pointASN + "," + customerDiamonds.Count + "," + peerDiamonds.Count + "," + providerDiamonds.Count); output.WriteLine(customerDiamonds.Count + " customer diamonds. " + summarizeDiamonds(customerDiamonds)); output.WriteLine(peerDiamonds.Count + " peer diamonds. " + summarizeDiamonds(peerDiamonds)); output.WriteLine(providerDiamonds.Count + " provider diamonds. " + summarizeDiamonds(providerDiamonds)); }
/// <summary> /// remove degree 1 diamonds and diamonds not used for traffic. /// </summary> /// <param name="diamonds"></param> private static void removeBadDiamonds(ref Hashtable diamonds, UInt32 point, int diamondType, resultObject Result) { NetworkGraph g = Result.g; //Remove level 1 diamonds. var keysToRemove = new List <UInt32>(); foreach (var key in diamonds.Keys) { if (((List <UInt32>)diamonds[key]).Count == 1) { keysToRemove.Add((UInt32)key); } } foreach (var key in keysToRemove) { diamonds.Remove(key); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int keysProcessed = 0; keysToRemove = new List <uint>(); //for diamonds that arer peer nad provider make sure //the point doesn't have a better path // to the stub. foreach (var key in diamonds.Keys) { Destination k = ObjectToText.destinationFromText(bucketTableFile + key + ".csv"); if (diamondType == _peerDiamonds) { if (k.BestRelation[point] == Destination._CUSTOMERCOLUMN) { keysToRemove.Add((UInt32)key); } } else if (diamondType == _providerDiamonds) { if (k.BestRelation[point] == Destination._CUSTOMERCOLUMN) { keysToRemove.Add((UInt32)key); } else if (k.BestRelation[point] == Destination._PEERCOLUMN) { keysToRemove.Add((UInt32)key); } } if (!keysToRemove.Contains((UInt32)key) && !checkFlipOrder(k, (List <UInt32>)diamonds[key], point, Result)) { keysToRemove.Add((UInt32)key); } keysProcessed++; if (keysProcessed % 500 == 0) { Console.WriteLine("processed " + keysProcessed + " out of " + diamonds.Count + " in " + stopwatch.ElapsedMilliseconds + " ms" + DateTime.Now); } } stopwatch.Stop(); Console.WriteLine("processed " + diamonds.Count + " in " + stopwatch.ElapsedMilliseconds + " ms"); foreach (var key in keysToRemove) { diamonds.Remove(key); } }
public static void makeOutputScenarios(resultObject results) { /* Scenario 1: * - 1 file per large AS. File contains the AS and it's stub customers */ var stubs = results.g.getStubs(); UInt32[] highdegreeASes = { 701, 174, 3356, 7018, 1239, 209, 3549, 4323, 6939, 9002, 6461, 2828, 2914, 4589, 3856, 3561, 6762, 1299, 3320 }; UInt32[] CPs = { 15169, 8075, 22822, 32934, 20940 }; int numPrinted; foreach (UInt32 bigAS in highdegreeASes) { StreamWriter output = new StreamWriter(ATTdir + "AS" + bigAS + ".txt"); numPrinted = 1; List <UInt32> printedASes = new List <UInt32>(); output.WriteLine(bigAS); printedASes.Add(bigAS); AsNode curr = results.g.GetNode(bigAS); foreach (AsNode customer in curr.GetNeighborsByType(RelationshipType.ProviderTo)) { if (stubs.Contains(customer.NodeNum) && !printedASes.Contains(customer.NodeNum)) { printedASes.Add(customer.NodeNum); output.WriteLine(customer.NodeNum); numPrinted++; } } Console.WriteLine("printed " + numPrinted + " for AS " + bigAS); output.Close(); } /* Scenario 2: * - 1 file per CP. File contains the CP and it's peers. * */ foreach (UInt32 CP in CPs) { StreamWriter outputpeers = new StreamWriter(ATTdir + "CP-AS" + CP + "-peers.txt"); StreamWriter outputpeersandstubs = new StreamWriter(ATTdir + "CP-AS" + CP + "-peers-stubs.txt"); outputpeers.WriteLine(CP); outputpeersandstubs.WriteLine(CP); List <UInt32> printedASes1 = new List <UInt32>(); List <UInt32> printedASes2 = new List <UInt32>(); numPrinted = 1; AsNode curr = results.g.GetNode(CP); printedASes1.Add(CP); printedASes2.Add(CP); foreach (AsNode peer in curr.GetNeighborsByType(RelationshipType.PeerOf)) { if (!printedASes1.Contains(peer.NodeNum) && !printedASes2.Contains(peer.NodeNum)) { printedASes1.Add(peer.NodeNum); printedASes2.Add(peer.NodeNum); numPrinted++; outputpeers.WriteLine(peer.NodeNum); } foreach (AsNode peercustomer in peer.GetNeighborsByType(RelationshipType.ProviderTo)) { if (stubs.Contains(peercustomer.NodeNum) && !printedASes2.Contains(peercustomer.NodeNum)) { printedASes2.Add(peercustomer.NodeNum); outputpeersandstubs.WriteLine(peercustomer.NodeNum); } } } Console.WriteLine("printed " + printedASes1.Count + "peers for AS and " + printedASes2.Count + " peer/customers for " + CP); outputpeers.Close(); outputpeersandstubs.Close(); } }
/// <summary> /// function that does all the things we want for AT&T /// pulls out ASes on at different points in simulation. /// computes different starting scenarios and writes them out. /// </summary> /// <param name="results"></param> public static void doATTThings(resultObject results) { printOnPerIteration(results); makeOutputScenarios(results); }
public static void printDiamonds(string[] commandPieces, resultObject Result) { if (commandPieces.Length < 3) { Console.WriteLine("usage: printdiamonds [AS#] [customer/peer/provider] [outputfile?]"); return; } UInt32 ASN; if (!UInt32.TryParse(commandPieces[1], out ASN)) { Console.WriteLine("invalid ASN. "); return; } if (Result.g.GetNode(ASN) == null) { Console.WriteLine("ASN not in graph. "); return; } int diamondType = 0; switch (commandPieces[2]) { case "customer": diamondType = _customerDiamonds; break; case "peer": diamondType = _peerDiamonds; break; case "provider": diamondType = _providerDiamonds; break; default: diamondType = -1; //return; break; } StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); if (commandPieces.Length > 3) { output.Close(); Console.WriteLine("outputting diamonds to : " + ResultsExplorer.defaultOutputDirectory + commandPieces[3]); output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[3]); } Hashtable diamonds = new Hashtable(); if (diamondType > 0) { getDiamonds(Result, ASN, diamondType, ref diamonds); int numPrinted = 0; foreach (var key in diamonds.Keys) { // if (((List<UInt32>)diamonds[key]).Count == degree) // { numPrinted++; output.WriteLine("------------ diamond " + numPrinted); printDiamond(ASN, (UInt32)key, ((List <UInt32>)diamonds[key]), Result.g, output); // } // if (numPrinted >= numDiamonds) // break; } output.Close(); } else { for (int Type = 1; Type < 4; Type++) { diamonds = new Hashtable(); getDiamonds(Result, ASN, Type, ref diamonds); int numPrinted = 0; foreach (var key in diamonds.Keys) { // if (((List<UInt32>)diamonds[key]).Count == degree) // { numPrinted++; output.WriteLine("------------ diamond " + numPrinted); printDiamond(ASN, (UInt32)key, ((List <UInt32>)diamonds[key]), Result.g, output); // } // if (numPrinted >= numDiamonds) // break; } } output.Close(); } }
public static void neverOn(string[] commandPieces) { string[] ResultDirs = Directory.GetDirectories(ResultsExplorer.defaultResultsDirectory); List <UInt32> neverOn = new List <UInt32>(); StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); if (commandPieces.Length > 1) { output.Close(); output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[1]); } bool includestubs = false; if (commandPieces.Length > 2 && commandPieces[2].IndexOf("stubs") >= 0) { includestubs = true; } NetworkGraph g = new NetworkGraph(); foreach (var reDir in ResultDirs) { if (File.Exists(reDir + "\\params.txt")) { resultObject curr = ResultsExplorer.readParamsFile(reDir + "\\params.txt"); double u = -1; int f = -1; int k = -1; double.TryParse(curr.u, out u); int.TryParse(curr.f, out f); int.TryParse(curr.k, out k); if (u == 0 && f == 0 && k == 9)//for simplicity vanilla graph + k=9 { if (File.Exists(reDir + "\\" + curr.precursor + ".S200000.csv")) { curr.state = ResultsExplorer.readStateFromFile(reDir + "\\" + curr.precursor + ".S200000.csv"); } if (neverOn.Count == 0)//init the set of nodes that are never on if needed. { if (File.Exists(ResultsExplorer.defaultGraphDirectory + curr.graphFile)) { InputFileReader ifr = new InputFileReader(ResultsExplorer.defaultGraphDirectory + curr.graphFile, g); ifr.ProcessFile(); } var nonstubs = g.getNonStubs(); foreach (var n in g.GetAllNodes()) { if (includestubs || nonstubs.Contains(n.NodeNum)) { neverOn.Add(n.NodeNum); } } } //go through and remove anyone we saw as on from the set of nodes that are never on. bool[] lastState = curr.state[curr.state.Count - 1]; for (int i = 0; i < lastState.Length; i++) { if (lastState[i]) { if (neverOn.Contains((UInt32)i)) { neverOn.Remove((UInt32)i); } } } } } } foreach (var no in neverOn) { output.WriteLine(no); } output.Close(); double avgDegreeOfNeverOn = 0; foreach (var no in neverOn) { double deg = g.GetNode(no).GetAllNeighbors().Count(); avgDegreeOfNeverOn += deg; } avgDegreeOfNeverOn /= neverOn.Count; Console.WriteLine(neverOn.Count + " nodes never turn on. their average degree is " + avgDegreeOfNeverOn); /** See who has competition **/ List <UInt32> haveCompetition = new List <UInt32>(); foreach (var no in neverOn) { var alwaysOffNode = g.GetNode(no); var customers = alwaysOffNode.GetNeighborsByType(RelationshipType.ProviderTo); foreach (var c in customers) { var providers = c.GetNeighborsByType(RelationshipType.CustomerOf); if (providers.Count() > 1 && !haveCompetition.Contains(no))//this customer of the never on guy has more than 1 provider. this never on guy had competition. { haveCompetition.Add(no); } } } //convert from list of nodes with competition to nodes without competition. List <UInt32> nocompetition = new List <uint>(); foreach (var no in neverOn) { if (!haveCompetition.Contains(no)) { nocompetition.Add(no); } } Console.WriteLine(nocompetition.Count + " of these guys had no competition for their customers."); /** See who is next to ASes with no competition **/ List <UInt32> nexttonocompetition = new List <UInt32>(); foreach (var no in neverOn) { if (!nocompetition.Contains(no)) { //this guy had competition. see if he is connected to someone without competition. var alwaysOffNode = g.GetNode(no); foreach (var neighbor in alwaysOffNode.GetAllNeighbors()) { if (nocompetition.Contains(neighbor.NodeNum) && !nexttonocompetition.Contains(no)) { nexttonocompetition.Add(no); } } } } Console.WriteLine(nexttonocompetition.Count + " of the remaining " + haveCompetition.Count + " ASes are next to one with no competition."); output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + "neveron-withcomp.txt"); List <UInt32> withCompetitionNotNextToNoCompetition = new List <UInt32>(); foreach (var asn in haveCompetition) { if (!nexttonocompetition.Contains(asn)) { output.WriteLine(asn); withCompetitionNotNextToNoCompetition.Add(asn); } } output.Close(); /** See which of the remaining ASes are a part of the "jump level" topology **/ List <UInt32> inJumpLevel = new List <uint>(); foreach (var asn in withCompetitionNotNextToNoCompetition) { var alwaysOffNode = g.GetNode(asn); var providers = alwaysOffNode.GetNeighborsByType(RelationshipType.CustomerOf); List <UInt32> providerASNs = new List <uint>(); foreach (var p in providers) { providerASNs.Add(p.NodeNum); } foreach (var c in alwaysOffNode.GetNeighborsByType(RelationshipType.ProviderTo)) { var customersProviders = c.GetNeighborsByType(RelationshipType.CustomerOf); foreach (var cP in customersProviders) { if (providerASNs.Contains(cP.NodeNum) && !inJumpLevel.Contains(asn)) { inJumpLevel.Add(asn); } } } } output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + "neveron-nojumplevel.txt"); foreach (var asn in withCompetitionNotNextToNoCompetition) { if (!inJumpLevel.Contains(asn)) { output.WriteLine(asn); } } output.Close(); /** to be continued***/ Console.WriteLine(inJumpLevel.Count + " of the remaining " + withCompetitionNotNextToNoCompetition.Count + " ASes are in jump level topologies"); }
private static void getDiamonds(resultObject Result, UInt32 pointASN, int diamondType, ref Hashtable diamonds) { var nonStubs = Result.g.getNonStubs(); var Stubs = Result.g.getStubs(); //neighbors depends on the type of diamond we want. IEnumerable <SecureSimulator.AsNode> neighborsOfPoint = null; switch (diamondType) { case _customerDiamonds: neighborsOfPoint = Result.g.GetNode(pointASN).GetNeighborsByType(SecureSimulator.RelationshipType.ProviderTo); break; case _peerDiamonds: neighborsOfPoint = Result.g.GetNode(pointASN).GetNeighborsByType(SecureSimulator.RelationshipType.PeerOf); break; case _providerDiamonds: neighborsOfPoint = Result.g.GetNode(pointASN).GetNeighborsByType(SecureSimulator.RelationshipType.CustomerOf); break; default: break; } var neighborASNs = new List <UInt32>(); foreach (var neighbor in Result.g.GetNode(pointASN).GetAllNeighbors()) { neighborASNs.Add(neighbor.NodeNum); } foreach (var neighbor in neighborsOfPoint) { //which neighbors our neighbors tell us about depends on the relationship type. IEnumerable <SecureSimulator.AsNode> grandchildren = null; switch (diamondType) { case _customerDiamonds: grandchildren = Result.g.GetNode(neighbor.NodeNum).GetNeighborsByType(SecureSimulator.RelationshipType.ProviderTo); break; case _peerDiamonds: grandchildren = Result.g.GetNode(neighbor.NodeNum).GetNeighborsByType(SecureSimulator.RelationshipType.ProviderTo); break; case _providerDiamonds: grandchildren = Result.g.GetNode(neighbor.NodeNum).GetAllNeighbors(); break; default: break; } foreach (var grandchild in grandchildren) { //this grandchild is a stub and is not directly connected to the point. if (Stubs.Contains(grandchild.NodeNum) && !neighborASNs.Contains(grandchild.NodeNum)) { if (diamonds.ContainsKey(grandchild.NodeNum)) { ((List <UInt32>)diamonds[grandchild.NodeNum]).Add(neighbor.NodeNum); } else { List <UInt32> toadd = new List <UInt32>(); toadd.Add(neighbor.NodeNum); diamonds.Add(grandchild.NodeNum, toadd); } } } } removeBadDiamonds(ref diamonds, pointASN, diamondType, Result); }
public static void printGeoTotalsPerIteration(string[] commandPieces, resultObject Result) { try { List <UInt32> allASNs = new List <UInt32>(); foreach (var ASNode in Result.g.GetAllNodes()) { allASNs.Add(ASNode.NodeNum); } loadRIRASNs(allASNs); char sep = '\t'; StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); if (commandPieces.Length > 1) { output = new StreamWriter(ResultsExplorer.defaultOutputDirectory + commandPieces[1]); Console.WriteLine("outputting results to: " + ResultsExplorer.defaultOutputDirectory + commandPieces[1]); sep = ','; } output.WriteLine("iter" + sep + "ALL" + sep + "ARIN" + sep + "RIPE" + sep + "APNIC" + sep + "LACNIC" + sep + "AFRINIC"); int lastARIN = howManyOn(Result.state[0], arinASNs); int lastRIPE = howManyOn(Result.state[0], ripeASNs); int lastAPNIC = howManyOn(Result.state[0], apnicASNs); int lastLACNIC = howManyOn(Result.state[0], lacnicASNs); int lastAFRINIC = howManyOn(Result.state[0], afrinicASNs); int lastALL = howManyOn(Result.state[0], allASNs); for (int s = 1; s < Result.state.Count; s++) { bool[] currState = Result.state[s]; int onARIN = howManyOn(currState, arinASNs); int onRIPE = howManyOn(currState, ripeASNs); int onLACNIC = howManyOn(currState, lacnicASNs); int onAPNIC = howManyOn(currState, apnicASNs); int onAFRINIC = howManyOn(currState, afrinicASNs); int onALL = howManyOn(currState, allASNs); output.WriteLine("{0}" + sep + "{1}" + sep + "{2}" + sep + "{3}" + sep + "{4}" + sep + "{5}" + sep + "{6}", s, onALL - lastALL, onARIN - lastARIN, onRIPE - lastRIPE, onAPNIC - lastAPNIC, onLACNIC - lastLACNIC, onAFRINIC - lastAFRINIC); lastARIN = onARIN; lastRIPE = onRIPE; lastLACNIC = onLACNIC; lastAPNIC = onAPNIC; lastAFRINIC = onAFRINIC; lastALL = onALL; } output.Close(); } catch (Exception e) { Console.WriteLine("Error: " + e.Message + "\nAre the data files in " + RIRdata); return; } }
private static bool checkFlipOrder(Destination d, List <UInt32> diamond, UInt32 pointASN, resultObject Result) { UInt32 winningAS = d.Best[pointASN][0];//who the point routes through originally. int winnerFlip = -1; List <int> competitorFlips = new List <int>(); foreach (var competitor in diamond) { int i = 0; while (i < Result.state.Count && !Result.state[i][competitor]) { i++; } competitorFlips.Add(i); if (competitor == winningAS) { winnerFlip = i; } } int minFlip = int.MaxValue; for (int i = 0; i < competitorFlips.Count; i++) { if (competitorFlips[i] < minFlip) { minFlip = competitorFlips[i]; } } if (minFlip == winnerFlip && minFlip < Result.state.Count) { return(false); //winner flipped first. } return(true); }
public static void findSecureIslands(string[] commandPieces, resultObject Result) { if (commandPieces.Length < 2) { Console.WriteLine("usage: findsecureislands [iteration]"); return; } int iteration; if (!int.TryParse(commandPieces[1], out iteration)) { Console.WriteLine("malformed iteration value."); return; } StreamWriter output = new StreamWriter(Console.OpenStandardOutput()); bool[] iterationstate = Result.state[iteration]; List <List <UInt32> > allIslands = new List <List <UInt32> >(); List <UInt32> allVisited = new List <UInt32>(); Queue <UInt32> queue = new Queue <UInt32>(); UInt32 root = getFirstNotVisited(iterationstate, allVisited); do { List <UInt32> currentIsland = new List <UInt32>(); queue.Enqueue(root); allVisited.Add(root); currentIsland.Add(root); while (queue.Count > 0) { UInt32 curr = queue.Dequeue(); var currNeighbors = Result.g.GetNode(curr).GetAllNeighbors(); foreach (var neighbor in currNeighbors) { //haven't visited this guy before and he is on. if (!allVisited.Contains(neighbor.NodeNum) && iterationstate[neighbor.NodeNum]) { allVisited.Add(neighbor.NodeNum); queue.Enqueue(neighbor.NodeNum); currentIsland.Add(neighbor.NodeNum); } } } allIslands.Add(currentIsland); root = getFirstNotVisited(iterationstate, allVisited); }while (root != UInt32.MaxValue); foreach (var island in allIslands) { if (island.Count < 50) { printIsland(island, Result, output); } } output.Close(); }
public static void trafficThroughSecureProviders(resultObject results) { //get what the simulation state would look like. GlobalState GS = SimulatorLibrary.initGlobalState(results.g, results.earlyAdopters, results.weightedNodes, short.Parse(results.k)); /** First, get a list of multihomed stubs as destinations **/ var stubs = results.g.getStubs(); List <UInt32> multihomedStubs = new List <UInt32>(); foreach (UInt32 stubNum in stubs) { AsNode stub = results.g.GetNode(stubNum); //if this stub is multihomed, init a destination. add it to the list. if (stub.GetNeighborsByType(RelationshipType.CustomerOf).ToArray().Length > 1) { multihomedStubs.Add(stubNum); } } Console.WriteLine(multihomedStubs.Count + " stubs out of " + stubs.Count + " are multihomed."); StreamWriter output = new StreamWriter("trafficThroughSecureProvider.txt"); /** Second, go through each iteration... **/ int iteration = 0; foreach (bool[] S in results.state) { DateTime IterationStart = DateTime.Now; Int32 numDone = 0; foreach (UInt32 multihomedStubNum in multihomedStubs) { /** for this multhomed stub, see how much traffic * goes through secure providers **/ AsNode multihomedStub = results.g.GetNode(multihomedStubNum); Destination multihomedStubDest = new Destination(SimulatorLibrary.initMiniDestination(results.g, multihomedStubNum, false)); //computer the paths and utilities. multihomedStubDest.UpdatePaths(S); multihomedStubDest.ComputeU(GS.W); //get the providers. var Providers = multihomedStub.GetNeighborsByType(RelationshipType.CustomerOf); //count traffic through secure providers (and number of secure providers). Int64 TotalU = 0; Int64 SecureProviderU = 0; Int32 TotalProviders = Providers.Count(); Int32 SecureProviders = 0; foreach (var Provider in Providers) { if (S[Provider.NodeNum]) { SecureProviderU += multihomedStubDest.U[Provider.NodeNum]; SecureProviders++; } TotalU += multihomedStubDest.U[Provider.NodeNum]; } /*write out summary of how much traffic went through secure providers. */ output.WriteLine(iteration + " :: " + multihomedStubNum + " " + SecureProviders + " " + TotalProviders + " " + SecureProviderU + " " + TotalU); numDone++; if ((numDone % 100) == 0) { Console.WriteLine("Done " + numDone + " at " + DateTime.Now); } } //some benchmarking. Console.WriteLine(DateTime.Now + " done iteration " + iteration + " it started at " + IterationStart); iteration++; } output.Close(); }
public static void printGeoTotals(string[] commandPieces, resultObject Result) { try { List <UInt32> allASNs = new List <UInt32>(); foreach (var ASNode in Result.g.GetAllNodes()) { allASNs.Add(ASNode.NodeNum); } loadRIRASNs(allASNs); bool[] lastState = Result.state[Result.state.Count - 1]; int onARIN = howManyOn(lastState, arinASNs); int onRIPE = howManyOn(lastState, ripeASNs); int onLACNIC = howManyOn(lastState, lacnicASNs); int onAPNIC = howManyOn(lastState, apnicASNs); int onAFRINIC = howManyOn(lastState, afrinicASNs); int onALL = howManyOn(lastState, allASNs); double fracARIN = (double)onARIN / (double)arinASNs.Count; double fracRIPE = (double)onRIPE / (double)ripeASNs.Count; double fracLACNIC = (double)onLACNIC / (double)lacnicASNs.Count; double fracAPNIC = (double)onAPNIC / (double)apnicASNs.Count; double fracAFRINIC = (double)onAFRINIC / (double)afrinicASNs.Count; double fracALL = (double)onALL / (double)Result.g.NodeCount; Console.WriteLine("ALL {0}/{1} = {2:0.0000}", onALL, Result.g.NodeCount, fracALL); Console.WriteLine("ARIN {0}/{1} = {2:0.0000}", onARIN, arinASNs.Count, fracARIN); Console.WriteLine("RIPE {0}/{1} = {2:0.0000}", onRIPE, ripeASNs.Count, fracRIPE); Console.WriteLine("APNIC {0}/{1} = {2:0.0000}", onAPNIC, apnicASNs.Count, fracAPNIC); Console.WriteLine("LACNIC {0}/{1} = {2:0.0000}", onLACNIC, lacnicASNs.Count, fracLACNIC); Console.WriteLine("AFRINIC {0}/{1} = {2:0.0000}", onAFRINIC, afrinicASNs.Count, fracAFRINIC); /*** Debugging code, tells us how many ASNs had no RIR owner or multiple owners. * Console.WriteLine("DEBUG total of RIRs is: " + (arinASNs.Count + ripeASNs.Count + lacnicASNs.Count + afrinicASNs.Count + apnicASNs.Count)); * * int[] ASNCounts = new int[6]; * foreach (var ASN in allASNs) * { * int inASNs = 0; * if (arinASNs.Contains(ASN)) * inASNs++; * if (ripeASNs.Contains(ASN)) * inASNs++; * if (lacnicASNs.Contains(ASN)) * inASNs++; * if (apnicASNs.Contains(ASN)) * inASNs++; * if (afrinicASNs.Contains(ASN)) * inASNs++; * * ASNCounts[inASNs]++; * * } * for (int i = 0; i < ASNCounts.Length; i++) * Console.WriteLine("{0} ASNs had {1} RIR associated with them.", ASNCounts[i], i); * **/ } catch (Exception e) { Console.WriteLine("Error: " + e.Message + "\nAre the data files in " + RIRdata); return; } }