From ce37f24dbd4a240ae6eaf87b82b69163b8e9a42a Mon Sep 17 00:00:00 2001 From: Tim Young Date: Wed, 16 Aug 2017 11:05:24 -0500 Subject: [PATCH] Get net-test to work once. --- EduNetworkBuilder/Network.cs | 43 +++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index 1efc618..3d4178c 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1800,7 +1800,48 @@ namespace EduNetworkBuilder foreach (NetTest NT in NetTests) { - //Here we test it. + IPAddress destination; + NetworkDevice src = null; + //Here we do any pings or actions + switch (NT.TheTest) + { + case NetTestType.FailedPing: + case NetTestType.SuccessfullyPings: + case NetTestType.SuccessfullyPingsAgain: + //We need to generate a ping request + src = GetDeviceFromName(NT.sHost); + if (src == null) continue; + destination = DNSLookup(src, NT.dHost); + if (destination == null || destination.GetIPString == NB.ZeroIPString) + destination = new IPAddress(NT.dHost); + src.PingFromHere(destination); + break; + case NetTestType.SuccessfullyArps: + src = GetDeviceFromName(NT.sHost); + if (src == null) continue; + destination = DNSLookup(src, NT.dHost); + if (destination == null || destination.GetIPString == NB.ZeroIPString) + destination = new IPAddress(NT.dHost); + src.AskArpFromHere(destination); + break; + case NetTestType.SuccessfullyTraceroutes: + src = GetDeviceFromName(NT.sHost); + if (src == null) continue; + destination = DNSLookup(src, NT.dHost); + if (destination == null || destination.GetIPString == NB.ZeroIPString) + destination = new IPAddress(NT.dHost); + src.TracerouteFromHere(destination); + break; + } + NonVisualProcessPacketsOnce(); //loop until we "timeout" or all packets are done. + DumpInvisibleNetMessages(); + } + + foreach (NetTest NT in NetTests) + { + //Here we test it. + bool WasComplete = NT.TestComplete(this); + Console.WriteLine(NT.GetDescription(NetTestVerbosity.full) + " done: " + WasComplete.ToString()); } NB.UnregisterInvisibleNetwork();