}
container actions-container {
- uses action-header;
+ uses actions;
}
grouping actions {
list actions-list {
- uses action-header;
- }
- }
-
- grouping action-header {
- container action {
- leaf type {
- type identityref {
- base oft:action;
+ container action {
+ leaf type {
+ type identityref {
+ base oft:action;
+ }
}
}
}
}\r
\r
// OFP_ACTION AUGMENTS\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "port-action";\r
leaf port {\r
type oft:port-number;\r
}\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "max-length-action";\r
leaf max-length {\r
type uint16;\r
}\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "mpls-ttl-action";\r
leaf mpls-ttl {\r
type uint8;\r
}\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "ethertype-action";\r
leaf ethertype {\r
type oft:ether-type;\r
}\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "queue-id-action";\r
leaf queue-id {\r
type uint32;\r
}\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "group-id-action";\r
leaf group-id {\r
type uint32;\r
}\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "nw-ttl-action";\r
leaf nw-ttl {\r
type uint8;\r
}\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "oxm-fields-action";\r
uses oxm:oxm-fields;\r
}\r
- augment "/ofaction:actions-container/ofaction:action" {\r
+ augment "/ofaction:actions-container/ofaction:actions-list/ofaction:action" {\r
ext:augment-identifier "experimenter-action";\r
leaf experimenter {\r
type uint32;\r
// OFP_TABLE_FEATURES_PROPERTIES AUGMENTS\r
augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
ext:augment-identifier "instruction-related-table-feature-property";\r
- list instruction-ids {\r
- uses ofinstruction:instructions;\r
- }\r
+ uses ofinstruction:instructions;\r
}\r
augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
ext:augment-identifier "next-table-related-table-feature-property";\r
}\r
augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
ext:augment-identifier "action-related-table-feature-property";\r
- list action-ids {\r
- uses ofaction:actions;\r
- }\r
+ uses ofaction:actions;\r
}\r
augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
ext:augment-identifier "oxm-related-table-feature-property";\r
- list oxm-ids {\r
- uses oxm:oxm-fields;\r
- }\r
+ uses oxm:oxm-fields;\r
}\r
augment "/ofproto:table-features-properties-container/ofproto:table-feature-properties" {\r
ext:augment-identifier "experimenter-related-table-feature-property";\r
type binary;\r
}\r
}\r
+ \r
+// OFP_QUEUE_PROP AUGMENTS\r
+ augment "/ofproto:queue-prop-container/ofproto:queue-property" {\r
+ ext:augment-identifier "rate-queue-property";\r
+ leaf rate {\r
+ type uint16;\r
+ }\r
+ }\r
+ augment "/ofproto:queue-prop-container/ofproto:queue-property" {\r
+ ext:augment-identifier "experimenter-queue-property";\r
+ leaf experimenter {\r
+ type uint32;\r
+ }\r
+ leaf data {\r
+ type binary;\r
+ }\r
+ }\r
}
\ No newline at end of file
units "kbps"; \r
}\r
}\r
-\r
- grouping match {\r
- leaf type {\r
- type identityref {\r
- base oft:match-type-base;\r
+ \r
+ grouping match-grouping {\r
+ container match {\r
+ leaf type {\r
+ type identityref {\r
+ base oft:match-type-base;\r
+ }\r
}\r
+ uses oxm:oxm-fields;\r
}\r
- uses oxm:oxm-fields;\r
}\r
\r
grouping buckets {\r
}\r
}\r
\r
- // TODO: ofp_packet_queue\r
-\r
// # MESSAGE Structures\r
/* Immutable messages. */\r
grouping ofHeader {\r
leaf-list version-bitmap {\r
type boolean;\r
}\r
- \r
- leaf data {\r
- type binary;\r
- }\r
}\r
}\r
grouping error {\r
// Cookie of the flow entry that was looked up.\r
type uint64;\r
}\r
- container match {\r
- uses match;\r
- }\r
+ uses match-grouping;\r
\r
// struct ofp_match match; /* Packet metadata. Variable size. */\r
// /* The variable size and padded match is always followed by:\r
leaf byte-count {\r
type uint64;\r
}\r
- container match {\r
- uses match;\r
- }\r
+ uses match-grouping;\r
} \r
grouping port-status {\r
// reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"\r
leaf flags {\r
type oft:flow-mod-flags;\r
}\r
- container match {\r
- uses match;\r
- }\r
+ uses match-grouping;\r
\r
uses ofinstruction:instructions;\r
} \r
leaf cookie-mask {\r
type uint64;\r
}\r
- container match {\r
- uses match;\r
- }\r
+ uses match-grouping;\r
}\r
case multipart-request-aggregate {\r
leaf table-id {\r
leaf cookie-mask {\r
type uint64;\r
}\r
- container match {\r
- uses match;\r
- }\r
+ uses match-grouping;\r
}\r
case multipart-request-port-stats {\r
leaf port-no {\r
leaf byte-count {\r
type uint64;\r
}\r
- container match {\r
- uses match;\r
- }\r
+ uses match-grouping;\r
\r
uses ofinstruction:instructions;\r
}\r
case multipart-reply-group-desc {\r
list group-desc {\r
leaf type {\r
- //type uint8;\r
type oft:group-type;\r
}\r
leaf group-id {\r
leaf-list max_groups {\r
type uint32;\r
}\r
- \r
- uses ofaction:actions;\r
+ leaf-list actions-bitmap {\r
+ type oft:action-type;\r
+ }\r
}\r
case multipart-reply-meter {\r
list meter-stats {\r
leaf port {\r
type oft:port-number;\r
}\r
- list properties {\r
- uses queue-property-header;\r
- }\r
+ uses queue-property-header;\r
+ }\r
+ container queue-prop-container {\r
+ uses queue-property-header;\r
}\r
grouping queue-property-header {\r
- leaf property {\r
- type oft:queue-property;\r
+ list queue-property {\r
+ leaf property {\r
+ type oft:queue-properties;\r
+ }\r
}\r
}\r
/* Controller role change request messages. */\r
typedef port-number {
type uint32 {
- range "0..4294967040"; // 0xffffff00 See for actual value
- }
- }
-
- typedef special-port-number {
- type enumeration {
- enum in-port {
- //value "4294967288";
- //description "Send the packet out the input port. This virtual port must be explicitly used in order to send back out of the input port."
- }
- enum table {
- //value "4294967289"; // 0xfffffff9;
- //description "Perform actions in flow table. NB: This can only be the destination port for packet-out messages."
- }
- enum normal {
- //value "4294967290"; // 0xfffffffa;
- //description "Process with normal L2/L3 switching."
- }
- enum flood {
- //value "4294967291"; // 0xfffffffb;
- //description "All physical ports except input port and those disabled by STP."
- }
- enum all {
- //value "4294967292"; // 0xfffffffc;
- //description "All physical ports except input port."
- }
- enum controller {
- //value "4294967293"; // 0xfffffffd;
- //description "Send to controller."
- }
- enum local {
- //value "4294967294"; // 0xfffffffe;
- //description "Local openflow port."
- }
- enum none {
- //value "4294967295"; // 0xffffffff;
- //description "not associated with a physical port."
- }
- }
- }
-
- typedef any-port-number {
- type union {
- type port-number;
- type special-port-number;
+ range "0..4294967040"; // 0xffffff00 See for actual value
}
}
type identityref {
base oft:match-type-base;
}
-
- //TODO: use identityref, when generating available
- //type string;
}
identity instruction {
identity action {
}
-
typedef metadata {
type binary;
}
}
}
- typedef queue-property {
+ typedef queue-properties {
/* ofp_queue_properties */
type enumeration {
enum OFPGT_ALL {
}
}
}
+
+ typedef action-type {
+ /* ofp_action_type */
+ type bits {
+ bit OFPAT_OUTPUT {
+ position 0;
+ /* Output to switch port. */
+ }
+ bit OFPAT_COPY_TTL_OUT {
+ position 1;
+ /* Copy TTL "outwards" -- from next-to-outermost to outermost */
+ }
+ bit OFPAT_COPY_TTL_IN {
+ position 2;
+ /* Copy TTL "inwards" -- from outermost to next-to-outermost */
+ }
+ bit OFPAT_SET_MPLS_TTL {
+ position 3;
+ /* MPLS TTL */
+ }
+ bit OFPAT_DEC_MPLS_TTL {
+ position 4;
+ /* Decrement MPLS TTL */
+ }
+ bit OFPAT_PUSH_VLAN {
+ position 5;
+ /* Push a new VLAN tag */
+ }
+ bit OFPAT_POP_VLAN {
+ position 6;
+ /* Pop the outer VLAN tag */
+ }
+ bit OFPAT_PUSH_MPLS {
+ position 7;
+ /* Push a new MPLS tag */
+ }
+ bit OFPAT_POP_MPLS {
+ position 8;
+ /* Pop the outer MPLS tag */
+ }
+ bit OFPAT_SET_QUEUE {
+ position 9;
+ /* Set queue id when outputting to a port */
+ }
+ bit OFPAT_GROUP {
+ position 10;
+ /* Apply group. */
+ }
+ bit OFPAT_SET_NW_TTL {
+ position 11;
+ /* IP TTL. */
+ }
+ bit OFPAT_DEC_NW_TTL {
+ position 12;
+ /* Decrement IP TTL. */
+ }
+ bit OFPAT_SET_FIELD {
+ position 13;
+ /* Set a header field using OXM TLV format. */
+ }
+ bit OFPAT_PUSH_PBB {
+ position 14;
+ /* Push a new PBB service tag (I-TAG) */
+ }
+ bit OFPAT_POP_PBB {
+ position 15;
+ /* Pop the outer PBB service tag (I-TAG) */
+ }
+ bit OFPAT_EXPERIMENTER {
+ position 16;
+ }
+ }
+ }
typedef meter-mod-command {
/* ofp_meter_mod_command */
* @param connectionAdapter reference for adapter communicating with upper layers outside library\r
*/\r
public DelegatingInboundHandler(MessageConsumer connectionAdapter) {\r
- LOGGER.info("Creating DelegatingInboundHandler");\r
+ LOGGER.debug("Creating DelegatingInboundHandler");\r
consumer = connectionAdapter;\r
}\r
\r
* Constructor of class\r
*/\r
public OF13Decoder() {\r
- LOGGER.info("Creating OF 1.3 Decoder");\r
+ LOGGER.debug("Creating OF 1.3 Decoder");\r
}\r
\r
@Override\r
\r
/** Constructor of class */\r
public OF13Encoder() {\r
- LOGGER.info("Creating OF13Encoder");\r
+ LOGGER.debug("Creating OF13Encoder");\r
}\r
@Override\r
protected void encode(ChannelHandlerContext ctx, OfHeader msg, ByteBuf out)\r
* Constructor of class.
*/
public OFFrameDecoder() {
- LOGGER.info("Creating OFFrameDecoder");
+ LOGGER.debug("Creating OFFrameDecoder");
}
@Override
* Constructor of class.
*/
public OFVersionDetector() {
- LOGGER.info("Creating OFVersionDetector");
+ LOGGER.debug("Creating OFVersionDetector");
}
@Override
protected void decode(ChannelHandlerContext chc, ByteBuf bb, List<Object> list) throws Exception {
- LOGGER.info("Decoding frame");
+ LOGGER.debug("Decoding frame");
if (bb.readableBytes() == 0) {
- LOGGER.info("not enough data");
+ LOGGER.debug("not enough data");
bb.release();
return;
}
*/
@Override
public void run() {
- LOGGER.info("Switch ");
bossGroup = new NioEventLoopGroup();
workerGroup = new NioEventLoopGroup();
try {
channelInitializer.setSwitchConnectionHandler(switchConnectionHandler);
}
+ /**
+ * @param switchIdleTimeout in milliseconds
+ */
public void setSwitchIdleTimeout(long switchIdleTimeout) {
channelInitializer.setSwitchIdleTimeout(switchIdleTimeout);
}
* Constructor of class
*/
public TlsDetector() {
- LOGGER.info("Creating TLS Detector");
+ LOGGER.debug("Creating TLS Detector");
detectSsl = true;
}
import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
import org.opendaylight.openflowjava.protocol.impl.util.ActionsDeserializer;\r
import org.opendaylight.openflowjava.protocol.impl.util.InstructionsDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.MatchEntriesDeserializer;\r
+import org.opendaylight.openflowjava.protocol.impl.util.MatchDeserializer;\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.ActionRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;\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
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeaturePropertyBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeaturePropertyBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;\r
private static MultipartReplyFlow setFlow(ByteBuf input) {\r
final byte PADDING_IN_FLOW_STATS_HEADER_01 = 1;\r
final byte PADDING_IN_FLOW_STATS_HEADER_02 = 4;\r
- final byte flowLength = 2;\r
MultipartReplyFlowBuilder flowBuilder = new MultipartReplyFlowBuilder();\r
List<FlowStats> flowStatsList = new ArrayList<>();\r
FlowStatsBuilder flowStatsBuilder = new FlowStatsBuilder();\r
while (input.readableBytes() > 0) {\r
- input.skipBytes(flowLength);\r
+ input.skipBytes(Short.SIZE / Byte.SIZE);\r
flowStatsBuilder.setTableId(input.readUnsignedByte());\r
input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);\r
flowStatsBuilder.setDurationSec(input.readUnsignedInt());\r
byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];\r
input.readBytes(byteCount);\r
flowStatsBuilder.setByteCount(new BigInteger(byteCount));\r
- // TODO match\r
- // TODO instructions\r
+ flowStatsBuilder.setMatch(MatchDeserializer.createMatch(input));\r
+ flowStatsBuilder.setInstructions(InstructionsDeserializer.createInstructions(input, input.readableBytes()));\r
flowStatsList.add(flowStatsBuilder.build());\r
}\r
flowBuilder.setFlowStats(new ArrayList<>(flowStatsList));\r
tableFeaturesLength -= propertyLength;\r
if (type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONS)\r
|| type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS)) {\r
- InstructionsDeserializer.createInstructions(input, propertyLength - COMMON_PROPERTY_LENGTH);\r
+ InstructionRelatedTableFeaturePropertyBuilder insBuilder = new InstructionRelatedTableFeaturePropertyBuilder();\r
+ insBuilder.setInstructions(InstructionsDeserializer.createInstructions(input, propertyLength - COMMON_PROPERTY_LENGTH));\r
+ builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insBuilder.build());\r
} else if (type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLES)\r
|| type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS)) {\r
propertyLength -= COMMON_PROPERTY_LENGTH;\r
}\r
tableBuilder.setNextTableIds(ids);\r
builder.addAugmentation(NextTableRelatedTableFeatureProperty.class, tableBuilder.build());\r
- properties.add(builder.build());\r
} else if (type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONS)\r
|| type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS)\r
|| type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONS)\r
|| type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS)) {\r
- ActionsDeserializer.createActionsList(input, propertyLength - COMMON_PROPERTY_LENGTH);\r
+ ActionRelatedTableFeaturePropertyBuilder actionBuilder = new ActionRelatedTableFeaturePropertyBuilder();\r
+ actionBuilder.setActionsList(ActionsDeserializer.createActionsList(input, propertyLength - COMMON_PROPERTY_LENGTH));\r
+ builder.addAugmentation(ActionRelatedTableFeatureProperty.class, actionBuilder.build());\r
} else if (type.equals(TableFeaturesPropType.OFPTFPTMATCH)\r
|| type.equals(TableFeaturesPropType.OFPTFPTWILDCARDS)\r
|| type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELD)\r
|| type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS)\r
|| type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD)\r
|| type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS)) {\r
- MatchEntriesDeserializer.createMatchEntries(input, propertyLength - COMMON_PROPERTY_LENGTH);\r
+ OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();\r
+ oxmBuilder.setMatchEntries(MatchDeserializer.createMatchEntries(input, propertyLength - COMMON_PROPERTY_LENGTH));\r
+ builder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
} else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)\r
|| type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS)) {\r
final byte EXPERIMENTER_PROPERTY_LENGTH = 12;\r
input.readBytes(data);\r
expBuilder.setData(data);\r
builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());\r
- properties.add(builder.build());\r
}\r
+ properties.add(builder.build());\r
}\r
return properties;\r
}\r
}\r
\r
private static MultipartReplyBody setGroupFeatures(ByteBuf rawMessage) {\r
- final int SIZE_OF_MAX_GROUPS = 4;\r
+ final int GROUP_TYPES = 4;\r
MultipartReplyGroupFeaturesBuilder featuresBuilder = new MultipartReplyGroupFeaturesBuilder();\r
featuresBuilder.setTypes(createGroupType(rawMessage.readUnsignedInt()));\r
featuresBuilder.setCapabilities(createCapabilities(rawMessage.readUnsignedInt()));\r
List<Long> maxGroupsList = new ArrayList<>();\r
- for (int i = 0; i < SIZE_OF_MAX_GROUPS ; i++) {\r
+ for (int i = 0; i < GROUP_TYPES ; i++) {\r
maxGroupsList.add(rawMessage.readUnsignedInt());\r
}\r
featuresBuilder.setMaxGroups(maxGroupsList);\r
- // TODO - groupfeatures - actions bitmap\r
- rawMessage.skipBytes(4);\r
+ List<ActionType> actionBitmaps = new ArrayList<>();\r
+ for (int i = 0; i < GROUP_TYPES ; i++) {\r
+ actionBitmaps.add(createActionBitmap(rawMessage.readUnsignedInt()));\r
+ }\r
+ featuresBuilder.setActionsBitmap(actionBitmaps);\r
return featuresBuilder.build();\r
}\r
+ \r
+ private static ActionType createActionBitmap(long input) {\r
+ final Boolean OFPAT_OUTPUT = ((input) & (1<<0)) != 0;\r
+ final Boolean OFPAT_COPY_TTL_OUT = ((input) & (1<<1)) != 0;\r
+ final Boolean OFPAT_COPY_TTL_IN = ((input) & (1<<2)) != 0;\r
+ final Boolean OFPAT_SET_MPLS_TTL = ((input) & (1<<3)) != 0;\r
+ final Boolean OFPAT_DEC_MPLS_TTL = ((input) & (1<<4)) != 0;\r
+ final Boolean OFPAT_PUSH_VLAN = ((input) & (1<<5)) != 0;\r
+ final Boolean OFPAT_POP_VLAN = ((input) & (1<<6)) != 0;\r
+ final Boolean OFPAT_PUSH_MPLS = ((input) & (1<<7)) != 0;\r
+ final Boolean OFPAT_POP_MPLS = ((input) & (1<<8)) != 0;\r
+ final Boolean OFPAT_SET_QUEUE = ((input) & (1<<9)) != 0;\r
+ final Boolean OFPAT_GROUP = ((input) & (1<<10)) != 0;\r
+ final Boolean OFPAT_SET_NW_TTL = ((input) & (1<<11)) != 0;\r
+ final Boolean OFPAT_DEC_NW_TTL = ((input) & (1<<12)) != 0;\r
+ final Boolean OFPAT_SET_FIELD = ((input) & (1<<13)) != 0;\r
+ final Boolean OFPAT_PUSH_PBB = ((input) & (1<<14)) != 0;\r
+ final Boolean OFPAT_POP_PBB = ((input) & (1<<15)) != 0;\r
+ final Boolean OFPAT_EXPERIMENTER = ((input) & (1<<16)) != 0;\r
+ return new ActionType(OFPAT_COPY_TTL_IN, OFPAT_COPY_TTL_OUT, OFPAT_DEC_MPLS_TTL,\r
+ OFPAT_DEC_NW_TTL, OFPAT_EXPERIMENTER, OFPAT_GROUP, OFPAT_OUTPUT, OFPAT_POP_MPLS,\r
+ OFPAT_POP_PBB, OFPAT_POP_VLAN, OFPAT_PUSH_MPLS, OFPAT_PUSH_PBB, OFPAT_PUSH_VLAN,\r
+ OFPAT_SET_FIELD, OFPAT_SET_MPLS_TTL, OFPAT_SET_NW_TTL, OFPAT_SET_QUEUE);\r
+ }\r
\r
private static GroupCapabilities createCapabilities(long input) {\r
final Boolean OFOFPGFC_SELECT_WEIGHT = ((input) & (1<<0)) != 0;\r
BucketsListBuilder bucketsBuilder = new BucketsListBuilder();\r
List<BucketsList> bucketsList = new ArrayList<>();\r
List<ActionsList> actionsList = new ArrayList<>();\r
- \r
while (input.readableBytes() > 0) {\r
bodyLength = input.readUnsignedShort();\r
- actualLength = 0;\r
- \r
- groupDescBuilder.setType(GroupType.forValue(input.readUnsignedByte())); // TODO enum or class?\r
+ groupDescBuilder.setType(GroupType.forValue(input.readUnsignedByte()));\r
input.skipBytes(PADDING_IN_GROUP_DESC_HEADER);\r
groupDescBuilder.setGroupId(input.readUnsignedInt());\r
actualLength = GROUP_DESC_HEADER_LENGTH;\r
- \r
while (actualLength < bodyLength) {\r
- \r
bucketsLength = input.readUnsignedShort();\r
bucketsBuilder.setWeight(input.readUnsignedShort());\r
bucketsBuilder.setWatchPort(new PortNumber(input.readUnsignedInt()));\r
/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
\r
+import io.netty.buffer.ByteBuf;\r
+\r
import java.util.ArrayList;\r
import java.util.List;\r
\r
-import io.netty.buffer.ByteBuf;\r
-\r
import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperty;\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.GetQueueConfigOutput;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutputBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.packet.queue.Properties;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.packet.queue.PropertiesBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.QueuesBuilder;\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 timotej.kubas\r
queueBuilder.setPort(new PortNumber(input.readUnsignedInt()));\r
input.skipBytes(2);\r
input.skipBytes(PADDING_IN_PACKET_QUEUE_HEADER);\r
- queueBuilder.setProperties(createPropertiesList(input));\r
+ queueBuilder.setQueueProperty(createPropertiesList(input));\r
queuesList.add(queueBuilder.build());\r
} \r
return queuesList;\r
}\r
\r
- private static List<Properties> createPropertiesList(ByteBuf propertiesInput){\r
- List<Properties> propertiesList = new ArrayList<>();\r
- PropertiesBuilder propertiesBuilder = new PropertiesBuilder();\r
- propertiesBuilder.setProperty(QueueProperty.forValue(propertiesInput.readUnsignedShort()));\r
+ private static List<QueueProperty> createPropertiesList(ByteBuf propertiesInput){\r
+ List<QueueProperty> propertiesList = new ArrayList<>();\r
+ QueuePropertyBuilder propertiesBuilder = new QueuePropertyBuilder();\r
+ propertiesBuilder.setProperty(QueueProperties.forValue(propertiesInput.readUnsignedShort()));\r
propertiesInput.skipBytes(2);\r
propertiesInput.skipBytes(PADDING_IN_QUEUE_PROPERTY_HEADER);\r
propertiesList.add(propertiesBuilder.build());\r
\r
/**\r
* Compute length of received message\r
- * @param message TODO\r
+ * @param message \r
* @return computed length\r
*/\r
public abstract int computeLength(E message);\r
import io.netty.buffer.ByteBuf;\r
\r
import java.util.HashMap;\r
+import java.util.List;\r
import java.util.Map;\r
\r
import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;\r
+import org.opendaylight.openflowjava.protocol.impl.util.ActionsSerializer;\r
import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;\r
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionsSerializer;\r
+import org.opendaylight.openflowjava.protocol.impl.util.MatchSerializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;\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.InstructionRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.Instructions;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestMessage;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregate;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueue;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeatures;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features.TableFeatures;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.TableFeatureProperties;\r
\r
/**\r
* @author timotej.kubas\r
public class MultipartRequestMessageFactory implements OFSerializer<MultipartRequestMessage> {\r
private static final byte MESSAGE_TYPE = 18;\r
private static final int MESSAGE_LENGTH = 16;\r
- private static MultipartRequestMessageFactory instance; \r
private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE = 4;\r
+ private static final byte TABLE_FEAT_HEADER_LENGTH = 4;\r
+ private static MultipartRequestMessageFactory instance; \r
+ \r
private MultipartRequestMessageFactory() {\r
// singleton\r
}\r
encodeMeterBody(message.getMultipartRequestBody(), out);\r
} else if (message.getMultipartRequestBody() instanceof MultipartRequestMeterConfig) {\r
encodeMeterConfigBody(message.getMultipartRequestBody(), out);\r
- } else if (message.getMultipartRequestBody() instanceof MultipartRequestExperimenter) {\r
- encodeExperimenterBody(message.getMultipartRequestBody(), out);\r
} else if (message.getMultipartRequestBody() instanceof MultipartRequestTableFeatures) {\r
encodeTableFeaturesBody(message.getMultipartRequestBody(), out);\r
+ } else if (message.getMultipartRequestBody() instanceof MultipartRequestExperimenter) {\r
+ encodeExperimenterBody(message.getMultipartRequestBody(), out);\r
}\r
}\r
\r
ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02, output);\r
output.writeLong(flow.getCookie().longValue()); \r
output.writeLong(flow.getCookieMask().longValue());\r
- //TODO match field\r
+ MatchSerializer.encodeMatch(flow.getMatch(), output);\r
}\r
\r
private static void encodeAggregateBody(MultipartRequestBody multipartRequestBody, ByteBuf output) {\r
ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_AGREGGATE_BODY_02, output);\r
output.writeLong(aggregate.getCookie().longValue()); \r
output.writeLong(aggregate.getCookieMask().longValue());\r
- //TODO match field\r
+ MatchSerializer.encodeMatch(aggregate.getMatch(), output);\r
}\r
\r
private static void encodePortStatsBody(MultipartRequestBody multipartRequestBody, ByteBuf output) {\r
}\r
\r
private static void encodeTableFeaturesBody(MultipartRequestBody multipartRequestBody, ByteBuf output) {\r
- MultipartRequestTableFeatures tableFeatures = (MultipartRequestTableFeatures) multipartRequestBody;\r
- \r
- for (TableFeatures currTableFeature : tableFeatures.getTableFeatures()) {\r
- final byte PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY = 5;\r
- output.writeByte(currTableFeature.getTableId());\r
- ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY, output);\r
- output.writeBytes(currTableFeature.getName().getBytes());\r
- ByteBufUtils.padBuffer((32 - currTableFeature.getName().getBytes().length), output);\r
- output.writeLong(currTableFeature.getMetadataMatch().longValue());\r
- output.writeLong(currTableFeature.getMetadataWrite().longValue());\r
- output.writeInt(createTableConfigBitmask(currTableFeature.getConfig()));\r
- output.writeInt(currTableFeature.getMaxEntries().intValue());\r
- //TODO properties\r
+ if (multipartRequestBody != null) {\r
+ MultipartRequestTableFeatures tableFeatures = (MultipartRequestTableFeatures) multipartRequestBody;\r
+ for (TableFeatures currTableFeature : tableFeatures.getTableFeatures()) {\r
+ final byte PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY = 5;\r
+ output.writeByte(currTableFeature.getTableId());\r
+ ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY, output);\r
+ output.writeBytes(currTableFeature.getName().getBytes());\r
+ ByteBufUtils.padBuffer((32 - currTableFeature.getName().getBytes().length), output);\r
+ output.writeLong(currTableFeature.getMetadataMatch().longValue());\r
+ output.writeLong(currTableFeature.getMetadataWrite().longValue());\r
+ output.writeInt(createTableConfigBitmask(currTableFeature.getConfig()));\r
+ output.writeInt(currTableFeature.getMaxEntries().intValue());\r
+ writeTableFeatureProperties(output, currTableFeature.getTableFeatureProperties());\r
+ }\r
+ }\r
+ }\r
+ \r
+ private static void writeTableFeatureProperties(ByteBuf output, List<TableFeatureProperties> props) {\r
+ if (props != null) {\r
+ for (TableFeatureProperties property : props) {\r
+ TableFeaturesPropType type = property.getType();\r
+ if (type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONS)) {\r
+ final byte INSTRUCTIONS_CODE = 0;\r
+ writeInstructionRelatedTableProperty(output, property, INSTRUCTIONS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS)) {\r
+ final byte INSTRUCTIONS_MISS_CODE = 1;\r
+ writeInstructionRelatedTableProperty(output, property, INSTRUCTIONS_MISS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLES)) {\r
+ final byte NEXT_TABLE_CODE = 2;\r
+ writeNextTableRelatedTableProperty(output, property, NEXT_TABLE_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS)) {\r
+ final byte NEXT_TABLE_MISS_CODE = 3;\r
+ writeNextTableRelatedTableProperty(output, property, NEXT_TABLE_MISS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONS)) {\r
+ final byte WRITE_ACTIONS_CODE = 4;\r
+ writeActionsRelatedTableProperty(output, property, WRITE_ACTIONS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS)) {\r
+ final byte WRITE_ACTIONS_MISS_CODE = 5;\r
+ writeActionsRelatedTableProperty(output, property, WRITE_ACTIONS_MISS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONS)) {\r
+ final byte APPLY_ACTIONS_CODE = 6;\r
+ writeActionsRelatedTableProperty(output, property, APPLY_ACTIONS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS)) {\r
+ final byte APPLY_ACTIONS_MISS_CODE = 7;\r
+ writeActionsRelatedTableProperty(output, property, APPLY_ACTIONS_MISS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTMATCH)) {\r
+ final byte MATCH_CODE = 8;\r
+ writeOxmRelatedTableProperty(output, property, MATCH_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTWILDCARDS)) {\r
+ final byte WILDCARDS_CODE = 10;\r
+ writeOxmRelatedTableProperty(output, property, WILDCARDS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELD)) {\r
+ final byte WRITE_SETFIELD_CODE = 12;\r
+ writeOxmRelatedTableProperty(output, property, WRITE_SETFIELD_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS)) {\r
+ final byte WRITE_SETFIELD_MISS_CODE = 13;\r
+ writeOxmRelatedTableProperty(output, property, WRITE_SETFIELD_MISS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD)) {\r
+ final byte APPLY_SETFIELD_CODE = 14;\r
+ writeOxmRelatedTableProperty(output, property, APPLY_SETFIELD_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS)) {\r
+ final byte APPLY_SETFIELD_MISS_CODE = 15;\r
+ writeOxmRelatedTableProperty(output, property, APPLY_SETFIELD_MISS_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)) {\r
+ final int EXPERIMENTER_CODE = 65534; // 0xFFFE\r
+ writeExperimenterRelatedTableProperty(output, property, EXPERIMENTER_CODE);\r
+ } else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS)) {\r
+ final int EXPERIMENTER_MISS_CODE = 65535; // 0xFFFF\r
+ writeExperimenterRelatedTableProperty(output, property, EXPERIMENTER_MISS_CODE);\r
+ } \r
+ }\r
+ }\r
+ }\r
+\r
+ private static void writeInstructionRelatedTableProperty(ByteBuf output,\r
+ TableFeatureProperties property, byte code) {\r
+ output.writeShort(code);\r
+ List<Instructions> instructions = property.\r
+ getAugmentation(InstructionRelatedTableFeatureProperty.class).getInstructions();\r
+ int length = TABLE_FEAT_HEADER_LENGTH;\r
+ if (instructions != null) {\r
+ output.writeShort(InstructionsSerializer.computeInstructionsLength(instructions)\r
+ + TABLE_FEAT_HEADER_LENGTH);\r
+ InstructionsSerializer.encodeInstructions(instructions, output);\r
+ } else {\r
+ output.writeShort(length);\r
+ }\r
+ }\r
+ \r
+ private static void writeNextTableRelatedTableProperty(ByteBuf output,\r
+ TableFeatureProperties property, byte code) {\r
+ output.writeShort(code);\r
+ List<NextTableIds> nextTableIds = property.\r
+ getAugmentation(NextTableRelatedTableFeatureProperty.class).getNextTableIds();\r
+ int length = TABLE_FEAT_HEADER_LENGTH;\r
+ if (nextTableIds != null) {\r
+ output.writeShort(length + nextTableIds.size());\r
+ for (NextTableIds next : nextTableIds) {\r
+ output.writeByte(next.getTableId());\r
+ }\r
+ } else {\r
+ output.writeShort(length);\r
+ }\r
+ }\r
+ \r
+ private static void writeActionsRelatedTableProperty(ByteBuf output,\r
+ TableFeatureProperties property, byte code) {\r
+ output.writeShort(code);\r
+ List<ActionsList> actions = property.\r
+ getAugmentation(ActionRelatedTableFeatureProperty.class).getActionsList();\r
+ int length = TABLE_FEAT_HEADER_LENGTH;\r
+ if (actions != null) {\r
+ output.writeShort(ActionsSerializer.computeLengthOfActions(actions)\r
+ + TABLE_FEAT_HEADER_LENGTH);\r
+ ActionsSerializer.encodeActions(actions, output);\r
+ } else {\r
+ output.writeShort(length);\r
+ }\r
+ }\r
+ \r
+ private static void writeOxmRelatedTableProperty(ByteBuf output,\r
+ TableFeatureProperties property, byte code) {\r
+ output.writeShort(code);\r
+ List<MatchEntries> entries = property.\r
+ getAugmentation(OxmRelatedTableFeatureProperty.class).getMatchEntries();\r
+ int length = TABLE_FEAT_HEADER_LENGTH;\r
+ if (entries != null) {\r
+ output.writeShort(MatchSerializer.computeMatchEntriesLength(entries)\r
+ + TABLE_FEAT_HEADER_LENGTH);\r
+ MatchSerializer.encodeMatchEntries(entries, output);\r
+ } else {\r
+ output.writeShort(length);\r
+ }\r
+ }\r
+ \r
+ private static void writeExperimenterRelatedTableProperty(ByteBuf output,\r
+ TableFeatureProperties property, int code) {\r
+ output.writeShort(code);\r
+ ExperimenterRelatedTableFeatureProperty exp = property.\r
+ getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+ byte[] data = exp.getData();\r
+ int length = TABLE_FEAT_HEADER_LENGTH + 2 * (Integer.SIZE / Byte.SIZE);\r
+ if (data != null) {\r
+ output.writeShort(length + data.length);\r
+ output.writeInt(exp.getExperimenter().intValue());\r
+ output.writeInt(exp.getExpType().intValue());\r
+ output.writeBytes(data);\r
+ } else {\r
+ output.writeShort(length);\r
+ output.writeInt(exp.getExperimenter().intValue());\r
+ output.writeInt(exp.getExpType().intValue());\r
}\r
}\r
\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.action.header.ActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsListBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.ActionBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
\r
\r
case 25:\r
actionsLength = input.readUnsignedShort();//8\r
- //TODO field\r
actionsList.add(ActionsDeserializer.createSetFieldAction(input, actionsLength));\r
break; \r
case 26: \r
public static ActionsList createSetFieldAction(ByteBuf in, int actionLength) {\r
actionBuilder.setType(SetField.class);\r
OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
- matchEntries.setMatchEntries(MatchEntriesDeserializer.createMatchEntries(in, actionLength - 4));\r
+ matchEntries.setMatchEntries(MatchDeserializer.createMatchEntries(in, actionLength - 4));\r
actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
actionsListBuilder.setAction(actionBuilder.build());\r
\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.action.header.Action;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.StandardMatchType;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntriesBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.Match;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.MatchBuilder;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
* @author timotej.kubas\r
* @author michal.polkorab\r
*/\r
-public abstract class MatchEntriesDeserializer {\r
- private static final Logger LOGGER = LoggerFactory.getLogger(MatchEntriesDeserializer.class);\r
+public abstract class MatchDeserializer {\r
+ private static final Logger LOGGER = LoggerFactory.getLogger(MatchDeserializer.class);\r
private static final byte SIZE_OF_LONG_IN_BYTES = Long.SIZE / Byte.SIZE;\r
private static final byte SIZE_OF_INT_IN_BYTES = Integer.SIZE / Byte.SIZE;\r
private static final byte SIZE_OF_SHORT_IN_BYTES = Short.SIZE / Byte.SIZE;\r
private static List<MatchEntries> matchEntriesList = new ArrayList<>();\r
private static MatchEntriesBuilder matchEntriesBuilder = new MatchEntriesBuilder(); \r
\r
+ /**\r
+ * Creates match\r
+ * @param in inputu ByteBuf\r
+ * @return ofp_match\r
+ */\r
+ public static Match createMatch(ByteBuf in) {\r
+ if (in.readableBytes() > 0) {\r
+ final byte PADDING_IN_MATCH = 4;\r
+ MatchBuilder builder = new MatchBuilder();\r
+ int type = in.readUnsignedShort();\r
+ int length = in.readUnsignedShort();\r
+ switch (type) {\r
+ case 0:\r
+ builder.setType(StandardMatchType.class);\r
+ builder.setMatchEntries(createMatchEntries(in, length - 2 * Short.SIZE));\r
+ break;\r
+ case 1:\r
+ builder.setType(OxmMatchType.class);\r
+ builder.setMatchEntries(createMatchEntries(in, length - 2 * Short.SIZE));\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ in.skipBytes(PADDING_IN_MATCH);\r
+ return builder.build();\r
+ }\r
+ return null;\r
+ }\r
+ \r
/**\r
* @param in input ByteBuf\r
* @param matchArrayLength to infer size of array\r
Ipv4AddressMatchEntryBuilder ipv4AddressBuilder = new Ipv4AddressMatchEntryBuilder();\r
List<String> groups = new ArrayList<>();\r
for (int i = 0; i < GROUPS_IN_IPV4_ADDRESS; i++) {\r
- groups.add(String.format("X", in.readUnsignedByte()));\r
+ groups.add(Short.toString(in.readUnsignedByte()));\r
}\r
Joiner joiner = Joiner.on(".");\r
ipv4AddressBuilder.setIpv4Address(new Ipv4Address(joiner.join(groups)));\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.flow.mod.Match;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.Match;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperty;\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.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.packet.queue.Properties;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.packet.queue.PropertiesBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.QueuesBuilder;\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 timotej.kubas\r
for (int i = 1; i <= 3; i++) {\r
qb.setQueueId(new QueueId((long) i));\r
qb.setPort(new PortNumber((long) i));\r
- qb.setProperties(createPropertiesList());\r
+ qb.setQueueProperty(createPropertiesList());\r
queuesList.add(qb.build());\r
}\r
return queuesList;\r
}\r
\r
- private static List<Properties> createPropertiesList() {\r
- List<Properties> propertiesList = new ArrayList<>();\r
- PropertiesBuilder pb = new PropertiesBuilder();\r
- pb.setProperty(QueueProperty.values()[1]);\r
+ private static List<QueueProperty> createPropertiesList() {\r
+ List<QueueProperty> propertiesList = new ArrayList<>();\r
+ QueuePropertyBuilder pb = new QueuePropertyBuilder();\r
+ pb.setProperty(QueueProperties.forValue(1));\r
propertiesList.add(pb.build());\r
return propertiesList;\r
}\r
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueId;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperty;\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.GetQueueConfigOutput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.packet.queue.Properties;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.packet.queue.PropertiesBuilder;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.QueuesBuilder;\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 timotej.kubas\r
QueuesBuilder qb = new QueuesBuilder();\r
qb.setQueueId(new QueueId(1L));\r
qb.setPort(new PortNumber(1L));\r
- qb.setProperties(createPropertiesList());\r
+ qb.setQueueProperty(createPropertiesList());\r
queuesList.add(qb.build());\r
\r
return queuesList;\r
}\r
\r
- private static List<Properties> createPropertiesList(){\r
- List<Properties> propertiesList = new ArrayList<>();\r
- PropertiesBuilder pb = new PropertiesBuilder();\r
- pb.setProperty(QueueProperty.values()[2]);\r
+ private static List<QueueProperty> createPropertiesList(){\r
+ List<QueueProperty> propertiesList = new ArrayList<>();\r
+ QueuePropertyBuilder pb = new QueuePropertyBuilder();\r
+ pb.setProperty(QueueProperties.forValue(2));\r
propertiesList.add(pb.build());\r
\r
return propertiesList;\r
\r
@Override\r
public boolean accept(InetAddress switchAddress) {\r
- // TODO Auto-generated method stub\r
return true;\r
}\r
\r