use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginGroupTestCommandProvider method createNonAppyPushVlanAction.
private static List<Action> createNonAppyPushVlanAction() {
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
vlan.setEthernetType(0x8101);
ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
actionList.add(ab.build());
return actionList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginGroupTestCommandProvider method createPushVlanAction.
private List<Action> createPushVlanAction() {
PushVlanActionBuilder vlan = new PushVlanActionBuilder();
vlan.setEthernetType(0x8100);
ActionBuilder action = new ActionBuilder();
action.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
List<Action> actions = new ArrayList<>();
actions.add(action.build());
return actions;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder in project openflowplugin by opendaylight.
the class PacketOutInputMessageFactoryTest method testPacketOutInputMessage.
/**
* Testing of {@link PacketOutInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testPacketOutInputMessage() throws Exception {
PacketOutInputBuilder builder = new PacketOutInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setBufferId(256L);
builder.setInPort(new PortNumber(256L));
final List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
PushVlanCaseBuilder pushVlanCaseBuilder = new PushVlanCaseBuilder();
PushVlanActionBuilder pushVlanBuilder = new PushVlanActionBuilder();
pushVlanBuilder.setEthertype(new EtherType(new EtherType(25)));
pushVlanCaseBuilder.setPushVlanAction(pushVlanBuilder.build());
actionBuilder.setActionChoice(pushVlanCaseBuilder.build());
actions.add(actionBuilder.build());
actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(new PopVlanCaseBuilder().build());
actions.add(actionBuilder.build());
builder.setAction(actions);
builder.setData(ByteBufUtils.hexStringToBytes("00 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14"));
PacketOutInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
packetOutFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, 56);
Assert.assertEquals("Wrong BufferId", message.getBufferId().longValue(), out.readUnsignedInt());
Assert.assertEquals("Wrong PortNumber", message.getInPort().getValue().longValue(), out.readUnsignedInt());
Assert.assertEquals("Wrong ActionsLength", 16, out.readUnsignedShort());
out.skipBytes(PADDING_IN_PACKET_OUT_MESSAGE);
Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
Assert.assertEquals("Wrong ethertype", 25, out.readUnsignedShort());
out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());
Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
out.skipBytes(PADDING_IN_ACTION_HEADER);
byte[] readData = new byte[out.readableBytes()];
out.readBytes(readData);
Assert.assertArrayEquals("Wrong data", message.getData(), readData);
}
Aggregations