Search in sources :

Example 56 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match in project bgpcep by opendaylight.

the class MatchBgpNeighborSetHandler method matchBgpNeighborSetCondition.

private boolean matchBgpNeighborSetCondition(@Nonnull final PeerId fromPeerId, @Nullable final PeerId toPeerId, final MatchBgpNeighborSet matchBgpNeighborSet) {
    final BgpNeighbor from = matchBgpNeighborSet.getFromNeighbor();
    Boolean match = null;
    if (from != null) {
        match = checkMatch(from.getNeighborSet(), fromPeerId, from.getMatchSetOptions());
    }
    if (match != null && !match) {
        return false;
    }
    final BgpNeighbor to = matchBgpNeighborSet.getToNeighbor();
    if (to != null) {
        match = checkMatch(to.getNeighborSet(), toPeerId, to.getMatchSetOptions());
    }
    return match;
}
Also used : BgpNeighbor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.BgpNeighbor)

Example 57 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match in project bgpcep by opendaylight.

the class Stateful07LSPIdentifierIpv4TlvParser method parseTlv.

@Override
public LspIdentifiers parseTlv(final ByteBuf buffer) throws PCEPDeserializerException {
    if (buffer == null) {
        return null;
    }
    Preconditions.checkArgument(buffer.readableBytes() == V4_LENGTH, "Length %s does not match LSP Identifiers Ipv4 tlv length.", buffer.readableBytes());
    final Ipv4Builder builder = new Ipv4Builder();
    builder.setIpv4TunnelSenderAddress(Ipv4Util.addressForByteBuf(buffer));
    final LspId lspId = new LspId((long) buffer.readUnsignedShort());
    final TunnelId tunnelId = new TunnelId(buffer.readUnsignedShort());
    builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(Ipv4Util.addressForByteBuf(buffer)));
    builder.setIpv4TunnelEndpointAddress(Ipv4Util.addressForByteBuf(buffer));
    final AddressFamily afi = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
    return new LspIdentifiersBuilder().setAddressFamily(afi).setLspId(lspId).setTunnelId(tunnelId).build();
}
Also used : LspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId) LspIdentifiersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder) Ipv4CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.Ipv4CaseBuilder) Ipv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder) Ipv4ExtendedTunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv4ExtendedTunnelId) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.AddressFamily) TunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId) Ipv4ExtendedTunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv4ExtendedTunnelId)

Example 58 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match in project openflowplugin by opendaylight.

the class MatchEntriesInitializer method registerMatchEntrySerializers.

/**
 * Registers match entry serializers into provided registry.
 * @param serializerRegistry registry to be initialized with match entry serializers
 */
public static void registerMatchEntrySerializers(SerializerRegistry serializerRegistry) {
    // register OF v1.3 OpenflowBasicClass match entry serializers
    Class<OpenflowBasicClass> oxmClass = OpenflowBasicClass.class;
    MatchEntrySerializerRegistryHelper<OpenflowBasicClass> helper = new MatchEntrySerializerRegistryHelper<>(EncodeConstants.OF13_VERSION_ID, oxmClass, serializerRegistry);
    helper.registerSerializer(InPort.class, new OxmInPortSerializer());
    helper.registerSerializer(InPhyPort.class, new OxmInPhyPortSerializer());
    helper.registerSerializer(Metadata.class, new OxmMetadataSerializer());
    helper.registerSerializer(EthDst.class, new OxmEthDstSerializer());
    helper.registerSerializer(EthSrc.class, new OxmEthSrcSerializer());
    helper.registerSerializer(EthType.class, new OxmEthTypeSerializer());
    helper.registerSerializer(VlanVid.class, new OxmVlanVidSerializer());
    helper.registerSerializer(VlanPcp.class, new OxmVlanPcpSerializer());
    helper.registerSerializer(IpDscp.class, new OxmIpDscpSerializer());
    helper.registerSerializer(IpEcn.class, new OxmIpEcnSerializer());
    helper.registerSerializer(IpProto.class, new OxmIpProtoSerializer());
    helper.registerSerializer(Ipv4Src.class, new OxmIpv4SrcSerializer());
    helper.registerSerializer(Ipv4Dst.class, new OxmIpv4DstSerializer());
    helper.registerSerializer(TcpSrc.class, new OxmTcpSrcSerializer());
    helper.registerSerializer(TcpDst.class, new OxmTcpDstSerializer());
    helper.registerSerializer(UdpSrc.class, new OxmUdpSrcSerializer());
    helper.registerSerializer(UdpDst.class, new OxmUdpDstSerializer());
    helper.registerSerializer(SctpSrc.class, new OxmSctpSrcSerializer());
    helper.registerSerializer(SctpDst.class, new OxmSctpDstSerializer());
    helper.registerSerializer(Icmpv4Type.class, new OxmIcmpv4TypeSerializer());
    helper.registerSerializer(Icmpv4Code.class, new OxmIcmpv4CodeSerializer());
    helper.registerSerializer(ArpOp.class, new OxmArpOpSerializer());
    helper.registerSerializer(ArpSpa.class, new OxmArpSpaSerializer());
    helper.registerSerializer(ArpTpa.class, new OxmArpTpaSerializer());
    helper.registerSerializer(ArpSha.class, new OxmArpShaSerializer());
    helper.registerSerializer(ArpTha.class, new OxmArpThaSerializer());
    helper.registerSerializer(Ipv6Src.class, new OxmIpv6SrcSerializer());
    helper.registerSerializer(Ipv6Dst.class, new OxmIpv6DstSerializer());
    helper.registerSerializer(Ipv6Flabel.class, new OxmIpv6FlabelSerializer());
    helper.registerSerializer(Icmpv6Type.class, new OxmIcmpv6TypeSerializer());
    helper.registerSerializer(Icmpv6Code.class, new OxmIcmpv6CodeSerializer());
    helper.registerSerializer(Ipv6NdTarget.class, new OxmIpv6NdTargetSerializer());
    helper.registerSerializer(Ipv6NdSll.class, new OxmIpv6NdSllSerializer());
    helper.registerSerializer(Ipv6NdTll.class, new OxmIpv6NdTllSerializer());
    helper.registerSerializer(MplsLabel.class, new OxmMplsLabelSerializer());
    helper.registerSerializer(MplsTc.class, new OxmMplsTcSerializer());
    helper.registerSerializer(MplsBos.class, new OxmMplsBosSerializer());
    helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer());
    helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer());
    helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer());
    // Register approved openflow match entry serializers
    helper.registerExperimenterSerializer(TcpFlags.class, EncodeConstants.ONF_EXPERIMENTER_ID, new OnfOxmTcpFlagsSerializer());
}
Also used : OxmArpTpaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpTpaSerializer) OxmIpv6NdTargetSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTargetSerializer) OxmArpSpaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer) OxmIcmpv6TypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6TypeSerializer) OxmEthTypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthTypeSerializer) OxmUdpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDstSerializer) OxmIpv6SrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6SrcSerializer) OpenflowBasicClass(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass) OxmTcpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpDstSerializer) OxmEthDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthDstSerializer) OxmIpDscpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpDscpSerializer) OxmMplsLabelSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsLabelSerializer) OxmUdpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer) OxmIcmpv4CodeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4CodeSerializer) OxmIcmpv4TypeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv4TypeSerializer) OxmSctpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpSrcSerializer) OxmMetadataSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMetadataSerializer) OxmVlanPcpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer) OxmIpv4SrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4SrcSerializer) OxmSctpDstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmSctpDstSerializer) OxmIcmpv6CodeSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIcmpv6CodeSerializer) OxmTcpSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTcpSrcSerializer) OxmVlanVidSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer) OxmIpProtoSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpProtoSerializer) OxmIpv4DstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv4DstSerializer) OxmArpShaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer) OxmIpv6NdSllSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdSllSerializer) OxmArpThaSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpThaSerializer) OxmIpv6NdTllSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6NdTllSerializer) OxmIpv6FlabelSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6FlabelSerializer) OxmInPortSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPortSerializer) OxmIpv6DstSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6DstSerializer) MatchEntrySerializerRegistryHelper(org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper) OxmInPhyPortSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmInPhyPortSerializer) OxmMplsTcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsTcSerializer) OxmPbbIsidSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmPbbIsidSerializer) OxmEthSrcSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmEthSrcSerializer) OxmArpOpSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer) OxmMplsBosSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmMplsBosSerializer) OxmIpEcnSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpEcnSerializer) OxmTunnelIdSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmTunnelIdSerializer) OxmIpv6ExtHdrSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmIpv6ExtHdrSerializer) OnfOxmTcpFlagsSerializer(org.opendaylight.openflowjava.protocol.impl.serialization.match.ext.OnfOxmTcpFlagsSerializer)

