use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartMatchFieldSerializerInjector method injectSerializers.
/**
* Injects multipart match field serializers into provided
* {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
*
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
// Inject new message serializers here using injector created by createInjector method
final Function<Class<? extends MatchField>, Consumer<OFSerializer<SetFieldMatch>>> injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(ArpOp.class).accept(new ArpOpMatchFieldSerializer());
injector.apply(ArpSha.class).accept(new ArpShaMatchFieldSerializer());
injector.apply(ArpSpa.class).accept(new ArpSpaMatchFieldSerializer());
injector.apply(ArpTha.class).accept(new ArpThaMatchFieldSerializer());
injector.apply(ArpTpa.class).accept(new ArpTpaMatchFieldSerializer());
injector.apply(EthDst.class).accept(new EthDstMatchFieldSerializer());
injector.apply(EthSrc.class).accept(new EthSrcMatchFieldSerializer());
injector.apply(EthType.class).accept(new EthTypeMatchFieldSerializer());
injector.apply(Icmpv4Code.class).accept(new Icmpv4CodeMatchFieldSerializer());
injector.apply(Icmpv4Type.class).accept(new Icmpv4TypeMatchFieldSerializer());
injector.apply(Icmpv6Code.class).accept(new Icmpv6CodeMatchFieldSerializer());
injector.apply(Icmpv6Type.class).accept(new Icmpv6TypeMatchFieldSerializer());
injector.apply(InPhyPort.class).accept(new InPhyPortMatchFieldSerializer());
injector.apply(InPort.class).accept(new InPortMatchFieldSerializer());
injector.apply(IpDscp.class).accept(new IpDscpMatchFieldSerializer());
injector.apply(IpEcn.class).accept(new IpEcnMatchFieldSerializer());
injector.apply(IpProto.class).accept(new IpProtoMatchFieldSerializer());
injector.apply(Ipv4Dst.class).accept(new Ipv4DstMatchFieldSerializer());
injector.apply(Ipv4Src.class).accept(new Ipv4SrcMatchFieldSerializer());
injector.apply(Ipv6Dst.class).accept(new Ipv6DstMatchFieldSerializer());
injector.apply(Ipv6Exthdr.class).accept(new Ipv6ExtHdrMatchFieldSerializer());
injector.apply(Ipv6Flabel.class).accept(new Ipv6FlabelMatchFieldSerializer());
injector.apply(Ipv6NdSll.class).accept(new Ipv6NdSllMatchFieldSerializer());
injector.apply(Ipv6NdTarget.class).accept(new Ipv6NdTargetMatchFieldSerializer());
injector.apply(Ipv6NdTll.class).accept(new Ipv6NdTllMatchFieldSerializer());
injector.apply(Ipv6Src.class).accept(new Ipv6SrcMatchFieldSerializer());
injector.apply(Metadata.class).accept(new MetadataMatchFieldSerializer());
injector.apply(MplsBos.class).accept(new MplsBosMatchFieldSerializer());
injector.apply(MplsLabel.class).accept(new MplsLabelMatchFieldSerializer());
injector.apply(MplsTc.class).accept(new MplsTcMatchFieldSerializer());
injector.apply(PbbIsid.class).accept(new PbbIsidMatchFieldSerializer());
injector.apply(SctpDst.class).accept(new SctpDstMatchFieldSerializer());
injector.apply(SctpSrc.class).accept(new SctpSrcMatchFieldSerializer());
injector.apply(TcpDst.class).accept(new TcpDstMatchFieldSerializer());
injector.apply(TcpFlags.class).accept(new TcpFlagsMatchFieldSerializer());
injector.apply(TcpSrc.class).accept(new TcpSrcMatchFieldSerializer());
injector.apply(TunnelId.class).accept(new TunnelIdMatchFieldSerializer());
// TODO: Finish implementation of Tunnel Ipv4 src and dst
injector.apply(TunnelIpv4Dst.class).accept(new Ipv4DstMatchFieldSerializer());
injector.apply(TunnelIpv4Src.class).accept(new Ipv4SrcMatchFieldSerializer());
injector.apply(UdpDst.class).accept(new UdpDstMatchFieldSerializer());
injector.apply(UdpSrc.class).accept(new UdpSrcMatchFieldSerializer());
injector.apply(VlanPcp.class).accept(new VlanPcpMatchFieldSerializer());
injector.apply(VlanVid.class).accept(new VlanVidMatchFieldSerializer());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyFlowAggregateStatsDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(packetCount);
final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(byteCount);
final MultipartReplyFlowAggregateStatsBuilder builder = new MultipartReplyFlowAggregateStatsBuilder().setPacketCount(new Counter64(new BigInteger(1, packetCount))).setByteCount(new Counter64(new BigInteger(1, byteCount))).setFlowCount(new Counter32(message.readUnsignedInt()));
message.skipBytes(PADDING_IN_AGGREGATE_HEADER);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyMessageDeserializer method deserialize.
@Override
public MultipartReply deserialize(ByteBuf message) {
final long xid = message.readUnsignedInt();
final int type = message.readUnsignedShort();
final boolean reqMore = (message.readUnsignedShort() & 0x01) != 0;
message.skipBytes(PADDING_IN_MULTIPART_REPLY_HEADER);
final OFDeserializer<MultipartReplyBody> deserializer = Preconditions.checkNotNull(registry).getDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, type, MultipartReplyBody.class));
return new MultipartReplyBuilder().setVersion((short) EncodeConstants.OF13_VERSION_ID).setXid(xid).setRequestMore(reqMore).setMultipartReplyBody(deserializer.deserialize(message)).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyPortDescDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyPortDescBuilder builder = new MultipartReplyPortDescBuilder();
final List<Ports> items = new ArrayList<>();
while (message.readableBytes() > 0) {
final PortsBuilder itemBuilder = new PortsBuilder();
itemBuilder.setPortNumber(new PortNumberUni(message.readUnsignedInt()));
message.skipBytes(PADDING_IN_PORT_DESC_HEADER_01);
itemBuilder.setHardwareAddress(ByteBufUtils.readIetfMacAddress(message));
message.skipBytes(PADDING_IN_PORT_DESC_HEADER_02);
items.add(itemBuilder.setName(ByteBufUtils.decodeNullTerminatedString(message, EncodeConstants.MAX_PORT_NAME_LENGTH)).setConfiguration(readPortConfig(message)).setState(readPortState(message)).setCurrentFeature(readPortFeatures(message)).setAdvertisedFeatures(readPortFeatures(message)).setSupported(readPortFeatures(message)).setPeerFeatures(readPortFeatures(message)).setCurrentSpeed(message.readUnsignedInt()).setMaximumSpeed(message.readUnsignedInt()).build());
}
return builder.setPorts(items).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message 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