Search in sources :

Example 66 with Ipv4

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project openflowplugin by opendaylight.

the class MatchResponseConvertor2Test method testWithMatchEntryWithSrcCidrMaskAndDstArbitraryBitMask.

/**
 * Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
 */
@Test
public void testWithMatchEntryWithSrcCidrMaskAndDstArbitraryBitMask() {
    final MatchBuilder builder = new MatchBuilder();
    builder.setType(OxmMatchType.class);
    final List<MatchEntry> entries = new ArrayList<>();
    MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata.class);
    entriesBuilder.setHasMask(true);
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Src.class);
    entriesBuilder.setHasMask(true);
    final Ipv4SrcCaseBuilder ipv4SrcCaseBuilder = new Ipv4SrcCaseBuilder();
    final Ipv4SrcBuilder ipv4SrcBuilder = new Ipv4SrcBuilder();
    ipv4SrcBuilder.setIpv4Address(new Ipv4Address("10.1.1.1"));
    ipv4SrcBuilder.setMask(new byte[] { (byte) 255, (byte) 255, (byte) 255, 0 });
    ipv4SrcCaseBuilder.setIpv4Src(ipv4SrcBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4SrcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Dst.class);
    entriesBuilder.setHasMask(true);
    final Ipv4DstCaseBuilder ipv4DstCaseBuilder = new Ipv4DstCaseBuilder();
    final Ipv4DstBuilder ipv4AddressBuilder = new Ipv4DstBuilder();
    ipv4AddressBuilder.setIpv4Address(new Ipv4Address("10.0.1.1"));
    ipv4AddressBuilder.setMask(new byte[] { (byte) 255, 0, (byte) 240, 0 });
    ipv4DstCaseBuilder.setIpv4Dst(ipv4AddressBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4DstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    builder.setMatchEntry(entries);
    final Match match = builder.build();
    final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
    datapathIdConvertorData.setDatapathId(new BigInteger("42"));
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder salMatch = convert(match, datapathIdConvertorData);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match builtMatch = salMatch.build();
    final Ipv4MatchArbitraryBitMask ipv4MatchArbitraryBitMask = (Ipv4MatchArbitraryBitMask) builtMatch.getLayer3Match();
    Assert.assertEquals("Wrong ipv4 src address", "10.1.1.1", ipv4MatchArbitraryBitMask.getIpv4SourceAddressNoMask().getValue());
    Assert.assertEquals("Wrong ipv4 dst address", "10.0.1.1", ipv4MatchArbitraryBitMask.getIpv4DestinationAddressNoMask().getValue());
}
Also used : Ipv4SrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4SrcCaseBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) VersionDatapathIdConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData) ArrayList(java.util.ArrayList) UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match) ArpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch) SctpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) Ipv4MatchArbitraryBitMask(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchArbitraryBitMask) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Ipv4DstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCaseBuilder) Ipv4DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.dst._case.Ipv4DstBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) BigInteger(java.math.BigInteger) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) Ipv4SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.src._case.Ipv4SrcBuilder) Test(org.junit.Test)

Example 67 with Ipv4

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project openflowplugin by opendaylight.

the class MatchResponseConvertor2Test method testWithMatchEntryWithSrcArbitraryBitMaskAndDstCidrMask.

/**
 * Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
 */
