diff --git a/EduNetworkBuilder/NB.cs b/EduNetworkBuilder/NB.cs
index fe8f95e..05dc50d 100644
--- a/EduNetworkBuilder/NB.cs
+++ b/EduNetworkBuilder/NB.cs
@@ -96,7 +96,7 @@ namespace EduNetworkBuilder
vpn, vpn_encryption, vpn_decryption, ip_address, masquerade, forward, arrived, network_interface}
public enum HowToBreak { PowerOff, EthernetBreak, EthernetCorrupt, EthernetRemoveLink, LockOutSwitch,
WirelessBreakSSID, WirelessBreakKey, DeviceChangeIP, DeviceChangeGW, StaticRouteClear,
- StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey}
+ StaticRouteCorrupt, VLANChange, VPNChangeEndpoint, VPNChangeKey, BreakDevice }
[Serializable]
public struct HostNicID //This holds a unique identifier for a network card. Links use this to know what it is connected to
@@ -1243,6 +1243,8 @@ namespace EduNetworkBuilder
case HowToBreak.WirelessBreakKey:
case HowToBreak.WirelessBreakSSID:
return TraversalTechnology.wireless;
+ case HowToBreak.BreakDevice:
+ return TraversalTechnology.any;
}
return TraversalTechnology.none;
}
diff --git a/EduNetworkBuilder/NetTest.cs b/EduNetworkBuilder/NetTest.cs
index e602595..be697a6 100644
--- a/EduNetworkBuilder/NetTest.cs
+++ b/EduNetworkBuilder/NetTest.cs
@@ -139,6 +139,9 @@ namespace EduNetworkBuilder
case NetTestType.DeviceNeedsUPS:
toreturn = NB.Translate("NT_TstDescriptNeedsUPS");
break;
+ case NetTestType.DeviceBlowsUpWithPower:
+ toreturn = NB.Translate("NT_TstDescriptBadPowersupply");
+ break;
case NetTestType.NeedsDefaultGW:
toreturn = NB.Translate("NT_TstDscriptGteway");
break;
@@ -229,6 +232,9 @@ namespace EduNetworkBuilder
case NetTestType.DeviceNeedsUPS:
toreturn = NB.Translate("NT_TstDescriptNeedsUPS2");
break;
+ case NetTestType.DeviceBlowsUpWithPower:
+ toreturn = NB.Translate("NT_TstDescriptBadPowersupply2");
+ break;
case NetTestType.NeedsDefaultGW:
toreturn = NB.Translate("NT_TstDiscriptGteway2");
break;
diff --git a/EduNetworkBuilder/Network.cs b/EduNetworkBuilder/Network.cs
index 6318834..60ea3d7 100644
--- a/EduNetworkBuilder/Network.cs
+++ b/EduNetworkBuilder/Network.cs
@@ -2098,6 +2098,7 @@ namespace EduNetworkBuilder
if (BrokenItems.Contains(WhatBreak)) return 0; //it was already done
NetworkDevice tDevice = null;
NetworkLink tLink = null;
+ NetTest tTest = null;
if (What is NetworkDevice) tDevice = (NetworkDevice)What;
if (What is NetworkLink) tLink = (NetworkLink)What;
switch(How)
@@ -2171,6 +2172,39 @@ namespace EduNetworkBuilder
if (How == HowToBreak.WirelessBreakKey && rndEnd.BreakWirelessKey(tnic.NicName()))
didit = 2;
break;
+ case HowToBreak.BreakDevice:
+ //The device can be frozen, have bad power, or need a UPS, or just be burnt
+ Random rnd = NB.GetRandom();
+ int i = rnd.Next(4);
+ if(i==0)
+ {
+ How = HowToBreak.BreakDevice;
+ Data = "frozen";
+ tTest = new NetTest(What.hostname, What.hostname, NetTestType.DeviceIsFrozen);
+ NetTests.Add(tTest);
+ }
+ else if(i == 1)
+ {
+ How = HowToBreak.BreakDevice;
+ Data = "BlowsUp";
+ tTest = new NetTest(What.hostname, What.hostname, NetTestType.DeviceBlowsUpWithPower);
+ NetTests.Add(tTest);
+ }
+ else if (i == 2)
+ {
+ How = HowToBreak.BreakDevice;
+ Data = "Needs UPS";
+ tTest = new NetTest(What.hostname, What.hostname, NetTestType.DeviceNeedsUPS);
+ NetTests.Add(tTest);
+ }
+ else if (i == 3)
+ {
+ How = HowToBreak.BreakDevice;
+ Data = "burnt";
+ tDevice.IsBurned = true; //Burn the device
+ }
+ didit = 1;
+ break;
}
if(didit > 0)
BrokenItems.Add(WhatBreak);
@@ -2199,6 +2233,9 @@ namespace EduNetworkBuilder
//Fail if we cannot do it
TraversalTechnology WhatNeeded = NB.TechnologyNeededToBreak(How);
+ if (How == HowToBreak.BreakDevice)
+ Console.WriteLine("Trying to break it");
+
int count = 0;
while(count < 3)
{
diff --git a/EduNetworkBuilder/Resources/languages/edustrings.resx b/EduNetworkBuilder/Resources/languages/edustrings.resx
index 232a4a1..bfb4fab 100644
--- a/EduNetworkBuilder/Resources/languages/edustrings.resx
+++ b/EduNetworkBuilder/Resources/languages/edustrings.resx
@@ -2021,4 +2021,12 @@
Needs a UPS
NT_TstDescriptNeedsUPS2 = Needs a UPS
+
+ hardware problem
+ NT_TstDescriptBadPowersupply = hardware problem
+
+
+ Bad power supply
+ NT_TstDescriptBadPowersupply2 = bad power supply
+
\ No newline at end of file