Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit e5b28df

Browse files
Sumanth SathyanarayanaSumanth Sathyanarayana
authored andcommitted
Some minor changes and logging added
1 parent 129a422 commit e5b28df

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

src/org/flowvisor/classifier/FVClassifier.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ public synchronized void classifyFlowStats(FVStatisticsReply fvStatisticsReply)
11391139
cache.put("packetCount ", reply.getPacketCount());
11401140
cache.put("byteCount ",reply.getByteCount());
11411141
cache.put("length ", reply.getLength());
1142-
1142+
11431143
//cache.put(FlowSpace.DLDST, HexString.toHexString(reply.getMatch().getDataLayerDestination()));
11441144
//cache.put(FlowSpace.DLSRC, HexString.toHexString(reply.getMatch().getDataLayerSource()));
11451145
//cache.put(FlowSpace.DLTYPE, reply.getMatch().getDataLayerType());
@@ -1186,8 +1186,9 @@ public synchronized void classifyFlowStats(FVStatisticsReply fvStatisticsReply)
11861186
if (this.registeredForFlowTable == true && !this.flowTableList.isEmpty()){
11871187
FVLog.log(LogLevel.DEBUG, this, "Inside registeredForFlowTable ",this.registeredForFlowTable);
11881188
for (FlowTableCallback fcb : this.flowTableList) {
1189+
fcb.clearParams();
11891190
fcb.setParams(params);
1190-
fcb.run(); // Is this ok to use run, there will be only one thread of fcb per classifier?
1191+
fcb.spawn(); // Is this ok to use run, there will be only one thread of fcb per classifier?
11911192

11921193
}
11931194
}

src/org/flowvisor/message/lldp/LLDPTrailer.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,26 @@ public static LLDPTrailer getTrailer(FVPacketIn pi) {
202202
try{
203203
FVLog.log(LogLevel.DEBUG, null, " packet capacity: ", packet.capacity());
204204
int offset = packet.capacity() - END_LLDPDU_LEN ;
205-
206-
if (packet.get(offset) != 0)
205+
//FVLog.log(LogLevel.DEBUG, null, "offset0: ",offset);
206+
if (packet.get(offset) != 0){
207207
FVLog.log(LogLevel.WARN, null, "End of LLDPDU is missing");
208-
208+
return null;//didn't find the End Trailer, so does not contain the rest too!
209+
}
209210
offset -= FLOWNAMELEN_LEN;
211+
//FVLog.log(LogLevel.DEBUG, null, "offset1: ",offset);
210212
byte flowLen = packet.get(offset);
213+
FVLog.log(LogLevel.DEBUG, null, "flowLen: ",flowLen);
211214
offset -= SLICENAMELEN_LEN;
215+
//FVLog.log(LogLevel.DEBUG, null, "offset2: ",offset);
212216
byte sliceLen = packet.get(offset);
217+
FVLog.log(LogLevel.DEBUG, null, "sliceLen: ",sliceLen);
213218
offset = offset - (flowLen + sliceLen); // this includes the NULL
219+
//FVLog.log(LogLevel.DEBUG, null, "offset3: ",offset);
214220
packet.position(offset);
215-
221+
FVLog.log(LogLevel.MOBUG, null, "packet: ",packet.toString());
216222
sliceName = StringByteSerializer.readFrom(packet, sliceLen);
217223
fvName = StringByteSerializer.readFrom(packet, flowLen);
218224

219-
FVLog.log(LogLevel.DEBUG, null, "sliceName = ", sliceName, "fvName= ", fvName);
220-
221225
//Check for the OUI Id and its subtype from backwards -
222226
offset -= 1;
223227
FVLog.log(LogLevel.DEBUG, null, " OUI Subtype: ",packet.get(offset));
@@ -237,7 +241,12 @@ public static LLDPTrailer getTrailer(FVPacketIn pi) {
237241
FVLog.log(LogLevel.ALERT, null, "Wrong OUI2");
238242
}
239243
catch(IndexOutOfBoundsException ioe){
240-
FVLog.log(LogLevel.CRIT, null, "Yikes! The LLDP packet-in is not well formed - IndexOutOfBound while getting the trailer ");
244+
FVLog.log(LogLevel.CRIT, null, "Yikes! The LLDP packet-in is not well formed - " +
245+
" IndexOutOfBound while getting the trailer ",ioe);
246+
}
247+
catch(IllegalArgumentException iae){
248+
FVLog.log(LogLevel.CRIT, null, "Yikes! Got an illegal argument-something wrong " +
249+
" with the positioning of the offset in the ByteBuffer! ",iae);
241250
}
242251

243252
/*offset = offset - (OUI_HEADER_LEN + TTL_LEN + TTL_HEADER_LEN + PORT_LEN);

src/org/flowvisor/message/lldp/LLDPUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static public boolean handleLLDPFromController(FVPacketOut po,
5050
if (!LLDPCheck(po.getPacketData()))
5151
return false;
5252
String fvName = FlowVisor.getInstance().getInstanceName();
53+
FVLog.log(LogLevel.DEBUG,null,"fvName is: ",fvName, "sliceName is: ", fvSlicer.getSliceName() );
5354
/**
5455
* This is a hack to ensure that the resulting lldp packet is larger
5556
* than 60: #133
@@ -110,10 +111,13 @@ static private boolean LLDPCheck(byte[] packetArray) {
110111
return false; // not lddp if no packet exists or too short
111112
ByteBuffer packet = ByteBuffer.wrap(packetArray);
112113
short ether_type = packet.getShort(12);
114+
FVLog.log(LogLevel.DEBUG,null,"Checking if the pkt is LLDP?", ether_type );
113115
if (ether_type == ETHER_VLAN)
114116
ether_type = packet.getShort(16);
115-
if (ether_type != ETHER_LLDP)
117+
if (ether_type != ETHER_LLDP){
118+
FVLog.log(LogLevel.DEBUG,null,"The pkt is not LLDP" );
116119
return false;
120+
}
117121
// TODO think about checking for NOX OID
118122
return true;
119123
}

0 commit comments

Comments
 (0)