DHCP Server enabled test

This commit is contained in:
Tim Young 2015-08-26 16:58:00 -07:00
parent 5bd41d2198
commit 290e025ea9
3 changed files with 23 additions and 0 deletions

View File

@ -41,6 +41,7 @@ namespace EduNetworkBuilder
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,
SuccessfullyPings, SuccessfullyArps, SuccessfullyDHCPs, HelpRequest, ReadContextHelp, FailedPing, SuccessfullyPings, SuccessfullyArps, SuccessfullyDHCPs, HelpRequest, ReadContextHelp, FailedPing,
DHCPServerEnabled,
LockAll, LockIP, LockRoute, LockNic, LockDHCP, LockGateway LockAll, LockIP, LockRoute, LockNic, LockDHCP, LockGateway
} }
public enum NetTestVerbosity { none, basic, hints, full } public enum NetTestVerbosity { none, basic, hints, full }

View File

@ -152,6 +152,9 @@ namespace EduNetworkBuilder
case NetTestType.FailedPing: case NetTestType.FailedPing:
toreturn = "Should fail to ping a specific host"; toreturn = "Should fail to ping a specific host";
break; break;
case NetTestType.DHCPServerEnabled:
toreturn = "Needs change to DHCP server:";
break;
case NetTestType.LockAll: case NetTestType.LockAll:
toreturn = "Is Locked"; toreturn = "Is Locked";
break; break;
@ -209,6 +212,10 @@ namespace EduNetworkBuilder
case NetTestType.FailedPing: case NetTestType.FailedPing:
toreturn = "Needs to try to ping (and fail):"; toreturn = "Needs to try to ping (and fail):";
break; break;
case NetTestType.DHCPServerEnabled:
toreturn = "DHCP Server enabled = ";
break;
case NetTestType.LockAll: case NetTestType.LockAll:
toreturn = "Is Locked:"; toreturn = "Is Locked:";
break; break;
@ -271,6 +278,7 @@ namespace EduNetworkBuilder
NetworkDevice Source = theNet.GetDeviceFromName(sHost); NetworkDevice Source = theNet.GetDeviceFromName(sHost);
NetworkDevice Dest = theNet.GetDeviceFromName(dHost); NetworkDevice Dest = theNet.GetDeviceFromName(dHost);
if (Source == null) return false; if (Source == null) return false;
if (TheTest == NetTestType.DHCPServerEnabled) return true; //dest does not matter
if (Dest == null) return false; if (Dest == null) return false;
return true; return true;
} }
@ -391,6 +399,14 @@ namespace EduNetworkBuilder
case NetTestType.ReadContextHelp: case NetTestType.ReadContextHelp:
case NetTestType.FailedPing: case NetTestType.FailedPing:
return TaskWasDone; //This variable will tell us if these tests have been done. return TaskWasDone; //This variable will tell us if these tests have been done.
case NetTestType.DHCPServerEnabled:
if (Source == null) return false; //Unable to do it. Do not count it against them.
//dHost is either "true" or "false"
string srvr = Source.GetIsDHCPServer().ToString().ToLower();
string shouldbe = dHost.ToLower();
if (srvr == shouldbe)
return true;
break;
case NetTestType.LockAll: case NetTestType.LockAll:
case NetTestType.LockDHCP: case NetTestType.LockDHCP:
case NetTestType.LockIP: case NetTestType.LockIP:

View File

@ -94,6 +94,11 @@ namespace EduNetworkBuilder
cbDest.Items.Add(subnet); cbDest.Items.Add(subnet);
} }
} }
else if (ToEdit.TheTest == NetTestType.DHCPServerEnabled)
{
cbDest.Items.Add(true.ToString());
cbDest.Items.Add(false.ToString());
}
else if (ToEdit.TheTest == NetTestType.HelpRequest) else if (ToEdit.TheTest == NetTestType.HelpRequest)
{ {
foreach (string HelpLevel in Enum.GetNames(typeof(NetTestVerbosity))) foreach (string HelpLevel in Enum.GetNames(typeof(NetTestVerbosity)))
@ -215,6 +220,7 @@ namespace EduNetworkBuilder
Network theNet = NB.GetNetwork(); Network theNet = NB.GetNetwork();
NetTestType ntt = NB.ParseEnum<NetTestType>(cbTest.SelectedItem.ToString()); NetTestType ntt = NB.ParseEnum<NetTestType>(cbTest.SelectedItem.ToString());
if (ntt == NetTestType.ReadContextHelp) return true; if (ntt == NetTestType.ReadContextHelp) return true;
if (ntt == NetTestType.DHCPServerEnabled) return true;
if (cbSource.SelectedItem.ToString() == cbDest.SelectedItem.ToString() && ntt != NetTestType.HelpRequest) if (cbSource.SelectedItem.ToString() == cbDest.SelectedItem.ToString() && ntt != NetTestType.HelpRequest)
return false; //Source cannot equal dest return false; //Source cannot equal dest
if (theNet.GetDeviceFromName(cbSource.SelectedItem.ToString()) == null) if (theNet.GetDeviceFromName(cbSource.SelectedItem.ToString()) == null)