Search in sources :

Example 1 with SetTpSrcCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder in project openflowplugin by opendaylight.

the class OF10FlowModInputMessageFactoryTest method createAction.

private static List<Action> createAction() {
    final List<Action> actions = new ArrayList<>();
    ActionBuilder actionBuilder = new ActionBuilder();
    SetNwDstCaseBuilder nwDstCaseBuilder = new SetNwDstCaseBuilder();
    SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
    nwDstBuilder.setIpAddress(new Ipv4Address("2.2.2.2"));
    nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());
    actionBuilder.setActionChoice(nwDstCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetTpSrcCaseBuilder tpSrcCaseBuilder = new SetTpSrcCaseBuilder();
    SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
    tpSrcBuilder.setPort(new PortNumber(42L));
    tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
    actionBuilder.setActionChoice(tpSrcCaseBuilder.build());
    actions.add(actionBuilder.build());
    return actions;
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) SetTpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder) ArrayList(java.util.ArrayList) SetNwDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 2 with SetTpSrcCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder in project openflowplugin by opendaylight.

the class OF10SetTpSrcActionDeserializer method deserialize.

@Override
public Action deserialize(ByteBuf input) {
    final ActionBuilder builder = new ActionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    SetTpSrcCaseBuilder caseBuilder = new SetTpSrcCaseBuilder();
    SetTpSrcActionBuilder actionBuilder = new SetTpSrcActionBuilder();
    actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
    caseBuilder.setSetTpSrcAction(actionBuilder.build());
    builder.setActionChoice(caseBuilder.build());
    input.skipBytes(ActionConstants.PADDING_IN_TP_PORT_ACTION);
    return builder.build();
}
Also used : SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) SetTpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)

Example 3 with SetTpSrcCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder in project openflowplugin by opendaylight.

the class OF10FlowModInputMessageFactoryTest method testFlowModInputMessageFactory.

/**
 * Testing of {@link OF10FlowModInputMessageFactory} for correct translation from POJO.
 */
