Search in sources :

Example 66 with Metadata

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.Metadata in project openflowplugin by opendaylight.

the class InstructionsDeserializerTest method test.

/**
 * Testing instructions translation.
 */
@Test
public void test() {
    ByteBuf message = BufferHelper.buildBuffer("00 01 00 08 0A 00 00 00 00 02 00 18 00 00 00 00 " + "00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 30 00 05 00 08 00 00 00 00 00 06 00 08 " + "00 01 02 03 00 03 00 20 00 00 00 00 00 00 00 10 00 00 00 25 00 35 00 00 00 00 00 00 " + "00 16 00 08 00 00 00 50 00 04 00 18 00 00 00 00 00 15 00 08 00 00 00 25 00 0F 00 08 05 00 00 00");
    // skip XID
    message.skipBytes(4);
    CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
    List<Instruction> instructions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, message.readableBytes(), message, keyMaker, registry);
    Instruction i1 = instructions.get(0);
    Assert.assertTrue("Wrong type - i1", i1.getInstructionChoice() instanceof GotoTableCase);
    Assert.assertEquals("Wrong table-id - i1", 10, ((GotoTableCase) i1.getInstructionChoice()).getGotoTable().getTableId().intValue());
    Instruction i2 = instructions.get(1);
    Assert.assertTrue("Wrong type - i2", i2.getInstructionChoice() instanceof WriteMetadataCase);
    Assert.assertArrayEquals("Wrong metadata - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 20"), ((WriteMetadataCase) i2.getInstructionChoice()).getWriteMetadata().getMetadata());
    Assert.assertArrayEquals("Wrong metadata-mask - i2", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 30"), ((WriteMetadataCase) i2.getInstructionChoice()).getWriteMetadata().getMetadataMask());
    Instruction i3 = instructions.get(2);
    Assert.assertTrue("Wrong type - i3", i3.getInstructionChoice() instanceof ClearActionsCase);
    Instruction i4 = instructions.get(3);
    Assert.assertTrue("Wrong type - i4", i4.getInstructionChoice() instanceof MeterCase);
    Assert.assertEquals("Wrong meterId - i4", 66051, ((MeterCase) i4.getInstructionChoice()).getMeter().getMeterId().intValue());
    Instruction i5 = instructions.get(4);
    Assert.assertTrue("Wrong type - i5", i5.getInstructionChoice() instanceof WriteActionsCase);
    Assert.assertEquals("Wrong instructions - i5", 2, ((WriteActionsCase) i5.getInstructionChoice()).getWriteActions().getAction().size());
    Action action1 = ((WriteActionsCase) i5.getInstructionChoice()).getWriteActions().getAction().get(0);
    Assert.assertTrue("Wrong action", action1.getActionChoice() instanceof OutputActionCase);
    Assert.assertEquals("Wrong action", 37, ((OutputActionCase) action1.getActionChoice()).getOutputAction().getPort().getValue().intValue());
    Assert.assertEquals("Wrong action", 53, ((OutputActionCase) action1.getActionChoice()).getOutputAction().getMaxLength().intValue());
    Action action2 = ((WriteActionsCase) i5.getInstructionChoice()).getWriteActions().getAction().get(1);
    Assert.assertTrue("Wrong action", action2.getActionChoice() instanceof GroupCase);
    Assert.assertEquals("Wrong action", 80, ((GroupCase) action2.getActionChoice()).getGroupAction().getGroupId().intValue());
    Instruction i6 = instructions.get(5);
    Assert.assertTrue("Wrong type - i6", i6.getInstructionChoice() instanceof ApplyActionsCase);
    Assert.assertEquals("Wrong instructions - i6", 2, ((ApplyActionsCase) i6.getInstructionChoice()).getApplyActions().getAction().size());
    action1 = ((ApplyActionsCase) i6.getInstructionChoice()).getApplyActions().getAction().get(0);
    Assert.assertTrue("Wrong action", action1.getActionChoice() instanceof SetQueueCase);
    Assert.assertEquals("Wrong action", 37, ((SetQueueCase) action1.getActionChoice()).getSetQueueAction().getQueueId().intValue());
    action2 = ((ApplyActionsCase) i6.getInstructionChoice()).getApplyActions().getAction().get(1);
    Assert.assertTrue("Wrong action", action2.getActionChoice() instanceof SetMplsTtlCase);
    Assert.assertEquals("Wrong action", 5, ((SetMplsTtlCase) action2.getActionChoice()).getSetMplsTtlAction().getMplsTtl().shortValue());
}
Also used : GotoTableCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCase) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) WriteMetadataCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase) MeterCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCase) WriteActionsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase) SetQueueCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCase) SetMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCase) GroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCase) ByteBuf(io.netty.buffer.ByteBuf) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction) ClearActionsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase) OutputActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCase) ApplyActionsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase) Test(org.junit.Test)

