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));
});
}
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));
}
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));
}
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));
}
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;
}
Aggregations