import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDesc;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroup;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter._case.MultipartReplyMeter;
@Test
public void testMultipartReplyFlowBody(){
ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 "+
- "00 0C "+//length
+ "00 48 "+//length
"08 "+//tableId
"00 "+//pad_01
"00 00 00 09 "+//durationSec
"00 00 00 00 "+//pad_02
"FF 01 01 01 01 01 01 01 "+//cookie
"EF 01 01 01 01 01 01 01 "+//packetCount
- "7F 01 01 01 01 01 01 01"//byteCount
- );
+ "7F 01 01 01 01 01 01 01 "+//byteCount
+ "00 01 00 04 00 00 00 00 "+//empty match
+ "00 01 00 08 06 00 00 00 "+
+ "00 01 00 08 06 00 00 00 "+
+ "00 48 "+//length
+ "08 "+//tableId
+ "00 "+//pad_01
+ "00 00 00 09 "+//durationSec
+ "00 00 00 07 "+//durationNsec
+ "00 0C "+//priority
+ "00 0E "+//idleTimeout
+ "00 0F "+//hardTimeout
+ "00 0B "+//flags
+ "00 00 00 00 "+//pad_02
+ "FF 01 01 01 01 01 01 01 "+//cookie
+ "EF 01 01 01 01 01 01 01 "+//packetCount
+ "7F 01 01 01 01 01 01 01 "+//byteCount
+ "00 01 00 04 00 00 00 00 "+//empty match
+ "00 01 00 08 06 00 00 00 "+
+ "00 01 00 08 06 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyFlowCase messageCase = (MultipartReplyFlowCase) builtByFactory.getMultipartReplyBody();
MultipartReplyFlow message = messageCase.getMultipartReplyFlow();
- Assert.assertEquals("Wrong tableId", 8, message.getFlowStats().get(0).getTableId().intValue());
- Assert.assertEquals("Wrong durationSec", 9, message.getFlowStats().get(0).getDurationSec().intValue());
- Assert.assertEquals("Wrong durationNsec", 7, message.getFlowStats().get(0).getDurationNsec().intValue());
- Assert.assertEquals("Wrong priority", 12, message.getFlowStats().get(0).getPriority().intValue());
- Assert.assertEquals("Wrong idleTimeOut", 14, message.getFlowStats().get(0).getIdleTimeout().intValue());
- Assert.assertEquals("Wrong hardTimeOut", 15, message.getFlowStats().get(0).getHardTimeout().intValue());
+ FlowStats flowStats1 = message.getFlowStats().get(0);
+ Assert.assertEquals("Wrong tableId", 8, flowStats1.getTableId().intValue());
+ Assert.assertEquals("Wrong durationSec", 9, flowStats1.getDurationSec().intValue());
+ Assert.assertEquals("Wrong durationNsec", 7, flowStats1.getDurationNsec().intValue());
+ Assert.assertEquals("Wrong priority", 12, flowStats1.getPriority().intValue());
+ Assert.assertEquals("Wrong idleTimeOut", 14, flowStats1.getIdleTimeout().intValue());
+ Assert.assertEquals("Wrong hardTimeOut", 15, flowStats1.getHardTimeout().intValue());
Assert.assertEquals("Wrong flags", new FlowModFlags(true, false, true, false, true),
- message.getFlowStats().get(0).getFlags());
+ flowStats1.getFlags());
Assert.assertEquals("Wrong cookie",
new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
- message.getFlowStats().get(0).getCookie());
+ flowStats1.getCookie());
Assert.assertEquals("Wrong packetCount",
new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
- message.getFlowStats().get(0).getPacketCount());
+ flowStats1.getPacketCount());
Assert.assertEquals("Wrong byteCount",
new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
- message.getFlowStats().get(0).getByteCount());
+ flowStats1.getByteCount());
+ Assert.assertEquals("Wrong match type", OxmMatchType.class, flowStats1.getMatch().getType());
}
/**
message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertEquals("Wrong outputType", Output.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getType());
Assert.assertEquals("Wrong outputPort", 4351,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getAugmentation(PortAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getAugmentation(PortAction.class).
getPort().getValue().intValue());
Assert.assertEquals("Wrong outputMaxLen", 65535,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getAugmentation(MaxLengthAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getAugmentation(MaxLengthAction.class).
getMaxLength().intValue());
Assert.assertEquals("Wrong copyTtlOutType", CopyTtlOut.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1)
+ .getType());
Assert.assertEquals("Wrong copyTtlInType", CopyTtlIn.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2)
+ .getType());
}
/**
Assert.assertEquals("Wrong bucketWatchGroup", 4,
message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertEquals("Wrong setMplsTtlType", SetMplsTtl.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getType());
Assert.assertEquals("Wrong setMplsTtlMPLS_TTL", 9,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getAugmentation(MplsTtlAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getAugmentation(MplsTtlAction.class).
getMplsTtl().intValue());
Assert.assertEquals("Wrong decMplsTtlType", DecMplsTtl.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1)
+ .getType());
Assert.assertEquals("Wrong pushVlanType", PushVlan.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2)
+ .getType());
Assert.assertEquals("Wrong pushVlanEthertype", 32,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
- getAction().getAugmentation(EthertypeAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2)
+ .getAugmentation(EthertypeAction.class).
getEthertype().getValue().intValue());
Assert.assertEquals("Wrong pushMplsType", PushMpls.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3)
+ .getType());
Assert.assertEquals("Wrong pushMplsEthertype", 255,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
- getAction().getAugmentation(EthertypeAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).
+ getAugmentation(EthertypeAction.class).
getEthertype().getValue().intValue());
Assert.assertEquals("Wrong pushPbbType", PushPbb.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4)
+ .getType());
Assert.assertEquals("Wrong pushPbbEthertype", 4095,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
- getAction().getAugmentation(EthertypeAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4)
+ .getAugmentation(EthertypeAction.class).
getEthertype().getValue().intValue());
}
Assert.assertEquals("Wrong bucketWatchGroup", 4,
message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertEquals("Wrong popVlanType", PopVlan.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getType());
Assert.assertEquals("Wrong popPbbType", PopPbb.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1)
+ .getType());
Assert.assertEquals("Wrong popMplsType", PopMpls.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2)
+ .getType());
Assert.assertEquals("Wrong popMplsEthertype", 207,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(2).
- getAction().getAugmentation(EthertypeAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2)
+ .getAugmentation(EthertypeAction.class).
getEthertype().getValue().intValue());
Assert.assertEquals("Wrong setQueueType", SetQueue.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3)
+ .getType());
Assert.assertEquals("Wrong setQueueQueueId", 13565952,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(3).
- getAction().getAugmentation(QueueIdAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3)
+ .getAugmentation(QueueIdAction.class).
getQueueId().intValue());
Assert.assertEquals("Wrong groupType", Group.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4)
+ .getType());
Assert.assertEquals("Wrong groupGroupId", 13565952,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(4).
- getAction().getAugmentation(GroupIdAction.class).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4)
+ .getAugmentation(GroupIdAction.class).
getGroupId().intValue());
Assert.assertEquals("Wrong decNwTtlType", DecNwTtl.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(5).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(5)
+ .getType());
}
/**
message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertEquals("Wrong nwTTlType", SetNwTtl.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getType());
Assert.assertEquals("Wrong nwTTlnwTTL", 14,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(0).
- getAction().getAugmentation(NwTtlAction.class).getNwTtl().intValue());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0)
+ .getAugmentation(NwTtlAction.class).getNwTtl().intValue());
Assert.assertEquals("Wrong setFieldType", SetField.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
- getAction().getType());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1)
+ .getType());
Assert.assertEquals("Wrong setFieldOXMClass", OpenflowBasicClass.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
- getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmClass());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1)
+ .getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmClass());
Assert.assertEquals("Wrong setFieldOXMField", InPort.class,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
- getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmMatchField());
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1)
+ .getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).getOxmMatchField());
Assert.assertEquals("Wrong setFieldOXMValue", 255,
- message.getGroupDesc().get(0).getBucketsList().get(0).getActionsList().get(1).
- getAction().getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).
+ message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1)
+ .getAugmentation(OxmFieldsAction.class).getMatchEntries().get(0).
getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());
}
}