@Test
public void testFlowModInputMessageFactory() throws Exception {
    FlowModInputBuilder builder = new FlowModInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    MatchV10Builder matchBuilder = new MatchV10Builder();
    matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true, true, true, true, true));
    matchBuilder.setNwSrcMask((short) 0);
    matchBuilder.setNwDstMask((short) 0);
    matchBuilder.setInPort(58);
    matchBuilder.setDlSrc(new MacAddress("01:01:01:01:01:01"));
    matchBuilder.setDlDst(new MacAddress("ff:ff:ff:ff:ff:ff"));
    matchBuilder.setDlVlan(18);
    matchBuilder.setDlVlanPcp((short) 5);
    matchBuilder.setDlType(42);
    matchBuilder.setNwTos((short) 4);
    matchBuilder.setNwProto((short) 7);
    matchBuilder.setNwSrc(new Ipv4Address("8.8.8.8"));
    matchBuilder.setNwDst(new Ipv4Address("16.16.16.16"));
    matchBuilder.setTpSrc(6653);
    matchBuilder.setTpDst(6633);
    builder.setMatchV10(matchBuilder.build());
    byte[] cookie = new byte[] { (byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01 };
    builder.setCookie(new BigInteger(1, cookie));
    builder.setCommand(FlowModCommand.forValue(0));
    builder.setIdleTimeout(12);
    builder.setHardTimeout(16);
    builder.setPriority(1);
    builder.setBufferId(2L);
    builder.setOutPort(new PortNumber(4422L));
    builder.setFlagsV10(new FlowModFlagsV10(true, false, true));
    final List<Action> actions = new ArrayList<>();
    ActionBuilder actionBuilder = new ActionBuilder();
    SetNwDstCaseBuilder nwDstCaseBuilder = new SetNwDstCaseBuilder();
    SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
    nwDstBuilder.setIpAddress(new Ipv4Address("2.2.2.2"));
    nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());
    actionBuilder.setActionChoice(nwDstCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetTpSrcCaseBuilder tpSrcCaseBuilder = new SetTpSrcCaseBuilder();
    SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
    tpSrcBuilder.setPort(new PortNumber(42L));
    tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
    actionBuilder.setActionChoice(tpSrcCaseBuilder.build());
    actions.add(actionBuilder.build());
    builder.setAction(actions);
    FlowModInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    flowModFactory.serialize(message, out);
    BufferHelper.checkHeaderV10(out, (byte) 14, 88);
    Assert.assertEquals("Wrong wildcards", 3678463, out.readUnsignedInt());
    Assert.assertEquals("Wrong inPort", 58, out.readUnsignedShort());
    byte[] dlSrc = new byte[6];
    out.readBytes(dlSrc);
    Assert.assertEquals("Wrong dlSrc", "01:01:01:01:01:01", ByteBufUtils.macAddressToString(dlSrc));
    byte[] dlDst = new byte[6];
    out.readBytes(dlDst);
    Assert.assertEquals("Wrong dlDst", "FF:FF:FF:FF:FF:FF", ByteBufUtils.macAddressToString(dlDst));
    Assert.assertEquals("Wrong dlVlan", 18, out.readUnsignedShort());
    Assert.assertEquals("Wrong dlVlanPcp", 5, out.readUnsignedByte());
    out.skipBytes(1);
    Assert.assertEquals("Wrong dlType", 42, out.readUnsignedShort());
    Assert.assertEquals("Wrong nwTos", 4, out.readUnsignedByte());
    Assert.assertEquals("Wrong nwProto", 7, out.readUnsignedByte());
    out.skipBytes(2);
    Assert.assertEquals("Wrong nwSrc", 134744072, out.readUnsignedInt());
    Assert.assertEquals("Wrong nwDst", 269488144, out.readUnsignedInt());
    Assert.assertEquals("Wrong tpSrc", 6653, out.readUnsignedShort());
    Assert.assertEquals("Wrong tpDst", 6633, out.readUnsignedShort());
    byte[] cookieRead = new byte[8];
    out.readBytes(cookieRead);
    Assert.assertArrayEquals("Wrong cookie", cookie, cookieRead);
    Assert.assertEquals("Wrong command", 0, out.readUnsignedShort());
    Assert.assertEquals("Wrong idleTimeOut", 12, out.readUnsignedShort());
    Assert.assertEquals("Wrong hardTimeOut", 16, out.readUnsignedShort());
    Assert.assertEquals("Wrong priority", 1, out.readUnsignedShort());
    Assert.assertEquals("Wrong bufferId", 2, out.readUnsignedInt());
    Assert.assertEquals("Wrong outPort", 4422, out.readUnsignedShort());
    Assert.assertEquals("Wrong flags", 3, out.readUnsignedShort());
    Assert.assertEquals("Wrong action - type", 7, out.readUnsignedShort());
    Assert.assertEquals("Wrong action - length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong flags", 33686018, out.readUnsignedInt());
    Assert.assertEquals("Wrong action - type", 9, out.readUnsignedShort());
    Assert.assertEquals("Wrong action - length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong flags", 42, out.readUnsignedShort());
    out.skipBytes(2);
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) ArrayList(java.util.ArrayList) FlowModFlagsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlagsV10) SetNwDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder) FlowModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ByteBuf(io.netty.buffer.ByteBuf) FlowWildcardsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) SetTpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder) FlowModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput) BigInteger(java.math.BigInteger) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Test(org.junit.Test)

Example 4 with SetTpSrcCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder in project openflowplugin by opendaylight.

the class OF10ActionsSerializerTest method test.

/**
 * Testing correct serialization of actions (OF v1.0).
 */
