Search in sources :

Example 1 with Ipv6ExthdrFlags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags in project openflowplugin by opendaylight.

the class MatchDeserializerTest method testMatch.

/**
 * Testing match deserialization.
 */
@Test
public void testMatch() {
    ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 01 A8 " + "80 00 00 04 00 00 00 01 " + "80 00 02 04 00 00 00 02 " + "80 00 05 10 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 04 " + "80 00 07 0C 00 00 00 00 00 05 00 00 00 00 00 06 " + "80 00 09 0C 00 00 00 00 00 07 00 00 00 00 00 08 " + "80 00 0A 02 00 09 " + "80 00 0D 04 00 0A 00 0B " + "80 00 0E 01 0C " + "80 00 10 01 0D " + "80 00 12 01 0E " + "80 00 14 01 0F " + "80 00 17 08 0A 00 00 01 00 00 FF 00 " + "80 00 19 08 0A 00 00 02 00 00 00 FF " + "80 00 1A 02 00 03 " + "80 00 1C 02 00 04 " + "80 00 1E 02 00 05 " + "80 00 20 02 00 06 " + "80 00 22 02 00 07 " + "80 00 24 02 00 08 " + "80 00 26 01 05 " + "80 00 28 01 07 " + "80 00 2A 02 00 10 " + "80 00 2D 08 0A 00 00 09 00 00 FF 00 " + "80 00 2F 08 0A 00 00 0A 00 00 00 FF " + "80 00 31 0C 00 00 00 00 00 01 00 00 00 00 00 03 " + "80 00 33 0C 00 00 00 00 00 02 00 00 00 00 00 04 " + "80 00 35 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 " + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 " + "80 00 37 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 " + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 " + "80 00 38 04 00 00 00 02 " + "80 00 3A 01 15 " + "80 00 3C 01 17 " + // ipv6ndtarget
    "80 00 3E 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 " + "80 00 40 06 00 05 00 00 00 01 " + "80 00 42 06 00 05 00 00 00 02 " + "80 00 44 04 00 00 02 03 " + "80 00 46 01 03 " + "80 00 48 01 01 " + "80 00 4B 06 00 00 02 00 00 01 " + "80 00 4D 10 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 FF " + "80 00 4F 04 00 00 03 04");
    Match match = matchDeserializer.deserialize(buffer);
    Assert.assertEquals("Wrong match type", OxmMatchType.class, match.getType());
    Assert.assertEquals("Wrong match entries size", 40, match.getMatchEntry().size());
    List<MatchEntry> entries = match.getMatchEntry();
    MatchEntry entry0 = entries.get(0);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry0.getOxmClass());
    Assert.assertEquals("Wrong entry field", InPort.class, entry0.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry0.isHasMask());
    Assert.assertEquals("Wrong entry value", 1, ((InPortCase) entry0.getMatchEntryValue()).getInPort().getPortNumber().getValue().intValue());
    MatchEntry entry1 = entries.get(1);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry1.getOxmClass());
    Assert.assertEquals("Wrong entry field", InPhyPort.class, entry1.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry1.isHasMask());
    Assert.assertEquals("Wrong entry value", 2, ((InPhyPortCase) entry1.getMatchEntryValue()).getInPhyPort().getPortNumber().getValue().intValue());
    MatchEntry entry2 = entries.get(2);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry2.getOxmClass());
    Assert.assertEquals("Wrong entry field", Metadata.class, entry2.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry2.isHasMask());
    Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), ((MetadataCase) entry2.getMatchEntryValue()).getMetadata().getMetadata());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 04"), ((MetadataCase) entry2.getMatchEntryValue()).getMetadata().getMask());
    MatchEntry entry3 = entries.get(3);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry3.getOxmClass());
    Assert.assertEquals("Wrong entry field", EthDst.class, entry3.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry3.isHasMask());
    Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:05"), ((EthDstCase) entry3.getMatchEntryValue()).getEthDst().getMacAddress());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 06"), ((EthDstCase) entry3.getMatchEntryValue()).getEthDst().getMask());
    MatchEntry entry4 = entries.get(4);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry4.getOxmClass());
    Assert.assertEquals("Wrong entry field", EthSrc.class, entry4.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry4.isHasMask());
    Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:07"), ((EthSrcCase) entry4.getMatchEntryValue()).getEthSrc().getMacAddress());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 08"), ((EthSrcCase) entry4.getMatchEntryValue()).getEthSrc().getMask());
    MatchEntry entry5 = entries.get(5);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry5.getOxmClass());
    Assert.assertEquals("Wrong entry field", EthType.class, entry5.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry5.isHasMask());
    Assert.assertEquals("Wrong entry value", 9, ((EthTypeCase) entry5.getMatchEntryValue()).getEthType().getEthType().getValue().intValue());
    MatchEntry entry6 = entries.get(6);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry6.getOxmClass());
    Assert.assertEquals("Wrong entry field", VlanVid.class, entry6.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry6.isHasMask());
    Assert.assertEquals("Wrong entry value", 10, ((VlanVidCase) entry6.getMatchEntryValue()).getVlanVid().getVlanVid().intValue());
    Assert.assertEquals("Wrong entry value", false, ((VlanVidCase) entry6.getMatchEntryValue()).getVlanVid().isCfiBit());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 0B"), ((VlanVidCase) entry6.getMatchEntryValue()).getVlanVid().getMask());
    MatchEntry entry7 = entries.get(7);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry7.getOxmClass());
    Assert.assertEquals("Wrong entry field", VlanPcp.class, entry7.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry7.isHasMask());
    Assert.assertEquals("Wrong entry value", 12, ((VlanPcpCase) entry7.getMatchEntryValue()).getVlanPcp().getVlanPcp().intValue());
    MatchEntry entry8 = entries.get(8);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry8.getOxmClass());
    Assert.assertEquals("Wrong entry field", IpDscp.class, entry8.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry8.isHasMask());
    Assert.assertEquals("Wrong entry value", 13, ((IpDscpCase) entry8.getMatchEntryValue()).getIpDscp().getDscp().getValue().intValue());
    MatchEntry entry9 = entries.get(9);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry9.getOxmClass());
    Assert.assertEquals("Wrong entry field", IpEcn.class, entry9.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry9.isHasMask());
    Assert.assertEquals("Wrong entry value", 14, ((IpEcnCase) entry9.getMatchEntryValue()).getIpEcn().getEcn().intValue());
    MatchEntry entry10 = entries.get(10);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry10.getOxmClass());
    Assert.assertEquals("Wrong entry field", IpProto.class, entry10.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry10.isHasMask());
    Assert.assertEquals("Wrong entry value", 15, ((IpProtoCase) entry10.getMatchEntryValue()).getIpProto().getProtocolNumber().intValue());
    MatchEntry entry11 = entries.get(11);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry11.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv4Src.class, entry11.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry11.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.1"), ((Ipv4SrcCase) entry11.getMatchEntryValue()).getIpv4Src().getIpv4Address());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), ((Ipv4SrcCase) entry11.getMatchEntryValue()).getIpv4Src().getMask());
    MatchEntry entry12 = entries.get(12);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry12.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry12.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry12.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.2"), ((Ipv4DstCase) entry12.getMatchEntryValue()).getIpv4Dst().getIpv4Address());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), ((Ipv4DstCase) entry12.getMatchEntryValue()).getIpv4Dst().getMask());
    MatchEntry entry13 = entries.get(13);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry13.getOxmClass());
    Assert.assertEquals("Wrong entry field", TcpSrc.class, entry13.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry13.isHasMask());
    Assert.assertEquals("Wrong entry value", 3, ((TcpSrcCase) entry13.getMatchEntryValue()).getTcpSrc().getPort().getValue().intValue());
    MatchEntry entry14 = entries.get(14);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry14.getOxmClass());
    Assert.assertEquals("Wrong entry field", TcpDst.class, entry14.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry14.isHasMask());
    Assert.assertEquals("Wrong entry value", 4, ((TcpDstCase) entry14.getMatchEntryValue()).getTcpDst().getPort().getValue().intValue());
    MatchEntry entry15 = entries.get(15);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry15.getOxmClass());
    Assert.assertEquals("Wrong entry field", UdpSrc.class, entry15.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry15.isHasMask());
    Assert.assertEquals("Wrong entry value", 5, ((UdpSrcCase) entry15.getMatchEntryValue()).getUdpSrc().getPort().getValue().intValue());
    MatchEntry entry16 = entries.get(16);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry16.getOxmClass());
    Assert.assertEquals("Wrong entry field", UdpDst.class, entry16.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry16.isHasMask());
    Assert.assertEquals("Wrong entry value", 6, ((UdpDstCase) entry16.getMatchEntryValue()).getUdpDst().getPort().getValue().intValue());
    MatchEntry entry17 = entries.get(17);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry17.getOxmClass());
    Assert.assertEquals("Wrong entry field", SctpSrc.class, entry17.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry17.isHasMask());
    Assert.assertEquals("Wrong entry value", 7, ((SctpSrcCase) entry17.getMatchEntryValue()).getSctpSrc().getPort().getValue().intValue());
    MatchEntry entry18 = entries.get(18);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry18.getOxmClass());
    Assert.assertEquals("Wrong entry field", SctpDst.class, entry18.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry18.isHasMask());
    Assert.assertEquals("Wrong entry value", 8, ((SctpDstCase) entry18.getMatchEntryValue()).getSctpDst().getPort().getValue().intValue());
    MatchEntry entry19 = entries.get(19);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry19.getOxmClass());
    Assert.assertEquals("Wrong entry field", Icmpv4Type.class, entry19.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry19.isHasMask());
    Assert.assertEquals("Wrong entry value", 5, ((Icmpv4TypeCase) entry19.getMatchEntryValue()).getIcmpv4Type().getIcmpv4Type().intValue());
    MatchEntry entry20 = entries.get(20);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry20.getOxmClass());
    Assert.assertEquals("Wrong entry field", Icmpv4Code.class, entry20.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry20.isHasMask());
    Assert.assertEquals("Wrong entry value", 7, ((Icmpv4CodeCase) entry20.getMatchEntryValue()).getIcmpv4Code().getIcmpv4Code().intValue());
    MatchEntry entry21 = entries.get(21);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry21.getOxmClass());
    Assert.assertEquals("Wrong entry field", ArpOp.class, entry21.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry21.isHasMask());
    Assert.assertEquals("Wrong entry value", 16, ((ArpOpCase) entry21.getMatchEntryValue()).getArpOp().getOpCode().intValue());
    MatchEntry entry22 = entries.get(22);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry22.getOxmClass());
    Assert.assertEquals("Wrong entry field", ArpSpa.class, entry22.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry22.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.9"), ((ArpSpaCase) entry22.getMatchEntryValue()).getArpSpa().getIpv4Address());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), ((ArpSpaCase) entry22.getMatchEntryValue()).getArpSpa().getMask());
    MatchEntry entry23 = entries.get(23);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry23.getOxmClass());
    Assert.assertEquals("Wrong entry field", ArpTpa.class, entry23.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry23.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.10"), ((ArpTpaCase) entry23.getMatchEntryValue()).getArpTpa().getIpv4Address());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), ((ArpTpaCase) entry23.getMatchEntryValue()).getArpTpa().getMask());
    MatchEntry entry24 = entries.get(24);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry24.getOxmClass());
    Assert.assertEquals("Wrong entry field", ArpSha.class, entry24.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry24.isHasMask());
    Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:01"), ((ArpShaCase) entry24.getMatchEntryValue()).getArpSha().getMacAddress());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 03"), ((ArpShaCase) entry24.getMatchEntryValue()).getArpSha().getMask());
    MatchEntry entry25 = entries.get(25);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry25.getOxmClass());
    Assert.assertEquals("Wrong entry field", ArpTha.class, entry25.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry25.isHasMask());
    Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:02"), ((ArpThaCase) entry25.getMatchEntryValue()).getArpTha().getMacAddress());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 04"), ((ArpThaCase) entry25.getMatchEntryValue()).getArpTha().getMask());
    MatchEntry entry26 = entries.get(26);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry26.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6Src.class, entry26.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry26.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv6Address("::15"), ((Ipv6SrcCase) entry26.getMatchEntryValue()).getIpv6Src().getIpv6Address());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16"), ((Ipv6SrcCase) entry26.getMatchEntryValue()).getIpv6Src().getMask());
    MatchEntry entry27 = entries.get(27);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry27.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6Dst.class, entry27.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry27.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv6Address("::17"), ((Ipv6DstCase) entry27.getMatchEntryValue()).getIpv6Dst().getIpv6Address());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18"), ((Ipv6DstCase) entry27.getMatchEntryValue()).getIpv6Dst().getMask());
    MatchEntry entry28 = entries.get(28);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry28.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry28.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry28.isHasMask());
    Assert.assertEquals("Wrong entry value", 2, ((Ipv6FlabelCase) entry28.getMatchEntryValue()).getIpv6Flabel().getIpv6Flabel().getValue().intValue());
    MatchEntry entry29 = entries.get(29);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry29.getOxmClass());
    Assert.assertEquals("Wrong entry field", Icmpv6Type.class, entry29.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry29.isHasMask());
    Assert.assertEquals("Wrong entry value", 21, ((Icmpv6TypeCase) entry29.getMatchEntryValue()).getIcmpv6Type().getIcmpv6Type().intValue());
    MatchEntry entry30 = entries.get(30);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry30.getOxmClass());
    Assert.assertEquals("Wrong entry field", Icmpv6Code.class, entry30.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry30.isHasMask());
    Assert.assertEquals("Wrong entry value", 23, ((Icmpv6CodeCase) entry30.getMatchEntryValue()).getIcmpv6Code().getIcmpv6Code().intValue());
    MatchEntry entry31 = entries.get(31);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry31.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6NdTarget.class, entry31.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry31.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv6Address("::20"), ((Ipv6NdTargetCase) entry31.getMatchEntryValue()).getIpv6NdTarget().getIpv6Address());
    MatchEntry entry32 = entries.get(32);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry32.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6NdSll.class, entry32.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry32.isHasMask());
    Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:01"), ((Ipv6NdSllCase) entry32.getMatchEntryValue()).getIpv6NdSll().getMacAddress());
    MatchEntry entry33 = entries.get(33);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry33.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6NdTll.class, entry33.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry33.isHasMask());
    Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:02"), ((Ipv6NdTllCase) entry33.getMatchEntryValue()).getIpv6NdTll().getMacAddress());
    MatchEntry entry34 = entries.get(34);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry34.getOxmClass());
    Assert.assertEquals("Wrong entry field", MplsLabel.class, entry34.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry34.isHasMask());
    Assert.assertEquals("Wrong entry value", 515, ((MplsLabelCase) entry34.getMatchEntryValue()).getMplsLabel().getMplsLabel().intValue());
    MatchEntry entry35 = entries.get(35);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry35.getOxmClass());
    Assert.assertEquals("Wrong entry field", MplsTc.class, entry35.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry35.isHasMask());
    Assert.assertEquals("Wrong entry value", 3, ((MplsTcCase) entry35.getMatchEntryValue()).getMplsTc().getTc().intValue());
    MatchEntry entry36 = entries.get(36);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry36.getOxmClass());
    Assert.assertEquals("Wrong entry field", MplsBos.class, entry36.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry36.isHasMask());
    Assert.assertEquals("Wrong entry value", true, ((MplsBosCase) entry36.getMatchEntryValue()).getMplsBos().isBos());
    MatchEntry entry37 = entries.get(37);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry37.getOxmClass());
    Assert.assertEquals("Wrong entry field", PbbIsid.class, entry37.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry37.isHasMask());
    Assert.assertEquals("Wrong entry value", 2, ((PbbIsidCase) entry37.getMatchEntryValue()).getPbbIsid().getIsid().intValue());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 01"), ((PbbIsidCase) entry37.getMatchEntryValue()).getPbbIsid().getMask());
    MatchEntry entry38 = entries.get(38);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry38.getOxmClass());
    Assert.assertEquals("Wrong entry field", TunnelId.class, entry38.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry38.isHasMask());
    Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 07"), ((TunnelIdCase) entry38.getMatchEntryValue()).getTunnelId().getTunnelId());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 FF"), ((TunnelIdCase) entry38.getMatchEntryValue()).getTunnelId().getMask());
    MatchEntry entry39 = entries.get(39);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry39.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry39.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", true, entry39.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv6ExthdrFlags(false, false, false, false, false, false, false, false, false), ((Ipv6ExthdrCase) entry39.getMatchEntryValue()).getIpv6Exthdr().getPseudoField());
    Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("03 04"), ((Ipv6ExthdrCase) entry39.getMatchEntryValue()).getIpv6Exthdr().getMask());
    Assert.assertTrue("Unread data", buffer.readableBytes() == 0);
}
Also used : Ipv6FlabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6FlabelCase) Ipv6ExthdrCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCase) Ipv6ExthdrFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) Ipv6DstCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6DstCase) MplsBosCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsBosCase) ArpShaCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ArpShaCase) ByteBuf(io.netty.buffer.ByteBuf) Ipv4SrcCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4SrcCase) Ipv6SrcCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6SrcCase) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match) Ipv6NdTllCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTllCase) EthTypeCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthTypeCase) Ipv4DstCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCase) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) InPortCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCase) ArpThaCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ArpThaCase) TunnelIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TunnelIdCase) MetadataCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MetadataCase) TcpSrcCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCase) ArpSpaCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ArpSpaCase) Ipv6NdTargetCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTargetCase) Ipv6NdSllCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdSllCase) IpDscpCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCase) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) TcpDstCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCase) UdpSrcCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCase) EthDstCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthDstCase) EthSrcCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthSrcCase) SctpDstCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.SctpDstCase) ArpTpaCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ArpTpaCase) InPhyPortCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPhyPortCase) VlanVidCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCase) SctpSrcCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.SctpSrcCase) UdpDstCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCase) PbbIsidCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.PbbIsidCase) Test(org.junit.Test)

