Working on VLAN tests (mainly locked vlan stuff)
This commit is contained in:
parent
0ea057c4ed
commit
4ffc40d0b3
@ -41,9 +41,11 @@ namespace EduNetworkBuilder
|
||||
public enum NBSoundType { none, success, saved_ok, saved_failed }
|
||||
public enum RTFWindowContents { help, about, release_notes }
|
||||
public enum NetTestType { NeedsLocalIPTo, NeedsDefaultGW, NeedsLinkToDevice, NeedsRouteToNet,
|
||||
NeedsUntaggedVLAN, NeedsTaggedVLAN, NeedsForbiddenVLAN,
|
||||
SuccessfullyPings, SuccessfullyPingsAgain, SuccessfullyArps, SuccessfullyDHCPs, HelpRequest, ReadContextHelp, FailedPing,
|
||||
DHCPServerEnabled,
|
||||
LockAll, LockIP, LockRoute, LockNic, LockDHCP, LockGateway
|
||||
LockAll, LockIP, LockRoute, LockNic, LockDHCP, LockGateway,
|
||||
LockVLAN, LockNicVLAN, LockInterfaceVLAN, LockVLANNames,
|
||||
}
|
||||
public enum NetTestVerbosity { none, basic, hints, full }
|
||||
public enum LBContents { routes, messages, dhcp, puzzles }
|
||||
|
@ -70,6 +70,9 @@ namespace EduNetworkBuilder
|
||||
case NetTestType.LockIP:
|
||||
case NetTestType.LockNic:
|
||||
case NetTestType.LockRoute:
|
||||
case NetTestType.LockInterfaceVLAN:
|
||||
case NetTestType.LockNicVLAN:
|
||||
case NetTestType.LockVLANNames:
|
||||
TaskWasDone = true;
|
||||
break;
|
||||
}
|
||||
@ -176,6 +179,27 @@ namespace EduNetworkBuilder
|
||||
case NetTestType.LockGateway:
|
||||
toreturn = NB.Translate("NT_TstDiscriptGteway");
|
||||
break;
|
||||
case NetTestType.LockVLANNames:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockVLANNames");
|
||||
break;
|
||||
case NetTestType.LockVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockVLAN");
|
||||
break;
|
||||
case NetTestType.LockNicVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockNicVLAN");
|
||||
break;
|
||||
case NetTestType.LockInterfaceVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockInterfaceVLAN");
|
||||
break;
|
||||
case NetTestType.NeedsTaggedVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptNeedsTaggedVLAN");
|
||||
break;
|
||||
case NetTestType.NeedsUntaggedVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptNeedsUntaggedVLAN");
|
||||
break;
|
||||
case NetTestType.NeedsForbiddenVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptNeedsForbiddenVLAN");
|
||||
break;
|
||||
case NetTestType.ReadContextHelp:
|
||||
toreturn = NB.Translate("_ReadContext");
|
||||
break;
|
||||
@ -236,6 +260,27 @@ namespace EduNetworkBuilder
|
||||
case NetTestType.LockGateway:
|
||||
toreturn = NB.Translate("NT_TstDiscriptGteway") + ":";
|
||||
break;
|
||||
case NetTestType.LockVLANNames:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockVLANNames") + ":";
|
||||
break;
|
||||
case NetTestType.LockVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockVLAN") + ":";
|
||||
break;
|
||||
case NetTestType.LockNicVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockNicVLAN") + ":";
|
||||
break;
|
||||
case NetTestType.LockInterfaceVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptLockInterfaceVLAN") + ":";
|
||||
break;
|
||||
case NetTestType.NeedsTaggedVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptNeedsTaggedVLAN") + ":";
|
||||
break;
|
||||
case NetTestType.NeedsUntaggedVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptNeedsUntaggedVLAN") + ":";
|
||||
break;
|
||||
case NetTestType.NeedsForbiddenVLAN:
|
||||
toreturn = NB.Translate("NT_TstDiscriptNeedsForbiddenVLAN") + ":";
|
||||
break;
|
||||
case NetTestType.ReadContextHelp:
|
||||
toreturn = NB.Translate("_ReadContext");
|
||||
break;
|
||||
@ -446,6 +491,10 @@ namespace EduNetworkBuilder
|
||||
case NetTestType.LockNic:
|
||||
case NetTestType.LockRoute:
|
||||
case NetTestType.LockGateway:
|
||||
case NetTestType.LockInterfaceVLAN:
|
||||
case NetTestType.LockNicVLAN:
|
||||
case NetTestType.LockVLAN:
|
||||
case NetTestType.LockVLANNames:
|
||||
return true; //Nothing to solve. We just lock it so it cannot be changed.
|
||||
}
|
||||
return false;
|
||||
|
@ -161,6 +161,11 @@ namespace EduNetworkBuilder
|
||||
cbDest.Items.Add(nname);
|
||||
}
|
||||
}
|
||||
else if(ToEdit.TheTest == NetTestType.LockVLANNames)
|
||||
{
|
||||
//No items for lockvlannames
|
||||
cbDest.Items.Add(NB.Translate("_All"));
|
||||
}
|
||||
else
|
||||
{ //List all the hosts
|
||||
foreach (string host in HostNames)
|
||||
|
@ -744,6 +744,8 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
if (nt.TheTest == NetTestType.LockAll)
|
||||
return true;
|
||||
if (WhatToCheck == nt.TheTest && WhatToCheck == NetTestType.LockVLANNames) //no dest to check
|
||||
return true;
|
||||
if (WhatToCheck == nt.TheTest && dest == nt.dHost)
|
||||
return true;
|
||||
}
|
||||
|
@ -1573,4 +1573,32 @@
|
||||
<value>Enable VLANs on this network. Otherwise, the vlan configuration stuff is kept hidden to keep it simple</value>
|
||||
<comment>OW_OWVLANs = Enable VLANs on this network. Otherwise, the vlan configuration stuff is kept hidden to keep it simple</comment>
|
||||
</data>
|
||||
<data name="NT_TstDiscriptLockInterfaceVLAN" xml:space="preserve">
|
||||
<value>The VLAN on an interface is locked</value>
|
||||
<comment>NT_TstDiscriptLockInterfaceVLAN</comment>
|
||||
</data>
|
||||
<data name="NT_TstDiscriptLockNicVLAN" xml:space="preserve">
|
||||
<value>The VLAN on a NIC is locked</value>
|
||||
<comment>NT_TstDiscriptLockNicVLAN</comment>
|
||||
</data>
|
||||
<data name="NT_TstDiscriptLockVLAN" xml:space="preserve">
|
||||
<value>A VLAN is Locked</value>
|
||||
<comment>NT_TstDiscriptLockVLAN</comment>
|
||||
</data>
|
||||
<data name="NT_TstDiscriptLockVLANNames" xml:space="preserve">
|
||||
<value>VLAN Names and IDs are Locked</value>
|
||||
<comment>NT_TstDiscriptLockVLANNames = VLAN Names and IDs are Locked</comment>
|
||||
</data>
|
||||
<data name="NT_TstDiscriptNeedsForbiddenVLAN" xml:space="preserve">
|
||||
<value>The Interface needs a Forbidden VLAN</value>
|
||||
<comment>NT_TstDiscriptNeedsForbiddenVLAN</comment>
|
||||
</data>
|
||||
<data name="NT_TstDiscriptNeedsTaggedVLAN" xml:space="preserve">
|
||||
<value>The Interface needs a Tagged VLAN</value>
|
||||
<comment>NT_TstDiscriptNeedsTaggedVLAN</comment>
|
||||
</data>
|
||||
<data name="NT_TstDiscriptNeedsUntaggedVLAN" xml:space="preserve">
|
||||
<value>The Interface needs an Untagged VLAN</value>
|
||||
<comment>NT_TstDiscriptNeedsUntaggedVLAN</comment>
|
||||
</data>
|
||||
</root>
|
@ -19,6 +19,7 @@ namespace EduNetworkBuilder
|
||||
List<NetworkInterface> interfaces = new List<NetworkInterface>();
|
||||
BindingList<VLANName> StashedVLANNameList = new BindingList<VLANName>();
|
||||
List<bool> LockedIFs = new List<bool>();
|
||||
bool LockedNames = false;
|
||||
|
||||
bool processing = false;
|
||||
|
||||
@ -32,6 +33,7 @@ namespace EduNetworkBuilder
|
||||
processing = false;
|
||||
|
||||
dgv_VLANAssignments.DataBindingComplete += AssignmentsDataBindingComplete;
|
||||
dgv_VLANNames.DataBindingComplete += NamesDataBindingComplete;
|
||||
|
||||
UpdateForm();
|
||||
}
|
||||
@ -46,9 +48,23 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
void NamesDataBindingComplete(object Sender, EventArgs e)
|
||||
{
|
||||
dgv_VLANNames.Columns[0].ReadOnly = LockedNames;
|
||||
dgv_VLANNames.Columns[1].ReadOnly = LockedNames;
|
||||
}
|
||||
|
||||
private void UpdateForm()
|
||||
{
|
||||
if (processing) return;
|
||||
string hostname = "";
|
||||
|
||||
LockedNames = false;
|
||||
|
||||
if (TheDevice != null)
|
||||
{
|
||||
hostname = TheDevice.hostname;
|
||||
}
|
||||
|
||||
LockedIFs.Clear();
|
||||
UpdateNamesFromForm(); //Read in any changes so far
|
||||
@ -70,7 +86,13 @@ namespace EduNetworkBuilder
|
||||
|
||||
dgv_VLANNames.DataSource = StashedVLANNameList;
|
||||
dgv_VLANNames.AllowUserToAddRows = true;
|
||||
|
||||
if (TheDevice != null)
|
||||
{
|
||||
if (theNet.ItemIsLocked(hostname, "", NetTestType.LockVLANNames))
|
||||
LockedNames = true;
|
||||
else
|
||||
LockedNames = false;
|
||||
}
|
||||
VlanBindings.Columns.Clear();
|
||||
VlanBindings.Columns.Add("IF", typeof(string));
|
||||
foreach (VLANName vn in theNet.VlanNames)
|
||||
@ -92,17 +114,23 @@ namespace EduNetworkBuilder
|
||||
if (NIC.GetNicType == NicType.none) continue;
|
||||
if (NIC.GetNicType == NicType.tun) continue;
|
||||
bool locked = false;
|
||||
string hostname = "";
|
||||
if (TheDevice != null) { hostname = TheDevice.hostname;
|
||||
|
||||
if (TheDevice != null) {
|
||||
if (theNet.ItemIsLocked(hostname, oneNic, NetTestType.LockNic))
|
||||
{
|
||||
locked = true;
|
||||
}
|
||||
if (theNet.ItemIsLocked(hostname, oneNic, NetTestType.LockAll))
|
||||
locked = true;
|
||||
if (theNet.ItemIsLocked(hostname, oneNic, NetTestType.LockNicVLAN))
|
||||
locked = true;
|
||||
}
|
||||
for (int i = 0; i < NIC.IFCount; i++)
|
||||
{
|
||||
NetworkInterface nif = NIC.GetInterface(i);
|
||||
|
||||
if (TheDevice != null)
|
||||
{
|
||||
if (theNet.ItemIsLocked(hostname, nif.nic_name, NetTestType.LockInterfaceVLAN))
|
||||
locked = true;
|
||||
}
|
||||
DataRow DR = VlanBindings.NewRow();
|
||||
DR["IF"] = nif.nic_name;
|
||||
foreach (VLANName vn in theNet.VlanNames)
|
||||
|
Loading…
Reference in New Issue
Block a user