blob: 6acee760e47f6ffa0e286c81ff218842afd9457f [file] [log] [blame]
Avantika-Huaweife44ea62016-05-27 19:21:24 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Avantika-Huaweife44ea62016-05-27 19:21:24 +05303 *
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.pcep.api;
17
18import org.onosproject.net.DeviceId;
19import org.onosproject.net.config.Config;
20
21/**
22 * Configuration to specify device capabilities.
23 */
24public class DeviceCapability extends Config<DeviceId> {
25 public static final String SRCAP = "srCapabaility";
26 public static final String LABELSTACKCAP = "labelStackCapability";
27 public static final String LOCALLABELCAP = "localLabelCapability";
28
29 @Override
30 public boolean isValid() {
31 return true;
32 }
33
34 /**
35 * Gets the SR capability of the router.
36 *
37 * @return SR capability
38 */
39 public boolean srCap() {
40 String srCap = get(SRCAP, null);
41 return srCap != null ?
42 Boolean.valueOf(srCap) :
43 false;
44 }
45
46 /**
47 * Gets the label stack capability of the router.
48 *
49 * @return label stack capability
50 */
51 public boolean labelStackCap() {
52 String labelStackCap = get(LABELSTACKCAP, null);
53 return labelStackCap != null ?
54 Boolean.valueOf(labelStackCap) :
55 false;
56 }
57
58 /**
59 * Gets the local label capability of the router.
60 *
61 * @return local label capability
62 */
63 public boolean localLabelCap() {
64 String localLabelCap = get(LOCALLABELCAP, null);
65 return localLabelCap != null ?
66 Boolean.valueOf(localLabelCap) :
67 false;
68 }
69
70 /**
71 * Sets the SR capability of the router.
72 *
73 * @param srCap SR capability of the router.
74 * @return the capability configuration of the device.
75 */
76 public DeviceCapability setSrCap(boolean srCap) {
77 return (DeviceCapability) setOrClear(SRCAP, srCap);
78 }
79
80 /**
81 * Sets the label stack capability of the router.
82 *
83 * @param labelStackCap label stack capability of the router.
84 * @return the capability configuration of the device.
85 */
86 public DeviceCapability setLabelStackCap(boolean labelStackCap) {
87 return (DeviceCapability) setOrClear(LABELSTACKCAP, labelStackCap);
88 }
89
90 /**
91 * Sets the local label capability of the router.
92 *
93 * @param localLabelCap local label capability of the router.
94 * @return the capability configuration of the device.
95 */
96 public DeviceCapability setLocalLabelCap(boolean localLabelCap) {
97 return (DeviceCapability) setOrClear(LOCALLABELCAP, localLabelCap);
98 }
99}
100