blob: 2dd6bb0c63ddaf60d3e53e8c0b60c25173159ce1 [file] [log] [blame]
Henry Yuab25a712017-02-18 13:15:25 -05001/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.protocol.restconf.server.restconfmanager;
17
18import org.onosproject.core.ApplicationId;
19import org.onosproject.incubator.net.config.basics.ConfigException;
20import org.onosproject.net.config.Config;
21
22/**
23 * Configuration for TE Topology parameters.
24 */
25public class RestconfConfig extends Config<ApplicationId> {
26 private static final String CONFIG_VALUE_ERROR = "Error parsing config value";
27 private static final String USE_DNY_CONFIG = "use-dyn-config";
28
29
30 /**
31 * Retrieves whether RESTCONF should use Dynamic Config service.
32 *
33 * @return string value of true or false
34 * @throws ConfigException if the parameters are not correctly configured or
35 * conversion of the parameters fails
36 */
37 public String useDynamicConfig() throws ConfigException {
38 try {
39 return object.path(USE_DNY_CONFIG).asText();
40 } catch (IllegalArgumentException e) {
41 throw new ConfigException(CONFIG_VALUE_ERROR, e);
42 }
43 }
44
45}