public NetworkViewForm(string briteFilePath, Type deployType) { InitializeComponent(); tb_file_name.Text = briteFilePath; m_topo = new NetworkTopology(0, 0); m_topo.SetupDrawingControl(draw_panel); tb_k.TextChanged += new EventHandler(checkValid); tb_n.TextChanged += new EventHandler(checkValid); tb_k.KeyPress += new KeyPressEventHandler(checkInputValue); tb_n.KeyPress += new KeyPressEventHandler(checkInputValue); btn_show.Click += (s, e) => { m_topo.ReadBriteFile(tb_file_name.Text); int K = int.Parse(tb_k.Text); int N = int.Parse(tb_n.Text); Deployment deployment = Activator.CreateInstance(deployType, new object[] { 30, 20, 10, K, N }) as Deployment; //new KCutStartWithConsider2KConsiderCoefficient(10, 10, 10, K, N); deployment.Deploy(m_topo); draw_panel.Invalidate(); }; }
private void RemoveNode(DatanodeDescriptor deadNode) { NetworkTopology cluster = bm.GetDatanodeManager().GetNetworkTopology(); cluster.Remove(deadNode); bm.RemoveBlocksAssociatedTo(deadNode); }
/// <summary> /// Loads a topology from a file into the gui. /// </summary> private void LoadTopology(object sender, EventArgs e) { openTopology.ShowDialog(); Dictionary <string, IUserObjectFactory> factories = metaData.GetFactories(); NetworkSettings settings = new NetworkSettings(); NetworkTopology topology = Topology.Load(openTopology.FileName, ref factories, ref settings, openTopology.FileName.EndsWith(".nntc", true, null)); topologyMetaData = topology.MetaData; AddPreProcessor(null, null); GetLayer(0).SetMetaData(topology.PreProcessor.MetaData); AddInputLayer(null, null); GetLayer(1).SetMetaData(topology.InputLayer.MetaData); int row = 2; for (int i = 0; i < topology.HiddenLayers.Length; i++) { AddHiddenLayer(null, null); HiddenLayerView layer = (HiddenLayerView)GetLayer(row); layer.SetMetaData(topology.HiddenLayers[i].MetaData); currentSelectedLayer = layer; row++; } AddOutputLayer(null, null); AddPostProcessor(null, null); }
public virtual void SetUp() { FileSystem.SetDefaultUri(Conf, "hdfs://localhost:0"); Conf.Set(DFSConfigKeys.DfsNamenodeHttpAddressKey, "0.0.0.0:0"); // Set properties to make HDFS aware of NodeGroup. Conf.Set(DFSConfigKeys.DfsBlockReplicatorClassnameKey, typeof(BlockPlacementPolicyWithNodeGroup ).FullName); Conf.Set(CommonConfigurationKeysPublic.NetTopologyImplKey, typeof(NetworkTopologyWithNodeGroup ).FullName); Conf.SetBoolean(DFSConfigKeys.DfsNamenodeAvoidStaleDatanodeForWriteKey, true); FilePath baseDir = PathUtils.GetTestDir(typeof(TestReplicationPolicyWithNodeGroup )); Conf.Set(DFSConfigKeys.DfsNamenodeNameDirKey, new FilePath(baseDir, "name").GetPath ()); DFSTestUtil.FormatNameNode(Conf); namenode = new NameNode(Conf); BlockManager bm = namenode.GetNamesystem().GetBlockManager(); replicator = bm.GetBlockPlacementPolicy(); cluster = bm.GetDatanodeManager().GetNetworkTopology(); // construct network topology for (int i = 0; i < NumOfDatanodes; i++) { cluster.Add(dataNodes[i]); } SetupDataNodeCapacity(); }
protected override void doDeploy(NetworkTopology networkTopology) { MarkingTracerID = new List <int>(); FilteringTracerID = new List <int>(); TunnelingTracerID = new List <int>(); // Create random array. int[] randomArray = DataUtility.RandomArray(networkTopology.Nodes.Count); int randomArrayIndex = 0; // Randomly select tunneling tracer. for (; randomArrayIndex < numberOfTTracer; randomArrayIndex++) { networkTopology.Nodes[randomArray[randomArrayIndex]].Tracer = NetworkTopology.TracerType.Tunneling; TunnelingTracerID.Add(networkTopology.Nodes[randomArray[randomArrayIndex]].ID); } // Randomly select marking tracer. for (; randomArrayIndex < numberOfTTracer + numberOfMTracer; randomArrayIndex++) { networkTopology.Nodes[randomArray[randomArrayIndex]].Tracer = NetworkTopology.TracerType.Marking; MarkingTracerID.Add(networkTopology.Nodes[randomArray[randomArrayIndex]].ID); } // Randomly select filtering tracer. for (; randomArrayIndex < numberOfTTracer + numberOfMTracer + numberOfFTracer; randomArrayIndex++) { networkTopology.Nodes[randomArray[randomArrayIndex]].Tracer = NetworkTopology.TracerType.Filtering; FilteringTracerID.Add(networkTopology.Nodes[randomArray[randomArrayIndex]].ID); } }
private bool checkHaveRunned(NetworkTopology topo) { string cmd = "SELECT node_id,level,deploy_type FROM NetworkTopology AS N JOIN DeploySimulation AS D on D.n_id=N.n_id JOIN LevelRecord AS L on D.job_id=L.job_id WHERE N.file_name LIKE @file_name AND D.k = @k AND D.n = @n AND D.deploy_name LIKE @deploy_name ORDER BY L.level,L.node_id"; List <SQLiteParameter> parms = new List <SQLiteParameter>(); parms.Add(new SQLiteParameter("@file_name", topo.FileName)); parms.Add(new SQLiteParameter("@k", K)); parms.Add(new SQLiteParameter("@n", N)); parms.Add(new SQLiteParameter("@deploy_name", GetType().Name)); DataView dv = sqlite_utility.GetResult(cmd, parms); if (dv != null && dv.Count > 0) { int now_level; int pre_level = -1; NetworkTopology scope = null; for (int i = 0; i < dv.Count; i++) { switch (Convert.ToString(dv[i]["deploy_type"])) { case "Scope": now_level = Convert.ToInt32(dv[i]["level"]); if (now_level != pre_level) { if (scope != null) { allRoundScopeList.Add(scope); } scope = new NetworkTopology(topo.Nodes); scope.Edges = new List <NetworkTopology.Edge>(topo.Edges); scope.AdjacentMatrix = topo.AdjacentMatrix; scope.Nodes.Add(topo.Nodes.Where(n => n.ID == Convert.ToInt32(dv[i]["node_id"])).First()); } else { scope.Nodes.Add(topo.Nodes.Where(n => n.ID == Convert.ToInt32(dv[i]["node_id"])).First()); } pre_level = now_level; break; case "Deploy": deployNodes.Add(Convert.ToInt32(dv[i]["node_id"])); break; } } if (scope != null) { allRoundScopeList.Add(scope); } return(true); } return(false); }
public void LogDeploymentResult(NetworkTopology networkTopology, Deployment deployment) { try { using (SQLiteConnection connection = new SQLiteConnection(connectionString)) { connection.Open(); SQLiteTransaction trans = connection.BeginTransaction(); SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = string.Format("INSERT INTO {0}_Deployment(NodeID, TracerType, NodeType, K, N, Status) VALUES(@NodeID, @TracerType, @NodeType, @K, @N, @Status)", prefixNameOfTable); foreach (Network_Simulation.NetworkTopology.Node node in networkTopology.Nodes) { cmd.Parameters.Add("@NodeID", DbType.Int32).Value = node.ID; cmd.Parameters.Add("@TracerType", DbType.Int32).Value = node.Tracer; cmd.Parameters.Add("@NodeType", DbType.Int32).Value = node.Type; cmd.Parameters.Add("@K", DbType.Int32).Value = deployment.K; cmd.Parameters.Add("@N", DbType.Int32).Value = deployment.N; cmd.Parameters.Add("@Status", DbType.Boolean).Value = node.IsTunnelingActive; cmd.ExecuteNonQuery(); } trans.Commit(); } } catch { } }
public Simulator(NetworkTopology networkTopology, string deployName) { this.m_networkTopology = networkTopology; this.m_sqlite_utils = new SimulationSqliteUtility(deployName); this.m_sqlite_utils.CreateTable(); }
private double GetNetworkDelay(int src, int dst) { if (NetworkTopology.IsNetworkEnabled) { return(NetworkTopology.GetDelay(src, dst)); } return(0); }
/// <summary> /// Saves a topology to file in binary format. /// </summary> /// <param name="file">Location to save the topology.</param> /// <param name="topology">The topology object to persist to disk.</param> /// <exception cref="IOException">System.IO.IOException</exception> private static void SaveBinary(string file, ref NetworkTopology topology) { Stream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write); BinaryFormatter binary = new BinaryFormatter(); binary.Serialize(fs, topology); fs.Close(); }
public void LoadTextTest() { SetUpBaseTopology(); testTopology = Topology.Load( basePath + "testTopology.nnt", ref objectFactory, ref settings); Assert.IsTrue(baseTopology.Equals(testTopology), "Test for logical equality"); Assert.IsNotNull(testTopology.MetaData, "Test for meta data"); }
protected override void write2SQLite(NetworkTopology networkTopology) { string cmd = string.Format("INSERT INTO DeploySimulation(job_id, n_id, k, n, deploy_name) SELECT {0},n_id,{1},{2},'{3}' FROM NetworkTopology WHERE file_name='{4}'", jobID, K, N, GetType().Name, networkTopology.FileName); sqlite_utility.RunCommnad(cmd); int itemCount = 0; StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO LevelRecord(job_id, level, node_id, deploy_type)"); for (int level = 0; level < allRoundScopeList.Count; level++) { foreach (var n in allRoundScopeList[level].Nodes) { if (itemCount != 0 && itemCount % 499 == 0) { sqlite_utility.RunCommnad(sb.ToString().Remove(sb.ToString().Length - 6, 6)); sb.Clear(); sb.Append("INSERT INTO LevelRecord(job_id, level, node_id, deploy_type)"); sb.AppendFormat(" SELECT {0},{1},{2},'{3}' UNION", jobID, level + 1, n.ID, "Scope"); } else { sb.AppendFormat(" SELECT {0},{1},{2},'{3}' UNION", jobID, level + 1, n.ID, "Scope"); } itemCount++; } if (level < allLevelDeploy.Count) { foreach (int id in allLevelDeploy[level]) { if (itemCount % 499 == 0) { sqlite_utility.RunCommnad(sb.ToString().Remove(sb.ToString().Length - 6, 6)); sb.Clear(); sb.Append("INSERT INTO LevelRecord(job_id, level, node_id, deploy_type)"); sb.AppendFormat(" SELECT {0},{1},{2},'{3}' UNION", jobID, level + 1, id, "Deploy"); } else { sb.AppendFormat(" SELECT {0},{1},{2},'{3}' UNION", jobID, level + 1, id, "Deploy"); } itemCount++; } } } if (itemCount % 499 != 0) { sqlite_utility.RunCommnad(sb.ToString().Remove(sb.ToString().Length - 6, 6)); } }
/// <summary> /// Get an instance of the configured Block Placement Policy based on the /// the configuration property /// <see cref="Org.Apache.Hadoop.Hdfs.DFSConfigKeys.DfsBlockReplicatorClassnameKey"/> /// . /// </summary> /// <param name="conf">the configuration to be used</param> /// <param name="stats">an object that is used to retrieve the load on the cluster</param> /// <param name="clusterMap">the network topology of the cluster</param> /// <returns>an instance of BlockPlacementPolicy</returns> public static BlockPlacementPolicy GetInstance(Configuration conf, FSClusterStats stats, NetworkTopology clusterMap, Host2NodesMap host2datanodeMap) { Type replicatorClass = conf.GetClass <BlockPlacementPolicy>(DFSConfigKeys.DfsBlockReplicatorClassnameKey , DFSConfigKeys.DfsBlockReplicatorClassnameDefault); BlockPlacementPolicy replicator = ReflectionUtils.NewInstance(replicatorClass, conf ); replicator.Initialize(conf, stats, clusterMap, host2datanodeMap); return(replicator); }
public TopologyController(IConfiguration configuration) { if (Topology == null) { var path = configuration["NetworkTopology:Path"]; using (var fs = new FileStream(path, FileMode.Open)) { Topology = new NetworkTopology(fs); } } }
/// <summary> /// Save a NetworkTopology to file. /// </summary> /// <param name="file">Location to save the file.</param> /// <param name="topology">The topology to save to file.</param> /// <exception cref="IOException">System.IO.IOException</exception> public static void Save(string file, NetworkTopology topology, bool binary = false) { if (binary) { SaveBinary(file, ref topology); } else { SaveText(file, ref topology); } }
private bool selectStartNode(NetworkTopology topo, out int selectNode, bool isNeedRecompute) { int eccentricity; int diameter = int.MinValue; int minDegree = int.MaxValue; bool isSelected = false; // If find center point. if (topo.FindCenterNodeID(out selectNode, out eccentricity, isNeedRecompute)) { foreach (var node in topo.Nodes) { if (diameter < node.Eccentricity) { diameter = node.Eccentricity; } } // Check whether the diameter is greater than 2 * K, then select the point from center. if (diameter > 2 * K) { isSelected = true; } // Select the point from minimum degree. else { foreach (var n in topo.Nodes) { if (minDegree > topo.Degree(n.ID)) { minDegree = topo.Degree(n.ID); selectNode = n.ID; isSelected = true; } } } } // Select the point from minimum degree. else { foreach (var n in topo.Nodes) { if (minDegree > topo.Degree(n.ID)) { minDegree = topo.Degree(n.ID); selectNode = n.ID; isSelected = true; } } } return(isSelected); }
public void LoadDependencies(string networkModelPath) { Console.WriteLine("Loading network model..."); using (var fs = new FileStream(networkModelPath, FileMode.Open)) { var model = new NetworkTopology(fs); TopologyController.Topology = model; GeographyController.Geography = new NetworkGeography(model); } Console.WriteLine("Network model loaded!"); _host.Start(); }
public LineImpedanceEstimation(NetworkTopology ConfiguredNetwork) { m_currentSystem = new VIDataSet(ConfiguredNetwork); m_lineVisited = new int[m_currentSystem.Network.LineNum, 2]; m_KVKILines = new LinesKVKIRecord[m_currentSystem.Network.LineNum]; //[line_ID, from_bus_num, KV1, KI1] m_NonCalibratableComponentsNum = new int[50]; //m_Z = new Complex[2, 2]; m_V1 = new List <Complex>(); m_I1 = new List <Complex>(); m_V2 = new List <Complex>(); m_I2 = new List <Complex>(); m_Zhat = new Complex[2, 2]; m_K = new Complex[m_currentSystem.Network.BusNum, 9]; m_ResultsTable = new DataTable(); }
private void AddNodes(IEnumerable <DatanodeDescriptor> nodesToAdd) { NetworkTopology cluster = bm.GetDatanodeManager().GetNetworkTopology(); // construct network topology foreach (DatanodeDescriptor dn in nodesToAdd) { cluster.Add(dn); dn.GetStorageInfos()[0].SetUtilizationForTesting(2 * HdfsConstants.MinBlocksForWrite * BlockSize, 0L, 2 * HdfsConstants.MinBlocksForWrite * BlockSize, 0L); dn.UpdateHeartbeat(BlockManagerTestUtil.GetStorageReportsForDatanode(dn), 0L, 0L, 0, 0, null); bm.GetDatanodeManager().CheckIfClusterIsNowMultiRack(dn); } }
public void SetUp() { basePath = "C:\\Development Projects\\ENN\\TestSuite\\TestFiles\\"; objectFactory = new Dictionary <string, IUserObjectFactory>() { { "standard", new StandLibFactory() }, { "TestBinary", new TestBinary() } }; settings = new NetworkSettings(); settings.Mode = NetworkMode.Training; baseTopology = new NetworkTopology(); }
public MainForm() { InitializeComponent(); AllocConsole(); m_topo = new NetworkTopology(0, 0); m_simulation_worker = new BackgroundWorker(); m_simulation_worker.WorkerSupportsCancellation = true; m_simulation_worker.WorkerReportsProgress = true; m_data_worker = new BackgroundWorker(); m_data_worker.WorkerSupportsCancellation = true; m_data_worker.WorkerReportsProgress = true; m_deploy_types = new List <Type>(); m_deploy_types.Add(typeof(KCutStartWithCenterNode)); m_deploy_types.Add(typeof(KCutStartWithCenterNodeConsiderCoefficient)); m_deploy_types.Add(typeof(KCutStartWithCenterNodeConsiderScopeCoefficientMinDegree)); m_deploy_types.Add(typeof(KCutStartWithCenterNodeNoRecomputeEccentricity)); m_deploy_types.Add(typeof(KCutStartWithComparableConsiderCoefficient)); m_deploy_types.Add(typeof(KCutStartWithConsider2KConsiderCoefficient)); m_deploy_types.Add(typeof(KCutStartWithSideNode)); m_deploy_types.Add(typeof(KCutStartWithSideNodeConcentrateDegree)); m_deploy_types.Add(typeof(KCutStartWithSideNodeConsiderCoefficient)); m_deploy_types.Add(typeof(KCutStartWithSideNodeConsiderCoefficientWithN)); m_deploy_types.Add(typeof(KCutStartWithSideNodeConsiderCoefficientWithNRatio)); m_deploy_types.Add(typeof(KCutStartWithSideNodeCoefficientAndMinDegree)); m_deploy_types.Add(typeof(KCutStartWithSideMinDegreeAndCoefficient)); m_deploy_types.Add(typeof(KCutStartWithSideNodeConsiderCoefficientStrictDegree)); m_deploy_types.Add(typeof(KCutStartWithSideNodeConsiderCoefficientStrictDegreeWithN)); foreach (var t in m_deploy_types) { cb_deployment.Items.Add(t.Name); } cb_deployment.SelectedItem = typeof(KCutStartWithConsider2KConsiderCoefficient).Name; m_now_deployment_method = typeof(KCutStartWithConsider2KConsiderCoefficient).Name; m_sim_run_n_range = new List <int>() { 10, 20, 30, 40, 50 }; eventRegist(); }
public Simulator(Deployment deployment, NetworkTopology topology, SQLiteUtility sql, string version) { if (topology.Nodes.Count == 0) { throw new Exception("Run() Fail: There are 0 nodes in the network."); } this.sql = sql; this.topology = topology; this.deployment = deployment; this.version = version; attackNode = topology.Nodes.Where(node => node.Type == NetworkTopology.NodeType.Attacker).ToList(); //sql.LogDeploymentResult(topology, deployment); }
/// <summary> /// Create a geographical view of the network /// </summary> /// <param name="topology"></param> public NetworkGeography(NetworkTopology topology) { foreach (var device in topology.Devices.Values) { // Add the device to the spatial index _geospatialElements.Insert(device.Envelope, device); // Add the edges to the tree (check on Id is due to edges being bi-directional, only want to add once) foreach (var adjacentDevice in device.AdjacentDevices.Where(ad => ad.Id > device.Id)) { var edge = new Edge(device, adjacentDevice); _geospatialElements.Insert(edge.Envelope, edge); } } _geospatialElements.Build(); }
/// <summary>Pick up replica node set for deleting replica as over-replicated.</summary> /// <remarks> /// Pick up replica node set for deleting replica as over-replicated. /// First set contains replica nodes on rack with more than one /// replica while second set contains remaining replica nodes. /// If first is not empty, divide first set into two subsets: /// moreThanOne contains nodes on nodegroup with more than one replica /// exactlyOne contains the remaining nodes in first set /// then pickup priSet if not empty. /// If first is empty, then pick second. /// </remarks> protected internal override ICollection <DatanodeStorageInfo> PickupReplicaSet(ICollection <DatanodeStorageInfo> first, ICollection <DatanodeStorageInfo> second) { // If no replica within same rack, return directly. if (first.IsEmpty()) { return(second); } // Split data nodes in the first set into two sets, // moreThanOne contains nodes on nodegroup with more than one replica // exactlyOne contains the remaining nodes IDictionary <string, IList <DatanodeStorageInfo> > nodeGroupMap = new Dictionary <string , IList <DatanodeStorageInfo> >(); foreach (DatanodeStorageInfo storage in first) { string nodeGroupName = NetworkTopology.GetLastHalf(storage.GetDatanodeDescriptor( ).GetNetworkLocation()); IList <DatanodeStorageInfo> storageList = nodeGroupMap[nodeGroupName]; if (storageList == null) { storageList = new AList <DatanodeStorageInfo>(); nodeGroupMap[nodeGroupName] = storageList; } storageList.AddItem(storage); } IList <DatanodeStorageInfo> moreThanOne = new AList <DatanodeStorageInfo>(); IList <DatanodeStorageInfo> exactlyOne = new AList <DatanodeStorageInfo>(); // split nodes into two sets foreach (IList <DatanodeStorageInfo> datanodeList in nodeGroupMap.Values) { if (datanodeList.Count == 1) { // exactlyOne contains nodes on nodegroup with exactly one replica exactlyOne.AddItem(datanodeList[0]); } else { // moreThanOne contains nodes on nodegroup with more than one replica Sharpen.Collections.AddAll(moreThanOne, datanodeList); } } return(moreThanOne.IsEmpty() ? exactlyOne : moreThanOne); }
private ICollection <ExtendedBlock> GetBlocksOnRack(IList <LocatedBlock> blks, string rack) { ICollection <ExtendedBlock> ret = new HashSet <ExtendedBlock>(); foreach (LocatedBlock blk in blks) { foreach (DatanodeInfo di in blk.GetLocations()) { if (rack.Equals(NetworkTopology.GetFirstHalf(di.GetNetworkLocation()))) { ret.AddItem(blk.GetBlock()); break; } } } return(ret); }
public void EqualsTest() { string basePath = "C:\\Development Projects\\ENN\\TestSuite\\TestFiles\\"; Dictionary <string, IUserObjectFactory> factory = new Dictionary <string, IUserObjectFactory>(); factory.Add("standard", new StandLibFactory()); factory.Add("TestBinary", new TestUserBinary.TestBinary()); NetworkSettings settings = Settings.Load(basePath + "testSettings.nns"); NetworkTopology target = Topology.Load( basePath + "testTopology.nnt", ref factory, ref settings); bool expected = true; bool actual; actual = target.Equals(target); Assert.AreEqual(expected, actual); }
public void SaveLoadBinaryTest() { SetUpBaseTopology(); Topology.Save( basePath + "testBinaryTopologySave.nntc", baseTopology, true); testTopology = Topology.Load( basePath + "testBinaryTopologySave.nntc", ref objectFactory, ref settings, true); Assert.IsTrue(baseTopology.Equals(testTopology)); File.Delete(basePath + "testBinaryTopologySave.nntc"); }
private bool selectStartNode(NetworkTopology topo, out int selectNode, bool isNeedRecompute) { int minDegree = int.MaxValue; bool isSelected = false; selectNode = -1; foreach (var n in topo.Nodes) { if (minDegree > topo.Degree(n.ID)) { minDegree = topo.Degree(n.ID); selectNode = n.ID; isSelected = true; } } return(isSelected); }
/// <exception cref="Org.Apache.Hadoop.Hdfs.Server.Blockmanagement.BlockPlacementPolicy.NotEnoughReplicasException /// "/> protected internal override DatanodeStorageInfo ChooseLocalRack(Node localMachine , ICollection <Node> excludedNodes, long blocksize, int maxNodesPerRack, IList <DatanodeStorageInfo > results, bool avoidStaleNodes, EnumMap <StorageType, int> storageTypes) { // no local machine, so choose a random machine if (localMachine == null) { return(ChooseRandom(NodeBase.Root, excludedNodes, blocksize, maxNodesPerRack, results , avoidStaleNodes, storageTypes)); } // choose one from the local rack, but off-nodegroup try { string scope = NetworkTopology.GetFirstHalf(localMachine.GetNetworkLocation()); return(ChooseRandom(scope, excludedNodes, blocksize, maxNodesPerRack, results, avoidStaleNodes , storageTypes)); } catch (BlockPlacementPolicy.NotEnoughReplicasException) { // find the second replica DatanodeDescriptor newLocal = SecondNode(localMachine, results); if (newLocal != null) { try { return(ChooseRandom(clusterMap.GetRack(newLocal.GetNetworkLocation()), excludedNodes , blocksize, maxNodesPerRack, results, avoidStaleNodes, storageTypes)); } catch (BlockPlacementPolicy.NotEnoughReplicasException) { //otherwise randomly choose one from the network return(ChooseRandom(NodeBase.Root, excludedNodes, blocksize, maxNodesPerRack, results , avoidStaleNodes, storageTypes)); } } else { //otherwise randomly choose one from the network return(ChooseRandom(NodeBase.Root, excludedNodes, blocksize, maxNodesPerRack, results , avoidStaleNodes, storageTypes)); } } }
internal void LoadAttackersAndVictim(ref NetworkTopology networkTopology) { try { using (SQLiteConnection connection = new SQLiteConnection(connectionString)) { connection.Open(); SQLiteCommand cmd = connection.CreateCommand(); cmd.CommandText = string.Format("SELECT * FROM NoneDeployment_Deployment"); SQLiteDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { NetworkTopology.Node node = networkTopology.Nodes.Find(n => n.ID == Convert.ToInt32(rd["NodeID"])); node.Type = (NetworkTopology.NodeType)Convert.ToInt32(rd["NodeType"]); } } } catch { } }