Search in sources :

Example 1 with BmpMonitorConfig

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);
    }
}
Also used : Server(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.server.config.Server) InetSocketAddress(java.net.InetSocketAddress) MonitorId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.MonitorId) BmpMonitoringStationImpl(org.opendaylight.protocol.bmp.impl.app.BmpMonitoringStationImpl)

Example 2 with BmpMonitorConfig

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);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) BmpMonitorConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.BmpMonitorConfig) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) MapNode(org.opendaylight.yangtools.yang.data.api.schema.MapNode) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 ExecutionException (java.util.concurrent.ExecutionException)1 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 BmpMonitoringStationImpl (org.opendaylight.protocol.bmp.impl.app.BmpMonitoringStationImpl)1 BmpMonitorConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.BmpMonitorConfig)1 Server (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.server.config.Server)1 MonitorId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.MonitorId)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1 MapEntryNode (org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)1 MapNode (org.opendaylight.yangtools.yang.data.api.schema.MapNode)1