private void connectMonitoredRouters(final BmpDispatcher dispatcher) { if (this.monitoredRouters != null) { for (final MonitoredRouter mr : this.monitoredRouters) { if (mr.getActive()) { Preconditions.checkNotNull(mr.getAddress()); Preconditions.checkNotNull(mr.getPort()); final String s = mr.getAddress().getIpv4Address().getValue(); final InetAddress addr = InetAddresses.forString(s); KeyMapping ret = null; final Rfc2385Key rfc2385KeyPassword = mr.getPassword(); ret = KeyMapping.getKeyMapping(addr, rfc2385KeyPassword.getValue()); dispatcher.createClient( Ipv4Util.toInetSocketAddress(mr.getAddress(), mr.getPort()), this.sessionManager, Optional.<KeyMapping>fromNullable(ret)); } } } }
@Override public java.lang.AutoCloseable createInstance() { try { return BmpMonitoringStationImpl.createBmpMonitorInstance(getExtensionsDependency(), getBmpDispatcherDependency(), getDomDataProviderDependency(), new MonitorId(getIdentifier().getInstanceName()), Ipv4Util.toInetSocketAddress(getBindingAddress(), getBindingPort()), constructKeys(), getCodecTreeFactoryDependency(), getSchemaProvider(), getMonitoredRouter()); } catch(final InterruptedException e) { throw new IllegalStateException("Failed to istantiate BMP application.", e); } }
private BgpPeerSingletonService(final RIB rib, final Neighbor neighbor, final BGPOpenConfigMappingService mappingService, final WriteConfiguration configurationWriter) { this.neighborAddress = neighbor.getNeighborAddress(); this.bgpPeer = new BGPPeer(Ipv4Util.toStringIP(this.neighborAddress), rib, mappingService.toPeerRole(neighbor), rpcRegistry); final List<BgpParameters> bgpParameters = getBgpParameters(neighbor, rib, mappingService); final KeyMapping key = OpenConfigMappingUtil.getNeighborKey(neighbor); this.prefs = new BGPSessionPreferences(rib.getLocalAs(), getHoldTimer(neighbor), rib.getBgpIdentifier(), getPeerAs(neighbor, rib), bgpParameters, getPassword(key)); this.activeConnection = OpenConfigMappingUtil.isActive(neighbor); this.dispatcher = rib.getDispatcher(); this.inetAddress = Ipv4Util.toInetSocketAddress(this.neighborAddress, OpenConfigMappingUtil.getPort(neighbor)); this.retryTimer = OpenConfigMappingUtil.getRetryTimer(neighbor); this.key = Optional.fromNullable(key); this.configurationWriter = configurationWriter; this.serviceGroupIdentifier = rib.getRibIServiceGroupIdentifier(); LOG.info("Peer Singleton Service {} registered", this.serviceGroupIdentifier); //this need to be always the last step this.registration = rib.registerClusterSingletonService(this); }