Example 2 with Ipv6ExthdrFlags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags in project openflowplugin by opendaylight.

the class MatchResponseConvertor2Test method testLayer3MatchIpv6.

/**
 * Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
 */
@Test
public void testLayer3MatchIpv6() {
    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(Ipv6Src.class);
    entriesBuilder.setHasMask(false);
    final Ipv6SrcCaseBuilder ipv6SrcCaseBuilder = new Ipv6SrcCaseBuilder();
    final Ipv6SrcBuilder ipv6AddressBuilder = new Ipv6SrcBuilder();
    ipv6AddressBuilder.setIpv6Address(new Ipv6Address("2001:cdba:0000:0000:0000:0000:3257:9657"));
    ipv6SrcCaseBuilder.setIpv6Src(ipv6AddressBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv6SrcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv6Dst.class);
    entriesBuilder.setHasMask(false);
    final Ipv6DstCaseBuilder ipv6DstCaseBuilder = new Ipv6DstCaseBuilder();
    final Ipv6DstBuilder ipv6DstBuilder = new Ipv6DstBuilder();
    ipv6DstBuilder.setIpv6Address(new Ipv6Address("2001:cdba:0000:0000:0000:0000:3257:9658"));
    ipv6DstCaseBuilder.setIpv6Dst(ipv6DstBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv6DstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv6Flabel.class);
    entriesBuilder.setHasMask(false);
    final Ipv6FlabelCaseBuilder ipv6FlabelCaseBuilder = new Ipv6FlabelCaseBuilder();
    final Ipv6FlabelBuilder ipv6FlabelBuilder = new Ipv6FlabelBuilder();
    ipv6FlabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(18L));
    ipv6FlabelCaseBuilder.setIpv6Flabel(ipv6FlabelBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv6FlabelCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv6NdTarget.class);
    entriesBuilder.setHasMask(false);
    final Ipv6NdTargetCaseBuilder ipv6NdTargetCaseBuilder = new Ipv6NdTargetCaseBuilder();
    final Ipv6NdTargetBuilder ipv6NdTargetBuilder = new Ipv6NdTargetBuilder();
    ipv6NdTargetBuilder.setIpv6Address(new Ipv6Address("2001:cdba:0000:0000:0000:0000:3257:9659"));
    ipv6NdTargetCaseBuilder.setIpv6NdTarget(ipv6NdTargetBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv6NdTargetCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv6NdSll.class);
    entriesBuilder.setHasMask(false);
    final Ipv6NdSllCaseBuilder ipv6NdSllCaseBuilder = new Ipv6NdSllCaseBuilder();
    final Ipv6NdSllBuilder ipv6NdSllBuilder = new Ipv6NdSllBuilder();
    ipv6NdSllBuilder.setMacAddress(new MacAddress("00:00:00:00:00:05"));
    ipv6NdSllCaseBuilder.setIpv6NdSll(ipv6NdSllBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv6NdSllCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv6NdTll.class);
    entriesBuilder.setHasMask(false);
    final Ipv6NdTllCaseBuilder ipv6NdTllCaseBuilder = new Ipv6NdTllCaseBuilder();
    final Ipv6NdTllBuilder ipv6NdTllBuilder = new Ipv6NdTllBuilder();
    ipv6NdTllBuilder.setMacAddress(new MacAddress("00:00:00:00:00:06"));
    ipv6NdTllCaseBuilder.setIpv6NdTll(ipv6NdTllBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv6NdTllCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv6Exthdr.class);
    entriesBuilder.setHasMask(false);
    final Ipv6ExthdrCaseBuilder ipv6ExthdrCaseBuilder = new Ipv6ExthdrCaseBuilder();
    final Ipv6ExthdrBuilder ipv6ExthdrBuilder = new Ipv6ExthdrBuilder();
    ipv6ExthdrBuilder.setPseudoField(new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));
    ipv6ExthdrCaseBuilder.setIpv6Exthdr(ipv6ExthdrBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv6ExthdrCaseBuilder.build());
    builder.setMatchEntry(entries);
    entries.add(entriesBuilder.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 salMatchBuilder = convert(builder.build(), datapathIdConvertorData);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match builtMatch = salMatchBuilder.build();
    final Ipv6Match ipv6Match = (Ipv6Match) builtMatch.getLayer3Match();
    Assert.assertEquals("Wrong ipv6 src address", "2001:cdba::3257:9657/128", ipv6Match.getIpv6Source().getValue());
    Assert.assertEquals("Wrong ipv6 dst address", "2001:cdba::3257:9658/128", ipv6Match.getIpv6Destination().getValue());
    Assert.assertEquals("Wrong ipv6 nd target", "2001:cdba:0000:0000:0000:0000:3257:9659", ipv6Match.getIpv6NdTarget().getValue());
    Assert.assertEquals("Wrong ipv6 flabel", 18, ipv6Match.getIpv6Label().getIpv6Flabel().getValue().intValue());
    Assert.assertEquals("Wrong ipv6 nd sll", new MacAddress("00:00:00:00:00:05"), ipv6Match.getIpv6NdSll());
    Assert.assertEquals("Wrong ipv6 nd tll", new MacAddress("00:00:00:00:00:06"), ipv6Match.getIpv6NdTll());
    Assert.assertEquals("Wrong ipv6 ext header", 358, ipv6Match.getIpv6ExtHeader().getIpv6Exthdr().intValue());
}
Also used : Ipv6NdTargetBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.target._case.Ipv6NdTargetBuilder) Ipv6ExthdrFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags) 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) Ipv6NdTargetCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTargetCaseBuilder) Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) Ipv6DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.dst._case.Ipv6DstBuilder) Ipv6SrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6SrcCaseBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Ipv6FlabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.flabel._case.Ipv6FlabelBuilder) Ipv6NdTllBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.tll._case.Ipv6NdTllBuilder) Ipv6NdTllCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTllCaseBuilder) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Ipv6DstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6DstCaseBuilder) Ipv6NdSllCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdSllCaseBuilder) Ipv6ExthdrBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.exthdr._case.Ipv6ExthdrBuilder) Ipv6FlowLabel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv6NdSllBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSllBuilder) Ipv6FlabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6FlabelCaseBuilder) Ipv6SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.src._case.Ipv6SrcBuilder) BigInteger(java.math.BigInteger) Ipv6ExthdrCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCaseBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) Test(org.junit.Test)

