use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.SourceAsExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class SourceASHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
final SourceAsExtendedCommunityBuilder builder = new SourceAsExtendedCommunityBuilder();
builder.setGlobalAdministrator(new ShortAsNumber(Uint32.valueOf(buffer.readUnsignedShort())));
buffer.skipBytes(AS_LOCAL_ADMIN_LENGTH);
return new SourceAsExtendedCommunityCaseBuilder().setSourceAsExtendedCommunity(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.SourceAsExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class SourceASHandlerTest method testHandler.
@Test
public void testHandler() {
final SourceAsExtendedCommunityCase expected = new SourceAsExtendedCommunityCaseBuilder().setSourceAsExtendedCommunity(new SourceAsExtendedCommunityBuilder().setGlobalAdministrator(new ShortAsNumber(Uint32.ONE)).build()).build();
final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
Assert.assertEquals(expected, exComm);
final ByteBuf output = Unpooled.buffer(INPUT.length);
this.handler.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(INPUT, output.array());
assertEquals(9, this.handler.getSubType());
}
Aggregations