use of org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey in project openflowplugin by opendaylight.
the class MatchEntryDeserializerRegistryHelper method registerExperimenter.
public void registerExperimenter(int oxmField, long expId, OFGeneralDeserializer deserializer) {
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(version, OxmMatchConstants.EXPERIMENTER_CLASS, oxmField);
key.setExperimenterId(expId);
registry.registerDeserializer(key, deserializer);
}
use of org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey in project openflowplugin by opendaylight.
the class MatchEntryDeserializerRegistryHelper method register.
/**
* Registers match entry deserializer under provided oxmfield.
*
* @param oxmField oxm_field value/code
* @param deserializer deserializer instance
*/
public void register(int oxmField, OFGeneralDeserializer deserializer) {
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(version, oxmClass, oxmField);
key.setExperimenterId(null);
registry.registerDeserializer(key, deserializer);
}
use of org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey in project openflowplugin by opendaylight.
the class CodeKeyMakerFactory method createMatchEntriesKeyMaker.
public static CodeKeyMaker createMatchEntriesKeyMaker(short version) {
return new AbstractCodeKeyMaker(version) {
@Override
public MessageCodeKey make(ByteBuf input) {
int oxmClass = input.getUnsignedShort(input.readerIndex());
int oxmField = input.getUnsignedByte(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(getVersion(), oxmClass, oxmField);
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
key.setExperimenterId(expId);
return key;
}
key.setExperimenterId(null);
return key;
}
};
}
use of org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey in project openflowplugin by opendaylight.
the class MatchDeserializerTest method testIpv6Address.
/**
* Testing Ipv6 address deserialization.
*/
@Test
public void testIpv6Address() {
ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("80 00 34 10 00 00 00 01 00 02 00 03 00 04 00 05 00 06 0F 07");
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 26);
key.setExperimenterId(null);
OFDeserializer<MatchEntry> entryDeserializer = registry.getDeserializer(key);
MatchEntry entry = entryDeserializer.deserialize(buffer);
Assert.assertEquals("Wrong Ipv6 address format", new Ipv6Address("0:1:2:3:4:5:6:f07"), ((Ipv6SrcCase) entry.getMatchEntryValue()).getIpv6Src().getIpv6Address());
}
use of org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey in project openflowplugin by opendaylight.
the class TableFeaturesMatchFieldDeserializer method deserialize.
/**
* Deserialize match field if deserializer supports it, otherwise returns empty optional.
*
* @param message input buffer
* @return set field match
*/
public Optional<SetFieldMatch> deserialize(ByteBuf message) {
int oxmClass = message.getUnsignedShort(message.readerIndex());
int oxmField = message.getUnsignedByte(message.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
Long expId = null;
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
expId = message.getUnsignedInt(message.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
}
final MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, oxmClass, oxmField);
key.setExperimenterId(expId);
return Optional.ofNullable(codeToFieldMap.get(key)).map(clazz -> processHeader(message).setKey(new SetFieldMatchKey(clazz)).setMatchType(clazz).build());
}
Aggregations