Example 3 with Ipv6ExthdrFlags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags in project openflowplugin by opendaylight.

the class OxmIpv6ExtHdrSerializerTest method testSerializeWithoutMask.

/**
 * Test correct serialization.
 */
@Test
public void testSerializeWithoutMask() {
    MatchEntryBuilder builder = prepareIpv6ExtHdrMatchEntry(false, new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));
    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(builder.build(), buffer);
    checkHeader(buffer, false);
    assertEquals("Wrong value", 358, buffer.readUnsignedShort());
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
Also used : Ipv6ExthdrFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 4 with Ipv6ExthdrFlags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags in project openflowplugin by opendaylight.

the class OxmIpv6ExtHdrDeserializerTest method test.

/**
 * Tests {@link OxmIpv6ExtHdrDeserializer#deserialize(ByteBuf)}.
 */
@Test
public void test() {
    ByteBuf buffer = BufferHelper.buildBuffer("80 00 4E 02 01 FF");
    // skip XID
    buffer.skipBytes(4);
    OxmIpv6ExtHdrDeserializer deserializer = new OxmIpv6ExtHdrDeserializer();
    MatchEntry entry = deserializer.deserialize(buffer);
    Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
    Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry.getOxmMatchField());
    Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
    Assert.assertEquals("Wrong entry value", new Ipv6ExthdrFlags(true, true, true, true, true, true, true, true, true), ((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getPseudoField());
    Assert.assertEquals("Wrong entry mask", null, ((Ipv6ExthdrCase) entry.getMatchEntryValue()).getIpv6Exthdr().getMask());
    Assert.assertTrue("Unread data", buffer.readableBytes() == 0);
}
Also used : Ipv6ExthdrCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCase) Ipv6ExthdrFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 5 with Ipv6ExthdrFlags

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags 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());
}
Also used : Ipv6ExthdrCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCase) VersionConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData) Ipv6ExthdrFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) List(java.util.List) Ipv6ExtHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) 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) 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) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match) Test(org.junit.Test)

Aggregations

Ipv6ExthdrFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags)12 Test (org.junit.Test)10 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)7 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)6 ByteBuf (io.netty.buffer.ByteBuf)5 Ipv6ExthdrCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCase)5 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)4 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)4 ArrayList (java.util.ArrayList)3 Ipv6FlowLabel (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel)3 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)3 Ipv6ExtHeaderBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder)3 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)3 Ipv6ExthdrCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCaseBuilder)3 Ipv6ExthdrBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.exthdr._case.Ipv6ExthdrBuilder)3 BigInteger (java.math.BigInteger)2 List (java.util.List)2 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)2 VersionDatapathIdConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2