Example 67 with Metadata

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.Metadata in project openflowplugin by opendaylight.

the class MatchConvertor method metadataMatch.

private static void metadataMatch(final List<MatchEntry> matchEntryList, final org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata metadata) {
    if (metadata == null) {
        return;
    }
    MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
    final boolean hasmask = metadata.getMetadataMask() != null;
    matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
    matchEntryBuilder.setOxmMatchField(Metadata.class);
    MetadataCaseBuilder metadataCaseBuilder = new MetadataCaseBuilder();
    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.MetadataBuilder metadataBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.MetadataBuilder();
    metadataBuilder.setMetadata(ByteUtil.convertBigIntegerToNBytes(metadata.getMetadata(), OFConstants.SIZE_OF_LONG_IN_BYTES));
    if (hasmask) {
        metadataBuilder.setMask(ByteUtil.convertBigIntegerToNBytes(metadata.getMetadataMask(), OFConstants.SIZE_OF_LONG_IN_BYTES));
    }
    metadataCaseBuilder.setMetadata(metadataBuilder.build());
    matchEntryBuilder.setMatchEntryValue(metadataCaseBuilder.build());
    matchEntryBuilder.setHasMask(hasmask);
    matchEntryList.add(matchEntryBuilder.build());
}
Also used : MetadataCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MetadataCaseBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)

Example 68 with Metadata

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.Metadata in project openflowplugin by opendaylight.

the class MatchResponseConvertor2Test method testWithMatchEntryWithMasks.

/**
 * Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
 */
