use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.source.as._4.extended.community._case.SourceAs4ExtendedCommunityBuilder in project bgpcep by opendaylight.
the class SourceAS4OctectASHandlerTest method testHandler.
@Test
public void testHandler() {
final SourceAs4ExtendedCommunityCase expected = new SourceAs4ExtendedCommunityCaseBuilder().setSourceAs4ExtendedCommunity(new SourceAs4ExtendedCommunityBuilder().setGlobalAdministrator(new AsNumber(Uint32.valueOf(20))).build()).build();
final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
assertEquals(expected, exComm);
final ByteBuf output = Unpooled.buffer(INPUT.length);
this.handler.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(INPUT, output.array());
assertEquals(209, this.handler.getSubType());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.extended.community.extended.community.source.as._4.extended.community._case.SourceAs4ExtendedCommunityBuilder in project bgpcep by opendaylight.
the class SourceAS4OctectHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) {
final SourceAs4ExtendedCommunityBuilder builder = new SourceAs4ExtendedCommunityBuilder().setGlobalAdministrator(new AsNumber(ByteBufUtils.readUint32(body)));
body.skipBytes(LOCAL_LENGTH);
return new SourceAs4ExtendedCommunityCaseBuilder().setSourceAs4ExtendedCommunity(builder.build()).build();
}
Aggregations