vlan tagging tests
This commit is contained in:
parent
907fdc17dd
commit
c45b8ba221
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using System.Drawing;
|
||||
using System.Xml;
|
||||
using System.Windows.Forms;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace EduNetworkBuilder
|
||||
{
|
||||
@ -408,6 +409,23 @@ namespace EduNetworkBuilder
|
||||
TaskWasDone = true;
|
||||
}
|
||||
|
||||
|
||||
public string GetInterfaceFromVLANInterfaceRequirement()
|
||||
{
|
||||
Match result = Regex.Match(dHost, @"(?<interface>[A-z:0-9]+) - (?<id>\d+)");
|
||||
if (result.Groups["interface"] != null) return result.Groups["interface"].Value;
|
||||
return "";
|
||||
}
|
||||
|
||||
public int GetIDFromVLANInterfaceRequirement()
|
||||
{
|
||||
int answer = -1;
|
||||
Match result = Regex.Match(dHost, @"(?<interface>[A-z:0-9]+) - (?<id>\d+)");
|
||||
if (result.Groups["id"] != null) int.TryParse( result.Groups["id"].Value, out answer);
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// See if the test has been solved
|
||||
/// </summary>
|
||||
|
@ -197,6 +197,25 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ToEdit.TheTest == NetTestType.NeedsForbiddenVLAN ||
|
||||
ToEdit.TheTest == NetTestType.NeedsTaggedVLAN ||
|
||||
ToEdit.TheTest == NetTestType.NeedsUntaggedVLAN )
|
||||
{
|
||||
sItem = theNet.GetDeviceFromName(ToEdit.sHost);
|
||||
foreach (string nname in sItem.NICNames())
|
||||
{
|
||||
NetworkCard nic = sItem.NicFromName(nname);
|
||||
if (!nic.NicCanDoVLANs()) continue;
|
||||
for (int i = 0; i < nic.IFCount; i++)
|
||||
{
|
||||
NetworkInterface nif = nic.GetInterface(i);
|
||||
foreach (VLANName vn in theNet.VlanNames)
|
||||
{
|
||||
cbDest.Items.Add(nif.nic_name + " - " + vn.ID.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //List all the hosts
|
||||
foreach (string host in HostNames)
|
||||
@ -278,6 +297,16 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (ntt == NetTestType.NeedsUntaggedVLAN || ntt == NetTestType.NeedsTaggedVLAN ||
|
||||
ntt == NetTestType.NeedsForbiddenVLAN)
|
||||
{
|
||||
//We have an interface and a network ID. Verify they exist
|
||||
if (cbDest.SelectedIndex < 0) return false;
|
||||
Match result = Regex.Match(cbDest.SelectedItem.ToString(), @"(?<interface>[A-z:0-9]+) - (?<id>\d+)");
|
||||
if (result.Groups["interface"] != null && result.Groups["id"] != null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ntt == NetTestType.SuccessfullyPings) return true;
|
||||
|
@ -906,6 +906,8 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (Size > 200) Size = 200;
|
||||
if (Size < 10) Size = 10;
|
||||
|
||||
DateTime Test = DateTime.UtcNow + TimeSpan.FromMilliseconds(100);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user