Vlan tests are working
This commit is contained in:
parent
c45b8ba221
commit
58ce4f64fa
@ -504,6 +504,29 @@ namespace EduNetworkBuilder
|
||||
if (srvr == shouldbe)
|
||||
return true;
|
||||
break;
|
||||
case NetTestType.NeedsForbiddenVLAN:
|
||||
case NetTestType.NeedsTaggedVLAN:
|
||||
case NetTestType.NeedsUntaggedVLAN:
|
||||
if (Source == null) return false; //Unable to do it. Do not count it against them.
|
||||
string ifname = GetInterfaceFromVLANInterfaceRequirement();
|
||||
if (ifname == "") return false; //unable to do it.
|
||||
string nicname = Regex.Replace(ifname, @":\w*","");
|
||||
int id = GetIDFromVLANInterfaceRequirement();
|
||||
//Find the nic
|
||||
NetworkCard nic = Source.NicFromName(nicname);
|
||||
if (nic == null) return false; //no matching nic
|
||||
//find the interface
|
||||
NetworkInterface nif = nic.InterfaceFromName(ifname);
|
||||
if (nif == null) return false; //no matchint interface
|
||||
|
||||
//find the entry for the vlan
|
||||
VLANInfo vi = nif.GetVLANInfo(id);
|
||||
if (vi == null) return false; //No such vlan or something.
|
||||
if (TheTest == NetTestType.NeedsForbiddenVLAN && vi.Tag == VLANTagType.Forbidden) return true;
|
||||
if (TheTest == NetTestType.NeedsUntaggedVLAN && vi.Tag == VLANTagType.Untagged) return true;
|
||||
if (TheTest == NetTestType.NeedsTaggedVLAN && vi.Tag == VLANTagType.Tagged) return true;
|
||||
return false;
|
||||
break;
|
||||
case NetTestType.LockAll:
|
||||
case NetTestType.LockDHCP:
|
||||
case NetTestType.LockIP:
|
||||
|
@ -769,6 +769,16 @@ namespace EduNetworkBuilder
|
||||
return null;
|
||||
}
|
||||
|
||||
public NetworkInterface InterfaceFromName(string InterfaceName)
|
||||
{
|
||||
foreach (NetworkInterface oneIF in interfaces)
|
||||
{
|
||||
if (oneIF.nic_name == InterfaceName)
|
||||
return oneIF;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IPAddress FirstIP()
|
||||
{
|
||||
List<IPAddress> addresses = IPAddressList();
|
||||
|
Loading…
Reference in New Issue
Block a user