public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Debug($"Reading configuration from {_filename}");
            XElement xelement = XElement.Load(_filename);

            configurationBuilder.SetServerAddress(IPAddress.Parse((xelement.Descendants("server_address").First().Value)));
            configurationBuilder.SetConnectionRequestLocalPort(int.Parse(xelement.Descendants("ncc_connection_request_local_port").First().Value));
            configurationBuilder.SetCallCoordinationLocalPort(int.Parse(xelement.Descendants("ncc_call_coordination_local_port").First().Value));
            configurationBuilder.SetCallTeardownLocalPort(int.Parse(xelement.Descendants("ncc_call_teardown_local_port").First().Value));
            configurationBuilder.SetConnectionRequestRemotePort(int.Parse(xelement.Descendants("cc_connection_request_remote_port").First().Value));
            configurationBuilder.SetCallCoordinationRemotePort(int.Parse(xelement.Descendants("ncc_call_coordination_remote_port").First().Value));
            configurationBuilder.SetDomain(xelement.Descendants("domain").First().Value);

            foreach (XElement element in xelement.Descendants("client_port"))
            {
                LOG.Trace($"NCC: ClientName: {element.FirstAttribute.Value} ClientPortAlias: {element.Value}");
                configurationBuilder.AddClientPortAlias(element.FirstAttribute.Value, element.Value);
            }

            foreach (XElement element in xelement.Descendants("port_domain"))
            {
                LOG.Trace($"NCC: PortTemplate: {element.FirstAttribute.Value} Domain: {element.Value}");
                configurationBuilder.AddPortDomain(element.FirstAttribute.Value, element.Value);
            }

            return(configurationBuilder.Build());
        }
示例#2
0
        public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Trace($"Reading configuration from {_filename}");
            XElement xelement = XElement.Load(_filename);

            configurationBuilder.SetComponentName(xelement.Descendants("component_name").First().Value);
            configurationBuilder.SetRouteTableQueryLocalPort(
                int.Parse(xelement.Descendants("rc_route_table_query_local_port").First().Value));
            configurationBuilder.SetLocalTopologyLocalPort(
                int.Parse(xelement.Descendants("rc_local_topology_local_port").First().Value));
            configurationBuilder.SetNetworkTopologyLocalPort(
                int.Parse(xelement.Descendants("rc_network_topology_local_port").First().Value));

            foreach (XElement element in xelement.Descendants("row"))
            {
                Configuration.RouteTableRow.RouteTableRowBuilder routeTableRowBuilder =
                    new Configuration.RouteTableRow.RouteTableRowBuilder();
                routeTableRowBuilder.SetSrc(element.Descendants("src").First().Value);
                routeTableRowBuilder.SetDst(element.Descendants("dst").First().Value);
                routeTableRowBuilder.SetGateway(element.Descendants("gateway").First().Value);

                LOG.Trace(
                    $"src: {element.Descendants("src").First().Value} " +
                    $"dst: {element.Descendants("dst").First().Value} " +
                    $"gateway: {element.Descendants("gateway").First().Value}");
                configurationBuilder.AddRouteTableRow(routeTableRowBuilder.Build());
            }

            return(configurationBuilder.Build());
        }
示例#3
0
        public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Debug($"Reading configuration from {_filename}");
            XElement xElement = XElement.Load(_filename);

            configurationBuilder.SetPort(int.Parse(xElement.Descendants("listener_port").First().Value));

            foreach (XElement element in xElement.Descendants("message"))
            {
                LOG.Trace($"Router: {element.FirstAttribute.Value}\tConfig message: {element.Value}");
                configurationBuilder.AddConfigMessage(new Message(element.FirstAttribute.Value, element.Value));
            }

            return(configurationBuilder.Build());
        }
