Search in sources :

Example 1 with MonitoredRouter

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.bmp.monitor.config.MonitoredRouter in project bgpcep by opendaylight.

the class KeyConstructorUtil method constructKeys.

public static KeyMapping constructKeys(final List<MonitoredRouter> mrs) {
    final KeyMapping ret = KeyMapping.getKeyMapping();
    if (mrs != null) {
        mrs.stream().filter(Objects::nonNull).filter(KeyConstructorUtil::isNotNullorEmpty).forEach(mr -> {
            final Rfc2385Key rfc2385KeyPassword = mr.getPassword();
            ret.put(IetfInetUtil.INSTANCE.inetAddressFor(mr.getAddress()), rfc2385KeyPassword.getValue().getBytes(StandardCharsets.US_ASCII));
        });
    }
    return ret;
}
Also used : Objects(java.util.Objects) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key)

Example 2 with MonitoredRouter

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.bmp.monitor.config.MonitoredRouter in project bgpcep by opendaylight.

the class BmpMonitoringStationImpl method connectMonitoredRouters.

private void connectMonitoredRouters(final BmpDispatcher pdispatcher) {
    if (this.monitoredRouters != null) {
        for (final MonitoredRouter mr : this.monitoredRouters) {
            if (mr.isActive()) {
                requireNonNull(mr.getAddress());
                requireNonNull(mr.getPort());
                final String s = mr.getAddress().getIpv4Address().getValue();
                final InetAddress addr = InetAddresses.forString(s);
                final KeyMapping ret;
                final Rfc2385Key rfc2385KeyPassword = mr.getPassword();
                ret = KeyMapping.getKeyMapping(addr, rfc2385KeyPassword.getValue());
                pdispatcher.createClient(Ipv4Util.toInetSocketAddress(mr.getAddress(), mr.getPort()), this.sessionManager, ret);
            }
        }
    }
}
Also used : MonitoredRouter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.bmp.monitor.config.MonitoredRouter) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) Rfc2385Key(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key) InetAddress(java.net.InetAddress)

Aggregations

KeyMapping (org.opendaylight.protocol.concepts.KeyMapping)2 Rfc2385Key (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key)2 InetAddress (java.net.InetAddress)1 Objects (java.util.Objects)1 MonitoredRouter (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev171207.odl.bmp.monitors.bmp.monitor.config.MonitoredRouter)1