use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder in project openflowplugin by opendaylight.
the class OfToSalPbbIsidCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull PbbIsidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
PbbIsid pbbIsid = source.getPbbIsid();
if (pbbIsid != null) {
PbbBuilder pbbBuilder = new PbbBuilder();
pbbBuilder.setPbbIsid(pbbIsid.getIsid());
byte[] mask = pbbIsid.getMask();
if (mask != null) {
pbbBuilder.setPbbMask(ByteUtil.bytesToUnsignedMedium(mask));
}
protocolMatchFieldsBuilder.setPbb(pbbBuilder.build());
matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder in project openflowplugin by opendaylight.
the class OF13PushPbbActionDeserializer method deserialize.
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
PushPbbCaseBuilder caseBuilder = new PushPbbCaseBuilder();
PushPbbActionBuilder pbbBuilder = new PushPbbActionBuilder();
pbbBuilder.setEthertype(new EtherType(input.readUnsignedShort()));
caseBuilder.setPushPbbAction(pbbBuilder.build());
builder.setActionChoice(caseBuilder.build());
input.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder in project openflowplugin by opendaylight.
the class PbbEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final long pbbId = 6789;
final byte[] pbbIdMask = new byte[] { 0, 15, 10 };
final Match pbbMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setPbb(new PbbBuilder().setPbbIsid(pbbId).setPbbMask(ByteUtil.bytesToUnsignedMedium(pbbIdMask)).build()).build()).build();
assertMatch(pbbMatch, true, (out) -> {
assertEquals(out.readUnsignedMedium(), pbbId);
final byte[] mask = new byte[3];
out.readBytes(mask);
assertArrayEquals(mask, pbbIdMask);
});
final Match pbbMatchNoMask = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setPbb(new PbbBuilder().setPbbIsid(pbbId).build()).build()).build();
assertMatch(pbbMatchNoMask, false, (out) -> assertEquals(out.readUnsignedMedium(), pbbId));
}
Aggregations