示例#4
0
        public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Debug($"Reading configuration from {_filename}");
            XElement xelement = XElement.Load(_filename);

            configurationBuilder.SetListeningAddress(xelement.Descendants("cable_cloud_address").First().Value);
            configurationBuilder.SetListeningPort(short.Parse(xelement.Descendants("cable_cloud_port").First().Value));

            foreach (XElement element in xelement.Descendants("connection"))
            {
                string[] connection = element.Value.Split(',', 2);
                LOG.Trace($"{connection[0]} <---> {connection[1]}");

                configurationBuilder.AddConnection((connection[0], connection[1], true));
            }

            return(configurationBuilder.Build());
        }
        public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Debug($"Reading configuration from {_filename}");
            XElement xelement = XElement.Load(_filename);

            configurationBuilder.SetCableCloudAddress(xelement.Descendants("cable_cloud_address").First().Value);
            configurationBuilder.SetCableCloudPort(int.Parse(xelement.Descendants("cable_cloud_port").First().Value));
            configurationBuilder.SetClientAlias(xelement.Descendants("client_alias").First().Value);
            configurationBuilder.SetClientPortAlias(xelement.Descendants("client_port").First().Value);

            foreach (XElement element in xelement.Descendants("label"))
            {
                LOG.Trace($"Remote client node: {element.FirstAttribute.Value}\tLabel: {element.Value}");
                configurationBuilder.AddMplsLabel(element.FirstAttribute.Value, long.Parse(element.Value));
            }

            return(configurationBuilder.Build());
        }
        public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Debug($"Reading configuration from {_filename}");
            XElement xelement = XElement.Load(_filename);

            configurationBuilder.SetRouterAlias(xelement.Descendants("router_alias").First().Value);
            configurationBuilder.SetCableCloudAddress(xelement.Descendants("cable_cloud_address").First().Value);
            configurationBuilder.SetCableCloudPort(int.Parse(xelement.Descendants("cable_cloud_port").First().Value));
            configurationBuilder.SetManagementSystemAddress(xelement.Descendants("management_system_address").First().Value);
            configurationBuilder.SetManagementSystemPort(int.Parse(xelement.Descendants("management_system_port").First().Value));

            foreach (XElement element in xelement.Descendants("port_alias"))
            {
                LOG.Trace($"Router {xelement.Descendants("router_alias").First().Value} port alias: {element.Value}");
                configurationBuilder.AddPortAlias(element.Value);
            }

            return(configurationBuilder.Build());
        }
        public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Trace($"Reading configuration from {_filename}");
            XElement xelement = XElement.Load(_filename);

            configurationBuilder.SetRouterAlias(xelement.Descendants("router_alias").First().Value);
            configurationBuilder.SetCableCloudAddress(xelement.Descendants("cable_cloud_address").First().Value);
            configurationBuilder.SetCableCloudPort(int.Parse(xelement.Descendants("cable_cloud_port").First().Value));
            configurationBuilder.SetNnFibInsertLocalPort(int.Parse(xelement.Descendants("nn_fib_insert_local_port").First().Value));

            foreach (XElement element in xelement.Descendants("port_alias"))
            {
                LOG.Trace($"Router {xelement.Descendants("router_alias").First().Value} port alias: {element.Value}");
                configurationBuilder.AddPortAlias(element.Value);
            }

            foreach (XElement element in xelement.Descendants("lrm"))
            {
                Configuration.LrmConfiguration.LrmBuilder configurationLrmBuilder =
                    new Configuration.LrmConfiguration.LrmBuilder();
                configurationLrmBuilder.SetRemotePortAlias(element.Descendants("remote_port").First().Value);
                configurationLrmBuilder.SetLrmLinkConnectionRequestLocalPort(int.Parse(element
                                                                                       .Descendants("lrm_link_connection_request_local_port").First().Value));
                configurationLrmBuilder.SetLrmLinkConnectionRequestRemotePort(int.Parse(element
                                                                                        .Descendants("lrm_link_connection_request_remote_port").First().Value));
                configurationLrmBuilder.SetRcLocalTopologyRemotePort(int.Parse(element
                                                                               .Descendants("rc_local_topology_remote_port").First().Value));

                LOG.Trace($"LRM {element.Descendants("local_port").First().Value}");
                configurationBuilder.AddLrm(element.Descendants("local_port").First().Value, configurationLrmBuilder.Build());
            }

            return(configurationBuilder.Build());
        }