@Test
public void testWithMatchEntryWithSrcArbitraryBitMaskAndDstCidrMask() {
    final MatchBuilder builder = new MatchBuilder();
    builder.setType(OxmMatchType.class);
    final List<MatchEntry> entries = new ArrayList<>();
    MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata.class);
    entriesBuilder.setHasMask(true);
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Src.class);
    entriesBuilder.setHasMask(true);
    final Ipv4SrcCaseBuilder ipv4SrcCaseBuilder = new Ipv4SrcCaseBuilder();
    final Ipv4SrcBuilder ipv4SrcBuilder = new Ipv4SrcBuilder();
    ipv4SrcBuilder.setIpv4Address(new Ipv4Address("10.1.1.1"));
    ipv4SrcBuilder.setMask(new byte[] { (byte) 255, (byte) 0, (byte) 255, 0 });
    ipv4SrcCaseBuilder.setIpv4Src(ipv4SrcBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4SrcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Dst.class);
    entriesBuilder.setHasMask(true);
    final Ipv4DstCaseBuilder ipv4DstCaseBuilder = new Ipv4DstCaseBuilder();
    final Ipv4DstBuilder ipv4AddressBuilder = new Ipv4DstBuilder();
    ipv4AddressBuilder.setIpv4Address(new Ipv4Address("10.0.1.1"));
    ipv4AddressBuilder.setMask(new byte[] { (byte) 255, (byte) 255, (byte) 240, 0 });
    ipv4DstCaseBuilder.setIpv4Dst(ipv4AddressBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4DstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    builder.setMatchEntry(entries);
    final Match match = builder.build();
    final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
    datapathIdConvertorData.setDatapathId(new BigInteger("42"));
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder salMatch = convert(match, datapathIdConvertorData);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match builtMatch = salMatch.build();
    final Ipv4MatchArbitraryBitMask ipv4MatchArbitraryBitMask = (Ipv4MatchArbitraryBitMask) builtMatch.getLayer3Match();
    Assert.assertEquals("Wrong ipv4 src address", "10.1.1.1", ipv4MatchArbitraryBitMask.getIpv4SourceAddressNoMask().getValue());
    Assert.assertEquals("Wrong ipv4 dst address", "10.0.1.1", ipv4MatchArbitraryBitMask.getIpv4DestinationAddressNoMask().getValue());
}
Also used : Ipv4SrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4SrcCaseBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) VersionDatapathIdConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData) ArrayList(java.util.ArrayList) UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match) ArpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch) SctpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) Ipv4MatchArbitraryBitMask(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchArbitraryBitMask) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Ipv4DstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCaseBuilder) Ipv4DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.dst._case.Ipv4DstBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) BigInteger(java.math.BigInteger) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) Ipv4SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.src._case.Ipv4SrcBuilder) Test(org.junit.Test)

Example 68 with Ipv4

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 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());
}
Also used : ArpSpa(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSpa) UdpDstMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.UdpDstMatchFieldSerializer) PbbIsidMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.PbbIsidMatchFieldSerializer) IpProto(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto) Ipv6Src(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Src) Ipv6ExtHdrMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6ExtHdrMatchFieldSerializer) ArpSha(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha) Icmpv6Type(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type) SctpSrcMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.SctpSrcMatchFieldSerializer) Ipv4SrcMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv4SrcMatchFieldSerializer) Ipv6NdSll(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll) Icmpv6TypeMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv6TypeMatchFieldSerializer) SctpDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst) Icmpv4CodeMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv4CodeMatchFieldSerializer) TunnelIdMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TunnelIdMatchFieldSerializer) Consumer(java.util.function.Consumer) TcpFlagsMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TcpFlagsMatchFieldSerializer) ArpShaMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpShaMatchFieldSerializer) Icmpv4Type(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type) TcpSrc(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc) ArpThaMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpThaMatchFieldSerializer) InPort(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort) VlanVid(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid) UdpDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst) TunnelIpv4Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Dst) InPhyPortMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.InPhyPortMatchFieldSerializer) TcpDstMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TcpDstMatchFieldSerializer) Icmpv6CodeMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv6CodeMatchFieldSerializer) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) Ipv6NdSllMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6NdSllMatchFieldSerializer) UdpSrcMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.UdpSrcMatchFieldSerializer) EthType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType) EthTypeMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthTypeMatchFieldSerializer) EthSrcMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthSrcMatchFieldSerializer) IpEcnMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.IpEcnMatchFieldSerializer) Ipv6DstMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6DstMatchFieldSerializer) TcpDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpDst) MplsLabelMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MplsLabelMatchFieldSerializer) Ipv6NdTllMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6NdTllMatchFieldSerializer) IpDscpMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.IpDscpMatchFieldSerializer) MplsTcMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MplsTcMatchFieldSerializer) PbbIsid(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.PbbIsid) TunnelIpv4Src(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Src) Ipv4Src(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Src) UdpSrc(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc) ArpTpa(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTpa) Metadata(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata) ArpOp(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp) TunnelIpv4Src(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Src) Ipv6FlabelMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6FlabelMatchFieldSerializer) ArpTha(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha) TunnelId(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelId) VlanPcpMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.VlanPcpMatchFieldSerializer) MatchField(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField) MplsBosMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MplsBosMatchFieldSerializer) Ipv6Exthdr(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr) Ipv6NdTll(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTll) TcpFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags) InPortMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.InPortMatchFieldSerializer) VlanVidMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.VlanVidMatchFieldSerializer) MplsBos(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos) MplsLabel(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel) SctpDstMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.SctpDstMatchFieldSerializer) MplsTc(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsTc) EthDst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst) EthDstMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthDstMatchFieldSerializer) Icmpv6Code(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Code) Ipv4Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst) TunnelIpv4Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Dst) Ipv6SrcMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6SrcMatchFieldSerializer) Ipv6Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Dst) Ipv6NdTarget(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget) InPhyPort(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPhyPort) IpProtoMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.IpProtoMatchFieldSerializer) MetadataMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MetadataMatchFieldSerializer) ArpTpaMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpTpaMatchFieldSerializer) IpEcn(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn) TcpSrcMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TcpSrcMatchFieldSerializer) Icmpv4Code(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code) SctpSrc(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpSrc) Ipv6NdTargetMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6NdTargetMatchFieldSerializer) Icmpv4TypeMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv4TypeMatchFieldSerializer) VlanPcp(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp) ArpOpMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpOpMatchFieldSerializer) EthSrc(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc) Ipv6Flabel(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Flabel) Ipv4DstMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv4DstMatchFieldSerializer) ArpSpaMatchFieldSerializer(org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpSpaMatchFieldSerializer) IpDscp(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpDscp)

