From 4c921ab280ca7813922a84bdfc85428493c267a4 Mon Sep 17 00:00:00 2001 From: Tim Young Date: Thu, 3 Aug 2017 11:36:53 -0500 Subject: [PATCH] Process for connecting a network link to the device it is connected to. Without this, cloned networks fail. --- EduNetworkBuilder/Network.cs | 17 +++++++++++++++++ EduNetworkBuilder/NetworkLink.cs | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs index d137578..718eab0 100644 --- a/EduNetworkBuilder/Network.cs +++ b/EduNetworkBuilder/Network.cs @@ -1556,6 +1556,23 @@ namespace EduNetworkBuilder return didanything; } + public bool DoAllMarkAsLinked() + { + bool didanything = false; + NetworkLink nl; + foreach (NetworkComponent nc in NetComponents.ToList()) + { + if (NB.GetComponentType(nc) == GeneralComponentType.link) + { + nl = (NetworkLink)nc; + nl.MarkAsLinked(); + didanything = true; + } + } + + return didanything; + } + public bool DoAllAutoJoin() { bool didanything = false; diff --git a/EduNetworkBuilder/NetworkLink.cs b/EduNetworkBuilder/NetworkLink.cs index 7ac62b7..11106a6 100644 --- a/EduNetworkBuilder/NetworkLink.cs +++ b/EduNetworkBuilder/NetworkLink.cs @@ -118,6 +118,16 @@ namespace EduNetworkBuilder myNet.MarkAsLinked(DstNic, GetUniqueIdentifier); } + public void MarkAsLinked() + { + Network myNet = NB.GetNetwork(); + if (myNet != null) + { + myNet.MarkAsLinked(SrcNic, GetUniqueIdentifier); + myNet.MarkAsLinked(DstNic, GetUniqueIdentifier); + } + } + public override void Save(XmlWriter writer) { writer.WriteStartElement("link");