2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.netconf.persist.impl;
10 import io.netty.channel.EventLoopGroup;
12 import javax.annotation.concurrent.Immutable;
13 import java.net.InetSocketAddress;
14 import java.util.concurrent.TimeUnit;
17 * Configuration properties for ConfigPusher. Contains delays and timeouts for netconf
18 * connection establishment, netconf capabilities stabilization and configuration push.
21 public final class ConfigPusherConfiguration {
23 public static final long DEFAULT_CONNECTION_ATTEMPT_TIMEOUT_MS = TimeUnit.SECONDS.toMillis(5);
24 public static final int DEFAULT_CONNECTION_ATTEMPT_DELAY_MS = 5000;
26 public static final int DEFAULT_NETCONF_SEND_MESSAGE_MAX_ATTEMPTS = 20;
27 public static final int DEFAULT_NETCONF_SEND_MESSAGE_DELAY_MS = 1000;
29 public static final long DEFAULT_NETCONF_CAPABILITIES_WAIT_TIMEOUT_MS = TimeUnit.MINUTES.toMillis(2);
31 public static final int DEFAULT_NETCONF_PUSH_CONFIG_ATTEMPTS = 30;
32 public static final long DEFAULT_NETCONF_PUSH_CONFIG_DELAY_MS = TimeUnit.MINUTES.toMillis(1);
34 final InetSocketAddress netconfAddress;
35 final EventLoopGroup eventLoopGroup;
38 * Total time to wait for capability stabilization
40 final long netconfCapabilitiesWaitTimeoutMs;
43 * Delay between message send attempts
45 final int netconfSendMessageDelayMs;
47 * Total number attempts to send a message
49 final int netconfSendMessageMaxAttempts;
52 * Delay between connection establishment attempts
54 final int connectionAttemptDelayMs;
56 * Total number of attempts to perform connection establishment
58 final long connectionAttemptTimeoutMs;
61 * Total number of attempts to push configuration to netconf
63 final int netconfPushConfigAttempts;
65 * Delay between configuration push attempts
67 final long netconfPushConfigDelayMs;
69 ConfigPusherConfiguration(InetSocketAddress netconfAddress, long netconfCapabilitiesWaitTimeoutMs,
70 int netconfSendMessageDelayMs, int netconfSendMessageMaxAttempts, int connectionAttemptDelayMs,
71 long connectionAttemptTimeoutMs, EventLoopGroup eventLoopGroup, int netconfPushConfigAttempts,
72 long netconfPushConfigDelayMs) {
73 this.netconfAddress = netconfAddress;
74 this.netconfCapabilitiesWaitTimeoutMs = netconfCapabilitiesWaitTimeoutMs;
75 this.netconfSendMessageDelayMs = netconfSendMessageDelayMs;
76 this.netconfSendMessageMaxAttempts = netconfSendMessageMaxAttempts;
77 this.connectionAttemptDelayMs = connectionAttemptDelayMs;
78 this.connectionAttemptTimeoutMs = connectionAttemptTimeoutMs;
79 this.eventLoopGroup = eventLoopGroup;
80 this.netconfPushConfigAttempts = netconfPushConfigAttempts;
81 this.netconfPushConfigDelayMs = netconfPushConfigDelayMs;