use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.EncapsulationCase in project bgpcep by opendaylight.
the class EncapsulationEC method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf body) {
Preconditions.checkArgument(extendedCommunity instanceof EncapsulationCase, "The extended community %s is not EncapsulationCase type.", extendedCommunity);
final EncapsulationExtendedCommunity encap = ((EncapsulationCase) extendedCommunity).getEncapsulationExtendedCommunity();
body.writeZero(RESERVED_SIZE);
body.writeShort(encap.getTunnelType().getIntValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.EncapsulationCase in project bgpcep by opendaylight.
the class EncapsulationECTest method testParser.
@Test
public void testParser() throws BGPParsingException, BGPDocumentedException {
final ByteBuf buffer = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
final EncapsulationCase expected = new EncapsulationCaseBuilder().setEncapsulationExtendedCommunity(new EncapsulationExtendedCommunityBuilder().setTunnelType(TUNNEL_TYPE).build()).build();
this.parser.serializeExtendedCommunity(expected, buffer);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buffer));
final ExtendedCommunity result = this.parser.parseExtendedCommunity(Unpooled.wrappedBuffer(RESULT));
assertEquals(expected, result);
}
Aggregations