From: <aca...@us...> - 2008-05-30 16:56:57
|
Revision: 182 http://gridsim.svn.sourceforge.net/gridsim/?rev=182&view=rev Author: acaminero Date: 2008-05-30 09:57:03 -0700 (Fri, 30 May 2008) Log Message: ----------- modified the code to ignore packets whose sender/receiver IDs are listed in the white list Modified Paths: -------------- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FIFO.java branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbEndToEndPath.java branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbInput.java branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbNetPacket.java branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbRIPRouter.java branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbSCFQScheduler.java branches/gridsim4.0-branch2/source/gridsim/net/fnb/RED.java Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FIFO.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FIFO.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FIFO.java 2008-05-30 16:57:03 UTC (rev 182) @@ -157,14 +157,13 @@ // for example, src_outputPort_str = Output_SIM_0_User_0 // Check the destination, as I'm not sure if it works like that - int dst = ((FnbNetPacket) pnp).getDestID(); - String dst_str = GridSim.getEntityName(dst); + int dst_inputPort = ((FnbNetPacket) pnp).getDestID(); + String dst_inputPort_str = GridSim.getEntityName(dst_inputPort); - // If one of the ends of this packet is the broker or the GIS - if ((src_outputPort_str.indexOf("Broker") != -1) || - (dst_str.indexOf("Broker") != -1) || - (src_outputPort_str.indexOf("GIS") != -1) || - (dst_str.indexOf("GIS") != -1)) + // if neither the src or the dest of the packet are in the whitelist, then drop the packet + if ((GridSim.fnbWhiteList_.checkList(dst_inputPort) == false) && + (GridSim.fnbWhiteList_.checkList(src_outputPort) == false)) + { /* @@ -184,7 +183,7 @@ System.out.println("\n" + super.get_name() + ": buffer full, and a control packet has been dropped.\n" + " src.output: " + src_outputPort_str + - ". dst_inputPort: " + dst_str + + ". dst_inputPort: " + dst_inputPort_str + "\n HENCE, SIMULATION FINISHED"); System.exit(1); @@ -225,7 +224,7 @@ { // If the destination of the packet is the user, tell the user - entity = GridSim.getEntityId(dst_str); + entity = GridSim.getEntityId(dst_inputPort_str); } Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbEndToEndPath.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbEndToEndPath.java 2008-05-30 16:57:03 UTC (rev 182) @@ -27,14 +27,14 @@ private int srcID; private int classtype; private int totalPkts; // total num of packet that belongs to a group - private int glID; // the id of the gridlet this packet belongs to + private int glID; // the id of the gridlet/file this packet belongs to, /**Creates a new object of this class. Tihs is used in the FnbOutput class. * @param destID destination id * @param sourceID source id * @param classType network service level * @param totalPkts total number of packets this connection is made of - * @param glID the gridlet id + * @param glID the gridlet/file id * */ public FnbEndToEndPath (int destID, int srcID, int classtype, int totalPkts, int glID) { @@ -135,19 +135,19 @@ } - /** Sets the gridlet id of a connection. + /** Sets the gridlet/file id of a connection. * @param g the gridlet id of the connection * */ - public void setGlID(int g) + public void setObjectID(int g) { glID = g; } - /** Gets the gridlet id of a connection. + /** Gets the gridlet/file id of a connection. * @return the gridlet id of the connection * */ - public int getGlID() + public int getObjectID() { return glID; } Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbInput.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbInput.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbInput.java 2008-05-30 16:57:03 UTC (rev 182) @@ -329,7 +329,7 @@ //int pktID = ((FnbNetPacket) np).getID(); //int PrevPktNum; // The pkt Num of the previous packet int pktNum = ((FnbNetPacket) np).getPacketNum(); - int glID = ((FnbNetPacket) np).getGlID(); + int glID = ((FnbNetPacket) np).getObjectID(); srcPktNum = lookForSrcPktNum(src_outputPort, glID); if (srcPktNum == null) Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbNetPacket.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbNetPacket.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbNetPacket.java 2008-05-30 16:57:03 UTC (rev 182) @@ -328,10 +328,10 @@ conn = c; } - /**Returns the gridlet to which this packet belongs*/ - public int getGlID() + /**Returns the gridlet/file to which this packet belongs*/ + public int getObjectID() { - return conn.getGlID(); + return conn.getObjectID(); } } // end class Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbOutput.java 2008-05-30 16:57:03 UTC (rev 182) @@ -16,6 +16,7 @@ import eduni.simjava.*; import java.util.*; import gridsim.net.fnb.*; +import gridsim.datagrid.*; /** @@ -81,6 +82,8 @@ random_ = null; hasStarted_ = false; packetsGridletsList_ = new ArrayList(); + + System.out.println(super.get_name()); } /** @@ -501,7 +504,7 @@ // Send first and then hold super.sim_schedule(id, GridSimTags.SCHEDULE_NOW, ev.get_tag(), io); - double receiverBaudRate = ( (Input) + double receiverBaudRate = ( (NetIO) //(Input) Sim_system.get_entity(id) ).getBaudRate(); // NOTE: io is in byte and baud rate is in bits. 1 byte = 8 bits @@ -542,6 +545,7 @@ int MTU = link_.getMTU(); int numPackets = (int) Math.ceil(size / (MTU * 1.0)); int glID = 9999; + int fileID = 9999; firstLastPacketsGridlet packGl = new firstLastPacketsGridlet(); FnbEndToEndPath conn; if (obj instanceof Gridlet) @@ -555,11 +559,20 @@ conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, glID); } + /******* TODO: not yet done + else if (obj instanceof File) // For the datagrid extension + { + fileID = ((File) obj).getRegistrationID(); + System.out.println("FileID: " + fileID); + conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets, fileID); + } + ******/ else { conn = new FnbEndToEndPath(destId, super.get_id(), netServiceType, numPackets); } + // make dummy packets with null data convertIntoPacket(MTU, numPackets, tag, conn); Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbRIPRouter.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbRIPRouter.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbRIPRouter.java 2008-05-30 16:57:03 UTC (rev 182) @@ -536,7 +536,7 @@ { conn = new FnbEndToEndPath(pkt.getDestID(), pkt.getSrcID(), pkt.getNetServiceType(), - numPackets, ((FnbNetPacket) pkt).getGlID()); + numPackets, ((FnbNetPacket) pkt).getObjectID()); } else { Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbSCFQScheduler.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/FnbSCFQScheduler.java 2008-05-30 16:57:03 UTC (rev 182) @@ -671,8 +671,8 @@ int src_outputPort; String src_outputPort_str; - int dst_inputPort; - String dst_inputPort_str; + int dst; + String dst_str; int glID; @@ -694,36 +694,49 @@ // for example, src_outputPort_str = Output_SIM_0_User_0 // Check the destination, as I'm not sure if it works like that - dst_inputPort = ((FnbNetPacket) pkt).getDestID(); - dst_inputPort_str = GridSim.getEntityName(dst_inputPort); + dst = ((FnbNetPacket) pkt).getDestID(); + dst_str = GridSim.getEntityName(dst); // We must tell the user, not the other end of the transmission int entity; - if (dst_inputPort_str.indexOf("User") == -1) + if (dst_str.indexOf("User") == -1) { entity = GridSim.getEntityId(src_str); } else { - entity = GridSim.getEntityId(dst_inputPort_str); + entity = GridSim.getEntityId(dst_str); } - // If none of the ends of this packet is the broker or the GIS + /* // This works + // If none of the ends of this packet is the broker or the GIS if ((src_outputPort_str.indexOf("Broker") == -1) && - (dst_inputPort_str.indexOf("Broker") == -1) && + (dst_str.indexOf("Broker") == -1) && (src_outputPort_str.indexOf("GIS") == -1) && - (dst_inputPort_str.indexOf("GIS") == -1)) + (dst_str.indexOf("GIS") == -1) || + (src_outputPort_str.indexOf("RC") != -1) || + (dst_str.indexOf("RC") != -1))*/ + + + // if the src or the dest of the packet are in the whitelist, then try not to drop the packet + if ((GridSim.fnbWhiteList_.checkList(dst) == true) || + (GridSim.fnbWhiteList_.checkList(src_outputPort) == true)) { // To remove a packet form this queue we have to do some stuff // I've copied this from the deque method pktList.remove(i); - timeList.remove(i); if (i == 0) - CF = ( (Double) timeList.remove(0) ).doubleValue(); + { + CF = ((Double) timeList.remove(i)).doubleValue(); + } + else + { + timeList.remove(i); + } // Also, we have to tell the user involved in this transmission // that this packet it's been dropped. - glID = ((FnbNetPacket) pkt).getGlID(); + glID = ((FnbNetPacket) pkt).getObjectID(); if (checkDroppedGlList(glID, entity) == false) { super.send(src_outputPort, GridSimTags.SCHEDULE_NOW, @@ -732,7 +745,7 @@ /*System.out.println("\n" + super.get_name() + ":(make) A packet has been dropped, and an ACK has been sent.\n" + " src.output: " + src_outputPort_str + - ". dst_inputPort: " + dst_inputPort_str + + ". dst: " + dst_str + "\n Time: " + GridSim.clock() + ". PktID: " + pkt.getID() +". Gl: " + glID);*/ @@ -742,7 +755,7 @@ /*System.out.println("\n" + super.get_name() + ":(make) A packet has been dropped.\n" + " src.output: " + src_outputPort_str + - ". dst_inputPort: " + dst_inputPort_str + + ". dst: " + dst_str + "\n Time: " + GridSim.clock() + ". PktID: " + pkt.getID() + ". Gl: " + @@ -756,6 +769,11 @@ }// for (int i = 0; i < size() ; i++) + System.out.println("\n" + super.get_name() + + ":(make) No packet could be dropped.\n" + + "Time: " + GridSim.clock() ); + + return false; } Modified: branches/gridsim4.0-branch2/source/gridsim/net/fnb/RED.java =================================================================== --- branches/gridsim4.0-branch2/source/gridsim/net/fnb/RED.java 2008-05-30 16:54:28 UTC (rev 181) +++ branches/gridsim4.0-branch2/source/gridsim/net/fnb/RED.java 2008-05-30 16:57:03 UTC (rev 182) @@ -253,15 +253,21 @@ } - // If one of the ends of this packet is the broker or the GIS. + /* + //// This works + // If one of the ends of this packet is the broker or the GIS. // Also, pkts whose source or dest is a router are protected // (monitoring ping packets). And monitoring pkts (from the res monitor) if ((src_outputPort_str.indexOf("Broker") != -1) || (dst_str.indexOf("Broker") != -1) || (src_outputPort_str.indexOf("GIS") != -1) || (dst_str.indexOf("GIS") != -1) || - (src_outputPort_str.indexOf("Router") != -1) || - (dst_str.indexOf("Router") != -1)) + (src_outputPort_str.indexOf("RC") != -1) || + (dst_str.indexOf("RC") != -1))*/ + + // if the src or the dest of the packet are in the whitelist, then try not to drop the packet + if ((GridSim.fnbWhiteList_.checkList(dst) == true) || + (GridSim.fnbWhiteList_.checkList(src_outputPort) == true)) { if (makeRoomForPacket()) @@ -350,7 +356,7 @@ tag = ((FnbNetPacket) pnp).getTag(); // check the user and the gl this packet belongs to - glID = ((FnbNetPacket) pnp).getGlID(); + glID = ((FnbNetPacket) pnp).getObjectID(); } @@ -399,7 +405,7 @@ } else{ - /*System.out.println("\n" + super.get_name() + + /* System.out.println("\n" + super.get_name() + ": A packet has been dropped.\n" + " src.output: " + src_outputPort_str + ". dst_inputPort: " + dst_str + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |