use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactoryTest method testTable.
/**
* Testing OF10StatsReplyMessageFactory (Table) for correct deserialization.
*/
@Test
public void testTable() {
ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 " + "08 00 00 00 4A 41 4D 45 53 20 42 4F 4E 44 00 00 00 00 00 00 00 00 00 " + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 " + "00 00 00 30 00 00 00 10 FF 01 01 01 01 01 01 01 FF 01 01 01 01 01 01 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(statsFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyTableCase messageCase = (MultipartReplyTableCase) builtByFactory.getMultipartReplyBody();
MultipartReplyTable message = messageCase.getMultipartReplyTable();
Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
Assert.assertEquals("Wrong name", "JAMES BOND", message.getTableStats().get(0).getName());
Assert.assertEquals("Wrong wildcards", new FlowWildcardsV10(false, false, false, false, false, false, false, false, false, false), message.getTableStats().get(0).getWildcards());
Assert.assertEquals("Wrong src-mask", 32, message.getTableStats().get(0).getNwSrcMask().intValue());
Assert.assertEquals("Wrong dst-mask", 32, message.getTableStats().get(0).getNwDstMask().intValue());
Assert.assertEquals("Wrong max-entries", 48, message.getTableStats().get(0).getMaxEntries().longValue());
Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
Assert.assertEquals("Wrong lookupCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getTableStats().get(0).getLookupCount());
Assert.assertEquals("Wrong matchedCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }), message.getTableStats().get(0).getMatchedCount());
Assert.assertTrue("Unread data", bb.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst 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.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst in project lispflowmapping by opendaylight.
the class LispAddressUtil method asSrcDst.
public static SourceDestKey asSrcDst(String src, String dst, int smask, int dmask) {
SourceDestKeyBuilder builder = new SourceDestKeyBuilder();
builder.setSource(new SimpleAddress(asIpPrefix(src, smask)));
builder.setDest(new SimpleAddress(asIpPrefix(dst, dmask)));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst in project lispflowmapping by opendaylight.
the class LispAddressStringifier method getAddrString.
private static String getAddrString(Destination dst, LispAddress lispAddress) {
if (lispAddress == null) {
return "null";
}
Address addr = lispAddress.getAddress();
Long vni = null;
if (lispAddress.getVirtualNetworkId() != null) {
vni = lispAddress.getVirtualNetworkId().getValue();
}
return getAddrString(dst, addr, vni);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst in project lispflowmapping by opendaylight.
the class LispAddressStringifier method getStringFromAfiList.
protected static String getStringFromAfiList(Destination dst, AfiList addr) {
// AFI 16387, LCAF Type 1; Address List
// Example rendering:
// {192.0.2.1,192.0.2.2,2001:db8::1}
List<SimpleAddress> addresses = addr.getAfiList().getAddressList();
StringBuilder sb = new StringBuilder("{");
boolean needComma = false;
for (SimpleAddress a : addresses) {
if (needComma) {
sb.append(",");
}
sb.append(a.getValue());
needComma = true;
}
sb.append("}");
return sb.toString();
}
Aggregations