use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.RouteRefreshCapabilityBuilder in project bgpcep by opendaylight.
the class RouteRefreshCapabilityHandlerTest method testRRCapHandler.
@Test
public void testRRCapHandler() throws BGPDocumentedException, BGPParsingException {
final CParameters expectedParams = new CParametersBuilder().addAugmentation(new CParameters1Builder().setRouteRefreshCapability(new RouteRefreshCapabilityBuilder().build()).build()).build();
assertEquals(expectedParams, HANDLER.parseCapability(Unpooled.copiedBuffer(OK_BYTES)));
assertEquals(expectedParams, HANDLER.parseCapability(Unpooled.copiedBuffer(WRONG_BYTES)));
final ByteBuf byteAggregator = Unpooled.buffer(2);
HANDLER.serializeCapability(expectedParams, byteAggregator);
assertEquals(Unpooled.copiedBuffer(CAP_BYTES), byteAggregator);
final CParameters missingCap = new CParametersBuilder().addAugmentation(new CParameters1Builder().setRouteRefreshCapability(null).build()).build();
final ByteBuf byteAggregator2 = Unpooled.buffer(0);
HANDLER.serializeCapability(missingCap, byteAggregator2);
assertEquals(Unpooled.copiedBuffer(new byte[] {}), byteAggregator2);
}
Aggregations