blob: c2631497fb935ec8b09e5ae52e985a4defa849f6 [file] [log] [blame]
Amit Ghosh47243cb2017-07-26 05:08:53 +01001/*
Brian O'Connor10570622017-08-03 22:45:53 -07002 * Copyright 2017-present Open Networking Foundation
Amit Ghosh47243cb2017-07-26 05:08:53 +01003 *
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.opencord.dhcpl2relay;
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/**
25 * DHCP Relay Config class.
26 */
27public class DhcpL2RelayConfig extends Config<ApplicationId> {
28
29 private static final String DHCP_CONNECT_POINT = "dhcpserverConnectPoint";
30
31 @Override
32 public boolean isValid() {
33
34 return hasOnlyFields(DHCP_CONNECT_POINT) &&
35 isConnectPoint(DHCP_CONNECT_POINT, MANDATORY);
36 }
37
38 /**
39 * Returns the dhcp server connect point.
40 *
41 * @return dhcp server connect point
42 */
43 public ConnectPoint getDhcpServerConnectPoint() {
44 return ConnectPoint.deviceConnectPoint(object.path(DHCP_CONNECT_POINT).asText());
45 }
46}