@Test
public void test() {
    final List<Action> actions = new ArrayList<>();
    OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
    OutputActionBuilder outputBuilder = new OutputActionBuilder();
    outputBuilder.setPort(new PortNumber(42L));
    outputBuilder.setMaxLength(32);
    caseBuilder.setOutputAction(outputBuilder.build());
    ActionBuilder actionBuilder = new ActionBuilder();
    actionBuilder.setActionChoice(caseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetVlanVidCaseBuilder vlanVidCaseBuilder = new SetVlanVidCaseBuilder();
    SetVlanVidActionBuilder vlanVidBuilder = new SetVlanVidActionBuilder();
    vlanVidBuilder.setVlanVid(15);
    vlanVidCaseBuilder.setSetVlanVidAction(vlanVidBuilder.build());
    actionBuilder.setActionChoice(vlanVidCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetVlanPcpCaseBuilder vlanPcpCaseBuilder = new SetVlanPcpCaseBuilder();
    SetVlanPcpActionBuilder vlanPcpBuilder = new SetVlanPcpActionBuilder();
    vlanPcpBuilder.setVlanPcp((short) 16);
    vlanPcpCaseBuilder.setSetVlanPcpAction(vlanPcpBuilder.build());
    actionBuilder.setActionChoice(vlanPcpCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    actionBuilder.setActionChoice(new StripVlanCaseBuilder().build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetDlSrcCaseBuilder dlSrcCaseBuilder = new SetDlSrcCaseBuilder();
    SetDlSrcActionBuilder dlSrcBuilder = new SetDlSrcActionBuilder();
    dlSrcBuilder.setDlSrcAddress(new MacAddress("00:00:00:02:03:04"));
    dlSrcCaseBuilder.setSetDlSrcAction(dlSrcBuilder.build());
    actionBuilder.setActionChoice(dlSrcCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetDlDstCaseBuilder dlDstCaseBuilder = new SetDlDstCaseBuilder();
    SetDlDstActionBuilder dlDstBuilder = new SetDlDstActionBuilder();
    dlDstBuilder.setDlDstAddress(new MacAddress("00:00:00:01:02:03"));
    dlDstCaseBuilder.setSetDlDstAction(dlDstBuilder.build());
    actionBuilder.setActionChoice(dlDstCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetNwSrcCaseBuilder nwSrcCaseBuilder = new SetNwSrcCaseBuilder();
    SetNwSrcActionBuilder nwSrcBuilder = new SetNwSrcActionBuilder();
    nwSrcBuilder.setIpAddress(new Ipv4Address("10.0.0.1"));
    nwSrcCaseBuilder.setSetNwSrcAction(nwSrcBuilder.build());
    actionBuilder.setActionChoice(nwSrcCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetNwDstCaseBuilder nwDstCaseBuilder = new SetNwDstCaseBuilder();
    SetNwDstActionBuilder nwDstBuilder = new SetNwDstActionBuilder();
    nwDstBuilder.setIpAddress(new Ipv4Address("10.0.0.3"));
    nwDstCaseBuilder.setSetNwDstAction(nwDstBuilder.build());
    actionBuilder.setActionChoice(nwDstCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetNwTosCaseBuilder tosCaseBuilder = new SetNwTosCaseBuilder();
    SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();
    tosBuilder.setNwTos((short) 204);
    tosCaseBuilder.setSetNwTosAction(tosBuilder.build());
    actionBuilder.setActionChoice(tosCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetTpSrcCaseBuilder tpSrcCaseBuilder = new SetTpSrcCaseBuilder();
    SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
    tpSrcBuilder.setPort(new PortNumber(6653L));
    tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
    actionBuilder.setActionChoice(tpSrcCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetTpDstCaseBuilder tpDstCaseBuilder = new SetTpDstCaseBuilder();
    SetTpDstActionBuilder tpDstBuilder = new SetTpDstActionBuilder();
    tpDstBuilder.setPort(new PortNumber(6633L));
    tpDstCaseBuilder.setSetTpDstAction(tpDstBuilder.build());
    actionBuilder.setActionChoice(tpDstCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    EnqueueCaseBuilder enqueueCaseBuilder = new EnqueueCaseBuilder();
    EnqueueActionBuilder enqueueBuilder = new EnqueueActionBuilder();
    enqueueBuilder.setPort(new PortNumber(6613L));
    enqueueBuilder.setQueueId(new QueueId(400L));
    enqueueCaseBuilder.setEnqueueAction(enqueueBuilder.build());
    actionBuilder.setActionChoice(enqueueCaseBuilder.build());
    actions.add(actionBuilder.build());
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    ListSerializer.serializeList(actions, TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF10_VERSION_ID), registry, out);
    Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong port", 42, out.readUnsignedShort());
    Assert.assertEquals("Wrong max-length", 32, out.readUnsignedShort());
    Assert.assertEquals("Wrong action type", 1, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong vlan-vid", 15, out.readUnsignedShort());
    out.skipBytes(2);
    Assert.assertEquals("Wrong action type", 2, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong vlan-pcp", 16, out.readUnsignedByte());
    out.skipBytes(3);
    Assert.assertEquals("Wrong action type", 3, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    out.skipBytes(4);
    Assert.assertEquals("Wrong action type", 4, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
    byte[] data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
    out.readBytes(data);
    Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:02:03:04"), data);
    out.skipBytes(6);
    Assert.assertEquals("Wrong action type", 5, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
    data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
    out.readBytes(data);
    Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:01:02:03"), data);
    out.skipBytes(6);
    Assert.assertEquals("Wrong action type", 6, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());
    Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());
    Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());
    Assert.assertEquals("Wrong ip-address(4)", 1, out.readUnsignedByte());
    Assert.assertEquals("Wrong action type", 7, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());
    Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());
    Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());
    Assert.assertEquals("Wrong ip-address(4)", 3, out.readUnsignedByte());
    Assert.assertEquals("Wrong action type", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong nw-tos", 204, out.readUnsignedByte());
    out.skipBytes(3);
    Assert.assertEquals("Wrong action type", 9, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong port", 6653, out.readUnsignedShort());
    out.skipBytes(2);
    Assert.assertEquals("Wrong action type", 10, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong port", 6633, out.readUnsignedShort());
    out.skipBytes(2);
    Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
    Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());
    out.skipBytes(6);
    Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());
    Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);
}
Also used : OutputActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) SetVlanPcpCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanPcpCaseBuilder) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) SetTpDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.dst._case.SetTpDstActionBuilder) SetVlanVidActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.vlan.vid._case.SetVlanVidActionBuilder) SetDlSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.dl.src._case.SetDlSrcActionBuilder) SetNwSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.src._case.SetNwSrcActionBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) SetDlDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.dl.dst._case.SetDlDstActionBuilder) SetNwTosActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.tos._case.SetNwTosActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) SetVlanPcpActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.vlan.pcp._case.SetVlanPcpActionBuilder) EnqueueActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.enqueue._case.EnqueueActionBuilder) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) ArrayList(java.util.ArrayList) SetDlDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlDstCaseBuilder) SetNwTosCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTosCaseBuilder) SetNwTosActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.tos._case.SetNwTosActionBuilder) SetDlDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.dl.dst._case.SetDlDstActionBuilder) ByteBuf(io.netty.buffer.ByteBuf) SetVlanPcpActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.vlan.pcp._case.SetVlanPcpActionBuilder) SetTpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) SetDlSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlSrcCaseBuilder) SetVlanVidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanVidCaseBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) SetTpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpDstCaseBuilder) SetNwDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder) QueueId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueId) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) EnqueueActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.enqueue._case.EnqueueActionBuilder) StripVlanCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.StripVlanCaseBuilder) EnqueueCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.EnqueueCaseBuilder) SetVlanVidActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.vlan.vid._case.SetVlanVidActionBuilder) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder) SetNwSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.src._case.SetNwSrcActionBuilder) SetNwSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCaseBuilder) SetTpDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.dst._case.SetTpDstActionBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) SetDlSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.dl.src._case.SetDlSrcActionBuilder) Test(org.junit.Test)

