public void RemoveSlotPort(string sp) { int i; for (i = 0; i < slotPorts.Count(); i++) { if (slotPorts[i].Slot_Port == sp) { SlotPort[] tmpSP = new SlotPort[slotPorts.Count() - 1]; int ii; for (ii = 0; ii < tmpSP.Count(); ii++) { if (ii < i) { tmpSP[ii] = slotPorts[ii]; } else { tmpSP[ii] = slotPorts[ii + 1]; } } slotPorts = tmpSP; return; } } }
public SlotPort AddSlotPort(string _sp) { int count = 0; if ((_sp == "") || (_sp == null)) { return(null); } if (slotPorts != null) { count = slotPorts.Count(); } int i; for (i = 0; i < count; i++) { if (slotPorts[i].Slot_Port == _sp) { return(slotPorts[i]); } } SlotPort[] tmp = new SlotPort[count + 1]; for (i = 0; i < count; i++) { tmp[i] = slotPorts[i]; } tmp[count] = new SlotPort(); tmp[count].Slot_Port = _sp; slotPorts = tmp; return(slotPorts[count]); }
} //AddService public void AddTunnel(Tunnel _t) { if (_t == null) { return; } NE tmpNE = null; SlotPort tmpSP = null; if ((_t.SnkInterface != null) && (_t.SnkInterface.NEName != "")) { tmpNE = AddNE(_t.SnkInterface.NEName); if (tmpNE != null) { if (_t.SnkInterface.SlotPort != null) { tmpSP = tmpNE.AddSlotPort(_t.SnkInterface.SlotPort); } if (tmpSP != null) { tmpSP.AddTunnel(_t); } } } if ((_t.SrcInterface != null) && (_t.SrcInterface.NEName != "")) { tmpNE = AddNE(_t.SrcInterface.NEName); if (tmpNE != null) { if (_t.SrcInterface.SlotPort != null) { tmpSP = tmpNE.AddSlotPort(_t.SrcInterface.SlotPort); } if (tmpSP != null) { tmpSP.AddTunnel(_t); } } } if (_t.TransitNE != null) { foreach (TransitNE tmpTrNE in _t.TransitNE) { if ((tmpTrNE.NEName != null) && (tmpTrNE.NEName != "")) { tmpNE = AddNE(tmpTrNE.NEName); if (tmpNE != null) { if (tmpTrNE.InSlotPort != null) { tmpSP = tmpNE.AddSlotPort(tmpTrNE.InSlotPort); } if (tmpSP != null) { tmpSP.AddTunnel(_t); } if (tmpTrNE.OutSlotPort != null) { tmpSP = tmpNE.AddSlotPort(tmpTrNE.OutSlotPort); } if (tmpSP != null) { tmpSP.AddTunnel(_t); } } } } //forech } }
public void AddService(Service _s) { if (_s == null) { return; } NE tmpNE = null; SlotPort tmpSP = null; if ((_s.SrcInterfaceWork != null) && (_s.SrcInterfaceWork.NEName != "")) { tmpNE = AddNE(_s.SrcInterfaceWork.NEName); if (tmpNE != null) { if (_s.SrcInterfaceWork.SlotPort != null) { tmpSP = tmpNE.AddSlotPort(_s.SrcInterfaceWork.SlotPort); } if (tmpSP != null) { tmpSP.AddService(_s); } } } if ((_s.SrcInterfaceProt != null) && (_s.SrcInterfaceProt.NEName != "")) { tmpNE = AddNE(_s.SrcInterfaceProt.NEName); if (tmpNE != null) { if (_s.SrcInterfaceProt.SlotPort != null) { tmpSP = tmpNE.AddSlotPort(_s.SrcInterfaceProt.SlotPort); } if (tmpSP != null) { tmpSP.AddService(_s); } } } if ((_s.SnkInterfaceWork != null) && (_s.SnkInterfaceWork.NEName != "")) { tmpNE = AddNE(_s.SnkInterfaceWork.NEName); if (tmpNE != null) { if (_s.SnkInterfaceWork.SlotPort != null) { tmpSP = tmpNE.AddSlotPort(_s.SnkInterfaceWork.SlotPort); } if (tmpSP != null) { tmpSP.AddService(_s); } } } if ((_s.SnkInterfaceProt != null) && (_s.SnkInterfaceProt.NEName != "")) { tmpNE = AddNE(_s.SnkInterfaceProt.NEName); if (tmpNE != null) { if (_s.SnkInterfaceProt.SlotPort != null) { tmpSP = tmpNE.AddSlotPort(_s.SnkInterfaceProt.SlotPort); } if (tmpSP != null) { tmpSP.AddService(_s); } } } } //AddService