public NetworkClNode ConfigureNode()
        {
            List<NodeInput> ports = new List<NodeInput>();
            string nodeName = null;
            ManagementClientPort 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 ManagementClientPort(portNumber);
                        }
                        else if (configReader.Name == "node" && configReader.IsStartElement())
                        {
                            nodeName = configReader.GetAttribute("name");
                        }
                    }

                }
            }

            SynchronousPhysicalInterface spi = new SynchronousPhysicalInterface(ports, sender, nodeName);
            TransportTerminalFunction ttf = new TransportTerminalFunction(spi, NodeMode.CLIENT);
            AdaptationFunction adpt = new AdaptationFunction(ttf);
            NetworkClNode node = new NetworkClNode(adpt, nodeName);

            //TODO
            List<StreamData> records = new List<StreamData>();
            records.Add(new StreamData(1,StmLevel.STM1, VirtualContainerLevel.VC32, 0, 0));
            //node.AddStreamData(records);
            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 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 SynchronousPhysicalInterface(List<NodeInput> ports, NetworkNodeSender sender, string routerId)
 {
     RouterId = routerId;
     Sender = sender;
     Buffers = new Dictionary<int, List<string>>();
     this.Ports = new Dictionary<int, NodeInput>();
     foreach (NodeInput input in ports)
     {
         Buffers.Add(input.InputPort, new List<string>());
         this.Ports.Add(input.InputPort, input);
         input.HandleIncomingData += new HandleIncomingData(pullData);
     }
 }