/// <summary> /// naprawa sieci /// </summary> public static void Fix(int nodeAmount, List <Manager> manager) { CLI.RequestXML(); string name; do { name = Console.ReadLine(); if (name == "esc") { break; } XML.SetName(name); } while (XML.Test() != true); if (name != "esc") { for (int i = 1; i <= nodeAmount; i++) { try { manager[i - 1].Send(XML.StringNode(i)); } catch (Exception ex) { } } } }
/// <summary> /// wysyla klijentom info na jaki port maja wysylac /// </summary> /// <param name="clientAmount"></param> /// <param name="managerClient"></param> public static void ConfigureClients(int clientAmount, List <Manager> managerClient) { CLI.RequestXML(); string name; do { name = Console.ReadLine(); if (name == "esc") { break; } XML.SetName(name); } while (XML.Test() != true); if (name != "esc") { List <int> portOut = XMLeon.GetClientPortOut(name); for (int i = 0; i < clientAmount; i++) { try { managerClient[i].Send("port_out:" + portOut[i]); Console.WriteLine("Wysyłam info o porcie: " + portOut[i]); } catch (Exception ex) { Console.WriteLine("Błąd wysyłania informacji o porcie"); } } } }
/// <summary> /// wysyla chmurze xml z linkami /// </summary> /// <param name="managerCloud"></param> public static void ConfigureLinkConnections(Manager managerCloud) { CLI.RequestXML(); string name; do { name = Console.ReadLine(); if (name == "esc") { break; } XML.SetName(name); } while (XML.Test() != true); if (name != "esc") { XMLParser xml = new XMLParser(name); Program.links = xml.GetLinks(); managerCloud.Send(XML.StringCableLinks(name)); CLI.PrintConfigFilesSent(); } }
/// <summary> /// konfiguracja sieci w mpls /// </summary> public static void Configure(int nodeAmount, List <Manager> manager, int clientAmount, List <Manager> managerClient, Manager managerCloud) { CLI.RequestXML(); string name; do { name = Console.ReadLine(); if (name == "esc") { break; } XML.SetName(name); } while (XML.Test() != true); if (name != "esc") { for (int i = 1; i <= nodeAmount; i++) { try { manager[i - 1].Send(XML.StringNode(i)); } catch (Exception ex) { } } for (int i = 1; i <= clientAmount; i++) { try { managerClient[i - 1].Send(XML.StringClients()); } catch (Exception ex) { } } managerCloud.Send(XML.StringCableLinks(name)); CLI.PrintConfigFilesSent(); } }
public static void ConfigureSubnetworks() { CLI.RequestXML(); string name; do { name = Console.ReadLine(); if (name == "esc") { break; } XML.SetName(name); } while (XML.Test() != true); if (name != "esc") { Program.managerCloud.Send("clean_dictionary"); XMLeonSubnetwork file = new XMLeonSubnetwork(name); CLI.PrintConfigFilesSent(); lock (Program.subnetworksList) { Program.subnetworksList = file.GetSubnetworks(); foreach (Subnetwork sub in Program.subnetworksList) { lock (Program.subnetworkManager) { try { Program.subnetworkManager.Find(x => x.number == sub.id).Send(sub.myContent); } catch (Exception ex) { Console.WriteLine("Nie udała się konfiguracja podsieci, ex:" + ex.ToString()); } } } } string client; client = file.GetClientFile(); List <int> portOut = XMLeon.GetClientPortOut(client); for (int i = 0; i < Program.amountOfclients; i++) { try { Program.managerClient[i].Send("port_out:" + portOut[i]); Console.WriteLine("Wysyłam info o porcie: " + portOut[i]); } catch (Exception ex) { Console.WriteLine("Błąd wysyłania informacji o porcie"); } } string linksFile = file.GetLinkFile(); XMLParser xml = new XMLParser(linksFile); Program.links = xml.GetLinks(); lock (Program.managerCloud) { Program.managerCloud.Send(XML.StringCableLinks(linksFile)); //Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaaaaaaa"); } } }