Bugfix: filter out msg type other than pkt-in, flow-mod, stat-rep
CPMan only deals with PACKET-IN, FLOW-MOD, STATS-REPLY types for incoming control messages. With other message type, it throws NPE. This commit tries to fix this problem. Change-Id: Iedd264030e404b14d15e33907e082c3d73608baa
Showing
1 changed file
with
5 additions
and
0 deletions
... | @@ -38,6 +38,7 @@ import org.onosproject.openflow.controller.OpenFlowSwitchListener; | ... | @@ -38,6 +38,7 @@ import org.onosproject.openflow.controller.OpenFlowSwitchListener; |
38 | import org.onosproject.openflow.controller.RoleState; | 38 | import org.onosproject.openflow.controller.RoleState; |
39 | import org.projectfloodlight.openflow.protocol.OFMessage; | 39 | import org.projectfloodlight.openflow.protocol.OFMessage; |
40 | import org.projectfloodlight.openflow.protocol.OFPortStatus; | 40 | import org.projectfloodlight.openflow.protocol.OFPortStatus; |
41 | +import org.projectfloodlight.openflow.protocol.OFType; | ||
41 | import org.slf4j.Logger; | 42 | import org.slf4j.Logger; |
42 | 43 | ||
43 | import java.util.HashMap; | 44 | import java.util.HashMap; |
... | @@ -205,9 +206,13 @@ public class OpenFlowControlMessageProvider extends AbstractProvider | ... | @@ -205,9 +206,13 @@ public class OpenFlowControlMessageProvider extends AbstractProvider |
205 | 206 | ||
206 | @Override | 207 | @Override |
207 | public void handleMessage(Dpid dpid, OFMessage msg) { | 208 | public void handleMessage(Dpid dpid, OFMessage msg) { |
209 | + if (msg.getType() == OFType.PACKET_IN || | ||
210 | + msg.getType() == OFType.FLOW_MOD || | ||
211 | + msg.getType() == OFType.STATS_REPLY) { | ||
208 | aggregators.get(dpid).increment(msg); | 212 | aggregators.get(dpid).increment(msg); |
209 | } | 213 | } |
210 | } | 214 | } |
215 | + } | ||
211 | 216 | ||
212 | /** | 217 | /** |
213 | * A listener for outgoing OpenFlow messages. | 218 | * A listener for outgoing OpenFlow messages. | ... | ... |
-
Please register or login to post a comment