@Test
public void testWithMatchEntryWithMasks() {
    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(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata.class);
    entriesBuilder.setHasMask(true);
    final MetadataCaseBuilder metadataCaseBuilder = new MetadataCaseBuilder();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.MetadataBuilder metadataBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.MetadataBuilder();
    metadataBuilder.setMetadata(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 });
    metadataBuilder.setMask(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 });
    metadataCaseBuilder.setMetadata(metadataBuilder.build());
    entriesBuilder.setMatchEntryValue(metadataCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(EthDst.class);
    entriesBuilder.setHasMask(true);
    final EthDstCaseBuilder ethDstCaseBuilder = new EthDstCaseBuilder();
    final EthDstBuilder ethDstBuilder = new EthDstBuilder();
    ethDstBuilder.setMacAddress(new MacAddress("00:00:00:00:00:01"));
    ethDstBuilder.setMask(new byte[] { 0, 0, 0, 0, 1, 1 });
    ethDstCaseBuilder.setEthDst(ethDstBuilder.build());
    entriesBuilder.setMatchEntryValue(ethDstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(EthSrc.class);
    entriesBuilder.setHasMask(true);
    final EthSrcCaseBuilder ethSrcCaseBuilder = new EthSrcCaseBuilder();
    final EthSrcBuilder ethSrcBuilder = new EthSrcBuilder();
    ethSrcBuilder.setMacAddress(new MacAddress("00:00:00:00:00:02"));
    ethSrcBuilder.setMask(new byte[] { 0, 0, 0, 0, 2, 2 });
    ethSrcCaseBuilder.setEthSrc(ethSrcBuilder.build());
    entriesBuilder.setMatchEntryValue(ethSrcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(VlanVid.class);
    entriesBuilder.setHasMask(true);
    final VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
    final VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
    vlanVidBuilder.setVlanVid(4);
    vlanVidBuilder.setCfiBit(true);
    vlanVidBuilder.setMask(new byte[] { 0, 4 });
    vlanVidCaseBuilder.setVlanVid(vlanVidBuilder.build());
    entriesBuilder.setMatchEntryValue(vlanVidCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Src.class);
    entriesBuilder.setHasMask(true);
    final Ipv4SrcCaseBuilder ipv4SrcCaseBuilder = new Ipv4SrcCaseBuilder();
    final Ipv4SrcBuilder ipv4SrcBuilder = new Ipv4SrcBuilder();
    ipv4SrcBuilder.setIpv4Address(new Ipv4Address("10.0.0.0"));
    ipv4SrcBuilder.setMask(new byte[] { (byte) 255, (byte) 255, (byte) 255, 0 });
    ipv4SrcCaseBuilder.setIpv4Src(ipv4SrcBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4SrcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Dst.class);
    entriesBuilder.setHasMask(true);
    final Ipv4DstCaseBuilder ipv4DstCaseBuilder = new Ipv4DstCaseBuilder();
    final Ipv4DstBuilder ipv4AddressBuilder = new Ipv4DstBuilder();
    ipv4AddressBuilder.setIpv4Address(new Ipv4Address("10.0.0.0"));
    ipv4AddressBuilder.setMask(new byte[] { (byte) 255, (byte) 255, (byte) 240, 0 });
    ipv4DstCaseBuilder.setIpv4Dst(ipv4AddressBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4DstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(PbbIsid.class);
    entriesBuilder.setHasMask(true);
    final PbbIsidCaseBuilder pbbIsidCaseBuilder = new PbbIsidCaseBuilder();
    final PbbIsidBuilder pbbIsidBuilder = new PbbIsidBuilder();
    pbbIsidBuilder.setIsid(23L);
    pbbIsidBuilder.setMask(new byte[] { 0, 0, 7 });
    pbbIsidCaseBuilder.setPbbIsid(pbbIsidBuilder.build());
    entriesBuilder.setMatchEntryValue(pbbIsidCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(TunnelId.class);
    entriesBuilder.setHasMask(true);
    final TunnelIdCaseBuilder tunnelIdCaseBuilder = new TunnelIdCaseBuilder();
    final TunnelIdBuilder tunnelIdBuilder = new TunnelIdBuilder();
    tunnelIdBuilder.setTunnelId(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
    tunnelIdBuilder.setMask(new byte[] { 0, 0, 0, 0, 0, 0, 0, 8 });
    tunnelIdCaseBuilder.setTunnelId(tunnelIdBuilder.build());
    entriesBuilder.setMatchEntryValue(tunnelIdCaseBuilder.build());
    entries.add(entriesBuilder.build());
    builder.setMatchEntry(entries);
    final Match match = builder.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 salMatch = convert(match, datapathIdConvertorData);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match builtMatch = salMatch.build();
    Assert.assertEquals("Wrong metadata", new BigInteger(1, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }), builtMatch.getMetadata().getMetadata());
    Assert.assertEquals("Wrong metadata mask", new BigInteger(1, new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }), builtMatch.getMetadata().getMetadataMask());
    Assert.assertEquals("Wrong eth dst", new MacAddress("00:00:00:00:00:01"), builtMatch.getEthernetMatch().getEthernetDestination().getAddress());
    Assert.assertEquals("Wrong eth dst mask", new MacAddress("00:00:00:00:01:01"), builtMatch.getEthernetMatch().getEthernetDestination().getMask());
    Assert.assertEquals("Wrong eth src", new MacAddress("00:00:00:00:00:02"), builtMatch.getEthernetMatch().getEthernetSource().getAddress());
    Assert.assertEquals("Wrong eth src mask", new MacAddress("00:00:00:00:02:02"), builtMatch.getEthernetMatch().getEthernetSource().getMask());
    Assert.assertEquals("Wrong vlan id", 4, builtMatch.getVlanMatch().getVlanId().getVlanId().getValue().intValue());
    Assert.assertEquals("Wrong vlan id entries", true, builtMatch.getVlanMatch().getVlanId().isVlanIdPresent());
    final Ipv4Match ipv4Match = (Ipv4Match) builtMatch.getLayer3Match();
    Assert.assertEquals("Wrong ipv4 src address", "10.0.0.0/24", ipv4Match.getIpv4Source().getValue());
    Assert.assertEquals("Wrong ipv4 dst address", "10.0.0.0/20", ipv4Match.getIpv4Destination().getValue());
    Assert.assertEquals("Wrong pbb isid", 23, builtMatch.getProtocolMatchFields().getPbb().getPbbIsid().intValue());
    Assert.assertEquals("Wrong tunnel id", new BigInteger(1, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }), builtMatch.getTunnel().getTunnelId());
}
Also used : Ipv4SrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4SrcCaseBuilder) VlanVidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCaseBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) MetadataCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MetadataCaseBuilder) VersionDatapathIdConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData) ArrayList(java.util.ArrayList) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match) ArpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch) SctpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) EthDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.dst._case.EthDstBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) EthDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthDstCaseBuilder) Ipv4DstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCaseBuilder) Ipv4DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.dst._case.Ipv4DstBuilder) PbbIsidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.pbb.isid._case.PbbIsidBuilder) EthSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthSrcCaseBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) PbbIsidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.PbbIsidCaseBuilder) VlanVidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVidBuilder) EthSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.src._case.EthSrcBuilder) TunnelIdCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TunnelIdCaseBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) TunnelIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelIdBuilder) BigInteger(java.math.BigInteger) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) Ipv4SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.src._case.Ipv4SrcBuilder) Test(org.junit.Test)

