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 AdaptationFunction(TransportTerminalFunction ttf) { Ttf = ttf; Builder = new FrameBuilder(); Ttf.HandleInputFrame += new HandleInputFrame(GetDataFromFrame); this.Streams = new List<StreamData>(); Dictionary<int, StmLevel> portsLevels = Ttf.GetPorts(); OutputCredentials = new Dictionary<int, IFrame>(); foreach (int portNumber in portsLevels.Keys) { OutputCredentials.Add(portNumber, new Frame(portsLevels[portNumber])); } }
public HigherOrderPathConnection(TransportTerminalFunction ttf) { this.ForwardingTable = new Dictionary<int, List<ForwardingRecord>>(); this.ttf = ttf; this.ttf.HandleInputFrame += new HandleInputFrame(HandleIncomFrame); Builder = new FrameBuilder(); InputCredentials = new Dictionary<int, IFrame>(); OutputCredentials = new Dictionary<int, IFrame>(); Connections = new List<ForwardingRecord>(); Dictionary<int,StmLevel> allPorts = ttf.GetPorts(); foreach (int port in allPorts.Keys) { InputCredentials.Add(port, new Frame(allPorts[port])); OutputCredentials.Add(port, new Frame(allPorts[port])); } }
public NetworkNode(HigherOrderPathConnection hpc, TransportTerminalFunction ttf, string id) { this.ttf = ttf; this.hpc = hpc; Id = id; }