use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.BmpMonitorConfig 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.config.rev171207.odl.bmp.monitors.BmpMonitorConfig in project bgpcep by opendaylight.
the class BmpMonitorConfigFileProcessor method loadConfiguration.
@Override
public synchronized void loadConfiguration(final NormalizedNode<?, ?> dto) {
final ContainerNode bmpMonitorsConfigsContainer = (ContainerNode) dto;
final MapNode monitorsList = (MapNode) bmpMonitorsConfigsContainer.getChild(this.bmpMonitorsYii.getLastPathArgument()).orElse(null);
if (monitorsList == null) {
return;
}
final Collection<MapEntryNode> bmpMonitorConfig = monitorsList.getValue();
final WriteTransaction wtx = this.dataBroker.newWriteOnlyTransaction();
bmpMonitorConfig.stream().map(topology -> this.bindingSerializer.fromNormalizedNode(this.bmpMonitorsYii, topology)).filter(Objects::nonNull).forEach(bi -> processBmpMonitorConfig((BmpMonitorConfig) bi.getValue(), wtx));
try {
wtx.submit().get();
} catch (final ExecutionException | InterruptedException e) {
LOG.warn("Failed to create Bmp config", e);
}
}
Aggregations