Example 69 with Metadata

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.Metadata in project openflowplugin by opendaylight.

the class MatchResponseConvertor2Test method testWithMatchEntryNoMasks.

/**
 * Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
 */
@Test
public void testWithMatchEntryNoMasks() {
    final List<MatchEntry> entries = new ArrayList<>();
    MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort.class);
    entriesBuilder.setHasMask(false);
    final InPortCaseBuilder caseBuilder = new InPortCaseBuilder();
    final InPortBuilder portBuilder = new InPortBuilder();
    portBuilder.setPortNumber(new PortNumber(1L));
    caseBuilder.setInPort(portBuilder.build());
    entriesBuilder.setMatchEntryValue(caseBuilder.build());
    entries.add(entriesBuilder.build());
    final InPhyPortCaseBuilder inPhyPortCaseBuilder = new InPhyPortCaseBuilder();
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPhyPort.class);
    entriesBuilder.setHasMask(false);
    final InPhyPortBuilder inPhyPortBuilder = new InPhyPortBuilder();
    inPhyPortBuilder.setPortNumber(new PortNumber(2L));
    inPhyPortCaseBuilder.setInPhyPort(inPhyPortBuilder.build());
    entriesBuilder.setMatchEntryValue(inPhyPortCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata.class);
    entriesBuilder.setHasMask(false);
    final MetadataCaseBuilder metadataCaseBuilder = new MetadataCaseBuilder();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.MetadataBuilder metadataBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.MetadataBuilder();
    metadataBuilder.setMetadata(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 });
    metadataCaseBuilder.setMetadata(metadataBuilder.build());
    entriesBuilder.setMatchEntryValue(metadataCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(EthDst.class);
    entriesBuilder.setHasMask(false);
    final EthDstCaseBuilder ethDstCaseBuilder = new EthDstCaseBuilder();
    final EthDstBuilder ethDstBuilder = new EthDstBuilder();
    ethDstBuilder.setMacAddress(new MacAddress("00:00:00:00:00:01"));
    ethDstCaseBuilder.setEthDst(ethDstBuilder.build());
    entriesBuilder.setMatchEntryValue(ethDstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(EthSrc.class);
    entriesBuilder.setHasMask(false);
    final EthSrcCaseBuilder ethSrcCaseBuilder = new EthSrcCaseBuilder();
    final EthSrcBuilder ethSrcBuilder = new EthSrcBuilder();
    ethSrcBuilder.setMacAddress(new MacAddress("00:00:00:00:00:02"));
    ethSrcCaseBuilder.setEthSrc(ethSrcBuilder.build());
    entriesBuilder.setMatchEntryValue(ethSrcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(EthType.class);
    entriesBuilder.setHasMask(false);
    final EthTypeCaseBuilder ethTypeCaseBuilder = new EthTypeCaseBuilder();
    final EthTypeBuilder ethTypeBuilder = new EthTypeBuilder();
    ethTypeBuilder.setEthType(new EtherType(3));
    ethTypeCaseBuilder.setEthType(ethTypeBuilder.build());
    entriesBuilder.setMatchEntryValue(ethTypeCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(VlanVid.class);
    final VlanVidCaseBuilder vlanVidCaseBuilder = new VlanVidCaseBuilder();
    entriesBuilder.setHasMask(false);
    final VlanVidBuilder vlanVidBuilder = new VlanVidBuilder();
    vlanVidBuilder.setVlanVid(4);
    vlanVidBuilder.setCfiBit(true);
    vlanVidCaseBuilder.setVlanVid(vlanVidBuilder.build());
    entriesBuilder.setMatchEntryValue(vlanVidCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(VlanPcp.class);
    final VlanPcpCaseBuilder vlanPcpCaseBuilder = new VlanPcpCaseBuilder();
    entriesBuilder.setHasMask(false);
    final VlanPcpBuilder vlanPcpBuilder = new VlanPcpBuilder();
    vlanPcpBuilder.setVlanPcp((short) 5);
    vlanPcpCaseBuilder.setVlanPcp(vlanPcpBuilder.build());
    entriesBuilder.setMatchEntryValue(vlanPcpCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(IpDscp.class);
    entriesBuilder.setHasMask(false);
    final IpDscpCaseBuilder ipDscpCaseBuilder = new IpDscpCaseBuilder();
    final IpDscpBuilder ipDscpBuilder = new IpDscpBuilder();
    ipDscpBuilder.setDscp(new Dscp((short) 6));
    ipDscpCaseBuilder.setIpDscp(ipDscpBuilder.build());
    entriesBuilder.setMatchEntryValue(ipDscpCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(IpEcn.class);
    entriesBuilder.setHasMask(false);
    final IpEcnCaseBuilder ipEcnCaseBuilder = new IpEcnCaseBuilder();
    final IpEcnBuilder ipEcnBuilder = new IpEcnBuilder();
    ipEcnBuilder.setEcn((short) 7);
    ipEcnCaseBuilder.setIpEcn(ipEcnBuilder.build());
    entriesBuilder.setMatchEntryValue(ipEcnCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(IpProto.class);
    final IpProtoCaseBuilder ipProtoCaseBuilder = new IpProtoCaseBuilder();
    entriesBuilder.setHasMask(false);
    final IpProtoBuilder ipProtoBuilder = new IpProtoBuilder();
    ipProtoBuilder.setProtocolNumber((short) 8);
    ipProtoCaseBuilder.setIpProto(ipProtoBuilder.build());
    entriesBuilder.setMatchEntryValue(ipProtoCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Src.class);
    entriesBuilder.setHasMask(false);
    final Ipv4SrcCaseBuilder ipv4AddressBuilder = new Ipv4SrcCaseBuilder();
    final Ipv4SrcBuilder ipv4SrcBuilder = new Ipv4SrcBuilder();
    ipv4SrcBuilder.setIpv4Address(new Ipv4Address("10.0.0.1"));
    ipv4AddressBuilder.setIpv4Src(ipv4SrcBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4AddressBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Ipv4Dst.class);
    entriesBuilder.setHasMask(false);
    final Ipv4DstCaseBuilder ipv4DstCaseBuilder = new Ipv4DstCaseBuilder();
    final Ipv4DstBuilder ipv4DstBuilder = new Ipv4DstBuilder();
    ipv4DstBuilder.setIpv4Address(new Ipv4Address("10.0.0.2"));
    ipv4DstCaseBuilder.setIpv4Dst(ipv4DstBuilder.build());
    entriesBuilder.setMatchEntryValue(ipv4DstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(TcpSrc.class);
    entriesBuilder.setHasMask(false);
    final TcpSrcCaseBuilder tcpSrcCaseBuilder = new TcpSrcCaseBuilder();
    final TcpSrcBuilder tcpSrcBuilder = new TcpSrcBuilder();
    tcpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(9));
    tcpSrcCaseBuilder.setTcpSrc(tcpSrcBuilder.build());
    entriesBuilder.setMatchEntryValue(tcpSrcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(TcpDst.class);
    entriesBuilder.setHasMask(false);
    final TcpDstCaseBuilder tcpDstCaseBuilder = new TcpDstCaseBuilder();
    final TcpDstBuilder tcpDstBuilder = new TcpDstBuilder();
    tcpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(10));
    tcpDstCaseBuilder.setTcpDst(tcpDstBuilder.build());
    entriesBuilder.setMatchEntryValue(tcpDstCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Icmpv4Type.class);
    entriesBuilder.setHasMask(false);
    final Icmpv4TypeCaseBuilder icmpv4TypeCaseBuilder = new Icmpv4TypeCaseBuilder();
    final Icmpv4TypeBuilder icmpv4TypeBuilder = new Icmpv4TypeBuilder();
    icmpv4TypeBuilder.setIcmpv4Type((short) 15);
    icmpv4TypeCaseBuilder.setIcmpv4Type(icmpv4TypeBuilder.build());
    entriesBuilder.setMatchEntryValue(icmpv4TypeCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Icmpv4Code.class);
    entriesBuilder.setHasMask(false);
    final Icmpv4CodeCaseBuilder icmpv4CodeCaseBuilder = new Icmpv4CodeCaseBuilder();
    final Icmpv4CodeBuilder icmpv4CodeBuilder = new Icmpv4CodeBuilder();
    icmpv4CodeBuilder.setIcmpv4Code((short) 16);
    icmpv4CodeCaseBuilder.setIcmpv4Code(icmpv4CodeBuilder.build());
    entriesBuilder.setMatchEntryValue(icmpv4CodeCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Icmpv6Type.class);
    entriesBuilder.setHasMask(false);
    final Icmpv6TypeCaseBuilder icmpv6TypeCaseBuilder = new Icmpv6TypeCaseBuilder();
    final Icmpv6TypeBuilder icmpv6TypeBuilder = new Icmpv6TypeBuilder();
    icmpv6TypeBuilder.setIcmpv6Type((short) 19);
    icmpv6TypeCaseBuilder.setIcmpv6Type(icmpv6TypeBuilder.build());
    entriesBuilder.setMatchEntryValue(icmpv6TypeCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(Icmpv6Code.class);
    entriesBuilder.setHasMask(false);
    final Icmpv6CodeCaseBuilder icmpv6CodeCaseBuilder = new Icmpv6CodeCaseBuilder();
    final Icmpv6CodeBuilder icmpv6CodeBuilder = new Icmpv6CodeBuilder();
    icmpv6CodeBuilder.setIcmpv6Code((short) 20);
    icmpv6CodeCaseBuilder.setIcmpv6Code(icmpv6CodeBuilder.build());
    entriesBuilder.setMatchEntryValue(icmpv6CodeCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(MplsLabel.class);
    entriesBuilder.setHasMask(false);
    final MplsLabelCaseBuilder mplsLabelCaseBuilder = new MplsLabelCaseBuilder();
    final MplsLabelBuilder mplsLabelBuilder = new MplsLabelBuilder();
    mplsLabelBuilder.setMplsLabel(21L);
    mplsLabelCaseBuilder.setMplsLabel(mplsLabelBuilder.build());
    entriesBuilder.setMatchEntryValue(mplsLabelCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(MplsTc.class);
    entriesBuilder.setHasMask(false);
    final MplsTcCaseBuilder mplsTcCaseBuilder = new MplsTcCaseBuilder();
    final MplsTcBuilder mplsTcBuilder = new MplsTcBuilder();
    mplsTcBuilder.setTc((short) 22);
    mplsTcCaseBuilder.setMplsTc(mplsTcBuilder.build());
    entriesBuilder.setMatchEntryValue(mplsTcCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(MplsBos.class);
    entriesBuilder.setHasMask(false);
    final MplsBosCaseBuilder mplsBosCaseBuilder = new MplsBosCaseBuilder();
    final MplsBosBuilder mplsBosBuilder = new MplsBosBuilder();
    mplsBosBuilder.setBos(true);
    mplsBosCaseBuilder.setMplsBos(mplsBosBuilder.build());
    entriesBuilder.setMatchEntryValue(mplsBosCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(PbbIsid.class);
    entriesBuilder.setHasMask(false);
    final PbbIsidCaseBuilder pbbIsidCaseBuilder = new PbbIsidCaseBuilder();
    final PbbIsidBuilder pbbIsidBuilder = new PbbIsidBuilder();
    pbbIsidBuilder.setIsid(23L);
    pbbIsidCaseBuilder.setPbbIsid(pbbIsidBuilder.build());
    entriesBuilder.setMatchEntryValue(pbbIsidCaseBuilder.build());
    entries.add(entriesBuilder.build());
    entriesBuilder = new MatchEntryBuilder();
    entriesBuilder.setOxmClass(OpenflowBasicClass.class);
    entriesBuilder.setOxmMatchField(TunnelId.class);
    entriesBuilder.setHasMask(false);
    final TunnelIdCaseBuilder tunnelIdCaseBuilder = new TunnelIdCaseBuilder();
    final TunnelIdBuilder tunnelIdBuilder = new TunnelIdBuilder();
    tunnelIdBuilder.setTunnelId(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
    tunnelIdCaseBuilder.setTunnelId(tunnelIdBuilder.build());
    entriesBuilder.setMatchEntryValue(tunnelIdCaseBuilder.build());
    entries.add(entriesBuilder.build());
    final MatchBuilder builder = new MatchBuilder();
    builder.setMatchEntry(entries);
    final Match match = builder.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 salMatch = convert(match, datapathIdConvertorData);
    final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match builtMatch = salMatch.build();
    Assert.assertEquals("Wrong in port", "openflow:42:1", builtMatch.getInPort().getValue());
    Assert.assertEquals("Wrong in phy port", "openflow:42:2", builtMatch.getInPhyPort().getValue());
    Assert.assertEquals("Wrong metadata", new BigInteger(1, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }), builtMatch.getMetadata().getMetadata());
    Assert.assertEquals("Wrong eth dst", new MacAddress("00:00:00:00:00:01"), builtMatch.getEthernetMatch().getEthernetDestination().getAddress());
    Assert.assertEquals("Wrong eth src", new MacAddress("00:00:00:00:00:02"), builtMatch.getEthernetMatch().getEthernetSource().getAddress());
    Assert.assertEquals("Wrong eth type", 3, builtMatch.getEthernetMatch().getEthernetType().getType().getValue().intValue());
    Assert.assertEquals("Wrong vlan id", 4, builtMatch.getVlanMatch().getVlanId().getVlanId().getValue().intValue());
    Assert.assertEquals("Wrong vlan id entries", true, builtMatch.getVlanMatch().getVlanId().isVlanIdPresent());
    Assert.assertEquals("Wrong vlan pcp", 5, builtMatch.getVlanMatch().getVlanPcp().getValue().intValue());
    Assert.assertEquals("Wrong ip dscp", 6, builtMatch.getIpMatch().getIpDscp().getValue().intValue());
    Assert.assertEquals("Wrong ip ecn", 7, builtMatch.getIpMatch().getIpEcn().intValue());
    Assert.assertEquals("Wrong ip proto", null, builtMatch.getIpMatch().getIpProto());
    Assert.assertEquals("Wrong ip protocol", 8, builtMatch.getIpMatch().getIpProtocol().intValue());
    final TcpMatch tcpMatch = (TcpMatch) builtMatch.getLayer4Match();
    Assert.assertEquals("Wrong tcp src port", 9, tcpMatch.getTcpSourcePort().getValue().intValue());
    Assert.assertEquals("Wrong tcp dst port", 10, tcpMatch.getTcpDestinationPort().getValue().intValue());
    Assert.assertEquals("Wrong icmpv4 type", 15, builtMatch.getIcmpv4Match().getIcmpv4Type().intValue());
    Assert.assertEquals("Wrong icmpv4 code", 16, builtMatch.getIcmpv4Match().getIcmpv4Code().intValue());
    Assert.assertEquals("Wrong icmpv6 type", 19, builtMatch.getIcmpv6Match().getIcmpv6Type().intValue());
    Assert.assertEquals("Wrong icmpv6 code", 20, builtMatch.getIcmpv6Match().getIcmpv6Code().intValue());
    final Ipv4Match ipv4Match = (Ipv4Match) builtMatch.getLayer3Match();
    Assert.assertEquals("Wrong ipv4 src address", "10.0.0.1/32", ipv4Match.getIpv4Source().getValue());
    Assert.assertEquals("Wrong ipv4 dst address", "10.0.0.2/32", ipv4Match.getIpv4Destination().getValue());
    Assert.assertEquals("Wrong mpls label", 21, builtMatch.getProtocolMatchFields().getMplsLabel().intValue());
    Assert.assertEquals("Wrong mpls bos", 1, builtMatch.getProtocolMatchFields().getMplsBos().intValue());
    Assert.assertEquals("Wrong mpls tc", 22, builtMatch.getProtocolMatchFields().getMplsTc().intValue());
    Assert.assertEquals("Wrong pbb isid", 23, builtMatch.getProtocolMatchFields().getPbb().getPbbIsid().intValue());
    Assert.assertEquals("Wrong tunnel id", new BigInteger(1, new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }), builtMatch.getTunnel().getTunnelId());
}
Also used : ArrayList(java.util.ArrayList) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) InPhyPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.phy.port._case.InPhyPortBuilder) EthDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.dst._case.EthDstBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Icmpv6TypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.type._case.Icmpv6TypeBuilder) EthDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthDstCaseBuilder) Ipv4DstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCaseBuilder) EthSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthSrcCaseBuilder) Icmpv4CodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4CodeCaseBuilder) MplsBosCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsBosCaseBuilder) EthTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthTypeBuilder) IpProtoBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.proto._case.IpProtoBuilder) PbbIsidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.PbbIsidCaseBuilder) VlanVidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVidBuilder) TcpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder) IpEcnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.ecn._case.IpEcnBuilder) VlanPcpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.pcp._case.VlanPcpBuilder) Icmpv4TypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.type._case.Icmpv4TypeBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) MplsLabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsLabelCaseBuilder) IpProtoCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpProtoCaseBuilder) TcpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCaseBuilder) IpDscpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.dscp._case.IpDscpBuilder) TcpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder) BigInteger(java.math.BigInteger) VlanPcpCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Ipv4SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.src._case.Ipv4SrcBuilder) Ipv4SrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4SrcCaseBuilder) VlanVidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCaseBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) MetadataCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MetadataCaseBuilder) VersionDatapathIdConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData) Icmpv6TypeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6TypeCaseBuilder) TcpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder) UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match) ArpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch) SctpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) InPhyPortCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPhyPortCaseBuilder) InPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder) Ipv4DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.dst._case.Ipv4DstBuilder) PbbIsidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.pbb.isid._case.PbbIsidBuilder) Icmpv4CodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.code._case.Icmpv4CodeBuilder) IpEcnCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpEcnCaseBuilder) MplsTcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTcBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) EthSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.src._case.EthSrcBuilder) IpDscpCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCaseBuilder) MplsBosBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.bos._case.MplsBosBuilder) TunnelIdCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TunnelIdCaseBuilder) Icmpv4TypeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4TypeCaseBuilder) EthTypeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthTypeCaseBuilder) TunnelIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelIdBuilder) TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) InPortCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCaseBuilder) MplsLabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.label._case.MplsLabelBuilder) Dscp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp) IpDscp(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpDscp) Icmpv6CodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.code._case.Icmpv6CodeBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) Icmpv6CodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6CodeCaseBuilder) MplsTcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsTcCaseBuilder) Test(org.junit.Test)

