use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCaseBuilder in project openflowplugin by opendaylight.
the class TypeKeyMakerFactoryTest method testExperimenterMatchEntriesKeyMaker.
/**
* Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}.
*/
@Test
public void testExperimenterMatchEntriesKeyMaker() {
TypeKeyMaker<MatchEntry> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
Assert.assertNotNull("Null keyMaker", keyMaker);
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(ExperimenterClass.class);
builder.setOxmMatchField(OxmMatchFieldClass.class);
builder.setHasMask(true);
ExperimenterIdCaseBuilder caseBuilder = new ExperimenterIdCaseBuilder();
ExperimenterBuilder expBuilder = new ExperimenterBuilder();
expBuilder.setExperimenter(new ExperimenterId(42L));
caseBuilder.setExperimenter(expBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
MatchEntry entry = builder.build();
MessageTypeKey<?> key = keyMaker.make(entry);
Assert.assertNotNull("Null key", key);
MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, OxmMatchFieldClass.class);
comparationKey.setExperimenterId(42L);
Assert.assertEquals("Wrong key", comparationKey, key);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCaseBuilder in project openflowplugin by opendaylight.
the class AbstractOxmExperimenterMatchEntryDeserializer method createExperimenterIdCase.
protected ExperimenterIdCaseBuilder createExperimenterIdCase(MatchEntryBuilder entryBuilder, ByteBuf input) {
ExperimenterIdCaseBuilder expCaseBuilder = new ExperimenterIdCaseBuilder();
ExperimenterBuilder expBuilder = new ExperimenterBuilder();
expBuilder.setExperimenter(new ExperimenterId(input.readUnsignedInt()));
expCaseBuilder.setExperimenter(expBuilder.build());
return expCaseBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCaseBuilder in project openflowplugin by opendaylight.
the class MatchConvertor method tcpFlagsMatch.
private static void tcpFlagsMatch(List<MatchEntry> matchEntryList, TcpFlagsMatch tcpFlagsMatch) {
ExperimenterIdCaseBuilder expIdCaseBuilder = new ExperimenterIdCaseBuilder();
if (tcpFlagsMatch != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(ExperimenterClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(TcpFlags.class);
TcpFlagsContainerBuilder tcpFlagsContainerBuilder = new TcpFlagsContainerBuilder();
TcpFlagsBuilder tcpFlagsBuilder = new TcpFlagsBuilder();
tcpFlagsBuilder.setFlags(tcpFlagsMatch.getTcpFlags());
if (tcpFlagsMatch.getTcpFlagsMask() != null) {
matchEntryBuilder.setHasMask(true);
tcpFlagsBuilder.setMask(ByteUtil.unsignedShortToBytes(tcpFlagsMatch.getTcpFlagsMask()));
}
tcpFlagsContainerBuilder.setTcpFlags(tcpFlagsBuilder.build());
// Set experimenter ID.
ExperimenterBuilder experimenterBuilder = new ExperimenterBuilder();
experimenterBuilder.setExperimenter(new ExperimenterId(OFApprovedExperimenterIds.MATCH_TCP_FLAGS_EXP_ID));
expIdCaseBuilder.setExperimenter(experimenterBuilder.build());
expIdCaseBuilder.addAugmentation(TcpFlagsContainer.class, tcpFlagsContainerBuilder.build());
matchEntryBuilder.setMatchEntryValue(expIdCaseBuilder.build());
matchEntryList.add(matchEntryBuilder.build());
}
}
Aggregations