Example 59 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match in project openflowplugin by opendaylight.

the class MultipartRequestInputFactory method serializeFlowBody.

private void serializeFlowBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
    MultipartRequestFlowCase flowCase = (MultipartRequestFlowCase) multipartRequestBody;
    MultipartRequestFlow flow = flowCase.getMultipartRequestFlow();
    output.writeByte(flow.getTableId().byteValue());
    output.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01);
    output.writeInt(flow.getOutPort().intValue());
    output.writeInt(flow.getOutGroup().intValue());
    output.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02);
    output.writeLong(flow.getCookie().longValue());
    output.writeLong(flow.getCookieMask().longValue());
    OFSerializer<Match> serializer = registry.getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class));
    serializer.serialize(flow.getMatch(), output);
}
Also used : MultipartRequestFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase) MultipartRequestFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlow) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)

Example 60 with Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match in project openflowplugin by opendaylight.

the class MultipartReplyTableFeaturesDeserializer method deserialize.

@Override
public MultipartReplyBody deserialize(ByteBuf message) {
    final MultipartReplyTableFeaturesBuilder builder = new MultipartReplyTableFeaturesBuilder();
    final List<TableFeatures> items = new ArrayList<>();
    while (message.readableBytes() > 0) {
        final int itemLength = message.readUnsignedShort();
        final TableFeaturesBuilder itemBuilder = new TableFeaturesBuilder().setTableId(message.readUnsignedByte());
        message.skipBytes(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
        final String name = ByteBufUtils.decodeNullTerminatedString(message, MAX_TABLE_NAME_LENGTH);
        final byte[] match = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(match);
        final byte[] write = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(write);
        items.add(itemBuilder.setKey(new TableFeaturesKey(itemBuilder.getTableId())).setName(name).setMetadataMatch(new BigInteger(1, match)).setMetadataWrite(new BigInteger(1, write)).setConfig(readTableConfig(message)).setMaxEntries(message.readUnsignedInt()).setTableProperties(readTableProperties(message, itemLength - MULTIPART_REPLY_TABLE_FEATURES_STRUCTURE_LENGTH)).build());
    }
    return builder.setTableFeatures(items).build();
}
Also used : TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures) TableFeaturesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey) ArrayList(java.util.ArrayList) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder) BigInteger(java.math.BigInteger) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder)

Aggregations

Test (org.junit.Test)182 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)138 ArrayList (java.util.ArrayList)82 BigInteger (java.math.BigInteger)66 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)62 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)61 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)60 ByteBuf (io.netty.buffer.ByteBuf)59 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)53 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)49 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)48 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match)45 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)44 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)43 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)43 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)42 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)41 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)40 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)40 Ipv4Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match)39