2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.openflowplugin.api.openflow;
11 import com.google.common.collect.ImmutableMap;
13 import javax.annotation.Nonnull;
16 * Manages OpenFlowPlugin configuration
18 public interface OpenFlowPluginConfigurationService {
21 * Enum of property keys. All keys from OpenFlowPlugin configuration file are parsed to this enum.
22 * Each enum value represents one working configuration key in format
23 * ENUM.name().toLowerCase().replace('_', '-'), so for example PropertyType.IS_STATISTICS_POLLING_ON
24 * represents 'is-statistics-polling-on' configuration key.
28 * Is statistics polling on property type.
30 IS_STATISTICS_POLLING_ON,
32 * Barrier count limit property type.
36 * Barrier interval timeout limit property type.
38 BARRIER_INTERVAL_TIMEOUT_LIMIT,
40 * Echo reply timeout property type.
44 * Enable flow removed notification property type.
46 ENABLE_FLOW_REMOVED_NOTIFICATION,
48 * Skip table features property type.
52 * Basic timer delay property type.
56 * Maximum timer delay property type.
60 * Switch features mandatory property type.
62 SWITCH_FEATURES_MANDATORY,
64 * Is statistics rpc enabled property type.
67 IS_STATISTICS_RPC_ENABLED,
69 * Use single layer serialization property type.
71 USE_SINGLE_LAYER_SERIALIZATION,
73 * Rpc requests quota property type.
77 * Global notification quota property type.
79 GLOBAL_NOTIFICATION_QUOTA,
81 * Thread pool min threads property type.
83 THREAD_POOL_MIN_THREADS,
85 * Thread pool max threads property type.
87 THREAD_POOL_MAX_THREADS,
89 * Thread pool timeout property type.
93 private static final Map<String, PropertyType> KEY_VALUE_MAP;
96 * Get property type from property key
98 * @param key the property key
99 * @return the property type
101 public static PropertyType forValue(final String key) {
102 return KEY_VALUE_MAP.get(key);
106 final PropertyType[] values = values();
107 final ImmutableMap.Builder<String, PropertyType> builder = ImmutableMap.builder();
109 for (final PropertyType value : values) {
110 builder.put(value.toString(), value);
113 KEY_VALUE_MAP = builder.build();
117 * Converts enum name to property key
119 * @return the property key
122 public String toString() {
123 return this.name().toLowerCase().replace('_', '-');
129 * Parses key-value pairs of properties read from OpenFlowPlugin configuration file and processes them
131 * @param properties properties
133 void update(@Nonnull Map<String,Object> properties);
136 * Parse and process single property key-value pair
138 * @see org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginConfigurationService.PropertyType
139 * @param key property type
140 * @param value property value
142 void updateProperty(@Nonnull PropertyType key, @Nonnull Object value);