use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor in project netvirt by opendaylight.
the class ArpMonitorEventListener method onMonitorEvent.
@Override
public void onMonitorEvent(MonitorEvent notification) {
Long monitorId = notification.getEventData().getMonitorId();
MacEntry macEntry = AlivenessMonitorUtils.getMacEntryFromMonitorId(monitorId);
if (macEntry == null) {
LOG.debug("No MacEntry found associated with the monitor Id {}", monitorId);
return;
}
LivenessState livenessState = notification.getEventData().getMonitorState();
if (livenessState.equals(LivenessState.Down)) {
String vpnName = macEntry.getVpnName();
String learntIp = macEntry.getIpAddress().getHostAddress();
LearntVpnVipToPort vpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, learntIp);
if (vpnVipToPort != null && macEntry.getCreatedTime().equals(vpnVipToPort.getCreationTime())) {
jobCoordinator.enqueueJob(ArpMonitoringHandler.buildJobKey(macEntry.getIpAddress().getHostAddress(), macEntry.getVpnName()), new ArpMonitorStopTask(macEntry, dataBroker, alivenessManager));
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor in project netvirt by opendaylight.
the class StatisticsImpl method createIdPool.
private void createIdPool() {
if (checkPoolExists()) {
return;
}
CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(CountersServiceUtils.COUNTERS_PULL_NAME).setLow(CountersServiceUtils.COUNTERS_PULL_START).setHigh(CountersServiceUtils.COUNTERS_PULL_START + CountersServiceUtils.COUNTERS_PULL_END).build();
Future<RpcResult<Void>> result = idManagerService.createIdPool(createPool);
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(result), new FutureCallback<RpcResult<Void>>() {
@Override
public void onFailure(Throwable error) {
LOG.error("Failed to create idPool for Aliveness Monitor Service", error);
}
@Override
public void onSuccess(@Nonnull RpcResult<Void> rpcResult) {
if (rpcResult.isSuccessful()) {
LOG.debug("Created IdPool for tap");
} else {
LOG.error("RPC to create Idpool failed {}", rpcResult.getErrors());
}
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor in project bgpcep by opendaylight.
the class BmpDeployerImpl method updateBmpMonitor.
@SuppressWarnings("checkstyle:IllegalCatch")
private synchronized void updateBmpMonitor(final BmpMonitorConfig bmpConfig) {
final MonitorId monitorId = bmpConfig.getMonitorId();
final BmpMonitoringStationImpl oldService = this.bmpMonitorServices.remove(monitorId);
try {
if (oldService != null) {
oldService.closeServiceInstance().get(TIMEOUT_NS, TimeUnit.NANOSECONDS);
oldService.close();
}
final Server server = bmpConfig.getServer();
final InetSocketAddress inetAddress = Ipv4Util.toInetSocketAddress(server.getBindingAddress(), server.getBindingPort());
final BmpMonitoringStationImpl monitor = new BmpMonitoringStationImpl(this.bmpDeployerDependencies, this.dispatcher, monitorId, inetAddress, bmpConfig.getMonitoredRouter());
this.bmpMonitorServices.put(monitorId, monitor);
} catch (final Exception e) {
LOG.error("Failed to create Bmp Monitor {}.", monitorId, e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor in project genius by opendaylight.
the class ItmMonitorIntervalWorker method toggle.
private void toggle(String tunnelInterfaceName, WriteTransaction transaction) {
if (tunnelInterfaceName != null) {
LOG.debug("tunnel {} will have monitor interval {}", tunnelInterfaceName, interval);
InstanceIdentifier<IfTunnel> trunkIdentifier = ItmUtils.buildTunnelId(tunnelInterfaceName);
IfTunnel tunnel = new IfTunnelBuilder().setMonitorInterval(interval.longValue()).build();
transaction.merge(LogicalDatastoreType.CONFIGURATION, trunkIdentifier, tunnel);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor in project genius by opendaylight.
the class AlivenessMonitorTest method testMonitorProfileCreate.
@Test
public void testMonitorProfileCreate() throws InterruptedException, ExecutionException {
MonitorProfileCreateInput input = new MonitorProfileCreateInputBuilder().setProfile(new ProfileBuilder().setFailureThreshold(10L).setMonitorInterval(10000L).setMonitorWindow(10L).setProtocolType(EtherTypes.Arp).build()).build();
doReturn(Futures.immediateCheckedFuture(Optional.absent())).when(readWriteTx).read(eq(LogicalDatastoreType.OPERATIONAL), argThat(isType(MonitorProfile.class)));
doReturn(Futures.immediateCheckedFuture(null)).when(readWriteTx).submit();
RpcResult<MonitorProfileCreateOutput> output = alivenessMonitor.monitorProfileCreate(input).get();
assertTrue("Monitor Profile Create result", output.isSuccessful());
assertNotNull("Monitor Profile Output", output.getResult().getProfileId());
}
Aggregations