Example 5 with SetTpSrcCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder in project openflowplugin by opendaylight.

the class SalToOfSetTpSrcActionV10Case method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    SetTpSrcAction settpsrcaction = source.getSetTpSrcAction();
    SetTpSrcCaseBuilder setTpSrcCaseBuilder = new SetTpSrcCaseBuilder();
    SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
    setTpSrcActionBuilder.setPort(new PortNumber(settpsrcaction.getPort().getValue().longValue()));
    setTpSrcCaseBuilder.setSetTpSrcAction(setTpSrcActionBuilder.build());
    return Optional.of(new ActionBuilder().setActionChoice(setTpSrcCaseBuilder.build()).build());
}
Also used : SetTpSrcAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcAction) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder) SetTpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Nonnull(javax.annotation.Nonnull)

Aggregations

SetTpSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder)5 SetTpSrcActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.tp.src._case.SetTpSrcActionBuilder)5 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)5 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)5 ArrayList (java.util.ArrayList)3 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)3 SetNwDstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder)3 SetNwDstActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.dst._case.SetNwDstActionBuilder)3 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)3 ByteBuf (io.netty.buffer.ByteBuf)2 Test (org.junit.Test)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 BigInteger (java.math.BigInteger)1 Nonnull (javax.annotation.Nonnull)1 SetTpSrcAction (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcAction)1 EnqueueCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.EnqueueCaseBuilder)1 OutputActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder)1 SetDlDstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlDstCaseBuilder)1 SetDlSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlSrcCaseBuilder)1 SetNwSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCaseBuilder)1