public NetworkNode configureNode() { List<NodeInput> ports = new List<NodeInput>(); string nodeName = null; string nodeType = null; ManagementPort managementPort = null; NetworkNodeSender sender = null; while (configReader.Read()) { if (configReader.IsStartElement()) { if (configReader.NodeType == XmlNodeType.Element) { if (configReader.Name == "port") { int portNumber = int.Parse(configReader.GetAttribute("local")); int tcp = int.Parse(configReader.GetAttribute("tcp")); string stm = configReader.GetAttribute("stm"); ports.Add(new NodeInput(tcp, portNumber, StmLevelExt.GetContainer(stm))); } else if (configReader.Name == "cloud-server") { int tcp = int.Parse(configReader.GetAttribute("tcp")); sender = new NetworkNodeSender(tcp); } else if (configReader.Name == "managment-port") { int portNumber = int.Parse(configReader.GetAttribute("number")); managementPort = new ManagementPort(portNumber); } else if (configReader.Name == "node" && configReader.IsStartElement()) { nodeName = configReader.GetAttribute("name"); nodeType = configReader.GetAttribute("type"); } } } } SynchronousPhysicalInterface spi = new SynchronousPhysicalInterface(ports, sender, nodeName); TransportTerminalFunction ttf = new TransportTerminalFunction(spi, getMode(nodeType)); HigherOrderPathConnection hpc = new HigherOrderPathConnection(ttf); NetworkNode node = new NetworkNode(hpc, ttf, nodeName); ManagementCenter managementCenter = new ManagementCenter(managementPort,node); managementPort.SetManagementCenter(managementCenter); managementPort.StartListening(); foreach (NodeInput input in ports) { input.SetUpServer(10000, 10); input.StartListening(); } return node; }
public ManagementCenter(ManagementPort managementPort, NetworkNode node) { this.node = node; this.managementPort = managementPort; }