Merge "Update ONF tests"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / configuration / OpenFlowProviderConfigImpl.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.impl.configuration;
10
11 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationProperty;
12 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationService;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
16 import org.opendaylight.yangtools.yang.binding.Augmentation;
17 import org.opendaylight.yangtools.yang.binding.DataContainer;
18
19 public class OpenFlowProviderConfigImpl implements OpenflowProviderConfig {
20     private final ConfigurationService service;
21
22     public OpenFlowProviderConfigImpl(final ConfigurationService service) {
23         this.service = service;
24     }
25
26     @Override
27     public NonZeroUint16Type getRpcRequestsQuota() {
28         final Integer property = service.getProperty(
29                 ConfigurationProperty.RPC_REQUESTS_QUOTA.toString(),
30                 Integer::valueOf);
31
32         return new NonZeroUint16Type(property);
33     }
34
35     @Override
36     public Boolean isSwitchFeaturesMandatory() {
37         return service.getProperty(ConfigurationProperty.SWITCH_FEATURES_MANDATORY.toString(), Boolean::valueOf);
38     }
39
40     @Override
41     public Long getGlobalNotificationQuota() {
42         return service.getProperty(ConfigurationProperty.GLOBAL_NOTIFICATION_QUOTA.toString(), Long::valueOf);
43     }
44
45     @Override
46     public Boolean isIsStatisticsPollingOn() {
47         return service.getProperty(ConfigurationProperty.IS_STATISTICS_POLLING_ON.toString(), Boolean::valueOf);
48     }
49
50     @Override
51     public Boolean isIsStatisticsRpcEnabled() {
52         return service.getProperty(ConfigurationProperty.IS_STATISTICS_RPC_ENABLED.toString(), Boolean::valueOf);
53     }
54
55     @Override
56     public NonZeroUint32Type getBarrierIntervalTimeoutLimit() {
57         final Long property = service.getProperty(
58                 ConfigurationProperty.BARRIER_INTERVAL_TIMEOUT_LIMIT.toString(),
59                 Long::valueOf);
60
61         return new NonZeroUint32Type(property);
62     }
63
64     @Override
65     public NonZeroUint16Type getBarrierCountLimit() {
66         final Integer property = service.getProperty(
67                 ConfigurationProperty.BARRIER_COUNT_LIMIT.toString(),
68                 Integer::valueOf);
69
70         return new NonZeroUint16Type(property);
71     }
72
73     @Override
74     public NonZeroUint32Type getEchoReplyTimeout() {
75         final Long property = service.getProperty(
76                 ConfigurationProperty.ECHO_REPLY_TIMEOUT.toString(),
77                 Long::valueOf);
78
79         return new NonZeroUint32Type(property);
80     }
81
82     @Override
83     public Integer getThreadPoolMinThreads() {
84         return service.getProperty(ConfigurationProperty.THREAD_POOL_MIN_THREADS.toString(), Integer::valueOf);
85     }
86
87     @Override
88     public NonZeroUint16Type getThreadPoolMaxThreads() {
89         final Integer property = service.getProperty(
90                 ConfigurationProperty.THREAD_POOL_MAX_THREADS.toString(),
91                 Integer::valueOf);
92
93         return new NonZeroUint16Type(property);
94     }
95
96     @Override
97     public Long getThreadPoolTimeout() {
98         return service.getProperty(ConfigurationProperty.THREAD_POOL_TIMEOUT.toString(), Long::valueOf);
99     }
100
101     @Override
102     public Boolean isEnableFlowRemovedNotification() {
103         return service.getProperty(ConfigurationProperty.ENABLE_FLOW_REMOVED_NOTIFICATION.toString(), Boolean::valueOf);
104     }
105
106     @Override
107     public Boolean isSkipTableFeatures() {
108         return service.getProperty(ConfigurationProperty.SKIP_TABLE_FEATURES.toString(), Boolean::valueOf);
109     }
110
111     @Override
112     public NonZeroUint32Type getBasicTimerDelay() {
113         final Long property = service.getProperty(
114                 ConfigurationProperty.BASIC_TIMER_DELAY.toString(),
115                 Long::valueOf);
116
117         return new NonZeroUint32Type(property);
118     }
119
120     @Override
121     public NonZeroUint32Type getMaximumTimerDelay() {
122         final Long property = service.getProperty(
123                 ConfigurationProperty.MAXIMUM_TIMER_DELAY.toString(),
124                 Long::valueOf);
125
126         return new NonZeroUint32Type(property);
127     }
128
129     @Override
130     public Boolean isUseSingleLayerSerialization() {
131         return service.getProperty(ConfigurationProperty.USE_SINGLE_LAYER_SERIALIZATION.toString(), Boolean::valueOf);
132     }
133
134     @Override
135     public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
136             .openflow.provider.config.rev160510.OpenflowProviderConfig>> E getAugmentation(
137                     java.lang.Class<E> augmentationType) {
138         return null;
139     }
140
141     @Override
142     public Class<? extends DataContainer> getImplementedInterface() {
143         return OpenflowProviderConfig.class;
144     }
145
146 }