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 NetTestType { NeedsLocalIPTo, NeedsDefaultGW, NeedsLinkToDevice, NeedsRouteToNet,
SuccessfullyPings, SuccessfullyArps, SuccessfullyDHCPs, HelpRequest, ReadContextHelp, FailedPing,
DHCPServerEnabled,
LockAll, LockIP, LockRoute, LockNic, LockDHCP, LockGateway
}
public enum NetTestVerbosity { none, basic, hints, full }

View File

@ -152,6 +152,9 @@ namespace EduNetworkBuilder
case NetTestType.FailedPing:
toreturn = "Should fail to ping a specific host";
break;
case NetTestType.DHCPServerEnabled:
toreturn = "Needs change to DHCP server:";
break;
case NetTestType.LockAll:
toreturn = "Is Locked";
break;
@ -209,6 +212,10 @@ namespace EduNetworkBuilder
case NetTestType.FailedPing:
toreturn = "Needs to try to ping (and fail):";
break;
case NetTestType.DHCPServerEnabled:
toreturn = "DHCP Server enabled = ";
break;
case NetTestType.LockAll:
toreturn = "Is Locked:";
break;
@ -271,6 +278,7 @@ namespace EduNetworkBuilder
NetworkDevice Source = theNet.GetDeviceFromName(sHost);
NetworkDevice Dest = theNet.GetDeviceFromName(dHost);
if (Source == null) return false;
if (TheTest == NetTestType.DHCPServerEnabled) return true; //dest does not matter
if (Dest == null) return false;
return true;
}
@ -391,6 +399,14 @@ namespace EduNetworkBuilder
case NetTestType.ReadContextHelp:
case NetTestType.FailedPing:
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.LockDHCP:
case NetTestType.LockIP:

View File

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