use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.RouteMonitoringMessage in project bgpcep by opendaylight.
the class RouteMonitoringMessageHandlerTest method testParseRouteMonitMessage.
@Test
public void testParseRouteMonitMessage() throws BmpDeserializationException {
final RouteMonitoringMessage parsedInitMsg = (RouteMonitoringMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(ROUTE_MONIT_MSG));
assertEquals(createRouteMonitMsg(true), parsedInitMsg);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.RouteMonitoringMessage in project bgpcep by opendaylight.
the class BmpMockUtilTest method testCreateRouteMonitoringPrePolicy.
@Test
public void testCreateRouteMonitoringPrePolicy() {
final RouteMonitoringMessage routeMonitoring = BmpMockUtil.createRouteMonitoring(PEER_IP, AdjRibInType.PrePolicy, PREFIX);
final PeerHeader peerHeader = routeMonitoring.getPeerHeader();
assertEquals(PEER_IP, peerHeader.getAddress().getIpv4AddressNoZone());
assertEquals(65431L, peerHeader.getAs().getValue().longValue());
assertEquals(PEER_IP, peerHeader.getBgpId());
assertEquals(PeerType.Global, peerHeader.getType());
assertEquals(AdjRibInType.PrePolicy, peerHeader.getAdjRibInType());
final Update update = routeMonitoring.getUpdate();
assertEquals(PREFIX, update.getNlri().get(0).getPrefix());
assertEquals("1.2.3.4", ((Ipv4NextHopCase) update.getAttributes().getCNextHop()).getIpv4NextHop().getGlobal().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.RouteMonitoringMessage in project bgpcep by opendaylight.
the class BmpMockUtilTest method testCreateRouteMonitoringPostPolicy.
@Test
public void testCreateRouteMonitoringPostPolicy() {
final RouteMonitoringMessage routeMonitoring = BmpMockUtil.createRouteMonitoring(PEER_IP, AdjRibInType.PostPolicy, PREFIX);
assertEquals(AdjRibInType.PostPolicy, routeMonitoring.getPeerHeader().getAdjRibInType());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.RouteMonitoringMessage in project bgpcep by opendaylight.
the class RouteMonitoringMessageHandler method serializeMessageBody.
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
Preconditions.checkArgument(message instanceof RouteMonitoringMessage, "An instance of RouteMonitoringMessage is required");
final RouteMonitoringMessage routeMonitor = (RouteMonitoringMessage) message;
this.msgRegistry.serializeMessage(new UpdateBuilder(routeMonitor.getUpdate()).build(), buffer);
}
Aggregations