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);
}
}
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();
}
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));
}
Aggregations