use of org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MatchDeserializer in project openflowplugin by opendaylight.
the class MatchDeserializerInjector method injectDeserializers.
/**
* Injects deserializers into provided
* {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
*
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
for (MatchPath path : MatchPath.values()) {
final MatchDeserializer deserializer = new MatchDeserializer(path);
provider.registerDeserializer(new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_LENGTH, Match.class, path), deserializer);
// Inject new match entry serializers here using injector created by createInjector method
final Function<Integer, Function<Long, Function<Integer, Consumer<MatchEntryDeserializer>>>> injector = createInjector(deserializer, EncodeConstants.OF13_VERSION_ID);
// Wrapped injector that uses OPENFLOW_BASIC_CLASS
final Function<Integer, Consumer<MatchEntryDeserializer>> basicInjector = injector.apply(OxmMatchConstants.OPENFLOW_BASIC_CLASS).apply(null);
// Wrapped injector that uses EXPERIMENTER_CLASS
final Function<Long, Function<Integer, Consumer<MatchEntryDeserializer>>> experInjector = injector.apply(OxmMatchConstants.EXPERIMENTER_CLASS);
basicInjector.apply(OxmMatchConstants.ARP_OP).accept(new ArpOpEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_SHA).accept(new ArpSourceHardwareAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_THA).accept(new ArpTargetHardwareAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_SPA).accept(new ArpSourceTransportAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_TPA).accept(new ArpTargetTransportAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IN_PORT).accept(new InPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IN_PHY_PORT).accept(new InPhyPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.METADATA).accept(new MetadataEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ETH_DST).accept(new EthernetDestinationEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ETH_SRC).accept(new EthernetSourceEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ETH_TYPE).accept(new EthernetTypeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.VLAN_PCP).accept(new VlanPcpEntryDeserializer());
basicInjector.apply(OxmMatchConstants.VLAN_VID).accept(new VlanVidEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IP_DSCP).accept(new IpDscpEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IP_ECN).accept(new IpEcnEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IP_PROTO).accept(new IpProtoEntryDeserializer());
basicInjector.apply(OxmMatchConstants.TCP_SRC).accept(new TcpSourcePortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.TCP_DST).accept(new TcpDestinationPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.UDP_SRC).accept(new UdpSourcePortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.UDP_DST).accept(new UdpDestinationPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.SCTP_SRC).accept(new SctpSourcePortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.SCTP_DST).accept(new SctpDestinationPortEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV4_CODE).accept(new Icmpv4CodeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV4_TYPE).accept(new Icmpv4TypeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV6_CODE).accept(new Icmpv6CodeEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ICMPV6_TYPE).accept(new Icmpv6TypeEntryDeserializer());
// TODO: How to differentiate between Ipv4 and Tunnel when both are serialized to same format?
basicInjector.apply(OxmMatchConstants.IPV4_SRC).accept(new Ipv4SourceEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV4_DST).accept(new Ipv4DestinationEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_SRC).accept(new Ipv6SourceEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_DST).accept(new Ipv6DestinationEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_EXTHDR).accept(new Ipv6ExtHeaderEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_FLABEL).accept(new Ipv6FlabelEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_ND_SLL).accept(new Ipv6NdSllEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_ND_TLL).accept(new Ipv6NdTllEntryDeserializer());
basicInjector.apply(OxmMatchConstants.IPV6_ND_TARGET).accept(new Ipv6NdTargetEntryDeserializer());
basicInjector.apply(OxmMatchConstants.MPLS_LABEL).accept(new MplsLabelEntryDeserializer());
basicInjector.apply(OxmMatchConstants.MPLS_BOS).accept(new MplsBosEntryDeserializer());
basicInjector.apply(OxmMatchConstants.MPLS_TC).accept(new MplsTcEntryDeserializer());
basicInjector.apply(OxmMatchConstants.PBB_ISID).accept(new PbbEntryDeserializer());
basicInjector.apply(OxmMatchConstants.TUNNEL_ID).accept(new TunnelIdEntryDeserializer());
experInjector.apply(EncodeConstants.ONF_EXPERIMENTER_ID).apply(EncodeConstants.ONFOXM_ET_TCP_FLAGS).accept(new TcpFlagsEntryDeserializer());
}
}
Aggregations