use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createEthernetMatch.
private static MatchBuilder createEthernetMatch() {
final MatchBuilder match = new MatchBuilder();
// ethernettype
final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
// match
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
final EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
// ethernet
final EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder();
// macaddress
// match
final MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS);
ethdest.setAddress(macdest);
ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
ethmatch.setEthernetDestination(ethdest.build());
final EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
final MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
ethsrc.setAddress(macsrc);
ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
ethmatch.setEthernetSource(ethsrc.build());
match.setEthernetMatch(ethmatch.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class PushVlanActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int ethType = 10;
final Action action = new PushVlanActionCaseBuilder().setPushVlanAction(new PushVlanActionBuilder().setEthernetType(ethType).build()).build();
assertAction(action, out -> {
assertEquals(out.readUnsignedShort(), ethType);
out.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class EthernetTypeEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final long ethType = 0xffffL;
final Match match = new MatchBuilder().setEthernetMatch(new EthernetMatchBuilder().setEthernetType(new EthernetTypeBuilder().setType(new EtherType(ethType)).build()).build()).build();
assertMatch(match, false, (out) -> assertEquals(out.readUnsignedShort(), ethType));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class PopMplsActionDeserializerTest method testDeserialize.
@Test
public void testDeserialize() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final short ethType = 10;
writeHeader(in);
in.writeShort(ethType);
in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
final Action action = deserializeAction(in);
assertTrue(PopMplsActionCase.class.isInstance(action));
final PopMplsAction popAction = PopMplsActionCase.class.cast(action).getPopMplsAction();
assertEquals(ethType, popAction.getEthernetType().shortValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class PushPbbActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int ethType = 10;
final Action action = new PushPbbActionCaseBuilder().setPushPbbAction(new PushPbbActionBuilder().setEthernetType(ethType).build()).build();
assertAction(action, out -> {
assertEquals(out.readUnsignedShort(), ethType);
out.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
});
}
Aggregations