示例#1
0
文件: LRM.cs 项目: sopel30/tsst2
        public void loadTopology(string xmlPath)
        {
            try
            {
                Config conf = new Config(xmlPath, Constants.Link);
                foreach(List<string> link in conf.links)
                {
                    if (link.Count > 4)
                    {
                        if (domain == link[5] && domain == link[6])
                        {
                            //linkConnections.Add(link[0], new Topology.Link())
                            SNPLink l = new SNPLink(link.ElementAt(1), link.ElementAt(2), link.ElementAt(3), link.ElementAt(4), link.ElementAt(9));
                            resources.Add(link[0], l);
                            links.Items.Add(new SNPLink(link.ElementAt(1), link.ElementAt(2), link.ElementAt(3), link.ElementAt(4), link.ElementAt(9)));
                        }

                        else if (domain == link[5])
                        {
                            SNPLink l = new SNPLink(link.ElementAt(1), link.ElementAt(6), link.ElementAt(3), link.ElementAt(4), link.ElementAt(9));
                            resources.Add(link[0], l);
                            links.Items.Add(new SNPLink(link.ElementAt(1), link.ElementAt(6), link.ElementAt(3), link.ElementAt(4), link.ElementAt(9)));
                        }

                        else if (domain == link[6])
                        {
                            SNPLink l = new SNPLink(link.ElementAt(5), link.ElementAt(2), link.ElementAt(3), link.ElementAt(4), link.ElementAt(9));
                            resources.Add(link[0], l);
                            links.Items.Add(new SNPLink(link.ElementAt(5), link.ElementAt(2), link.ElementAt(3), link.ElementAt(4), link.ElementAt(9)));
                        }

                    }
                }
            }
            catch { }
        }
示例#2
0
        public void readConfig(string pathToConfig)
        {
            try
            {
                int linkNum = 1;
                conf = new Config(pathToConfig, Constants.Cloud);
                this.CloudId = conf.config[0];
                this.CloudIP = conf.config[1];
                this.CloudPort = conf.config[2];
                foreach (KeyValuePair<string, string> entry in conf.switchTable)
                {
                    this.switchBox.addLink(entry.Key, entry.Value);
                    string[] keyItem = entry.Key.Split('%');
                    string[] valueItem = entry.Value.Split('%');
                    links.Items.Add(new CrossConnection(Convert.ToString(linkNum), keyItem[0], keyItem[1],
                                                valueItem[0], valueItem[1]));
                    linkNum++;
                }

                foreach (KeyValuePair<string, string> entry in conf.controlConnection)
                {
                    this.signalizationBox.addLink(entry.Key, entry.Value);
                    window.signalizationNetwork.Items.Add(new CallControlConnection(entry.Key, entry.Value));
                }

                addLog(logs, networkLibrary.Constants.CONFIG_OK, networkLibrary.Constants.LOG_INFO);
            }
            catch(Exception e)
            {
                addLog(logs, networkLibrary.Constants.CONFIG_ERROR, networkLibrary.Constants.LOG_ERROR);
                Console.WriteLine(e.StackTrace);
            }
        }
示例#3
0
文件: Node.cs 项目: sopel30/tsst
        public void readConfig(string pathToConfig)
        {
            addLog(logs, pathToConfig, Constants.LOG_INFO);
            try
            {
                conf = new Config(pathToConfig, Constants.node);
                this.NodeId = conf.config[0];
                this.CloudIP = conf.config[1];
                this.CloudPort = conf.config[2];
                this.ManagerIP = conf.config[3];
                this.ManagerPort = conf.config[4];
                this.portsInTemp = conf.portsIn;
                this.portsOutTemp = conf.portsOut;

               
                foreach (string portIn in portsInTemp)
                {

                        Port tempPort = new Port(portIn);
                        this.portsIn.Add(tempPort);

                    
                }

                foreach (string portOut in portsOutTemp)
                {

                        Port tempPort = new Port(portOut);
                        this.portsIn.Add(tempPort);

                }
                
                this.mainWindow.Title = this.NodeId; 
                addLog(logs, networkLibrary.Constants.CONFIG_OK, networkLibrary.Constants.LOG_INFO);

                foreach (Port portIn in portsIn)
                {
                    addLog(logs,portIn.portID,Constants.TEXT);
                }
                foreach (Port portOut in portsOut)
                {
                    addLog(logs, portOut.portID, Constants.TEXT);
                }
            }

            catch(Exception e)
            {
                addLog(logs, networkLibrary.Constants.CONFIG_ERROR, networkLibrary.Constants.LOG_ERROR);
                System.Console.WriteLine(e);
            }
        }
示例#4
0
文件: Client.cs 项目: sopel30/tsst2
        public void readConfig(string path)
        {
            try
            {
                conf = new Config(path, Constants.Client);
                this.nodeName = conf.config[0];
                this.CloudIP = conf.config[1];
                this.CloudPort = conf.config[2];
                this.name = conf.config[3];
                this.networkController = conf.config[4];
                this.portsIn = conf.portsIn;
                this.portsOut = conf.portsOut;

                mainWindow.Title = "Client " + this.name;
                displayStatusMessage(Constants.CONFIG_OK, Constants.LOG_INFO);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                displayStatusMessage(Constants.CONFIG_ERROR + "...", Constants.LOG_ERROR);
                displayStatusMessage(" from " + path + "...", Constants.LOG_ERROR);
            }
        }
示例#5
0
        public void readConfig(string xmlConfigPath, string xmlTopologyPath)
        {
            try
            {
                networkLibrary.Config conf = new Config(xmlConfigPath, Constants.AD);
                nccname = conf.config[0];
                linkResourceManager = new LRM(conf.config[3], window.links);
                linkResourceManager.loadTopology(xmlTopologyPath);

                CloudIp = conf.config[1];
                this.CloudPort = conf.config[2];
                this.domain = conf.config[3];
                neighbours = conf.neighbours;
                parents = conf.parent;
                children = conf.child;
                addLog(window.logList, networkLibrary.Constants.CONFIG_OK, networkLibrary.Constants.LOG_INFO);
            }
            catch (Exception e)
            {
                addLog(window.logList, networkLibrary.Constants.CONFIG_ERROR, networkLibrary.Constants.LOG_ERROR);
                Console.WriteLine(e.StackTrace);
            }
        }