Beispiel #1
0
    void createElements(XmlNode configuration)
    {
        //create routing protocol
        XmlNode routingProtocolNode = XmlParser.GetChildNode(configuration, RoutingProtocol.RoutingProtocolTag);

        routingProtocol = RoutingProtocol.Create(routingProtocolNode, this);
        interfaces      = new NetworkInterfaces(this);
        //create data destination
        dataDestination = new DataDestination(this);

        //create bundle protocol instance
        XmlNode bundleProtocolNode = configuration[BundleInstance.BundleProtocolTag];

        if (bundleProtocolNode != null)
        {
            bundleInstance = new BundleInstance(bundleProtocolNode, this);
        }
        else
        {
            bundleInstance = new BundleInstance(this);
        }
        //create data source(if any requested)
        XmlNode dataSourceNode = configuration[DataSource.DataSourceTag];

        if (dataSourceNode != null)
        {
            dataSource = new DataSource(dataSourceNode, this);
        }
    }
        public static void Main(string[] args)
        {
            Config(args[0], args[1]);
            //Config("..\\..\\..\\..\\Configs\\NetworkConfig1.txt");

            NetClient nc = new NetClient(HandleMessage, Name);

            Task.Run(() => nc.ListenForMessages());

            if (Inner_Name.Equals(" ") && !Name.Equals("NC2"))
            {
                Disp.ViewOnScreen("INNER SUBNETWORK " + Name);
                NetworkMessage msg = new NetworkMessage(Name, Upper_Name, IPAddress.Parse("1.0.0.1"), IPAddress.Parse("2.0.0.1"), 1, "INNER_NC_AVAILABLE");
                nc.Send(msg.ToBytes());
            }

            Disp.ViewOnScreen("Starting subnetwork!");

            //RoutingProtocol rc = new RoutingProtocol("..\\..\\..\\..\\Configs\\RCConfigNode1.txt", "..\\..\\..\\..\\Configs\\RCConfigLink1.txt");
            RoutingProtocol rc  = new RoutingProtocol(args[2], args[3], nc, Name);
            LRM             lrm = new LRM(nc, rc, Name, Links);
            CC cc = new CC(nc, rc, lrm, Name);

            _cc     = cc;
            _rc     = rc;
            _lrm    = lrm;
            _lrm.cc = cc;
            while (true)
            {
                Console.ReadLine();
            }
        }
 public string RouterID(RoutingProtocol protocol)
 {
     if (_routerID.Count == 0)
     {
         CalculateRouterIDAndASNumber();
     }
     return(_routerID.ContainsKey(protocol) ? _routerID[protocol] : "");
 }
 public CC(NetClient nc, RoutingProtocol rc, LRM lrm, string name)
 {
     this.nc  = nc;
     this.rc  = rc;
     this.lrm = lrm;
     Name     = name;
     Disp.ViewOnScreen("Starting CC!");
 }
        public List <string> RouteTableQuery_req(RoutingProtocol rc, string node1, string node2)        //Otrzymanie informacji o drogę przed podsieć
        {
            Disp.ViewOnScreen("[RC]: Preparing possible path!");
            Disp.ViewOnScreen("[RC]: Source: " + node1 + " Target: " + node2);
            List <string> path = rc.ShortestPath(node1, node2);

            return(path);
        }
 public ISpecializedProtocolParser ProtocolDependentParser(RoutingProtocol protocol)
 {
     if (protocol == RoutingProtocol.OSPF)
     {
         return(this);
     }
     else
     {
         return(null);
     }
 }
 public bool Initilize(IRouter router, RoutingProtocol protocol)
 {
     _router = router;
     if (protocol == RoutingProtocol.OSPF)
     {
         return(router?.Vendor == "Cisco");
     }
     else
     {
         return(false);
     }
 }
 public bool Initilize(IRouter router, RoutingProtocol protocol)
 {
     _router = router;
     if (protocol == RoutingProtocol.STATIC)
     {
         return(router?.Vendor == "JunOS");
     }
     else
     {
         return(false);
     }
 }
Beispiel #9
0
 /// <summary>
 /// convert string to RoutingProtocol
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static RoutingProtocol RoutingProtocolEnum(string value)
 {
     if (value != "")
     {
         RoutingProtocol m = (RoutingProtocol)Enum.Parse(typeof(RoutingProtocol), value, true);
         return(m);
     }
     else
     {
         return(RoutingProtocol.VEFR);
     }
 }