Example 70 with Metadata

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.Metadata in project genius by opendaylight.

the class ArpUtilImpl method getInterfaceName.

private String getInterfaceName(Metadata metadata) throws InterruptedException, ExecutionException {
    LOG.debug("metadata received is {} ", metadata);
    GetInterfaceFromIfIndexInputBuilder ifIndexInputBuilder = new GetInterfaceFromIfIndexInputBuilder();
    BigInteger lportTag = MetaDataUtil.getLportFromMetadata(metadata.getMetadata());
    ifIndexInputBuilder.setIfIndex(lportTag.intValue());
    GetInterfaceFromIfIndexInput input = ifIndexInputBuilder.build();
    Future<RpcResult<GetInterfaceFromIfIndexOutput>> interfaceFromIfIndex = odlInterfaceRpcService.getInterfaceFromIfIndex(input);
    GetInterfaceFromIfIndexOutput interfaceFromIfIndexOutput = interfaceFromIfIndex.get().getResult();
    return interfaceFromIfIndexOutput.getInterfaceName();
}
Also used : GetInterfaceFromIfIndexInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInput) GetInterfaceFromIfIndexInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) BigInteger(java.math.BigInteger) GetInterfaceFromIfIndexOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput)

Aggregations

BigInteger (java.math.BigInteger)44 ArrayList (java.util.ArrayList)34 Test (org.junit.Test)22 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)14 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)13 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)13 ByteBuf (io.netty.buffer.ByteBuf)10 MetadataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder)10 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)8 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)7 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)7 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)7 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)7 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)7 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)6 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)6 Metadata (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata)6 WriteMetadataCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder)6 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder)6 List (java.util.List)5