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