Example 69 with Ipv4

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project openflowplugin by opendaylight.

the class SetNwSrcActionSerializer method buildAction.

@Override
protected SetFieldCase buildAction(Action input) {
    final Address address = SetNwSrcActionCase.class.cast(input).getSetNwSrcAction().getAddress();
    final SetFieldBuilder builder = new SetFieldBuilder();
    if (Ipv4.class.isInstance(address)) {
        builder.setLayer3Match(new Ipv4MatchBuilder().setIpv4Source(Ipv4.class.cast(address).getIpv4Address()).build());
    } else if (Ipv6.class.isInstance(address)) {
        builder.setLayer3Match(new Ipv6MatchBuilder().setIpv6Source(Ipv6.class.cast(address).getIpv6Address()).build());
    }
    return new SetFieldCaseBuilder().setSetField(builder.build()).build();
}
Also used : Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) SetFieldCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder) Address(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address) Ipv6(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) SetFieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder)

Example 70 with Ipv4

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4 in project openflowplugin by opendaylight.

the class AbstractMatchEntrySerializer method writeIpv4Prefix.

/**
 * Serialize Ipv4 prefix (address and mask).
 *
 * @param prefix Ipv4 prefix
 * @param outBuffer output buffer
 */
protected static void writeIpv4Prefix(final Ipv4Prefix prefix, final ByteBuf outBuffer) {
    // Split address to IP and mask
    final Iterator<String> addressParts = IpConversionUtil.splitToParts(prefix);
    // Write address part of prefix
    writeIpv4Address(new Ipv4Address(addressParts.next()), outBuffer);
    // If prefix had mask, also write prefix
    Optional.ofNullable(MatchConvertorUtil.extractIpv4Mask(addressParts)).ifPresent(mask -> writeMask(mask, outBuffer, EncodeConstants.GROUPS_IN_IPV4_ADDRESS));
}
Also used : Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Aggregations

Test (org.junit.Test)89 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)35 ArrayList (java.util.ArrayList)32 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)23 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)22 ByteBuf (io.netty.buffer.ByteBuf)21 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)19 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)18 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)17 BigInteger (java.math.BigInteger)16 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)15 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)14 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)14 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)14 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)12 EtherType (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType)11 EthernetTypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder)11 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)11 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)10 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)10