Search in sources :

Example 1 with RouteMonitoringMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.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);
}
Also used : RouteMonitoringMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.RouteMonitoringMessage) Test(org.junit.Test)

Example 2 with RouteMonitoringMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.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().getIpv4Address());
    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());
}
Also used : PeerHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.header.PeerHeader) Update(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route.monitoring.message.Update) RouteMonitoringMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.RouteMonitoringMessage) Test(org.junit.Test)

Example 3 with RouteMonitoringMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.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());
}
Also used : RouteMonitoringMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.RouteMonitoringMessage) Test(org.junit.Test)

Example 4 with RouteMonitoringMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.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);
}
Also used : UpdateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder) RouteMonitoringMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.RouteMonitoringMessage)

Aggregations

RouteMonitoringMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.RouteMonitoringMessage)4 Test (org.junit.Test)3 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.UpdateBuilder)1 PeerHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.header.PeerHeader)1 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route.monitoring.message.Update)1