Search in sources :

Example 76 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder in project openflowplugin by opendaylight.

the class Ipv6ArbitraryBitMaskDestinationEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final Ipv6Address ipv6Address = new Ipv6Address("aaaa:bbbb:1111:2222::");
    final Ipv6ArbitraryMask ipv6mask = new Ipv6ArbitraryMask("ffff:ffff:ffff:ffff::");
    final Match ipv6abmMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder().setIpv6DestinationAddressNoMask(ipv6Address).setIpv6DestinationArbitraryBitmask(ipv6mask).build()).build();
    assertMatch(ipv6abmMatch, true, (out) -> {
        byte[] address = new byte[16];
        out.readBytes(address);
        assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(ipv6Address));
        byte[] mask = new byte[16];
        out.readBytes(mask);
        assertArrayEquals(mask, IpConversionUtil.convertIpv6ArbitraryMaskToByteArray(ipv6mask));
    });
    final Match ipv6abmMatchNoMask = new MatchBuilder().setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder().setIpv6DestinationAddressNoMask(ipv6Address).build()).build();
    assertMatch(ipv6abmMatchNoMask, false, (out) -> {
        byte[] address = new byte[16];
        out.readBytes(address);
        assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(ipv6Address));
    });
}
Also used : Ipv6ArbitraryMask(org.opendaylight.yang.gen.v1.urn.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask) Ipv6MatchArbitraryBitMaskBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchArbitraryBitMaskBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 77 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder in project openflowplugin by opendaylight.

the class Ipv6LabelEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final long ipv6flowLabel = 358;
    final long ipv6flowLabelMask = 100;
    final Match ipv6flowLabelMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6Label(new Ipv6LabelBuilder().setIpv6Flabel(new Ipv6FlowLabel(ipv6flowLabel)).setFlabelMask(new Ipv6FlowLabel(ipv6flowLabelMask)).build()).build()).build();
    assertMatch(ipv6flowLabelMatch, true, (out) -> {
        assertEquals(out.readUnsignedInt(), ipv6flowLabel);
        byte[] mask = new byte[4];
        out.readBytes(mask);
        assertArrayEquals(mask, ByteUtil.unsignedIntToBytes(ipv6flowLabelMask));
    });
    final Match ipv6exyHdrMatchNoMask = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6Label(new Ipv6LabelBuilder().setIpv6Flabel(new Ipv6FlowLabel(ipv6flowLabel)).build()).build()).build();
    assertMatch(ipv6exyHdrMatchNoMask, false, (out) -> assertEquals(out.readUnsignedInt(), ipv6flowLabel));
}
Also used : Ipv6LabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder) Ipv6FlowLabel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 78 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder in project openflowplugin by opendaylight.

the class MplsBosEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final short mplsBos = (short) 1;
    final Match mplsBosMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsBos(mplsBos).build()).build();
    // TODO: Why are we using short in models instead of boolean?
    assertMatch(mplsBosMatch, false, (out) -> assertEquals(out.readBoolean(), mplsBos != 0));
}
Also used : ProtocolMatchFieldsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 79 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder in project openflowplugin by opendaylight.

the class SctpDestinationPortEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final int sctp = 10;
    final Match sctpMatch = new MatchBuilder().setLayer4Match(new SctpMatchBuilder().setSctpDestinationPort(new PortNumber(sctp)).build()).build();
    assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), sctp));
}
Also used : SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 80 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginTestCommandProvider method createInphyportMatch.

private static MatchBuilder createInphyportMatch(final NodeId nodeId) {
    final MatchBuilder match = new MatchBuilder();
    match.setInPort(new NodeConnectorId(nodeId + ":202"));
    match.setInPhyPort(new NodeConnectorId(nodeId + ":10122"));
    return match;
}
Also used : NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)

Aggregations

MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)220 Test (org.junit.Test)135 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)90 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)84 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)80 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)69 ArrayList (java.util.ArrayList)65 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)63 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)56 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)55 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)54 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)53 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)52 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)51 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)51 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)51 BigInteger (java.math.BigInteger)46 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)44 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)42 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)40