Merge "Exception for URI /restconf/operations/module_name:rpc ended with slash"
[controller.git] / opendaylight / netconf / config-persister-impl / src / main / java / org / opendaylight / controller / netconf / persist / impl / ConfigPusherConfiguration.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.netconf.persist.impl;
9
10 import io.netty.channel.EventLoopGroup;
11
12 import javax.annotation.concurrent.Immutable;
13 import java.net.InetSocketAddress;
14 import java.util.concurrent.TimeUnit;
15
16 /**
17  * Configuration properties for ConfigPusher. Contains delays and timeouts for netconf
18  * connection establishment, netconf capabilities stabilization and configuration push.
19  */
20 @Immutable
21 public final class ConfigPusherConfiguration {
22
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;
25
26     public static final int DEFAULT_NETCONF_SEND_MESSAGE_MAX_ATTEMPTS = 20;
27     public static final int DEFAULT_NETCONF_SEND_MESSAGE_DELAY_MS = 1000;
28
29     public static final long DEFAULT_NETCONF_CAPABILITIES_WAIT_TIMEOUT_MS = TimeUnit.MINUTES.toMillis(2);
30
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);
33
34     final InetSocketAddress netconfAddress;
35     final EventLoopGroup eventLoopGroup;
36
37     /**
38      * Total time to wait for capability stabilization
39      */
40     final long netconfCapabilitiesWaitTimeoutMs;
41
42     /**
43      * Delay between message send attempts
44      */
45     final int netconfSendMessageDelayMs;
46     /**
47      * Total number attempts to send a message
48      */
49     final int netconfSendMessageMaxAttempts;
50
51     /**
52      * Delay between connection establishment attempts
53      */
54     final int connectionAttemptDelayMs;
55     /**
56      * Total number of attempts to perform connection establishment
57      */
58     final long connectionAttemptTimeoutMs;
59
60     /**
61      * Total number of attempts to push configuration to netconf
62      */
63     final int netconfPushConfigAttempts;
64     /**
65      * Delay between configuration push attempts
66      */
67     final long netconfPushConfigDelayMs;
68
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;
82     }
83 }