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
6 additions
and
1 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,7 +206,11 @@ public class OpenFlowControlMessageProvider extends AbstractProvider | ... | @@ -205,7 +206,11 @@ 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) { |
| 208 | - aggregators.get(dpid).increment(msg); | 209 | + if (msg.getType() == OFType.PACKET_IN || |
| 210 | + msg.getType() == OFType.FLOW_MOD || | ||
| 211 | + msg.getType() == OFType.STATS_REPLY) { | ||
| 212 | + aggregators.get(dpid).increment(msg); | ||
| 213 | + } | ||
| 209 | } | 214 | } |
| 210 | } | 215 | } |
| 211 | 216 | ... | ... |
-
Please register or login to post a comment