Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | ce2a03d | 2017-08-03 19:21:03 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
Avantika-Huawei | fe44ea6 | 2016-05-27 19:21:24 +0530 | [diff] [blame] | 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 | package org.onosproject.pcep.api; |
| 17 | |
| 18 | import org.onosproject.net.DeviceId; |
| 19 | import org.onosproject.net.config.Config; |
| 20 | |
| 21 | /** |
| 22 | * Configuration to specify device capabilities. |
| 23 | */ |
| 24 | public 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 | |