Example #1
0
 private void findInterfaces(string[] chunks)
 {
     foreach (String chunk in chunks)
     {
         String[] words = chunk.Trim().Split(' ');
         if (words[0] == "interface")
         {
             if (words[1].ToLower().Contains("vlan"))
             {
                 Vlan vlan = new Vlan();
                 vlan.populate(chunk);
                 if (vlan.ip != null)
                 {
                     vlans.Add(vlan);
                 }
             }
             else
             {
                 Interface inter = new Interface();
                 inter.populate(chunk);
                 if (inter.ip != null)
                 {
                     interfaces.Add(inter);
                 }
             }
         }
     }
 }
Example #2
0
 private void makeIPRoutes(string chunk)
 {
     String[] lines = chunk.Trim().Split('\n');
     foreach (String line in lines)
     {
         try
         {
             String[] words = line.Split(' ');
             if (words[1] == "route" && words[2] != "vrf" && !words[4].Contains("Null") && !words[4].Contains("Vlan"))
             {
                 Vlan vlan = new Vlan();
                 vlan.populate(words[2], words[3], words[4]);
                 routes.Add(vlan);
             }
         }
         catch (Exception e)
         {
             //no second word
             //Console.WriteLine("Exception: " + e.Message);
             //Console.ReadKey();
         }
     }
 }