OPNFLWPLUG-1049 : Device connection hold time to maintain delay between
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / configuration / ConfigurationProperty.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.openflowplugin.api.openflow.configuration;
10
11 import com.google.common.collect.ImmutableMap;
12 import java.util.Locale;
13 import java.util.Map;
14
15 /**
16  * Enum of property keys. All keys from OpenFlowPlugin configuration file are parsed to this enum.
17  * Each enum value represents one working configuration key in format
18  * ENUM.name().toLowerCase().replace('_', '-'), so for example ConfigurationProperty.IS_STATISTICS_POLLING_ON
19  * represents 'is-statistics-polling-on' configuration key.
20  */
21 public enum ConfigurationProperty {
22     /**
23      * Is statistics polling on property type.
24      */
25     IS_STATISTICS_POLLING_ON,
26     /**
27      * Is table statistics polling on property type.
28      */
29     IS_TABLE_STATISTICS_POLLING_ON,
30     /**
31      * Is flow statistics polling on property type.
32      */
33     IS_FLOW_STATISTICS_POLLING_ON,
34     /**
35      * Is group statistics polling on property type.
36      */
37     IS_GROUP_STATISTICS_POLLING_ON,
38     /**
39      * Is meter statistics polling on property type.
40      */
41     IS_METER_STATISTICS_POLLING_ON,
42     /**
43      * Is port statistics polling on property type.
44      */
45     IS_PORT_STATISTICS_POLLING_ON,
46     /**
47      * Is queue statistics polling on property type.
48      */
49     IS_QUEUE_STATISTICS_POLLING_ON,
50     /**
51      * Barrier count limit property type.
52      */
53     BARRIER_COUNT_LIMIT,
54     /**
55      * Barrier interval timeout limit property type.
56      */
57     BARRIER_INTERVAL_TIMEOUT_LIMIT,
58     /**
59      * Echo reply timeout property type.
60      */
61     ECHO_REPLY_TIMEOUT,
62     /**
63      * Enable flow removed notification property type.
64      */
65     ENABLE_FLOW_REMOVED_NOTIFICATION,
66     /**
67      * Skip table features property type.
68      */
69     SKIP_TABLE_FEATURES,
70     /**
71      * Basic timer delay property type.
72      */
73     BASIC_TIMER_DELAY,
74     /**
75      * Maximum timer delay property type.
76      */
77     MAXIMUM_TIMER_DELAY,
78     /**
79      * Switch features mandatory property type.
80      */
81     SWITCH_FEATURES_MANDATORY,
82     /**
83      * Is statistics rpc enabled property type.
84      */
85     @Deprecated
86     IS_STATISTICS_RPC_ENABLED,
87     /**
88      * Use single layer serialization property type.
89      */
90     USE_SINGLE_LAYER_SERIALIZATION,
91     /**
92      * Rpc requests quota property type.
93      */
94     RPC_REQUESTS_QUOTA,
95     /**
96      * Global notification quota property type.
97      */
98     GLOBAL_NOTIFICATION_QUOTA,
99     /**
100      * Thread pool min threads property type.
101      */
102     THREAD_POOL_MIN_THREADS,
103     /**
104      * Thread pool max threads property type.
105      */
106     THREAD_POOL_MAX_THREADS,
107     /**
108      * Thread pool timeout property type.
109      */
110     THREAD_POOL_TIMEOUT,
111     /**
112      * Enable or disable equal role functionality.
113      */
114     ENABLE_EQUAL_ROLE,
115     /**
116      * Device connection rate limit property type.
117      */
118     DEVICE_CONNECTION_RATE_LIMIT_PER_MIN,
119     /**
120      * Device connection hold time property type.
121      */
122     DEVICE_CONNECTION_HOLD_TIME_IN_SECONDS;
123
124     private static final Map<String, ConfigurationProperty> KEY_VALUE_MAP;
125
126     /**
127      * Get property type from property key.
128      *
129      * @param key the property key
130      * @return the property type
131      */
132     public static ConfigurationProperty forValue(final String key) {
133         return KEY_VALUE_MAP.get(key);
134     }
135
136     static {
137         final ConfigurationProperty[] values = values();
138         final ImmutableMap.Builder<String, ConfigurationProperty> builder = ImmutableMap.builder();
139
140         for (final ConfigurationProperty value : values) {
141             builder.put(value.toString(), value);
142         }
143
144         KEY_VALUE_MAP = builder.build();
145     }
146
147     /**
148      * Converts enum name to property key.
149      *
150      * @return the property key
151      */
152     @Override
153     public String toString() {
154         return this.name().toLowerCase(Locale.ENGLISH).replace('_', '-');
155     }
156 }