Group and Port are not mandatory in Flow. 32/3332/2
authorPrasanna Huddar <prasanna.huddar@ericsson.com>
Mon, 2 Dec 2013 11:33:54 +0000 (17:03 +0530)
committerPrasanna Huddar <prasanna.huddar@ericsson.com>
Mon, 2 Dec 2013 12:55:59 +0000 (18:25 +0530)
Signed-off-by: Prasanna Huddar <prasanna.huddar@ericsson.com>
Change-Id: Id6e8842a0e78486dfec6b439af716540318349fd

openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/FlowModInputMessageFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10FlowModInputMessageFactory.java

index 4793c286bf0556ba9dc4d1c04aadac5c02c1f8b8..8889339a2e45d767fbd32f23a0870492b9a02993 100644 (file)
@@ -49,8 +49,13 @@ public class FlowModInputMessageFactory implements OFSerializer<FlowModInput> {
         out.writeShort(message.getHardTimeout().intValue());\r
         out.writeShort(message.getPriority());\r
         out.writeInt(message.getBufferId().intValue());\r
-        out.writeInt(message.getOutPort().getValue().intValue());\r
-        out.writeInt(message.getOutGroup().intValue());\r
+        if (message.getOutPort() != null) {\r
+            out.writeInt(message.getOutPort().getValue().intValue());\r
+        }\r
+        \r
+        if (message.getOutGroup() != null) {\r
+            out.writeInt(message.getOutGroup().intValue());\r
+        }\r
         out.writeShort(createFlowModFlagsBitmask(message.getFlags()));\r
         ByteBufUtils.padBuffer(PADDING_IN_FLOW_MOD_MESSAGE, out);\r
         MatchSerializer.encodeMatch(message.getMatch(), out);\r
index 7821cd4979ad354993b1c37f63fd822c8a1da9a4..f0858af0009660be4563d00a2bcee2d9eaa65e66 100644 (file)
@@ -48,7 +48,9 @@ public class OF10FlowModInputMessageFactory implements OFSerializer<FlowModInput
         out.writeShort(message.getHardTimeout().intValue());\r
         out.writeShort(message.getPriority());\r
         out.writeInt(message.getBufferId().intValue());\r
-        out.writeShort(message.getOutPort().getValue().intValue());\r
+        if (null != message.getOutPort()) {\r
+            out.writeShort(message.getOutPort().getValue().intValue());\r
+        }\r
         out.writeShort(createFlowModFlagsBitmask(message.getFlagsV10()));\r
         OF10ActionsSerializer.encodeActionsV10(out, message.getActionsList());\r
     }\r