Search in sources :

Example 1 with MatchPath

use of org.opendaylight.openflowplugin.extension.api.path.MatchPath 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());
    }
}
Also used : IpProtoEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.IpProtoEntryDeserializer) TunnelIdEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.TunnelIdEntryDeserializer) Icmpv4CodeEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv4CodeEntryDeserializer) IpEcnEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.IpEcnEntryDeserializer) IpDscpEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.IpDscpEntryDeserializer) TcpSourcePortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.TcpSourcePortEntryDeserializer) Consumer(java.util.function.Consumer) MatchDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MatchDeserializer) InPhyPortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.InPhyPortEntryDeserializer) SctpSourcePortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.SctpSourcePortEntryDeserializer) MplsTcEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MplsTcEntryDeserializer) VlanVidEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.VlanVidEntryDeserializer) MplsBosEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MplsBosEntryDeserializer) Ipv6SourceEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv6SourceEntryDeserializer) Ipv6ExtHeaderEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv6ExtHeaderEntryDeserializer) Ipv6NdTllEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv6NdTllEntryDeserializer) Ipv6NdSllEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv6NdSllEntryDeserializer) UdpSourcePortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.UdpSourcePortEntryDeserializer) ArpSourceTransportAddressEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpSourceTransportAddressEntryDeserializer) Icmpv6TypeEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv6TypeEntryDeserializer) Ipv4DestinationEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv4DestinationEntryDeserializer) SctpDestinationPortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.SctpDestinationPortEntryDeserializer) TcpDestinationPortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.TcpDestinationPortEntryDeserializer) TcpFlagsEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.TcpFlagsEntryDeserializer) ArpTargetTransportAddressEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpTargetTransportAddressEntryDeserializer) MatchEntryDeserializer(org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MatchEntryDeserializer) PbbEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.PbbEntryDeserializer) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) VlanPcpEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.VlanPcpEntryDeserializer) Function(java.util.function.Function) MplsLabelEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MplsLabelEntryDeserializer) UdpDestinationPortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.UdpDestinationPortEntryDeserializer) Ipv6DestinationEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv6DestinationEntryDeserializer) EthernetDestinationEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.EthernetDestinationEntryDeserializer) Ipv4SourceEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv4SourceEntryDeserializer) Icmpv4TypeEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv4TypeEntryDeserializer) MatchPath(org.opendaylight.openflowplugin.extension.api.path.MatchPath) ArpOpEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpOpEntryDeserializer) MetadataEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MetadataEntryDeserializer) ArpTargetHardwareAddressEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpTargetHardwareAddressEntryDeserializer) Ipv6NdTargetEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv6NdTargetEntryDeserializer) EthernetSourceEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.EthernetSourceEntryDeserializer) EthernetTypeEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.EthernetTypeEntryDeserializer) ArpSourceHardwareAddressEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpSourceHardwareAddressEntryDeserializer) MessageCodeMatchKey(org.opendaylight.openflowplugin.impl.protocol.deserialization.key.MessageCodeMatchKey) InPortEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.InPortEntryDeserializer) Ipv6FlabelEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Ipv6FlabelEntryDeserializer) Icmpv6CodeEntryDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv6CodeEntryDeserializer)

Example 2 with MatchPath

use of org.opendaylight.openflowplugin.extension.api.path.MatchPath in project openflowplugin by opendaylight.

the class MatchExtensionHelper method processExtension.

/**
 * Processes an extension.
 *
 * @param ofVersion openflow version
 * @param matchPath match path
 * @param matchEntry match entry
 * @return an ExtensionListBuilder
 */
private static ExtensionListBuilder processExtension(MatchEntry matchEntry, short ofVersion, MatchPath matchPath) {
    ExtensionListBuilder extListBld = null;
    // TODO: EXTENSION PROPOSAL (match, OFJava to MD-SAL)
    MatchEntrySerializerKey<? extends OxmClassBase, ? extends MatchField> key = new MatchEntrySerializerKey<>(ofVersion, matchEntry.getOxmClass(), matchEntry.getOxmMatchField());
    if (null != OFSessionUtil.getExtensionConvertorProvider()) {
        ConvertorFromOFJava<MatchEntry, MatchPath> convertor = OFSessionUtil.getExtensionConvertorProvider().getConverter(key);
        if (convertor != null) {
            ExtensionAugment<? extends Augmentation<Extension>> extensionMatch = convertor.convert(matchEntry, matchPath);
            ExtensionBuilder extBld = new ExtensionBuilder();
            extBld.addAugmentation(extensionMatch.getAugmentationClass(), extensionMatch.getAugmentationObject());
            extListBld = new ExtensionListBuilder();
            extListBld.setExtension(extBld.build());
            extListBld.setExtensionKey(extensionMatch.getKey());
        }
    }
    return extListBld;
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) ExtensionListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionListBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) MatchPath(org.opendaylight.openflowplugin.extension.api.path.MatchPath) ExtensionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.ExtensionBuilder) MatchEntrySerializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)

Aggregations

MatchPath (org.opendaylight.openflowplugin.extension.api.path.MatchPath)2 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)1 MatchEntryDeserializer (org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MatchEntryDeserializer)1 MessageCodeMatchKey (org.opendaylight.openflowplugin.impl.protocol.deserialization.key.MessageCodeMatchKey)1 ArpOpEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpOpEntryDeserializer)1 ArpSourceHardwareAddressEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpSourceHardwareAddressEntryDeserializer)1 ArpSourceTransportAddressEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpSourceTransportAddressEntryDeserializer)1 ArpTargetHardwareAddressEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpTargetHardwareAddressEntryDeserializer)1 ArpTargetTransportAddressEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpTargetTransportAddressEntryDeserializer)1 EthernetDestinationEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.EthernetDestinationEntryDeserializer)1 EthernetSourceEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.EthernetSourceEntryDeserializer)1 EthernetTypeEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.EthernetTypeEntryDeserializer)1 Icmpv4CodeEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv4CodeEntryDeserializer)1 Icmpv4TypeEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv4TypeEntryDeserializer)1 Icmpv6CodeEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv6CodeEntryDeserializer)1 Icmpv6TypeEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.Icmpv6TypeEntryDeserializer)1 InPhyPortEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.InPhyPortEntryDeserializer)1 InPortEntryDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.match.InPortEntryDeserializer)1