Example #1
0
        public static void Main(string[] args)
        {
            DefaultStartup <NetworkNode> defaultStartup = new DefaultStartup <NetworkNode>();

            defaultStartup.InitArgumentParse(args);

            IConfigurationParser <Configuration> configurationParser;

            if (defaultStartup.ChooseXmlParser())
            {
                configurationParser = new XmlConfigurationParser(defaultStartup.Filename);
            }
            else
            {
                configurationParser = new MockConfigurationParser();
            }

            Configuration configuration = configurationParser.ParseConfiguration();

            defaultStartup.InitLogger(configuration.RouterAlias);

            IPacketForwarder packetForwarder = new MplsPacketForwarder();
            //IPacketForwarder packetForwarder = new MockPacketForwarder(configuration);
            IPersistentClientPortFactory <EonPacket> clientPortFactory =
                new PersistentClientPortFactory <EonPacket>(configuration.CableCloudAddress, configuration.CableCloudPort);
            IManager networkNodeManager = new NetworkNodeManager(configuration, packetForwarder, clientPortFactory);

            defaultStartup.SetTitle(configuration.RouterAlias);

            networkNodeManager.Start();
        }
Example #2
0
        public static void Main(string[] args)
        {
            DefaultStartup <CableCloud> defaultStartup = new DefaultStartup <CableCloud>();

            defaultStartup.InitArgumentParse(args);

            IConfigurationParser <Configuration> configurationParser;

            if (defaultStartup.ChooseXmlParser())
            {
                configurationParser = new XmlConfigurationParser(defaultStartup.Filename);
            }
            else
            {
                configurationParser = new MockConfigurationParser();
            }

            Configuration configuration = configurationParser.ParseConfiguration();

            defaultStartup.InitLogger(null);

            IWorkerFactory <EonPacket>        clientWorkerFactory = new WorkerFactory <EonPacket>();
            IPersistentServerPort <EonPacket> serverPort          = new PersistentServerPort <EonPacket>(configuration.ListeningAddress, configuration.ListeningPort, clientWorkerFactory);
            IPacketForwarder packetForwarder = new PacketForwarder(configuration);

            ICableCloudManager cableCloudManager = new CableCloudManager(serverPort, packetForwarder);

            ICommandParser commandParser = new CommandParser(configuration);
            IUserInterface userInterface = new UserInterface(commandParser, cableCloudManager);

            defaultStartup.SetTitle("CC");

            userInterface.Start();
        }
        public static void Main(string[] args)
        {
            DefaultStartup <RoutingController> defaultStartup = new DefaultStartup <RoutingController>();

            defaultStartup.InitArgumentParse(args);
            IConfigurationParser <Configuration> configurationParser;

            if (defaultStartup.ChooseXmlParser())
            {
                configurationParser = new XmlConfigurationParser(defaultStartup.Filename);
            }
            else
            {
                configurationParser = new MockConfigurationParser();
            }

            defaultStartup.InitLogger(null);

            Configuration configuration = configurationParser.ParseConfiguration();

            IRcState rcState = new RcState(configuration.RouteTable);

            defaultStartup.SetTitle($"RC_{configuration.ComponentName}");

            IManager routingControllerManager = new RoutingControllerManager(configuration,
                                                                             rcState.OnRouteTableQuery,
                                                                             rcState.OnLocalTopology,
                                                                             rcState.OnNetworkTopology);

            routingControllerManager.Start();
        }
Example #4
0
        public static void Main(string[] args)
        {
            DefaultStartup <ConnectionController> defaultStartup = new DefaultStartup <ConnectionController>();

            defaultStartup.InitArgumentParse(args);
            IConfigurationParser <Configuration> configurationParser;

            if (defaultStartup.ChooseXmlParser())
            {
                configurationParser = new XmlConfigurationParser(defaultStartup.Filename);
            }
            else
            {
                configurationParser = new MockConfigurationParser();
            }

            defaultStartup.InitLogger(null);

            Configuration configuration = configurationParser.ParseConfiguration();

            IConnectionControllerState connectionControllerState = configuration.ConnectionControllerType switch
            {
                "node" => new ConnectionControllerStateNode(configuration.ServerAddress,
                                                            configuration.CcPeerCoordinationRemotePorts,
                                                            configuration.LrmRemotePorts,
                                                            configuration.CcNames,
                                                            configuration.NnFibInsertRemotePort,
                                                            configuration.RcRouteTableQueryRemotePort),
                "domain" => new ConnectionControllerStateDomain(configuration.ServerAddress,
                                                                configuration.CcConnectionRequestRemotePorts,
                                                                configuration.CcNames),
                "subnetwork" => new ConnectionControllerStateSubnetwork(configuration.ServerAddress,
                                                                        configuration.CcPeerCoordinationRemotePorts,
                                                                        configuration.CcConnectionRequestRemotePorts,
                                                                        configuration.LrmRemotePorts,
                                                                        configuration.CcNames,
                                                                        configuration.RcRouteTableQueryRemotePort),
                _ => throw new Exception("Not a known ConnectionController type")
            };
            IManager connectionControllerManager = new ConnectionControllerManager(configuration,
                                                                                   connectionControllerState.OnConnectionRequest,
                                                                                   connectionControllerState.OnPeerCoordination);

            defaultStartup.SetTitle($"CC_{configuration.ComponentName}");
            connectionControllerManager.Start();
        }
    }
