One item to break
This commit is contained in:
parent
75bcd6d0ba
commit
eddfb773c0
@ -1909,9 +1909,9 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BreakNetComponent(NetworkComponent What, HowToBreak How)
|
int BreakNetComponent(NetworkComponent What, HowToBreak How)
|
||||||
{
|
{
|
||||||
bool didit = false;
|
int didit = 0;
|
||||||
NetworkDevice tDevice = null;
|
NetworkDevice tDevice = null;
|
||||||
NetworkLink tLink = null;
|
NetworkLink tLink = null;
|
||||||
if (What is NetworkDevice) tDevice = (NetworkDevice)What;
|
if (What is NetworkDevice) tDevice = (NetworkDevice)What;
|
||||||
@ -1920,7 +1920,7 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
case HowToBreak.PowerOff:
|
case HowToBreak.PowerOff:
|
||||||
tDevice.PowerOff = true;
|
tDevice.PowerOff = true;
|
||||||
didit = true;
|
didit = 1;
|
||||||
break;
|
break;
|
||||||
case HowToBreak.DeviceChangeGW:
|
case HowToBreak.DeviceChangeGW:
|
||||||
break;
|
break;
|
||||||
@ -1928,7 +1928,7 @@ namespace EduNetworkBuilder
|
|||||||
break;
|
break;
|
||||||
case HowToBreak.EthernetBreak:
|
case HowToBreak.EthernetBreak:
|
||||||
tLink.theLinkType = LinkType.broken;
|
tLink.theLinkType = LinkType.broken;
|
||||||
didit = true;
|
didit = 1;
|
||||||
break;
|
break;
|
||||||
case HowToBreak.EthernetCorrupt:
|
case HowToBreak.EthernetCorrupt:
|
||||||
break;
|
break;
|
||||||
@ -1953,16 +1953,30 @@ namespace EduNetworkBuilder
|
|||||||
return didit;
|
return didit;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BreakNetworkPath(TraversalClass ThePath, HowToBreak How)
|
int BreakNetworkPath(TraversalClass ThePath, HowToBreak How)
|
||||||
{
|
{
|
||||||
//find the device name it belongs to
|
//find the device name it belongs to
|
||||||
//try to break it. If it fails, try a different device.
|
//try to break it. If it fails, try a different device.
|
||||||
//Fail if we cannot do it
|
//Fail if we cannot do it
|
||||||
|
TraversalTechnology WhatNeeded = NB.TechnologyNeededToBreak(How);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while(count < 3)
|
while(count < 3)
|
||||||
{
|
{
|
||||||
string host = ThePath.HostnameFromTechnology();
|
string host = ThePath.HostnameFromTechnology(WhatNeeded);
|
||||||
|
if(host != "")
|
||||||
|
{
|
||||||
|
//We have a host, see if we can break it.
|
||||||
|
NetworkComponent NC = ItemFromName(host);
|
||||||
|
if(NC != null)
|
||||||
|
{
|
||||||
|
int answer = BreakNetComponent(NC, How);
|
||||||
|
if (answer>0) return answer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user