capture test traversal dump

This commit is contained in:
Tim Young 2017-08-25 15:32:00 -05:00
parent c7357f15e4
commit 743c531c1f
4 changed files with 21 additions and 3 deletions

View File

@ -59,6 +59,7 @@ namespace EduNetworkBuilder
private int NumberOfSecondsForTimeout = 10; private int NumberOfSecondsForTimeout = 10;
private List<Rectangle> PacketRectangles = new List<Rectangle>(); private List<Rectangle> PacketRectangles = new List<Rectangle>();
public BindingList<VLANName> VlanNames = new BindingList<VLANName>() { new VLANName(1, "Default") }; public BindingList<VLANName> VlanNames = new BindingList<VLANName>() { new VLANName(1, "Default") };
public TraversalClass LastTraversal = null;
private bool previously_had_packets = false; //used on "tick" to determine if we are starting from scratch private bool previously_had_packets = false; //used on "tick" to determine if we are starting from scratch
@ -1202,6 +1203,13 @@ namespace EduNetworkBuilder
else if (myPackets[loop].ready_to_delete) else if (myPackets[loop].ready_to_delete)
{ {
myPackets[loop].PrepareToDelete(); myPackets[loop].PrepareToDelete();
if(myPackets[loop].MyStatus == PacketStatus.finished_ok)
{
if (myPackets[loop].TraversalInformation != null)
{
LastTraversal = myPackets[loop].TraversalInformation;
}
}
myPackets.RemoveAt(loop); myPackets.RemoveAt(loop);
} }
} }
@ -1870,15 +1878,18 @@ namespace EduNetworkBuilder
return HomeworkSolvedStatus.NeverChecked; //for now. We want to change this later. Just so we keep re-testing return HomeworkSolvedStatus.NeverChecked; //for now. We want to change this later. Just so we keep re-testing
} }
public void NonVisualPingOneHost(string source, string dest) public TraversalClass NonVisualPingOneHost(string source, string dest)
{ {
LastTraversal = null;
NB.RegisterInvisibleNetwork(this); NB.RegisterInvisibleNetwork(this);
NetworkDevice src = GetDeviceFromName(source); NetworkDevice src = GetDeviceFromName(source);
if (src == null) return; if (src == null) return null;
IPAddress destination = DNSLookup(src, dest); IPAddress destination = DNSLookup(src, dest);
src.PingFromHere(destination); src.PingFromHere(destination);
NonVisualProcessPacketsOnce(); NonVisualProcessPacketsOnce();
if (LastTraversal != null) LastTraversal.DumpPath();
NB.UnregisterInvisibleNetwork(); NB.UnregisterInvisibleNetwork();
return LastTraversal;
} }
public void NonVisualDoDHCPOnAll() public void NonVisualDoDHCPOnAll()

View File

@ -2149,6 +2149,8 @@ namespace EduNetworkBuilder
{ {
//we will prompt for stuff. For now, just use the firewalls network //we will prompt for stuff. For now, just use the firewalls network
LoadSolvedResource( SolvedNetworkNames.firewalls.ToString()); LoadSolvedResource( SolvedNetworkNames.firewalls.ToString());
myNetwork.NonVisualDoDHCPOnAll();
myNetwork.NonVisualPingOneHost("pc1", "pc2");
} }
#endregion Random Map Stuff #endregion Random Map Stuff
} }

View File

@ -1692,6 +1692,8 @@ namespace EduNetworkBuilder
tPacket.MyStatus = PacketStatus.finished_ok; //It stops here tPacket.MyStatus = PacketStatus.finished_ok; //It stops here
nPacket = tPacket.payloadPacket; nPacket = tPacket.payloadPacket;
if (nPacket.TraversalInformation != null && tPacket.TraversalInformation != null)
nPacket.TraversalInformation.AddPath(tPacket.TraversalInformation);
NetworkCard nc = LocalNic(nPacket.TsourceIP, true); NetworkCard nc = LocalNic(nPacket.TsourceIP, true);
nPacket.TsourceIP = null; nPacket.TsourceIP = null;
if (nc != null) if (nc != null)

View File

@ -44,7 +44,10 @@ namespace EduNetworkBuilder
{ {
PathTaken.Add(new TraversalRecord(Host, WithWhat)); PathTaken.Add(new TraversalRecord(Host, WithWhat));
} }
public void AddPath(TraversalClass OtherTraversal)
{
PathTaken.AddRange(OtherTraversal.PathTaken);
}
/// <summary> /// <summary>
/// This is just a debug function to print off the whole path as we find it. /// This is just a debug function to print off the whole path as we find it.
/// </summary> /// </summary>