blob: 24ad67b0aecb9ca81f03f43d033c3fa12205742f [file] [log] [blame]
gauravf0884562016-06-17 02:47:13 +05301/*
2 * Copyright 2016-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.dhcprelay;
17
18import org.onosproject.core.ApplicationId;
19import org.onosproject.net.ConnectPoint;
20import org.onosproject.net.config.Config;
21
22import static org.onosproject.net.config.Config.FieldPresence.MANDATORY;
23/**
24 * DHCP Relay Config class.
25 */
26public class DhcpRelayConfig extends Config<ApplicationId> {
27
28 private static final String DHCP_CONNECT_POINT = "dhcpserverConnectPoint";
29
30 @Override
31 public boolean isValid() {
32
33 return hasOnlyFields(DHCP_CONNECT_POINT) &&
34 isConnectPoint(DHCP_CONNECT_POINT, MANDATORY);
35 }
36
37 /**
38 * Returns the dhcp server connect point.
39 *
40 * @return dhcp server connect point
41 */
42 public ConnectPoint getDhcpServerConnectPoint() {
43 return ConnectPoint.deviceConnectPoint(object.path(DHCP_CONNECT_POINT).asText());
44 }
45}