use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class FSExtendedCommunitiesTest method testRedirect4bParser.
@Test
public void testRedirect4bParser() throws BGPDocumentedException, BGPParsingException {
final RedirectAs4ExtendedCommunityCase redirect = new RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(6548L)).setLocalAdministrator(126).build()).build();
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_AS_4BYTES));
Assert.assertEquals(expected, parsed);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.update.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder in project bgpcep by opendaylight.
the class RedirectAsFourOctetEcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
final RedirectAs4Builder builder = new RedirectAs4Builder();
builder.setGlobalAdministrator(new AsNumber(buffer.readUnsignedInt()));
builder.setLocalAdministrator(buffer.readUnsignedShort());
return new RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(builder.build()).build();
}
Aggregations