leaf experimenter {\r
type uint32;\r
}\r
+ leaf data {\r
+ type binary; \r
+ }\r
}\r
\r
}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.openflowjava</groupId>
+ <artifactId>openflow-protocol-parent</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ </parent>
+ <groupId>org.opendaylight.openflowjava</groupId>
+ <artifactId>openflow-protocol-ext</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <name>Openflow Protocol Library - EXT</name>
+ <url>http://maven.apache.org</url>
+ <scm>
+ <url>https://wiki.opendaylight.org/view/Openflow_Protocol_Library:Main</url>
+ <tag>HEAD</tag>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openflow-protocol-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>openflow-protocol-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ </dependencies>
+</project>
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters.ExperimenterActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters.OF13ExperimenterInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
\r
public static void registerDeserializers(DeserializerRegistry registry) {\r
// register OF v1.0 default experimenter deserializers\r
// - default action deserializer\r
- registry.registerDeserializer(new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,\r
- EncodeConstants.EXPERIMENTER_VALUE, Action.class), new ExperimenterActionDeserializer());\r
+ registry.registerDeserializer(new MessageCodeKey(ExtConstants.OF10_VERSION_ID,\r
+ ExtConstants.EXPERIMENTER_VALUE, Action.class), new OF13ExperimenterActionDeserializer());\r
// register OF v1.3 default experimenter deserializers\r
// - default action deserializer\r
- registry.registerDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,\r
- EncodeConstants.EXPERIMENTER_VALUE, Action.class), new ExperimenterActionDeserializer());\r
+ registry.registerDeserializer(new MessageCodeKey(ExtConstants.OF13_VERSION_ID,\r
+ ExtConstants.EXPERIMENTER_VALUE, Action.class), new OF13ExperimenterActionDeserializer());\r
// - default instruction deserializer\r
- registry.registerDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,\r
- EncodeConstants.EXPERIMENTER_VALUE, Instruction.class), new OF13ExperimenterInstructionDeserializer());\r
+ registry.registerDeserializer(new MessageCodeKey(ExtConstants.OF13_VERSION_ID,\r
+ ExtConstants.EXPERIMENTER_VALUE, Instruction.class), new OF13ExperimenterInstructionDeserializer());\r
}\r
}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10StatsReplyVendorDeserializer implements OFDeserializer<MultipartReplyExperimenter> {\r
+\r
+ @Override\r
+ public MultipartReplyExperimenter deserialize(ByteBuf message) {\r
+ MultipartReplyExperimenterBuilder builder = new MultipartReplyExperimenterBuilder();\r
+ builder.setExperimenter(message.readUnsignedInt());\r
+ if (message.readableBytes() > 0) {\r
+ byte[] data = new byte[message.readableBytes()];\r
+ message.readBytes(data);\r
+ builder.setData(data);\r
+ }\r
+ return builder.build();\r
+ }\r
+\r
+}\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
* @author michal.polkorab\r
*\r
*/\r
-public class ExperimenterActionDeserializer implements OFDeserializer<Action>,\r
+public class OF10VendorActionDeserializer implements OFDeserializer<Action>,\r
HeaderDeserializer<Action> {\r
\r
@Override\r
public Action deserializeHeader(ByteBuf input) {\r
ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
builder.setType(Experimenter.class);\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
expBuilder.setExperimenter(input.readUnsignedInt());\r
builder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
@Override\r
public Action deserialize(ByteBuf input) {\r
ActionBuilder builder = new ActionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
builder.setType(Experimenter.class);\r
int length = input.readUnsignedShort();\r
// subtract experimenter header length\r
- length -= EncodeConstants.EXPERIMENTER_IDS_LENGTH;\r
+ length -= ExtConstants.EXPERIMENTER_IDS_LENGTH;\r
ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
expBuilder.setExperimenter(input.readUnsignedInt());\r
if (length > 0) {\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorMessageDeserializer implements OFDeserializer<ExperimenterMessage> {\r
+\r
+ @Override\r
+ public ExperimenterMessage deserialize(ByteBuf message) {\r
+ ExperimenterMessageBuilder builder = new ExperimenterMessageBuilder();\r
+ builder.setVersion((short) ExtConstants.OF10_VERSION_ID);\r
+ builder.setXid(message.readUnsignedInt());\r
+ builder.setExperimenter(message.readUnsignedInt());\r
+ if (message.readableBytes() > 0) {\r
+ byte[] data = new byte[message.readableBytes()];\r
+ message.readBytes(data);\r
+ builder.setData(data);\r
+ }\r
+ return builder.build();\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterActionDeserializer implements OFDeserializer<Action>,\r
+ HeaderDeserializer<Action> {\r
+\r
+ @Override\r
+ public Action deserializeHeader(ByteBuf input) {\r
+ ActionBuilder builder = new ActionBuilder();\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ builder.setType(Experimenter.class);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(input.readUnsignedInt());\r
+ builder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ return builder.build();\r
+ }\r
+\r
+ @Override\r
+ public Action deserialize(ByteBuf input) {\r
+ ActionBuilder builder = new ActionBuilder();\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ builder.setType(Experimenter.class);\r
+ int length = input.readUnsignedShort();\r
+ // subtract experimenter header length\r
+ length -= ExtConstants.EXPERIMENTER_IDS_LENGTH;\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(input.readUnsignedInt());\r
+ if (length > 0) {\r
+ byte[] data = new byte[length];\r
+ input.readBytes(data);\r
+ expBuilder.setData(data);\r
+ }\r
+ builder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ return builder.build();\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterError;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterErrorBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterErrorMessageDeserializer implements OFDeserializer<ExperimenterError> {\r
+\r
+ @Override\r
+ public ExperimenterError deserialize(ByteBuf message) {\r
+ ExperimenterErrorBuilder expBuilder = new ExperimenterErrorBuilder();\r
+ expBuilder.setExpType(message.readUnsignedShort());\r
+ expBuilder.setExperimenter(message.readUnsignedInt());\r
+ if (message.readableBytes() > 0) {\r
+ byte[] data = new byte[message.readableBytes()];\r
+ message.readBytes(data);\r
+ expBuilder.setData(data);\r
+ }\r
+ return expBuilder.build();\r
+ }\r
+\r
+}\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstructionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
@Override\r
public Instruction deserializeHeader(ByteBuf input) {\r
InstructionBuilder builder = new InstructionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
builder.setType(Experimenter.class);\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
expBuilder.setExperimenter(input.readUnsignedInt());\r
+ builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
return builder.build();\r
}\r
\r
@Override\r
public Instruction deserialize(ByteBuf input) {\r
InstructionBuilder builder = new InstructionBuilder();\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
builder.setType(Experimenter.class);\r
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+ input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
expBuilder.setExperimenter(input.readUnsignedInt());\r
if (input.readableBytes() > 0) {\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterMessageDeserializer implements OFDeserializer<ExperimenterMessage> {\r
+\r
+ @Override\r
+ public ExperimenterMessage deserialize(ByteBuf message) {\r
+ ExperimenterMessageBuilder builder = new ExperimenterMessageBuilder();\r
+ builder.setVersion((short) ExtConstants.OF13_VERSION_ID);\r
+ builder.setXid(message.readUnsignedInt());\r
+ builder.setExperimenter(message.readUnsignedInt());\r
+ builder.setExpType(message.readUnsignedInt());\r
+ if (message.readableBytes() > 0) {\r
+ byte[] data = new byte[message.readableBytes()];\r
+ message.readBytes(data);\r
+ builder.setData(data);\r
+ }\r
+ return builder.build();\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartReplyExperimenterDeserializer implements OFDeserializer<MultipartReplyExperimenter> {\r
+\r
+ @Override\r
+ public MultipartReplyExperimenter deserialize(ByteBuf message) {\r
+ MultipartReplyExperimenterBuilder builder = new MultipartReplyExperimenterBuilder();\r
+ builder.setExperimenter(message.readUnsignedInt());\r
+ builder.setExpType(message.readUnsignedInt());\r
+ if (message.readableBytes() > 0) {\r
+ byte[] data = new byte[message.readableBytes()];\r
+ message.readBytes(data);\r
+ builder.setData(data);\r
+ }\r
+ return builder.build();\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueuePropertyBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13QueueGetConfigReplyExperimenterDeserializer \r
+ implements OFDeserializer<QueueProperty> {\r
+\r
+ private static final int PADDING_IN_QUEUE_PROPERTY_HEADER = 4;\r
+ private static final int PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY = 4;\r
+\r
+ @Override\r
+ public QueueProperty deserialize(ByteBuf input) {\r
+ QueuePropertyBuilder builder = new QueuePropertyBuilder();\r
+ QueueProperties property = QueueProperties.forValue(input.readUnsignedShort());\r
+ builder.setProperty(property);\r
+ int length = input.readUnsignedShort();\r
+ input.skipBytes(PADDING_IN_QUEUE_PROPERTY_HEADER);\r
+ ExperimenterQueuePropertyBuilder expBuilder = new ExperimenterQueuePropertyBuilder();\r
+ expBuilder.setExperimenter(input.readUnsignedInt());\r
+ input.skipBytes(PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY);\r
+ // extract experimenter_data length\r
+ length = length - 2 * ExtConstants.SIZE_OF_SHORT_IN_BYTES - PADDING_IN_QUEUE_PROPERTY_HEADER\r
+ - ExtConstants.SIZE_OF_INT_IN_BYTES - PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY;\r
+ if (length > 0) {\r
+ byte[] data = new byte[length];\r
+ input.readBytes(data);\r
+ expBuilder.setData(data);\r
+ }\r
+ builder.addAugmentation(ExperimenterQueueProperty.class, expBuilder.build());\r
+ return builder.build();\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13TableFeaturesExperimenterDeserializer\r
+ implements OFDeserializer<TableFeatureProperties>{\r
+\r
+ @Override\r
+ public TableFeatureProperties deserialize(ByteBuf input) {\r
+ TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+ TableFeaturesPropType type = TableFeaturesPropType.forValue(input.readUnsignedShort());\r
+ builder.setType(type);\r
+ int length = input.readUnsignedShort();\r
+ ExperimenterRelatedTableFeaturePropertyBuilder expBuilder =\r
+ new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+ expBuilder.setExperimenter(input.readUnsignedInt());\r
+ expBuilder.setExpType(input.readUnsignedInt());\r
+ // extract experimenter_data length\r
+ length = length - 2 * ExtConstants.SIZE_OF_SHORT_IN_BYTES - 2 * ExtConstants.SIZE_OF_INT_IN_BYTES;\r
+ if (length > 0) {\r
+ byte[] data = new byte[length];\r
+ input.readBytes(data);\r
+ expBuilder.setData(data);\r
+ }\r
+ builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());\r
+ return builder.build();\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.EnhancedMessageTypeKey;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class DefaultExperimenterInitializer {\r
+\r
+ /**\r
+ * Registers message serializers into provided registry\r
+ * @param registry registry to be initialized with message serializers\r
+ */\r
+ public static void registerDefaultExperimenterSerializers(SerializerRegistry registry) {\r
+ // register OF v1.0 default experimenter serializers\r
+ short version = ExtConstants.OF10_VERSION_ID;\r
+ // - default vendor (experimenter) message serializer\r
+ registry.registerSerializer(new MessageTypeKey<>(version, ExperimenterInput.class),\r
+ new OF10VendorInputMessageFactory());\r
+ // - default vendor (experimenter) action serializer\r
+ registry.registerSerializer(new EnhancedMessageTypeKey<>(version, Action.class,\r
+ Experimenter.class), new OF10VendorActionSerializer());\r
+ // - default vendor stats (experimenter multipart) serializer\r
+ registry.registerSerializer(new MessageTypeKey<>(version, MultipartRequestExperimenter.class),\r
+ new OF10StatsRequestVendorSerializer());\r
+\r
+ // register OF v1.3 default experimenter serializers\r
+ version = ExtConstants.OF13_VERSION_ID;\r
+ // - default experimenter message serializer\r
+ registry.registerSerializer(new MessageTypeKey<>(version, ExperimenterInput.class),\r
+ new OF13ExperimenterInputMessageFactory());\r
+ // - default experimenter action serializer\r
+ registry.registerSerializer(new EnhancedMessageTypeKey<>(version, Action.class,\r
+ Experimenter.class), new OF13ExperimenterActionSerializer());\r
+ // - default vendor stats (experimenter multipart) serializer\r
+ registry.registerSerializer(new MessageTypeKey<>(version, MultipartRequestExperimenter.class),\r
+ new OF13MultipartExperimenterSerializer());\r
+ // - default experimenter instruction serializer\r
+ registry.registerSerializer(new EnhancedMessageTypeKey<>(version, Instruction.class,\r
+ org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common\r
+ .instruction.rev130731.Experimenter.class), new OF13ExperimenterInstructionSerializer());\r
+ // - default experimenter message serializer\r
+ registry.registerSerializer(new MessageTypeKey<>(version, TableFeatureProperties.class),\r
+ new OF13TableFeatExpSerializer());\r
+ // - default experimenter message serializer\r
+ registry.registerSerializer(new MessageTypeKey<>(version, MeterBandExperimenter.class),\r
+ new OF13MeterBandExperimenterSerializer());\r
+ }\r
+}\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
public class OF10StatsRequestVendorSerializer implements OFSerializer<MultipartRequestExperimenter>{\r
\r
- @Override\r
- public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
- outBuffer.writeInt(input.getExperimenter().intValue());\r
+ @Override\r
+ public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
+ outBuffer.writeInt(input.getExperimenter().intValue());\r
if (input.getData() != null) {\r
- outBuffer.writeBytes(input.getData());\r
+ outBuffer.writeBytes(input.getData());\r
}\r
- }\r
+ }\r
\r
}\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
public class OF10VendorActionSerializer implements OFSerializer<Action> {\r
\r
@Override\r
public void serialize(Action action, ByteBuf outBuffer) {\r
int startIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
+ outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
int lengthIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+ outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
outBuffer.writeInt(experimenter.getExperimenter().intValue());\r
byte[] data = experimenter.getData();\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
\r
/**\r
public class OF10VendorInputMessageFactory implements OFSerializer<ExperimenterInput> {\r
\r
private static final byte MESSAGE_TYPE = 4;\r
- \r
- @Override\r
- public void serialize(ExperimenterInput input, ByteBuf outBuffer) {\r
- ByteBufUtils.writeOFHeader(MESSAGE_TYPE, input, outBuffer, EncodeConstants.EMPTY_LENGTH);\r
+\r
+ @Override\r
+ public void serialize(ExperimenterInput input, ByteBuf outBuffer) {\r
+ ExtBufferUtils.writeOFHeader(MESSAGE_TYPE, input, outBuffer, ExtConstants.EMPTY_LENGTH);\r
outBuffer.writeInt(input.getExperimenter().intValue());\r
byte[] data = input.getData();\r
if (data != null) {\r
outBuffer.writeBytes(data);\r
}\r
- ByteBufUtils.updateOFHeaderLength(outBuffer);\r
- }\r
- \r
+ ExtBufferUtils.updateOFHeaderLength(outBuffer);\r
+ }\r
+\r
}
\ No newline at end of file
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
public class OF13ExperimenterActionSerializer implements OFSerializer<Action>,\r
HeaderSerializer<Action> {\r
\r
@Override\r
public void serialize(Action action, ByteBuf outBuffer) {\r
int actionStartIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
+ outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
int actionLengthIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+ outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
ExperimenterAction expAction = action.getAugmentation(ExperimenterAction.class);\r
outBuffer.writeInt(expAction.getExperimenter().intValue());\r
if (expAction.getData() != null) {\r
\r
@Override\r
public void serializeHeader(Action action, ByteBuf outBuffer) {\r
- outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
- outBuffer.writeShort(EncodeConstants.EXPERIMENTER_IDS_LENGTH);\r
+ outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ outBuffer.writeShort(ExtConstants.EXPERIMENTER_IDS_LENGTH);\r
ExperimenterAction expAction = action.getAugmentation(ExperimenterAction.class);\r
outBuffer.writeInt(expAction.getExperimenter().intValue());\r
}\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
\r
/**\r
\r
/** Code type of Experimenter message */\r
public static final byte MESSAGE_TYPE = 4;\r
- \r
- @Override\r
- public void serialize(ExperimenterInput message, ByteBuf outBuffer) {\r
- ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH);\r
- outBuffer.writeInt(message.getExperimenter().intValue());\r
+\r
+ @Override\r
+ public void serialize(ExperimenterInput message, ByteBuf outBuffer) {\r
+ ExtBufferUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, ExtConstants.EMPTY_LENGTH);\r
+ outBuffer.writeInt(message.getExperimenter().intValue());\r
outBuffer.writeInt(message.getExpType().intValue());\r
byte[] data = message.getData();\r
if (data != null) {\r
outBuffer.writeBytes(data);\r
}\r
- ByteBufUtils.updateOFHeaderLength(outBuffer);\r
- }\r
- \r
+ ExtBufferUtils.updateOFHeaderLength(outBuffer);\r
+ }\r
+\r
}
\ No newline at end of file
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
\r
\r
@Override\r
public void serializeHeader(Instruction instruction, ByteBuf outBuffer) {\r
- outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
- outBuffer.writeShort(EncodeConstants.EXPERIMENTER_IDS_LENGTH);\r
+ outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ outBuffer.writeShort(ExtConstants.EXPERIMENTER_IDS_LENGTH);\r
outBuffer.writeInt(instruction\r
.getAugmentation(ExperimenterInstruction.class).getExperimenter().intValue());\r
}\r
@Override\r
public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
int startIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
+ outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
int lengthIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+ outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
ExperimenterInstruction experimenter =\r
instruction.getAugmentation(ExperimenterInstruction.class);\r
outBuffer.writeInt(experimenter.getExperimenter().intValue());\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
\r
-public class OF13MeterBandExperimenterSerializer\r
- implements OFSerializer<MeterBandExperimenter> {\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MeterBandExperimenterSerializer implements OFSerializer<MeterBandExperimenter> {\r
\r
- @Override\r
- public void serialize(MeterBandExperimenter meterBand, ByteBuf outBuffer) {\r
- int startIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(meterBand.getType().getIntValue());\r
- int lengthIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+ @Override\r
+ public void serialize(MeterBandExperimenter meterBand, ByteBuf outBuffer) {\r
+ int startIndex = outBuffer.writerIndex();\r
+ outBuffer.writeShort(meterBand.getType().getIntValue());\r
+ int lengthIndex = outBuffer.writerIndex();\r
+ outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
outBuffer.writeInt(meterBand.getRate().intValue());\r
outBuffer.writeInt(meterBand.getBurstSize().intValue());\r
outBuffer.writeInt(meterBand.getExperimenter().intValue());\r
if (meterBand.getData() != null) {\r
- outBuffer.writeBytes(meterBand.getData());\r
+ outBuffer.writeBytes(meterBand.getData());\r
}\r
outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);\r
}\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
\r
-public class OF13MultipartExperimenterSerializer \r
- implements OFSerializer<MultipartRequestExperimenter> {\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartExperimenterSerializer implements OFSerializer<MultipartRequestExperimenter> {\r
\r
- @Override\r
- public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
- outBuffer.writeInt(input.getExperimenter().intValue());\r
- outBuffer.writeInt(input.getExpType().intValue());\r
+ @Override\r
+ public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
+ outBuffer.writeInt(input.getExperimenter().intValue());\r
+ outBuffer.writeInt(input.getExpType().intValue());\r
if (input.getData() != null) {\r
- outBuffer.writeBytes(input.getData());\r
+ outBuffer.writeBytes(input.getData());\r
}\r
- }\r
+ }\r
\r
}\r
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
\r
import io.netty.buffer.ByteBuf;\r
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
public class OF13TableFeatExpSerializer implements OFSerializer<TableFeatureProperties> {\r
\r
private static final int EXPERIMENTER_CODE = 65534; // 0xFFFE\r
private static final int EXPERIMENTER_MISS_CODE = 65535; // 0xFFFF\r
\r
- @Override\r
- public void serialize(TableFeatureProperties property, ByteBuf outBuffer) {\r
- int startIndex = outBuffer.writerIndex();\r
- if (property.getType().equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)) {\r
- outBuffer.writeShort(EXPERIMENTER_CODE);\r
- } else {\r
- outBuffer.writeShort(EXPERIMENTER_MISS_CODE);\r
- }\r
- int lengthIndex = outBuffer.writerIndex();\r
- outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+ @Override\r
+ public void serialize(TableFeatureProperties property, ByteBuf outBuffer) {\r
+ int startIndex = outBuffer.writerIndex();\r
+ if (property.getType().equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)) {\r
+ outBuffer.writeShort(EXPERIMENTER_CODE);\r
+ } else {\r
+ outBuffer.writeShort(EXPERIMENTER_MISS_CODE);\r
+ }\r
+ int lengthIndex = outBuffer.writerIndex();\r
+ outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
ExperimenterRelatedTableFeatureProperty exp = property.\r
getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
outBuffer.writeInt(exp.getExperimenter().intValue());\r
if (data != null) {\r
outBuffer.writeBytes(data);\r
}\r
- int paddingRemainder = (outBuffer.writerIndex() - startIndex) % EncodeConstants.PADDING;\r
+ int paddingRemainder = (outBuffer.writerIndex() - startIndex) % ExtConstants.PADDING;\r
if (paddingRemainder != 0) {\r
- int padding = EncodeConstants.PADDING - paddingRemainder;\r
- ByteBufUtils.padBuffer(padding, outBuffer);\r
+ int padding = ExtConstants.PADDING - paddingRemainder;\r
+ ExtBufferUtils.padBuffer(padding, outBuffer);\r
}\r
outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);\r
- }\r
+ }\r
\r
}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.util;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExtBufferUtils {\r
+\r
+ /**\r
+ * Create OF header\r
+ * @param msgType message code\r
+ * @param message POJO\r
+ * @param out writing buffer\r
+ * @param length ofheader length\r
+ */\r
+ public static <E extends OfHeader> void writeOFHeader(byte msgType, E message, ByteBuf out, int length) { \r
+ out.writeByte(message.getVersion());\r
+ out.writeByte(msgType);\r
+ out.writeShort(length);\r
+ out.writeInt(message.getXid().intValue());\r
+ }\r
+\r
+ /**\r
+ * Write length standard OF header\r
+ * @param out writing buffer\r
+ */\r
+ public static void updateOFHeaderLength(ByteBuf out) { \r
+ out.setShort(ExtConstants.OFHEADER_LENGTH_INDEX, out.readableBytes());\r
+ }\r
+\r
+ /**\r
+ * Fills specified ByteBuf with 0 (zeros) of desired length, used for padding\r
+ * @param length\r
+ * @param out ByteBuf to be padded\r
+ */\r
+ public static void padBuffer(int length, ByteBuf out) {\r
+ for (int i = 0; i < length; i++) {\r
+ out.writeByte(0);\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.util;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExtConstants {\r
+\r
+ /** Default OF padding (in bytes) */\r
+ public static final byte PADDING = 8;\r
+ /** OpenFlow v1.0 wire protocol number */\r
+ public static final byte OF10_VERSION_ID = 0x01;\r
+ /** OpenFlow v1.0 wire protocol number */\r
+ public static final byte OF13_VERSION_ID = 0x04;\r
+ /** Index of length in Openflow header */\r
+ public static final int OFHEADER_LENGTH_INDEX = 2;\r
+ /** Zero length - used when the length is updated later */\r
+ public static final int EMPTY_LENGTH = 0;\r
+\r
+ /** Length of long in bytes */\r
+ public static final byte SIZE_OF_LONG_IN_BYTES = Long.SIZE / Byte.SIZE;\r
+ /** Length of int in bytes */\r
+ public static final byte SIZE_OF_INT_IN_BYTES = Integer.SIZE / Byte.SIZE;\r
+ /** Length of short in bytes */\r
+ public static final byte SIZE_OF_SHORT_IN_BYTES = Short.SIZE / Byte.SIZE;\r
+ /** Length of byte in bytes */\r
+ public static final byte SIZE_OF_BYTE_IN_BYTES = Byte.SIZE / Byte.SIZE;\r
+ /** Length of 3 bytes */\r
+ public static final byte SIZE_OF_3_BYTES = 3;\r
+\r
+ /** Common experimenter value */\r
+ public static final int EXPERIMENTER_VALUE = 0xFFFF;\r
+ /** OF v1.3 lenght of experimenter_ids - see Multipart TableFeatures (properties) message */\r
+ public static final byte EXPERIMENTER_IDS_LENGTH = 8;\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">\r
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">\r
+\r
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">\r
+ <layout class="org.apache.log4j.PatternLayout">\r
+ <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />\r
+ </layout>\r
+ </appender>\r
+\r
+ <logger name="org.opendaylight.openflowjava.protocol.ext" additivity="false">\r
+ <level value="DEBUG" />\r
+ <appender-ref ref="console" />\r
+ </logger>\r
+\r
+ <root>\r
+ <priority value="INFO" />\r
+ <appender-ref ref="console" />\r
+ </root>\r
+</log4j:configuration>\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10StatsReplyVendorDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF10StatsReplyVendorDeserializer} for correct translation into POJO\r
+ * @throws Exception\r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(42);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 3, 2, 1, 0};\r
+ buffer.writeBytes(data);\r
+\r
+ OF10StatsReplyVendorDeserializer deserializer =\r
+ new OF10StatsReplyVendorDeserializer();\r
+ MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 42, message.getExperimenter().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF10StatsReplyVendorDeserializer} for correct translation into POJO\r
+ * @throws Exception\r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(42);\r
+\r
+ OF10StatsReplyVendorDeserializer deserializer =\r
+ new OF10StatsReplyVendorDeserializer();\r
+ MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 42, message.getExperimenter().intValue());\r
+ Assert.assertNull("Unexpected data", message.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorActionDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(16);\r
+ buffer.writeInt(42);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+ buffer.writeBytes(data);\r
+\r
+ OF10VendorActionDeserializer deserializer =\r
+ new OF10VendorActionDeserializer();\r
+ Action action = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+\r
+ OF10VendorActionDeserializer deserializer =\r
+ new OF10VendorActionDeserializer();\r
+ Action action = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeader() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+\r
+ OF10VendorActionDeserializer deserializer =\r
+ new OF10VendorActionDeserializer();\r
+ Action action = deserializer.deserializeHeader(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeaderWithData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+ buffer.writeBytes(data);\r
+\r
+ OF10VendorActionDeserializer deserializer =\r
+ new OF10VendorActionDeserializer();\r
+ Action action = deserializer.deserializeHeader(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorMessageDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF10VendorMessageDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(12345);\r
+ buffer.writeInt(98765);\r
+ byte[] data = new byte[]{5, 6, 7, 8};\r
+ buffer.writeBytes(data);\r
+\r
+ OF10VendorMessageDeserializer deserializer =\r
+ new OF10VendorMessageDeserializer();\r
+ ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong version", 1, message.getVersion().shortValue());\r
+ Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+ Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF10VendorMessageDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(12345);\r
+ buffer.writeInt(98765);\r
+\r
+ OF10VendorMessageDeserializer deserializer =\r
+ new OF10VendorMessageDeserializer();\r
+ ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong version", 1, message.getVersion().shortValue());\r
+ Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+ Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+ Assert.assertNull("Unexpected data", message.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterActionDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(16);\r
+ buffer.writeInt(42);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13ExperimenterActionDeserializer deserializer =\r
+ new OF13ExperimenterActionDeserializer();\r
+ Action action = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+\r
+ OF13ExperimenterActionDeserializer deserializer =\r
+ new OF13ExperimenterActionDeserializer();\r
+ Action action = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeader() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+\r
+ OF13ExperimenterActionDeserializer deserializer =\r
+ new OF13ExperimenterActionDeserializer();\r
+ Action action = deserializer.deserializeHeader(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeaderWithData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13ExperimenterActionDeserializer deserializer =\r
+ new OF13ExperimenterActionDeserializer();\r
+ Action action = deserializer.deserializeHeader(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+ ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterError;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterErrorMessageDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterErrorMessageDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(35000);\r
+ buffer.writeInt(70000);\r
+ byte[] data = new byte[]{5, 5, 5, 6, 7, 8, 9, 10};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13ExperimenterErrorMessageDeserializer deserializer =\r
+ new OF13ExperimenterErrorMessageDeserializer();\r
+ ExperimenterError message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong exp-type", 35000, message.getExpType().intValue());\r
+ Assert.assertEquals("Wrong experimenter", 70000, message.getExperimenter().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterErrorMessageDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(35000);\r
+ buffer.writeInt(70000);\r
+\r
+ OF13ExperimenterErrorMessageDeserializer deserializer =\r
+ new OF13ExperimenterErrorMessageDeserializer();\r
+ ExperimenterError message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong exp-type", 35000, message.getExpType().intValue());\r
+ Assert.assertEquals("Wrong experimenter", 70000, message.getExperimenter().intValue());\r
+ Assert.assertNull("Unexpected data", message.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterInstructionDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13ExperimenterInstructionDeserializer deserializer =\r
+ new OF13ExperimenterInstructionDeserializer();\r
+ Instruction instruction = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+ ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+\r
+ OF13ExperimenterInstructionDeserializer deserializer =\r
+ new OF13ExperimenterInstructionDeserializer();\r
+ Instruction instruction = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+ ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeader() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+\r
+ OF13ExperimenterInstructionDeserializer deserializer =\r
+ new OF13ExperimenterInstructionDeserializer();\r
+ Instruction instruction = deserializer.deserializeHeader(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+ ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeaderWithData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(8);\r
+ buffer.writeInt(42);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13ExperimenterInstructionDeserializer deserializer =\r
+ new OF13ExperimenterInstructionDeserializer();\r
+ Instruction instruction = deserializer.deserializeHeader(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+ ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+ Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+ Assert.assertNull("Data not null", experimenter.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterMessageDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterMessageDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(12345);\r
+ buffer.writeInt(98765);\r
+ buffer.writeInt(89123);\r
+ byte[] data = new byte[]{5, 6, 7, 8};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13ExperimenterMessageDeserializer deserializer =\r
+ new OF13ExperimenterMessageDeserializer();\r
+ ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong version", 4, message.getVersion().shortValue());\r
+ Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+ Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 89123, message.getExpType().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterMessageDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(12345);\r
+ buffer.writeInt(98765);\r
+ buffer.writeInt(89123);\r
+\r
+ OF13ExperimenterMessageDeserializer deserializer =\r
+ new OF13ExperimenterMessageDeserializer();\r
+ ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong version", 4, message.getVersion().shortValue());\r
+ Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+ Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 89123, message.getExpType().intValue());\r
+ Assert.assertNull("Unexpected data", message.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartReplyExperimenterDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13MultipartReplyExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(456654);\r
+ buffer.writeInt(888222);\r
+ byte[] data = new byte[]{0, 0, 1, 1, 2, 2, 3, 3};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13MultipartReplyExperimenterDeserializer deserializer =\r
+ new OF13MultipartReplyExperimenterDeserializer();\r
+ MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 456654, message.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 888222, message.getExpType().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13MultipartReplyExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeInt(456654);\r
+ buffer.writeInt(888222);\r
+\r
+ OF13MultipartReplyExperimenterDeserializer deserializer =\r
+ new OF13MultipartReplyExperimenterDeserializer();\r
+ MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 456654, message.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 888222, message.getExpType().intValue());\r
+ Assert.assertNull("Unexpected data", message.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13QueueGetConfigReplyExperimenterDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13QueueGetConfigReplyExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(24);\r
+ ExtBufferUtils.padBuffer(4, buffer);\r
+ buffer.writeInt(128);\r
+ ExtBufferUtils.padBuffer(4, buffer);\r
+ byte[] data = new byte[]{0, 0, 1, 1, 2, 2, 3, 3};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13QueueGetConfigReplyExperimenterDeserializer deserializer =\r
+ new OF13QueueGetConfigReplyExperimenterDeserializer();\r
+ QueueProperty message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong property", QueueProperties.OFPQTEXPERIMENTER, message.getProperty());\r
+ ExperimenterQueueProperty exp = message.getAugmentation(ExperimenterQueueProperty.class);\r
+ Assert.assertEquals("Wrong experimenter", 128, exp.getExperimenter().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, exp.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13QueueGetConfigReplyExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+ buffer.writeShort(16);\r
+ ExtBufferUtils.padBuffer(4, buffer);\r
+ buffer.writeInt(128);\r
+ ExtBufferUtils.padBuffer(4, buffer);\r
+\r
+ OF13QueueGetConfigReplyExperimenterDeserializer deserializer =\r
+ new OF13QueueGetConfigReplyExperimenterDeserializer();\r
+ QueueProperty message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong property", QueueProperties.OFPQTEXPERIMENTER, message.getProperty());\r
+ ExperimenterQueueProperty exp = message.getAugmentation(ExperimenterQueueProperty.class);\r
+ Assert.assertEquals("Wrong experimenter", 128, exp.getExperimenter().intValue());\r
+ Assert.assertNull("Unexpected data", exp.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13TableFeaturesExperimenterDeserializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenter() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(65534);\r
+ buffer.writeShort(16);\r
+ buffer.writeInt(256);\r
+ buffer.writeInt(546);\r
+ byte[] data = new byte[]{1, 2, 3, 4};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13TableFeaturesExperimenterDeserializer deserializer =\r
+ new OF13TableFeaturesExperimenterDeserializer();\r
+ TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTER, message.getType());\r
+ ExperimenterRelatedTableFeatureProperty property =\r
+ message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+ Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, property.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenterWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(65534);\r
+ buffer.writeShort(12);\r
+ buffer.writeInt(256);\r
+ buffer.writeInt(546);\r
+\r
+ OF13TableFeaturesExperimenterDeserializer deserializer =\r
+ new OF13TableFeaturesExperimenterDeserializer();\r
+ TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTER, message.getType());\r
+ ExperimenterRelatedTableFeatureProperty property =\r
+ message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+ Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+ Assert.assertNull("Unexpected data", property.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenterMiss() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(65535);\r
+ buffer.writeShort(16);\r
+ buffer.writeInt(256);\r
+ buffer.writeInt(546);\r
+ byte[] data = new byte[]{1, 2, 3, 4};\r
+ buffer.writeBytes(data);\r
+\r
+ OF13TableFeaturesExperimenterDeserializer deserializer =\r
+ new OF13TableFeaturesExperimenterDeserializer();\r
+ TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS, message.getType());\r
+ ExperimenterRelatedTableFeatureProperty property =\r
+ message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+ Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+ Assert.assertArrayEquals("Wrong data", data, property.getData());\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenterMissWithoutData() {\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ buffer.writeShort(65535);\r
+ buffer.writeShort(12);\r
+ buffer.writeInt(256);\r
+ buffer.writeInt(546);\r
+\r
+ OF13TableFeaturesExperimenterDeserializer deserializer =\r
+ new OF13TableFeaturesExperimenterDeserializer();\r
+ TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+ Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS, message.getType());\r
+ ExperimenterRelatedTableFeatureProperty property =\r
+ message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+ Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+ Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+ Assert.assertNull("Unexpected data", property.getData());\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10StatsRequestVendorSerializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+ expBuilder.setExperimenter(42L);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};\r
+ expBuilder.setData(data);\r
+ MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10StatsRequestVendorSerializer serializer = new OF10StatsRequestVendorSerializer();\r
+ serializer.serialize(message, buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+ byte[] expData = new byte[8];\r
+ buffer.readBytes(expData);\r
+ Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+ expBuilder.setExperimenter(42L);\r
+ MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10StatsRequestVendorSerializer serializer = new OF10StatsRequestVendorSerializer();\r
+ serializer.serialize(message, buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorActionSerializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF10VendorActionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testVendorActionWithData() {\r
+ ActionBuilder actionBuilder = new ActionBuilder();\r
+ actionBuilder.setType(Experimenter.class);\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(82L);\r
+ byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
+ expBuilder.setData(expData);\r
+ actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ Action action = actionBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10VendorActionSerializer serializer = new OF10VendorActionSerializer();\r
+ serializer.serialize(action, buffer);\r
+ \r
+ Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong action length", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 82, buffer.readUnsignedInt());\r
+ byte[] tmp = new byte[8];\r
+ buffer.readBytes(tmp);\r
+ Assert.assertArrayEquals("Wrong data", expData, tmp);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF10VendorActionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testVendorActionWithoutData() {\r
+ ActionBuilder actionBuilder = new ActionBuilder();\r
+ actionBuilder.setType(Experimenter.class);\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(102L);\r
+ actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ Action action = actionBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10VendorActionSerializer serializer = new OF10VendorActionSerializer();\r
+ serializer.serialize(action, buffer);\r
+\r
+ Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 102, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorInputMessageFactoryTest {\r
+\r
+ /**\r
+ * Testing of {@link OF10VendorInputMessageFactory} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() throws Exception {\r
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+ builder.setVersion((short) 1);\r
+ builder.setXid(1024L);\r
+ builder.setExperimenter(0x0001020304L);\r
+ byte[] data = new byte[]{5, 6, 7, 8};\r
+ builder.setData(data);\r
+ ExperimenterInput message = builder.build();\r
+ \r
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+ vendorFactory.serialize(message, out);\r
+ \r
+ Assert.assertEquals("Wrong version", 1, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong length", 16, out.readUnsignedShort());\r
+ Assert.assertEquals("Wrong xid", 1024, out.readUnsignedInt());\r
+ Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+ byte[] expData = new byte[4];\r
+ out.readBytes(expData);\r
+ Assert.assertArrayEquals("Wrong data", data, expData);\r
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF10VendorInputMessageFactory} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() throws Exception {\r
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+ builder.setVersion((short) 1);\r
+ builder.setXid(1024L);\r
+ builder.setExperimenter(0x0001020304L);\r
+ ExperimenterInput message = builder.build();\r
+ \r
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+ vendorFactory.serialize(message, out);\r
+ \r
+ Assert.assertEquals("Wrong version", 1, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong length", 12, out.readUnsignedShort());\r
+ Assert.assertEquals("Wrong xid", 1024, out.readUnsignedInt());\r
+ Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterActionSerializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testVendorActionWithData() {\r
+ ActionBuilder actionBuilder = new ActionBuilder();\r
+ actionBuilder.setType(Experimenter.class);\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(82L);\r
+ byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
+ expBuilder.setData(expData);\r
+ actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ Action action = actionBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+ serializer.serialize(action, buffer);\r
+ \r
+ Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong action length", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 82, buffer.readUnsignedInt());\r
+ byte[] tmp = new byte[8];\r
+ buffer.readBytes(tmp);\r
+ Assert.assertArrayEquals("Wrong data", expData, tmp);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testVendorActionWithoutData() {\r
+ ActionBuilder actionBuilder = new ActionBuilder();\r
+ actionBuilder.setType(Experimenter.class);\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(102L);\r
+ actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ Action action = actionBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+ serializer.serialize(action, buffer);\r
+\r
+ Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 102, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeaderWithData() {\r
+ ActionBuilder actionBuilder = new ActionBuilder();\r
+ actionBuilder.setType(Experimenter.class);\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(82L);\r
+ byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
+ expBuilder.setData(expData);\r
+ actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ Action action = actionBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+ serializer.serializeHeader(action, buffer);\r
+ \r
+ Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 82, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeaderWithoutData() {\r
+ ActionBuilder actionBuilder = new ActionBuilder();\r
+ actionBuilder.setType(Experimenter.class);\r
+ ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+ expBuilder.setExperimenter(102L);\r
+ actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+ Action action = actionBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+ serializer.serializeHeader(action, buffer);\r
+\r
+ Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 102, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterInputMessageFactoryTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInputMessageFactory} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() throws Exception {\r
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+ builder.setVersion((short) 4);\r
+ builder.setXid(888L);\r
+ builder.setExperimenter(0x0001020304L);\r
+ byte[] data = new byte[]{5, 6, 7, 8};\r
+ builder.setData(data);\r
+ ExperimenterInput message = builder.build();\r
+ \r
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+ vendorFactory.serialize(message, out);\r
+ \r
+ Assert.assertEquals("Wrong version", 4, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong length", 16, out.readUnsignedShort());\r
+ Assert.assertEquals("Wrong xid", 888, out.readUnsignedInt());\r
+ Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+ byte[] expData = new byte[4];\r
+ out.readBytes(expData);\r
+ Assert.assertArrayEquals("Wrong data", data, expData);\r
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInputMessageFactory} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() throws Exception {\r
+ ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+ builder.setVersion((short) 4);\r
+ builder.setXid(888L);\r
+ builder.setExperimenter(0x0001020304L);\r
+ ExperimenterInput message = builder.build();\r
+ \r
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+ vendorFactory.serialize(message, out);\r
+ \r
+ Assert.assertEquals("Wrong version", 4, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+ Assert.assertEquals("Wrong length", 12, out.readUnsignedShort());\r
+ Assert.assertEquals("Wrong xid", 888, out.readUnsignedInt());\r
+ Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstructionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterInstructionSerializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ InstructionBuilder builder = new InstructionBuilder();\r
+ builder.setType(Experimenter.class);\r
+ ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+ expBuilder.setExperimenter(142L);\r
+ byte[] data = new byte[]{1, 2, 3, 4, 5, 6, 7, 8};\r
+ expBuilder.setData(data);\r
+ builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+ Instruction instruction = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+ serializer.serialize(instruction, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+ byte[] expData = new byte[8];\r
+ buffer.readBytes(expData);\r
+ Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ InstructionBuilder builder = new InstructionBuilder();\r
+ builder.setType(Experimenter.class);\r
+ ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+ expBuilder.setExperimenter(142L);\r
+ builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+ Instruction instruction = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+ serializer.serialize(instruction, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 8, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeader() {\r
+ InstructionBuilder builder = new InstructionBuilder();\r
+ builder.setType(Experimenter.class);\r
+ ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+ expBuilder.setExperimenter(142L);\r
+ byte[] data = new byte[]{1, 2, 3, 4, 5, 6, 7, 8};\r
+ expBuilder.setData(data);\r
+ builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+ Instruction instruction = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+ serializer.serializeHeader(instruction, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 8, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testHeaderWithoutData() {\r
+ InstructionBuilder builder = new InstructionBuilder();\r
+ builder.setType(Experimenter.class);\r
+ ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+ expBuilder.setExperimenter(142L);\r
+ builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+ Instruction instruction = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+ serializer.serializeHeader(instruction, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 8, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MeterBandExperimenterSerializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13MeterBandExperimenterSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ MeterBandExperimenterBuilder builder = new MeterBandExperimenterBuilder();\r
+ builder.setType(MeterBandType.OFPMBTEXPERIMENTER);\r
+ builder.setRate(128L);\r
+ builder.setBurstSize(256L);\r
+ builder.setExperimenter(512L);\r
+ MeterBandExperimenter band = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13MeterBandExperimenterSerializer serializer = new OF13MeterBandExperimenterSerializer();\r
+ serializer.serialize(band, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong type", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong type", 128, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong type", 256, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong type", 512, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartExperimenterSerializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void test() {\r
+ MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+ expBuilder.setExperimenter(42L);\r
+ expBuilder.setExpType(84L);\r
+ byte[] data = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};\r
+ expBuilder.setData(data);\r
+ MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13MultipartExperimenterSerializer serializer = new OF13MultipartExperimenterSerializer();\r
+ serializer.serialize(message, buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong exp-type", 84, buffer.readUnsignedInt());\r
+ byte[] expData = new byte[8];\r
+ buffer.readBytes(expData);\r
+ Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testWithoutData() {\r
+ MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+ expBuilder.setExperimenter(42L);\r
+ expBuilder.setExpType(84L);\r
+ MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13MultipartExperimenterSerializer serializer = new OF13MultipartExperimenterSerializer();\r
+ serializer.serialize(message, buffer);\r
+\r
+ Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong exp-type", 84, buffer.readUnsignedInt());\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13TableFeatExpSerializerTest {\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenter() {\r
+ TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+ builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
+ ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+ new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+ propBuilder.setExperimenter(891L);\r
+ propBuilder.setExpType(6546L);\r
+ byte[] data = new byte[]{0, 1, 2, 3};\r
+ propBuilder.setData(data);\r
+ builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+ propBuilder.build());\r
+ TableFeatureProperties property = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+ serializer.serialize(property, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65534, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 891, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong exp-type", 6546, buffer.readUnsignedInt());\r
+ byte[] expData = new byte[4];\r
+ buffer.readBytes(expData);\r
+ Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenterWithoutData() {\r
+ TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+ builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
+ ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+ new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+ propBuilder.setExperimenter(891L);\r
+ propBuilder.setExpType(6546L);\r
+ builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+ propBuilder.build());\r
+ TableFeatureProperties property = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+ serializer.serialize(property, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65534, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 891, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong exp-type", 6546, buffer.readUnsignedInt());\r
+ buffer.skipBytes(4);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenterMiss() {\r
+ TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+ builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
+ ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+ new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+ propBuilder.setExperimenter(8L);\r
+ propBuilder.setExpType(6L);\r
+ byte[] data = new byte[]{4, 5, 6, 7};\r
+ propBuilder.setData(data);\r
+ builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+ propBuilder.build());\r
+ TableFeatureProperties property = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+ serializer.serialize(property, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 8, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong exp-type", 6, buffer.readUnsignedInt());\r
+ byte[] expData = new byte[4];\r
+ buffer.readBytes(expData);\r
+ Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+\r
+ /**\r
+ * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+ * @throws Exception \r
+ */\r
+ @Test\r
+ public void testExperimenterMissWithoutData() {\r
+ TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+ builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
+ ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+ new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+ propBuilder.setExperimenter(8L);\r
+ propBuilder.setExpType(6L);\r
+ builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+ propBuilder.build());\r
+ TableFeatureProperties property = builder.build();\r
+\r
+ ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+ OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+ serializer.serialize(property, buffer);\r
+\r
+ Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+ Assert.assertEquals("Wrong experimenter", 8, buffer.readUnsignedInt());\r
+ Assert.assertEquals("Wrong exp-type", 6, buffer.readUnsignedInt());\r
+ buffer.skipBytes(4);\r
+ Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+ }\r
+}\r
ActionDeserializerInitializer.registerDeserializers(this);
// register instruction deserializers
InstructionDeserializerInitializer.registerDeserializers(this);
- // register default experimenter deserializers
- DefaultExperimenterDeserializerInitializer.registerDeserializers(this);
}
@Override
import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterError;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterErrorBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.BadActionCode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.BadInstructionCode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.BadMatchCode;
* @author michal.polkorab
* @author timotej.kubas
*/
-public class ErrorMessageFactory implements OFDeserializer<ErrorMessage> {
+public class ErrorMessageFactory implements OFDeserializer<ErrorMessage>,
+ DeserializerRegistryInjector {
private static final String UNKNOWN_CODE = "UNKNOWN_CODE";
private static final String UNKNOWN_TYPE = "UNKNOWN_TYPE";
+ private DeserializerRegistry registry;
@Override
public ErrorMessage deserialize(ByteBuf rawMessage) {
builder.setXid(rawMessage.readUnsignedInt());
int type = rawMessage.readUnsignedShort();
ErrorType errorType = ErrorType.forValue(type);
- decodeType(builder, errorType, type);
- decodeCode(rawMessage, builder, errorType);
- if (rawMessage.readableBytes() > 0) {
- builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array());
+ if (ErrorType.EXPERIMENTER.equals(errorType)) {
+ builder.setType(errorType.getIntValue());
+ OFDeserializer<ExperimenterError> deserializer = registry.getDeserializer(new MessageCodeKey(
+ EncodeConstants.OF13_VERSION_ID, EncodeConstants.EXPERIMENTER_VALUE, ErrorMessage.class));
+ ExperimenterError error = deserializer.deserialize(rawMessage);
+ builder.addAugmentation(ExperimenterError.class, error);
+ } else {
+ decodeType(builder, errorType, type);
+ decodeCode(rawMessage, builder, errorType);
+ if (rawMessage.readableBytes() > 0) {
+ builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array());
+ }
}
return builder.build();
}
}
break;
}
- case EXPERIMENTER:
- ExperimenterErrorBuilder expBuilder = new ExperimenterErrorBuilder();
- expBuilder.setExpType(code);
- expBuilder.setExperimenter(rawMessage.readUnsignedInt());
- builder.addAugmentation(ExperimenterError.class, expBuilder.build());
- break;
default:
setUnknownCode(builder, code);
break;
builder.setCodeString(codeString);
}
+ @Override
+ public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+ this.registry = deserializerRegistry;
+ }
+
}
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
builder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)
|| type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS)) {
- ExperimenterRelatedTableFeaturePropertyBuilder expBuilder = new ExperimenterRelatedTableFeaturePropertyBuilder();
- expBuilder.setExperimenter(input.readUnsignedInt());
- expBuilder.setExpType(input.readUnsignedInt());
- OFDeserializer<ExperimenterRelatedTableFeatureProperty> propDeserializer = registry.getDeserializer(
+ // return index to property start, so that the experimenter properties are deserialized
+ // correctly - as whole ofp_table_feature_prop_experimenter property
+ input.readerIndex(input.readerIndex() - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ OFDeserializer<TableFeatureProperties> propDeserializer = registry.getDeserializer(
new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,
- type.getIntValue(), ExperimenterRelatedTableFeatureProperty.class));
- ExperimenterRelatedTableFeatureProperty expProp = propDeserializer.deserialize(input);
- builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expProp);
+ type.getIntValue(), TableFeatureProperties.class));
+ TableFeatureProperties expProp = propDeserializer.deserialize(input);
+ properties.add(expProp);
+ continue;
}
if (paddingRemainder != 0) {
input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueuePropertyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.RateQueueProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.RateQueuePropertyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
* @author timotej.kubas
* @author michal.polkorab
*/
-public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueueConfigOutput> {
+public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueueConfigOutput>,
+ DeserializerRegistryInjector {
private static final byte PADDING_IN_QUEUE_GET_CONFIG_REPLY_HEADER = 4;
private static final byte PADDING_IN_PACKET_QUEUE_HEADER = 6;
private static final byte PADDING_IN_QUEUE_PROPERTY_HEADER = 4;
private static final int PADDING_IN_RATE_QUEUE_PROPERTY = 6;
- private static final int PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY = 4;
private static final byte PACKET_QUEUE_LENGTH = 16;
+ private static final byte QUEUE_PROP_HEADER_SIZE = 8;
+ private DeserializerRegistry registry;
@Override
public GetQueueConfigOutput deserialize(ByteBuf rawMessage) {
return builder.build();
}
- private static List<Queues> createQueuesList(ByteBuf input){
+ private List<Queues> createQueuesList(ByteBuf input){
List<Queues> queuesList = new ArrayList<>();
while (input.readableBytes() > 0) {
QueuesBuilder queueBuilder = new QueuesBuilder();
return queuesList;
}
- private static List<QueueProperty> createPropertiesList(ByteBuf input, int length){
+ private List<QueueProperty> createPropertiesList(ByteBuf input, int length){
int propertiesLength = length;
List<QueueProperty> propertiesList = new ArrayList<>();
while (propertiesLength > 0) {
propertiesBuilder.addAugmentation(RateQueueProperty.class, rateBuilder.build());
input.skipBytes(PADDING_IN_RATE_QUEUE_PROPERTY);
} else if (property.equals(QueueProperties.OFPQTEXPERIMENTER)) {
- ExperimenterQueuePropertyBuilder expBuilder = new ExperimenterQueuePropertyBuilder();
- expBuilder.setExperimenter(input.readUnsignedInt());
- input.skipBytes(PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY);
- expBuilder.setData(input.readBytes(currentPropertyLength
- - EncodeConstants.SIZE_OF_INT_IN_BYTES - PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY).array());
- propertiesBuilder.addAugmentation(RateQueueProperty.class, expBuilder.build());
+ // return index to property start, so that the experimenter properties are deserialized
+ // correctly - as whole ofp_queue_prop_experimenter property
+ input.readerIndex(input.readerIndex() - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES
+ - PADDING_IN_QUEUE_PROPERTY_HEADER);
+ OFDeserializer<QueueProperty> deserializer = registry.getDeserializer(
+ new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,
+ EncodeConstants.EXPERIMENTER_VALUE, QueueProperty.class));
+ QueueProperty expProp = deserializer.deserialize(input.slice(input.readerIndex(),
+ currentPropertyLength - QUEUE_PROP_HEADER_SIZE));
+ propertiesList.add(expProp);
+ continue;
}
propertiesList.add(propertiesBuilder.build());
}
return propertiesList;
}
+ @Override
+ public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+ this.registry = deserializerRegistry;
+ }
+
}
+++ /dev/null
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF10StatsRequestVendorSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF10VendorInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13ExperimenterActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13ExperimenterInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13ExperimenterInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13MeterBandExperimenterSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13MultipartExperimenterSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13TableFeatExpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CommonMessageRegistryHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.EnhancedKeyRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class DefaultExperimenterInitializer {\r
-\r
- /**\r
- * Registers message serializers into provided registry\r
- * @param serializerRegistry registry to be initialized with message serializers\r
- */\r
- public static void registerDefaultExperimenterSerializers(SerializerRegistry serializerRegistry) {\r
- // register OF v1.0 default experimenter serializers\r
- short version = EncodeConstants.OF10_VERSION_ID;\r
- CommonMessageRegistryHelper helper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
- helper.registerSerializer(ExperimenterInput.class, new OF10VendorInputMessageFactory());\r
- EnhancedKeyRegistryHelper<Action> actionHelper = new EnhancedKeyRegistryHelper<>(\r
- EncodeConstants.OF10_VERSION_ID, Action.class, serializerRegistry);\r
- actionHelper.registerSerializer(Experimenter.class, new OF13ExperimenterActionSerializer());\r
- helper.registerSerializer(MultipartRequestExperimenter.class, new OF10StatsRequestVendorSerializer());\r
- // register OF v1.3 default experimenter serializers\r
- version = EncodeConstants.OF13_VERSION_ID;\r
- helper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
- helper.registerSerializer(ExperimenterInput.class, new OF13ExperimenterInputMessageFactory());\r
- helper.registerSerializer(MultipartRequestExperimenter.class, new OF13MultipartExperimenterSerializer());\r
- helper.registerSerializer(TableFeatureProperties.class, new OF13TableFeatExpSerializer());\r
- helper.registerSerializer(MeterBandExperimenter.class, new OF13MeterBandExperimenterSerializer());\r
- actionHelper = new EnhancedKeyRegistryHelper<>(\r
- EncodeConstants.OF13_VERSION_ID, Action.class, serializerRegistry);\r
- actionHelper.registerSerializer(Experimenter.class, new OF13ExperimenterActionSerializer());\r
- EnhancedKeyRegistryHelper<Instruction> insHelper = new EnhancedKeyRegistryHelper<>(\r
- EncodeConstants.OF13_VERSION_ID, Instruction.class, serializerRegistry);\r
- insHelper.registerSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight\r
- .openflow.common.instruction.rev130731.Experimenter.class,\r
- new OF13ExperimenterInstructionSerializer());\r
- }\r
-}\r
ActionsInitializer.registerActionSerializers(this);
// instruction serializers
InstructionsInitializer.registerInstructionSerializers(this);
- // default vendor / experimenter serializers
- DefaultExperimenterInitializer.registerDefaultExperimenterSerializers(this);
}
/**
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.drop._case.MeterBandDropBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.Bands;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.BandsBuilder;
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
meterModFactory.serialize(message, out);
- BufferHelper.checkHeaderV13(out, (byte) 29, 64);
+ BufferHelper.checkHeaderV13(out, (byte) 29, 48);
Assert.assertEquals("Wrong meterModCommand", message.getCommand().getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong meterFlags", message.getFlags(), decodeMeterModFlags(out.readShort()));
Assert.assertEquals("Wrong meterId", message.getMeterId().getValue().intValue(), out.readUnsignedInt());
dscpRemarkBand.setPrecLevel((short) 3);
dscpCaseBuilder.setMeterBandDscpRemark(dscpRemarkBand.build());
bandsList.add(bandsBuilder.setMeterBand(dscpCaseBuilder.build()).build());
- MeterBandExperimenterCaseBuilder expCaseBuilder = new MeterBandExperimenterCaseBuilder();
- MeterBandExperimenterBuilder experimenterBand = new MeterBandExperimenterBuilder();
- experimenterBand.setType(MeterBandType.OFPMBTEXPERIMENTER);
- experimenterBand.setRate(1L);
- experimenterBand.setBurstSize(2L);
- experimenterBand.setExperimenter(4L);
- expCaseBuilder.setMeterBandExperimenter(experimenterBand.build());
- bandsList.add(bandsBuilder.setMeterBand(expCaseBuilder.build()).build());
return bandsList;
}
input.skipBytes(3);
dscpCaseBuilder.setMeterBandDscpRemark(dscpRemarkBand.build());
bandsList.add(bandsBuilder.setMeterBand(dscpCaseBuilder.build()).build());
- MeterBandExperimenterCaseBuilder expCaseBuilder = new MeterBandExperimenterCaseBuilder();
- MeterBandExperimenterBuilder experimenterBand = new MeterBandExperimenterBuilder();
- experimenterBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
- input.skipBytes(Short.SIZE/Byte.SIZE);
- experimenterBand.setRate(input.readUnsignedInt());
- experimenterBand.setBurstSize(input.readUnsignedInt());
- experimenterBand.setExperimenter(input.readUnsignedInt());
- expCaseBuilder.setMeterBandExperimenter(experimenterBand.build());
- bandsList.add(bandsBuilder.setMeterBand(expCaseBuilder.build()).build());
return bandsList;
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
return caseBuilder.build();
}
- /**
- * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization
- * @throws Exception
- */
- @Test
- public void testExperimenter() throws Exception {
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
- builder.setType(MultipartType.OFPMPEXPERIMENTER);
- builder.setFlags(new MultipartRequestFlags(false));
- MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
- MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
- expBuilder.setExperimenter(56L);
- expBuilder.setExpType(148L);
- byte[] expData = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};
- expBuilder.setData(expData);
- caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
- builder.setMultipartRequestBody(caseBuilder.build());
- MultipartRequestInput message = builder.build();
-
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
- multipartFactory.serialize(message, out);
-
- BufferHelper.checkHeaderV10(out, (byte) 18, 32);
- Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
- Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());
- Assert.assertEquals("Wrong exp-type", 148, out.readUnsignedInt());
- byte[] temp = new byte[8];
- out.readBytes(temp);
- Assert.assertArrayEquals("Wrong data", expData, temp);
- Assert.assertTrue("Unread data", out.readableBytes() == 0);
- }
-
- /**
- * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization
- * @throws Exception
- */
- @Test
- public void testExperimenterWithoutData() throws Exception {
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
- builder.setType(MultipartType.OFPMPEXPERIMENTER);
- builder.setFlags(new MultipartRequestFlags(false));
- MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
- MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
- expBuilder.setExperimenter(56L);
- expBuilder.setExpType(152L);
- caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
- builder.setMultipartRequestBody(caseBuilder.build());
- MultipartRequestInput message = builder.build();
-
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
- multipartFactory.serialize(message, out);
-
- BufferHelper.checkHeaderV10(out, (byte) 18, 24);
- Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
- Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());
- Assert.assertEquals("Wrong exp-type", 152, out.readUnsignedInt());
- Assert.assertTrue("Unread data", out.readableBytes() == 0);
- }
-
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;\r
Assert.assertEquals("Wrong queue-id", 16, out.readUnsignedInt());\r
Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
}\r
- \r
- /**\r
- * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testExperimenter() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
- MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
- expBuilder.setExperimenter(56L);\r
- byte[] expData = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};\r
- expBuilder.setData(expData);\r
- caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 24);\r
- Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());\r
- byte[] temp = new byte[8];\r
- out.readBytes(temp);\r
- Assert.assertArrayEquals("Wrong data", expData, temp);\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
-\r
- /**\r
- * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization\r
- * @throws Exception\r
- */\r
- @Test\r
- public void testExperimenterWithoutData() throws Exception {\r
- MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
- builder.setFlags(new MultipartRequestFlags(false));\r
- MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
- MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
- expBuilder.setExperimenter(56L);\r
- caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
- builder.setMultipartRequestBody(caseBuilder.build());\r
- MultipartRequestInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- multipartFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 16, 16);\r
- Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
}\r
+++ /dev/null
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF10VendorInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10VendorInputMessageFactoryTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<ExperimenterInput> vendorFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- vendorFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, ExperimenterInput.class));\r
- }\r
-\r
-\r
- /**\r
- * Testing of {@link OF10VendorInputMessageFactory} for correct translation from POJO\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
- builder.setExperimenter(0x0001020304L);\r
- builder.setData(new byte[] {0x01, 0x02, 0x03, 0x04});\r
- ExperimenterInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- vendorFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV10(out, (byte) 4, 16);\r
- Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
- byte[] data = new byte[4];\r
- out.readBytes(data);\r
- Assert.assertArrayEquals("Wrong data", message.getData(), data);\r
- Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
- }\r
-\r
-}
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @author timotej.kubas\r
- */\r
-public class OF13ExperimenterInputMessageFactoryTest {\r
-\r
- private static final byte EXPERIMENTER_REQUEST_MESSAGE_CODE_TYPE = 4;\r
- private SerializerRegistry registry;\r
- private OFSerializer<ExperimenterInput> expFactory;\r
-\r
- /**\r
- * Initializes serializer registry and stores correct factory in field\r
- */\r
- @Before\r
- public void startUp() {\r
- registry = new SerializerRegistryImpl();\r
- registry.init();\r
- expFactory = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, ExperimenterInput.class));\r
- }\r
-\r
- /**\r
- * Testing of {@link ExperimenterInputMessageFactory} for correct translation from POJO\r
- * @throws Exception \r
- */\r
- @Test\r
- public void test() throws Exception {\r
- ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
- BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
- builder.setExperimenter(0x0001020304L);\r
- builder.setExpType(0x0001020304L);\r
- byte[] expData = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};\r
- builder.setData(expData);\r
- ExperimenterInput message = builder.build();\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- expFactory.serialize(message, out);\r
- \r
- BufferHelper.checkHeaderV13(out, EXPERIMENTER_REQUEST_MESSAGE_CODE_TYPE, 24);\r
- Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong expType", 0x0001020304L, out.readUnsignedInt());\r
- byte[] tmp = new byte[8];\r
- out.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong data", expData, tmp);\r
- }\r
- \r
-}
\ No newline at end of file
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
import org.opendaylight.openflowjava.util.ByteBufUtils;\r
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;\r
oxmBuilder.setMatchEntries(entries);\r
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
- ExperimenterRelatedTableFeaturePropertyBuilder expBuilder =\r
- new ExperimenterRelatedTableFeaturePropertyBuilder();\r
- expBuilder.setExperimenter(1024L);\r
- expBuilder.setExpType(2048L);\r
- byte[] expData = new byte[]{0, 1, 2};\r
- expBuilder.setData(expData);\r
- propBuilder.addAugmentation(\r
- ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());\r
- properties.add(propBuilder.build());\r
- propBuilder = new TableFeaturePropertiesBuilder();\r
- propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
- expBuilder = new ExperimenterRelatedTableFeaturePropertyBuilder();\r
- expBuilder.setExperimenter(4098L);\r
- expBuilder.setExpType(8152L);\r
- byte[] expData2 = new byte[]{3, 4, 6, 7, 8, 9};\r
- expBuilder.setData(expData2);\r
- propBuilder.addAugmentation(\r
- ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());\r
- properties.add(propBuilder.build());\r
tableFeaturesBuilder.setTableFeatureProperties(properties);\r
tableFeaturesList.add(tableFeaturesBuilder.build());\r
featuresBuilder.setTableFeatures(tableFeaturesList);\r
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
multipartFactory.serialize(message, out);\r
\r
- BufferHelper.checkHeaderV13(out, (byte) 18, 272);\r
+ BufferHelper.checkHeaderV13(out, (byte) 18, 232);\r
Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());\r
Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());\r
out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);\r
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong length", 136, out.readUnsignedShort());\r
+ Assert.assertEquals("Wrong length", 96, out.readUnsignedShort());\r
Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
out.skipBytes(5);\r
Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());\r
Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());\r
out.skipBytes(4);\r
- Assert.assertEquals("Wrong property type", 0xFFFE, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 1024, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong exp-type", 2048, out.readUnsignedInt());\r
- byte[] tmp = new byte[3];\r
- out.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong experimenter data", expData, tmp);\r
- out.skipBytes(1);\r
- Assert.assertEquals("Wrong property type", 0xFFFF, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 4098, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong exp-type", 8152, out.readUnsignedInt());\r
- byte[] tmp2 = new byte[6];\r
- out.readBytes(tmp2);\r
- Assert.assertArrayEquals("Wrong experimenter data", expData2, tmp2);\r
- out.skipBytes(6);\r
Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
}\r
\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
queueBuilder.setQueueId(400L);\r
actionBuilder.addAugmentation(QueueIdAction.class, queueBuilder.build());\r
actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Experimenter.class);\r
- ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
- expBuilder.setExperimenter(82L);\r
- byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
- expBuilder.setData(expData);\r
- actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Experimenter.class);\r
- expBuilder = new ExperimenterActionBuilder();\r
- expBuilder.setExperimenter(102L);\r
- actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
- actions.add(actionBuilder.build());\r
\r
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
ListSerializer.serializeList(actions, EnhancedTypeKeyMakerFactory\r
Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());\r
out.skipBytes(6);\r
Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 82, out.readUnsignedInt());\r
- byte[] tmp = new byte[8];\r
- out.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong data", expData, tmp);\r
- Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 102, out.readUnsignedInt());\r
Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);\r
}\r
\r
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
actionBuilder = new ActionBuilder();\r
actionBuilder.setType(PopPbb.class);\r
actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Experimenter.class);\r
- ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
- expBuilder.setExperimenter(82L);\r
- byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
- expBuilder.setData(expData);\r
- actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Experimenter.class);\r
- expBuilder = new ExperimenterActionBuilder();\r
- expBuilder.setExperimenter(102L);\r
- actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
- actions.add(actionBuilder.build());\r
\r
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
ListSerializer.serializeList(actions, EnhancedTypeKeyMakerFactory\r
Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());\r
Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 82, out.readUnsignedInt());\r
- byte[] tmp = new byte[8];\r
- out.readBytes(tmp);\r
- Assert.assertArrayEquals("Wrong data", expData, tmp);\r
- Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong experimenter", 102, out.readUnsignedInt());\r
Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
}\r
\r
<module>openflow-protocol-it</module>
<module>feature</module>
<module>simple-client</module>
+ <module>openflow-protocol-ext</module>
</modules>
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/openflowjava.git</connection>