Search in sources :

Example 6 with PeerUpNotification

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotification in project bgpcep by opendaylight.

the class BmpRouterImpl method onPeerUp.

private synchronized void onPeerUp(final PeerUpNotification peerUp) {
    final PeerId peerId = getPeerIdFromOpen(peerUp.getReceivedOpen());
    if (!getPeer(peerId).isPresent()) {
        final BmpRouterPeer peer = BmpRouterPeerImpl.createRouterPeer(this.domTxChain, this.peersYangIId, peerUp, this.extensions, this.tree, peerId);
        this.peers.put(peerId, peer);
        LOG.debug("Router {}: Peer {} goes up.", this.routerIp, peerId.getValue());
    } else {
        LOG.debug("Peer: {} for Router: {} already exists.", peerId.getValue(), this.routerIp);
    }
}
Also used : BmpRouterPeer(org.opendaylight.protocol.bmp.impl.spi.BmpRouterPeer) PeerId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId)

Example 7 with PeerUpNotification

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotification in project bgpcep by opendaylight.

the class BmpMockUtil method createPeerUp.

static PeerUpNotification createPeerUp(final Ipv4AddressNoZone peerIp, final InetAddress localAddress) {
    final PeerUpNotificationBuilder msgBuilder = new PeerUpNotificationBuilder();
    msgBuilder.setLocalAddress(new IpAddressNoZone(new Ipv4AddressNoZone(localAddress.getHostAddress())));
    msgBuilder.setLocalPort(PEER_PORT);
    msgBuilder.setRemotePort(PEER_PORT);
    msgBuilder.setReceivedOpen(new ReceivedOpenBuilder(createOpen(peerIp)).build());
    msgBuilder.setSentOpen(new SentOpenBuilder(createOpen(new Ipv4AddressNoZone(localAddress.getHostAddress()))).build());
    msgBuilder.setPeerHeader(createPeerHeader(peerIp, AdjRibInType.PrePolicy));
    return msgBuilder.build();
}
Also used : ReceivedOpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.up.ReceivedOpenBuilder) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) SentOpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.up.SentOpenBuilder) IpAddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone) PeerUpNotificationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotificationBuilder)

Example 8 with PeerUpNotification

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotification in project bgpcep by opendaylight.

the class AbstractBmpPerPeerMessageParserTest method testSerializeMessageBody.

@Test
public void testSerializeMessageBody() {
    final PeerHeader perHeader = AbstractBmpPerPeerMessageParser.parsePerPeerHeader(Unpooled.wrappedBuffer(this.ipv6MsgWithDistinguishergBytes));
    final PeerUpNotification peerNotif = new PeerUpNotificationBuilder().setPeerHeader(perHeader).build();
    final ByteBuf aggregator = Unpooled.buffer();
    this.parser.serializeMessageBody(peerNotif, aggregator);
    assertArrayEquals(this.ipv6MsgWithDistinguishergBytes, ByteArray.getAllBytes(aggregator));
}
Also used : PeerUpNotification(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotification) PeerHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.header.PeerHeader) ByteBuf(io.netty.buffer.ByteBuf) PeerUpNotificationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotificationBuilder) Test(org.junit.Test)

Aggregations

PeerUpNotification (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotification)4 Test (org.junit.Test)3 PeerHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.header.PeerHeader)3 PeerUpNotificationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerUpNotificationBuilder)2 ReceivedOpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.up.ReceivedOpenBuilder)2 SentOpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.up.SentOpenBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 BmpRouterPeer (org.opendaylight.protocol.bmp.impl.spi.BmpRouterPeer)1 TestUtil.createPeerUpNotification (org.opendaylight.protocol.bmp.parser.message.TestUtil.createPeerUpNotification)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 IpAddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)1 OpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.OpenBuilder)1 PeerId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId)1 PeerUpNotificationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.PeerUpNotificationBuilder)1 ReceivedOpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.up.ReceivedOpenBuilder)1 SentOpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.up.SentOpenBuilder)1 PeerDistinguisher (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Peer.PeerDistinguisher)1 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)1