use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData in project openflowplugin by opendaylight.
the class MatchConvertorTest method testIpv6MatchConversionWithMasks.
@Test
public void testIpv6MatchConversionWithMasks() {
MatchBuilder builder = new MatchBuilder();
Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
ipv6Builder.setIpv6Source(new Ipv6Prefix("::/24"));
ipv6Builder.setIpv6Destination(new Ipv6Prefix("::/64"));
builder.setLayer3Match(ipv6Builder.build());
Match match = builder.build();
Optional<List<MatchEntry>> entriesOptional = converterManager.convert(match, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MatchEntry> entries = entriesOptional.get();
Assert.assertEquals("Wrong entries size", 2, entries.size());
MatchEntry entry = entries.get(0);
checkEntryHeader(entry, Ipv6Src.class, true);
Assert.assertEquals("Wrong ipv6 src", "::", ((Ipv6SrcCase) entry.getMatchEntryValue()).getIpv6Src().getIpv6Address().getValue());
Assert.assertArrayEquals("Wrong ipv6 src mask", new byte[] { (byte) 255, (byte) 255, (byte) 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, ((Ipv6SrcCase) entry.getMatchEntryValue()).getIpv6Src().getMask());
entry = entries.get(1);
checkEntryHeader(entry, Ipv6Dst.class, true);
Assert.assertEquals("Wrong ipv6 dst", "::", ((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getIpv6Address().getValue());
Assert.assertArrayEquals("Wrong ipv6 src mask", new byte[] { (byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255, 0, 0, 0, 0, 0, 0, 0, 0 }, ((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getMask());
}
use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData in project openflowplugin by opendaylight.
the class MatchConvertorTest method testIpv4MatchArbitraryBitMaskwithNoMask.
@Test
public void testIpv4MatchArbitraryBitMaskwithNoMask() {
MatchBuilder builder = new MatchBuilder();
Ipv4MatchArbitraryBitMaskBuilder ipv4MatchArbitraryBitMaskBuilder = new Ipv4MatchArbitraryBitMaskBuilder();
ipv4MatchArbitraryBitMaskBuilder.setIpv4SourceAddressNoMask(new Ipv4Address("10.2.2.2"));
ipv4MatchArbitraryBitMaskBuilder.setIpv4DestinationAddressNoMask(new Ipv4Address("10.1.1.1"));
builder.setLayer3Match(ipv4MatchArbitraryBitMaskBuilder.build());
Match match = builder.build();
Optional<List<MatchEntry>> entriesOptional = converterManager.convert(match, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MatchEntry> entries = entriesOptional.get();
Assert.assertEquals("Wrong entries size", 2, entries.size());
MatchEntry entry = entries.get(0);
checkEntryHeader(entry, Ipv4Src.class, false);
Assert.assertEquals("wrong Ipv4Address source", "10.2.2.2", ((Ipv4SrcCase) entry.getMatchEntryValue()).getIpv4Src().getIpv4Address().getValue());
entry = entries.get(1);
checkEntryHeader(entry, Ipv4Dst.class, false);
Assert.assertEquals("wrong Ipv4Address destination", "10.1.1.1", ((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst().getIpv4Address().getValue());
}
use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData in project openflowplugin by opendaylight.
the class MatchConvertorTest method testIpv4MatchArbitraryBitMaskwithMask.
@Test
public void testIpv4MatchArbitraryBitMaskwithMask() {
Ipv4MatchArbitraryBitMaskBuilder ipv4MatchArbitraryBitMaskBuilder = new Ipv4MatchArbitraryBitMaskBuilder();
ipv4MatchArbitraryBitMaskBuilder.setIpv4SourceAddressNoMask(new Ipv4Address("10.2.2.2"));
ipv4MatchArbitraryBitMaskBuilder.setIpv4SourceArbitraryBitmask(new DottedQuad("0.0.255.0"));
ipv4MatchArbitraryBitMaskBuilder.setIpv4DestinationAddressNoMask(new Ipv4Address("10.1.1.1"));
ipv4MatchArbitraryBitMaskBuilder.setIpv4DestinationArbitraryBitmask(new DottedQuad("0.240.0.0"));
MatchBuilder builder = new MatchBuilder();
builder.setLayer3Match(ipv4MatchArbitraryBitMaskBuilder.build());
Match match = builder.build();
Optional<List<MatchEntry>> entriesOptional = converterManager.convert(match, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MatchEntry> entries = entriesOptional.get();
Assert.assertEquals("Wrong entries size", 2, entries.size());
MatchEntry entry = entries.get(0);
checkEntryHeader(entry, Ipv4Src.class, true);
Assert.assertEquals("wrong Ipv4Address source", "10.2.2.2", ((Ipv4SrcCase) entry.getMatchEntryValue()).getIpv4Src().getIpv4Address().getValue());
entry = entries.get(1);
checkEntryHeader(entry, Ipv4Dst.class, true);
Assert.assertEquals("wrong Ipv4Adress destination", "10.1.1.1", ((Ipv4DstCase) entry.getMatchEntryValue()).getIpv4Dst().getIpv4Address().getValue());
}
use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData in project openflowplugin by opendaylight.
the class MatchConvertorTest method testIpv6MatchArbitraryBitMask.
@Test
public void testIpv6MatchArbitraryBitMask() {
Ipv6MatchArbitraryBitMaskBuilder ipv6MatchArbitraryBitMaskBuilder = new Ipv6MatchArbitraryBitMaskBuilder();
ipv6MatchArbitraryBitMaskBuilder.setIpv6SourceAddressNoMask(new Ipv6Address("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0"));
ipv6MatchArbitraryBitMaskBuilder.setIpv6SourceArbitraryBitmask(new Ipv6ArbitraryMask("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:A555"));
ipv6MatchArbitraryBitMaskBuilder.setIpv6DestinationAddressNoMask(new Ipv6Address("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0"));
ipv6MatchArbitraryBitMaskBuilder.setIpv6DestinationArbitraryBitmask(new Ipv6ArbitraryMask("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:A555"));
MatchBuilder builder = new MatchBuilder();
builder.setLayer3Match(ipv6MatchArbitraryBitMaskBuilder.build());
Match match = builder.build();
Optional<List<MatchEntry>> entriesOptional = converterManager.convert(match, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MatchEntry> entries = entriesOptional.get();
Assert.assertEquals("Wrong entries size", 2, entries.size());
MatchEntry entry = entries.get(0);
checkEntryHeader(entry, Ipv6Src.class, true);
Assert.assertEquals("wrong Ipv6Adress source", "fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0", ((Ipv6SrcCase) entry.getMatchEntryValue()).getIpv6Src().getIpv6Address().getValue());
entry = entries.get(1);
checkEntryHeader(entry, Ipv6Dst.class, true);
Assert.assertEquals("wrong Ipv6Adress destination", "fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0", ((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getIpv6Address().getValue());
}
use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData in project openflowplugin by opendaylight.
the class MatchConvertorTest method testIpv6ExtHeaderConversion.
@Test
public void testIpv6ExtHeaderConversion() {
Ipv6MatchBuilder ipv6Builder = new Ipv6MatchBuilder();
Ipv6ExtHeaderBuilder extHdrBuilder = new Ipv6ExtHeaderBuilder();
extHdrBuilder.setIpv6Exthdr(358);
extHdrBuilder.setIpv6ExthdrMask(258);
ipv6Builder.setIpv6ExtHeader(extHdrBuilder.build());
MatchBuilder builder = new MatchBuilder();
builder.setLayer3Match(ipv6Builder.build());
Match match = builder.build();
Optional<List<MatchEntry>> entriesOptional = converterManager.convert(match, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MatchEntry> entries = entriesOptional.get();
Assert.assertEquals("Wrong entries size", 1, entries.size());
MatchEntry entry = entries.get(0);
checkEntryHeader(entry, Ipv6Exthdr.class, true);
Assert.assertEquals("Wrong ipv6 ext hdr", new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true), ((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getPseudoField());
Assert.assertArrayEquals("Wrong ipv6 ext hdr mask", new byte[] { 1, 2 }, ((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getMask());
}
Aggregations