use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.as4.extended.community.RedirectAs4Builder in project bgpcep by opendaylight.
the class FSExtendedCommunitiesTest method testredirect4bSerializer.
@Test
public void testredirect4bSerializer() throws BGPDocumentedException, BGPParsingException {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.route.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCase redirect = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.bgp.rib.route.attributes.extended.communities.extended.community.RedirectAs4ExtendedCommunityCaseBuilder().setRedirectAs4(new RedirectAs4Builder().setGlobalAdministrator(new AsNumber(Uint32.valueOf(6548))).setLocalAdministrator(Uint16.valueOf(126)).build()).build();
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_AS_4BYTES.length);
this.registry.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(REDIRECT_AS_4BYTES, output.array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.as4.extended.community.RedirectAs4Builder 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.redirect.as4.extended.community.RedirectAs4Builder 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(Uint32.valueOf(6548))).setLocalAdministrator(Uint16.valueOf(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);
}
Aggregations