Example #5
0
        public static void Main(string[] args)
        {
            DefaultStartup <ClientNode> defaultStartup = new DefaultStartup <ClientNode>();

            defaultStartup.InitArgumentParse(args);

            IConfigurationParser <Configuration> configurationParser;

            if (defaultStartup.ChooseXmlParser())
            {
                configurationParser = new XmlConfigurationParser(defaultStartup.Filename);
            }
            else
            {
                configurationParser = new MockConfigurationParser();
            }

            Configuration configuration = configurationParser.ParseConfiguration();

            defaultStartup.InitLogger(configuration.ClientAlias);

            CpccState cpccState = new CpccState(configuration.NccConnectionRequestRemoteAddress,
                                                configuration.NccConnectionRequestRemotePort,
                                                configuration.NccCallTeardownRemoteAddress,
                                                configuration.NccCallTeardownRemotePort);

            ICommandParser commandParser = new CommandParser(configuration);
            IPersistentClientPort <EonPacket> clientPort = new PersistentClientPort <EonPacket>(configuration.ClientPortAlias,
                                                                                                configuration.CableCloudAddress, configuration.CableCloudPort);
            IClientNodeManager clientNodeManager = new ClientNodeManager(configuration,
                                                                         clientPort,
                                                                         cpccState.OnCallAccept);

            IUserInterface userInterface = new UserInterface(commandParser, clientNodeManager, cpccState, configuration.ClientAlias);

            defaultStartup.SetTitle(configuration.ClientAlias);

            userInterface.Start();
        }
Example #6
0
        public static void Main(string[] args)
        {
            DefaultStartup <NetworkCallController> defaultStartup = new DefaultStartup <NetworkCallController>();

            defaultStartup.InitArgumentParse(args);
            IConfigurationParser <Configuration> configurationParser;

            if (defaultStartup.ChooseXmlParser())
            {
                configurationParser = new XmlConfigurationParser(defaultStartup.Filename);
            }
            else
            {
                configurationParser = new MockConfigurationParser();
            }

            defaultStartup.InitLogger(null); // TODO: Set log suffix from configuration

            Configuration configuration = configurationParser.ParseConfiguration();

            NccState nccState = new NccState(configuration.ClientPortAliases,
                                             configuration.PortDomains,
                                             configuration.Domain,
                                             configuration.ServerAddress,
                                             configuration.ConnectionRequestRemotePort,
                                             configuration.CallCoordinationRemotePort);

            IManager networkCallControllerManager = new NetworkCallControllerManager(configuration,
                                                                                     nccState.OnCallCoordinationReceived,
                                                                                     nccState.OnCallTeardownReceived,
                                                                                     nccState.OnCallRequestReceived);

            // TODO: Those are only empty delegates, make proper ones: 2 left

            defaultStartup.SetTitle($"NCC_{configuration.Domain}");

            networkCallControllerManager.Start();
        }
Example #7
0
        public static void Main(string[] args)
        {
            string filename = "";
            string logs     = "";

            try
            {
                LOG.Trace($"Args: {string.Join(", ", args)}");
                if (args[0] == "-c")
                {
                    filename = args[1];
                }
                if (args[2] == "-l")
                {
                    logs = args[3];
                }
                else
                {
                    LOG.Warn("Use '-c <filename> -l <log_filename>' to pass a config file to program and set where logs should be");
                }
            }
            catch (IndexOutOfRangeException)
            {
                LOG.Warn("Use '-c <filename> -l <log_filename>' to pass a config file to program and set where logs should be");
                LOG.Warn("Using MockConfigurationParser instead");
            }

            IConfigurationParser configurationParser;

            if (string.IsNullOrWhiteSpace(filename))
            {
                configurationParser = new MockConfigurationParser();
            }
            else
            {
                configurationParser = new XmlConfigurationParser(filename);
            }

            Configuration configuration = configurationParser.ParseConfiguration();

            LoggingConfiguration config        = new LoggingConfiguration();
            ColoredConsoleTarget consoleTarget = new ColoredConsoleTarget
            {
                Name   = "console",
                Layout = "[${time} | ${level:format=FirstCharacter} | ${logger}] ${message}"
            };
            FileTarget fileTarget = new FileTarget
            {
                FileName = logs + "/ClientNode_" + configuration.ClientAlias + ".log",
                DeleteOldFileOnStartup = true,
                Layout = "[${time} | ${level:format=FirstCharacter} | ${logger}] ${message}"
            };

            config.AddRule(LogLevel.Trace, LogLevel.Fatal, consoleTarget);
            config.AddRule(LogLevel.Debug, LogLevel.Fatal, fileTarget);
            LogManager.Configuration = config;

            IClientPortFactory clientPortFactory = new ClientPortFactory(configuration);
            ICommandParser     commandParser     = new CommandParser(configuration);
            IClientNodeManager clientNodeManager = new ClientNodeManager(configuration, clientPortFactory);

            IUserInterface userInterface = new UserInterface(commandParser, clientNodeManager);

            try
            {
                Console.Title = configuration.ClientAlias;
            }
            catch (Exception)
            {
                LOG.Trace("Could not set the title");
            }

            userInterface.Start();
        }