blob: 472343ad604ab8d58de4cfe89897afe2f4f07b70 [file] [log] [blame]
Daniele Moro94660a02019-12-02 12:02:07 -08001/*
2 * Copyright 2019-present Open Networking Foundation
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 */
16
17package org.opencord.bng.config;
18
19import org.onosproject.core.ApplicationId;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.config.Config;
22
23/**
24 * Configuration of the BNG app.
25 */
26public class BngConfig extends Config<ApplicationId> {
27 public static final String KEY = "bng";
28
29 private static final String BNGU_DEVICE_ID = "bnguDeviceId";
30
31 @Override
32 public boolean isValid() {
33 return hasOnlyFields(BNGU_DEVICE_ID) && hasField(BNGU_DEVICE_ID);
34 }
35
36 /**
37 * Gets the BNG user plane device ID.
38 *
39 * @return BNG user plane device ID
40 */
41 public DeviceId getBnguDeviceId() {
42 return DeviceId.deviceId(object.path(BNGU_DEVICE_ID).asText());
43 }
44}