blob: db4672d655521678e7afb3df9359d6c8f563b766 [file] [log] [blame]
samanwita palf28207b2015-09-04 10:41:56 -07001/*
2 * Copyright 2014 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.dhcp.impl;
17
18import org.onosproject.core.ApplicationId;
19import org.onosproject.net.config.Config;
20import org.onosproject.net.config.basics.BasicElementConfig;
21
22/**
23 * DHCP Store Config class.
24 */
Thomas Vachuskaa1da42e2015-09-09 00:45:22 -070025public class DhcpStoreConfig extends Config<ApplicationId> {
samanwita palf28207b2015-09-04 10:41:56 -070026
Thomas Vachuska00090442015-09-11 18:08:04 -070027 // FIXME: combine with the other config and properly type the values
28
samanwita palf28207b2015-09-04 10:41:56 -070029 public static final String TIMER_DELAY = "delay";
30 public static final String DEFAULT_TIMEOUT = "timeout";
31 public static final String START_IP = "startip";
32 public static final String END_IP = "endip";
33
34 /**
35 * Returns the delay after which the dhcp server will purge expired entries.
36 *
37 * @return time delay or null if not set
38 */
39 public String timerDelay() {
40 return get(TIMER_DELAY, null);
41 }
42
43 /**
44 * Sets the delay after which the dhcp server will purge expired entries.
45 *
46 * @param delay new time delay; null to clear
47 * @return self
48 */
49 public BasicElementConfig timerDelay(String delay) {
50 return (BasicElementConfig) setOrClear(TIMER_DELAY, delay);
51 }
52
53 /**
54 * Returns the default timeout for pending assignments.
55 *
56 * @return default timeout or null if not set
57 */
58 public String defaultTimeout() {
59 return get(DEFAULT_TIMEOUT, null);
60 }
61
62 /**
63 * Sets the default timeout for pending assignments.
64 *
65 * @param defaultTimeout new default timeout; null to clear
66 * @return self
67 */
68 public BasicElementConfig defaultTimeout(String defaultTimeout) {
69 return (BasicElementConfig) setOrClear(DEFAULT_TIMEOUT, defaultTimeout);
70 }
71
72 /**
73 * Returns the start IP for the available IP Range.
74 *
75 * @return start IP or null if not set
76 */
77 public String startIP() {
78 return get(START_IP, null);
79 }
80
81 /**
82 * Sets the start IP for the available IP Range.
83 *
84 * @param startIP new start IP; null to clear
85 * @return self
86 */
87 public BasicElementConfig startIP(String startIP) {
88 return (BasicElementConfig) setOrClear(START_IP, startIP);
89 }
90
91 /**
92 * Returns the end IP for the available IP Range.
93 *
94 * @return end IP or null if not set
95 */
96 public String endIP() {
97 return get(END_IP, null);
98 }
99
100 /**
101 * Sets the end IP for the available IP Range.
102 *
103 * @param endIP new end IP; null to clear
104 * @return self
105 */
106 public BasicElementConfig endIP(String endIP) {
107 return (BasicElementConfig) setOrClear(END_IP, endIP);
108 }
109}