public NetNode(string[] args)
        {
            flag                 = true;
            this.virtualIp       = args[0];
            Console.Title        = args[0];
            this.ports           = new Ports();
            this.physicalPort    = Convert.ToInt32(args[1]);
            this.managementAgent = new ManagementAgent(Convert.ToInt32(args[2]), this.virtualIp);
            this.controlAgent    = new ControlAgent(Convert.ToInt32(args[3]), this.virtualIp);
            this.listener        = new TcpListener(IPAddress.Parse("127.0.0.1"), Convert.ToInt32(args[1]));

            this.threadListen = new Thread(new ThreadStart(Listen));
            threadListen.Start();
            this.threadConsole = new Thread(new ThreadStart(ConsoleInterface));
            threadConsole.Start();
            this.threadComutation = new Thread(new ThreadStart(commutation));
            threadComutation.Start();

            if (args[3] != "0")
            {
                this.lrm = new LRM(args[0]);
            }

            //this.commutation();
        }
Esempio n. 2
0
 private void saveConnection(int port, string virtualIp)
 {
     if (!connections.ContainsKey(port))
     {
         Console.WriteLine("I am connected with " + virtualIp + " on port " + port);
         connections.Add(port, virtualIp);
         //send to RC e.g. NN0 connected on port 2 with NN1
         ControlAgent.sendTopology(this.virtualIp, port, virtualIp);
     }
 }
Esempio n. 3
0
 private void initResources(List <Resource> resources)
 {
     for (int i = 0; i < 21; i++)
     {
         for (int j = 11; j <= 13; j++)
         {
             resources.Add(new Resource(i, j, false));
         }
     }
     ControlAgent.sendTopologyInit(this.virtualIp);
 }
Esempio n. 4
0
 private void confirmAlive()
 {
     foreach (var i in connections)
     {
         if (confirmations[i.Key] == true)
         {
             //znaczy ze nie ma polaczenia
             Console.WriteLine("connection lost no keepalive from neighbour on port " + i.Key);
             connections.Remove(i.Key);
             //inform RC that row is deleted
             ControlAgent.sendDeleted(this.virtualIp, i.Key, i.Value);
             ControlAgent.sendDeletedCC(this.virtualIp, i.Key, i.Value);
             clearResources(i.Key);
         }
     }
 }