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.Drawing;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace EduNetworkBuilder
|
namespace EduNetworkBuilder
|
||||||
{
|
{
|
||||||
@ -408,6 +409,23 @@ namespace EduNetworkBuilder
|
|||||||
TaskWasDone = true;
|
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>
|
/// <summary>
|
||||||
/// See if the test has been solved
|
/// See if the test has been solved
|
||||||
/// </summary>
|
/// </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
|
else
|
||||||
{ //List all the hosts
|
{ //List all the hosts
|
||||||
foreach (string host in HostNames)
|
foreach (string host in HostNames)
|
||||||
@ -265,7 +284,7 @@ namespace EduNetworkBuilder
|
|||||||
if (ntt == NetTestType.LockAll || ntt == NetTestType.LockDHCP || ntt == NetTestType.LockIP ||
|
if (ntt == NetTestType.LockAll || ntt == NetTestType.LockDHCP || ntt == NetTestType.LockIP ||
|
||||||
ntt == NetTestType.LockNic || ntt == NetTestType.LockRoute)
|
ntt == NetTestType.LockNic || ntt == NetTestType.LockRoute)
|
||||||
return true;
|
return true;
|
||||||
if(ntt == NetTestType.NeedsRouteToNet)
|
if (ntt == NetTestType.NeedsRouteToNet)
|
||||||
{
|
{
|
||||||
//We should have a network, not a host.
|
//We should have a network, not a host.
|
||||||
}
|
}
|
||||||
@ -273,11 +292,21 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
//This uses a verbosity
|
//This uses a verbosity
|
||||||
}
|
}
|
||||||
else if(ntt == NetTestType.LockInterfaceVLAN || ntt == NetTestType.LockNicVLAN ||
|
else if (ntt == NetTestType.LockInterfaceVLAN || ntt == NetTestType.LockNicVLAN ||
|
||||||
ntt == NetTestType.LockVLANNames || ntt == NetTestType.LockVLANsOnHost)
|
ntt == NetTestType.LockVLANNames || ntt == NetTestType.LockVLANsOnHost)
|
||||||
{
|
{
|
||||||
return true;
|
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
|
else
|
||||||
{
|
{
|
||||||
if (ntt == NetTestType.SuccessfullyPings) return true;
|
if (ntt == NetTestType.SuccessfullyPings) return true;
|
||||||
|
@ -906,6 +906,8 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
if (Size > 200) Size = 200;
|
if (Size > 200) Size = 200;
|
||||||
if (Size < 10) Size = 10;
|
if (Size < 10) Size = 10;
|
||||||
|
|
||||||
|
DateTime Test = DateTime.UtcNow + TimeSpan.FromMilliseconds(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user