示例#8
0
        public Configuration ParseConfiguration()
        {
            Configuration.Builder configurationBuilder = new Configuration.Builder();

            LOG.Debug($"Reading configuration from {_filename}");
            XElement xelement = XElement.Load(_filename);

            configurationBuilder.SetConnectionControllerType(xelement.Descendants("cc_type").First().Value);
            configurationBuilder.SetConnectionRequestLocalPort(
                int.Parse(xelement.Descendants("cc_connection_request_listener_local_port").First().Value));
            configurationBuilder.SetPeerCoordinationLocalPort(
                int.Parse(xelement.Descendants("cc_peer_coordination_listener_local_port").First().Value));
            configurationBuilder.SetServerAddress(IPAddress.Parse(xelement.Descendants("server_address").First().Value));
            configurationBuilder.SetRcRouteTableQueryRemotePort(int.Parse(xelement.Descendants("rc_route_table_query_remote_port").First().Value));
            configurationBuilder.SetComponentName(xelement.Descendants("component_name").First().Value);


            foreach (XElement element in xelement.Descendants("cc_name"))
            {
                LOG.Trace($"CC: PortPattern: {element.FirstAttribute.Value} CcName: {element.Value}");
                configurationBuilder.AddCcName(element.FirstAttribute.Value, element.Value);
            }

            switch (xelement.Descendants("cc_type").First().Value)
            {
            case "node":
                foreach (XElement element in xelement.Descendants("cc_peer_coordination_remote_port"))
                {
                    LOG.Trace($"CC: CcName: {element.FirstAttribute.Value} CcPeerCoordinationRemotePort: {element.Value}");
                    configurationBuilder.AddCcPeerCoordinationRemotePort(element.FirstAttribute.Value, int.Parse(element.Value));
                }

                foreach (XElement element in xelement.Descendants("lrm_remote_port"))
                {
                    LOG.Trace($"CC: LrmRemotePortAlias: {element.FirstAttribute.Value} Port: {element.Value}");
                    configurationBuilder.AddLrmRemotePort(element.FirstAttribute.Value, int.Parse(element.Value));
                }
                configurationBuilder.SetNnFibInsertRemotePort(int.Parse(xelement.Descendants("nn_fib_insert_remote_port").First().Value));
                break;

            case "domain":
                configurationBuilder.SetPeerCoordinationRemotePort(
                    int.Parse(xelement.Descendants("cc_peer_coordination_remote_port").First().Value));

                foreach (XElement element in xelement.Descendants("cc_connection_request_remote_port"))
                {
                    LOG.Trace($"CC: CcName: {element.FirstAttribute.Value} CcConnectionRequestRemotePort: {element.Value}");
                    configurationBuilder.AddCcConnectionRequestRemotePort(element.FirstAttribute.Value, int.Parse(element.Value));
                }

                break;

            case "subnetwork":
                foreach (XElement element in xelement.Descendants("cc_connection_request_remote_port"))
                {
                    LOG.Trace($"CC: CcName: {element.FirstAttribute.Value} CcConnectionRequestRemotePort: {element.Value}");
                    configurationBuilder.AddCcConnectionRequestRemotePort(element.FirstAttribute.Value, int.Parse(element.Value));
                }

                foreach (XElement element in xelement.Descendants("cc_peer_coordination_remote_port"))
                {
                    LOG.Trace($"CC: CcName: {element.FirstAttribute.Value} CcPeerCoordinationRemotePort: {element.Value}");
                    configurationBuilder.AddCcPeerCoordinationRemotePort(element.FirstAttribute.Value, int.Parse(element.Value));
                }

                foreach (XElement element in xelement.Descendants("lrm_remote_port"))
                {
                    LOG.Trace($"CC: LrmRemotePortAlias: {element.FirstAttribute.Value} Port: {element.Value}");
                    configurationBuilder.AddLrmRemotePort(element.FirstAttribute.Value, int.Parse(element.Value));
                }

                break;
            }

            return(configurationBuilder.Build());
        }