use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.routes.evpn.routes.evpn.route.attributes.extended.communities.extended.community.EsiLabelExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class ESILabelExtCom method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final boolean singleActive = buffer.readBoolean();
buffer.skipBytes(RESERVED);
final MplsLabel label = mplsLabelForByteBuf(buffer);
return new EsiLabelExtendedCommunityCaseBuilder().setEsiLabelExtendedCommunity(new EsiLabelExtendedCommunityBuilder().setEsiLabel(label).setSingleActiveMode(singleActive).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.routes.evpn.routes.evpn.route.attributes.extended.communities.extended.community.EsiLabelExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class ESILabelExtComTest method parserTest.
@Test
public void parserTest() throws BGPParsingException, BGPDocumentedException {
final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
final EsiLabelExtendedCommunityCase expected = new EsiLabelExtendedCommunityCaseBuilder().setEsiLabelExtendedCommunity(new EsiLabelExtendedCommunityBuilder().setSingleActiveMode(true).setEsiLabel(MPLS_LABEL).build()).build();
this.parser.serializeExtendedCommunity(expected, buff);
assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
final ExtendedCommunity result = this.parser.parseExtendedCommunity(Unpooled.wrappedBuffer(RESULT));
assertEquals(expected, result);
}
Aggregations