Mark the nic spray fixed once the nic has been re-added. They should still add a test to make sure the IP has been put back, etc. Also fixed an issue with duplicate nic names.
This commit is contained in:
parent
10ef0a426f
commit
d8a5a8169c
@ -289,6 +289,8 @@ namespace EduNetworkBuilder
|
||||
private void btnNicPlus_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<NicType> WhatToAdd = new List<NicType>();
|
||||
Network tnet = NB.GetNetwork();
|
||||
NetworkCard tnic = null;
|
||||
//generate a new nic and add it to the device
|
||||
if (ClonedItem.GetType().ToString() == "EduNetworkBuilder.NetworkDevice")
|
||||
{
|
||||
@ -314,7 +316,7 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
if (WhatToAdd.Count == 1)
|
||||
{
|
||||
ndCLonedItem.AddNic(WhatToAdd[0]);
|
||||
tnic = ndCLonedItem.AddNic(WhatToAdd[0]);
|
||||
}
|
||||
if(WhatToAdd.Count > 1)
|
||||
{
|
||||
@ -352,9 +354,11 @@ namespace EduNetworkBuilder
|
||||
QuestionForm.ShowDialog();
|
||||
if(cbQuestions.SelectedIndex >=0)
|
||||
{
|
||||
ndCLonedItem.AddNic(WhatToAdd[cbQuestions.SelectedIndex]);
|
||||
tnic = ndCLonedItem.AddNic(WhatToAdd[cbQuestions.SelectedIndex]);
|
||||
}
|
||||
}
|
||||
if(tnet != null)
|
||||
tnet.RegisterNICAdded(ndCLonedItem.hostname, tnic.NicName());
|
||||
}
|
||||
UpdateForm();
|
||||
}
|
||||
|
@ -2003,7 +2003,16 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterNICAdded(string source, string nicname)
|
||||
{
|
||||
foreach (NetTest one in NetTests)
|
||||
{
|
||||
if (one.sHost == source && one.TheTest == NetTestType.DeviceNICSprays && one.dHost == nicname)
|
||||
{
|
||||
one.SetDone();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void RegisterUPSAdded(string source)
|
||||
{
|
||||
foreach (NetTest one in NetTests)
|
||||
|
@ -184,13 +184,35 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
return count;
|
||||
}
|
||||
public void AddNic(NicType TheType = NicType.eth)
|
||||
public int FirstEmptySlot(NicType TheType)
|
||||
{
|
||||
int count = 0;
|
||||
while (true)
|
||||
{
|
||||
bool found = false;
|
||||
string tname = TheType.ToString() + count.ToString();
|
||||
foreach (NetworkCard nic in NICs)
|
||||
{
|
||||
if(nic.NicName() == tname)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
return count;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkCard AddNic(NicType TheType = NicType.eth)
|
||||
{
|
||||
NetworkCard tnic;
|
||||
int count = CountNics(TheType);
|
||||
int count = FirstEmptySlot(TheType);
|
||||
tnic = new NetworkCard(count, GetUniqueIdentifier, hostname, TheType);
|
||||
NICs.Add(tnic);
|
||||
ApplyRulesToDevice();
|
||||
return tnic;
|
||||
}
|
||||
private void ApplyRulesToDevice()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user