Ai Hamano | bd51cdd | 2018-10-18 11:30:07 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2018-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 | package org.onosproject.odtn.utils.openconfig; |
| 17 | |
| 18 | import org.onosproject.yang.gen.v1.openconfigplatformtransceiver.rev20170708.openconfigplatformtransceiver.porttransceivertop.transceiver.DefaultConfig; |
| 19 | |
| 20 | /** |
| 21 | * Utility class to deal with OPENCONFIG Transceiver/Config ModelObject & Annotation. |
| 22 | */ |
| 23 | public final class OpenConfigConfigOfTransceiverHandler |
| 24 | extends OpenConfigObjectHandler<DefaultConfig> { |
| 25 | |
| 26 | private static final String OPENCONFIG_NAME = "config"; |
| 27 | private static final String NAME_SPACE = "http://openconfig.net/yang/platform/transceiver"; |
| 28 | |
| 29 | /** |
| 30 | * OpenConfigConfigOfTransceiverHandler Constructor. |
| 31 | * |
| 32 | * @param parent OpenConfigTransceiverHandler of parent OPENCONFIG(tranceiver) |
| 33 | */ |
| 34 | public OpenConfigConfigOfTransceiverHandler(OpenConfigTransceiverHandler parent) { |
| 35 | modelObject = new DefaultConfig(); |
| 36 | setResourceId(OPENCONFIG_NAME, NAME_SPACE, null, parent.getResourceIdBuilder()); |
| 37 | annotatedNodeInfos = parent.getAnnotatedNodeInfoList(); |
| 38 | |
| 39 | parent.addConfig(this); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Add enabled to modelObject of target OPENCONFIG. |
| 44 | * |
| 45 | * @param enabled boolean to be set for modelObject |
| 46 | * @return OpenConfigConfigOfTransceiverHandler of target OPENCONFIG |
| 47 | */ |
| 48 | public OpenConfigConfigOfTransceiverHandler addEnabled(boolean enabled) { |
| 49 | modelObject.enabled(enabled); |
| 50 | return this; |
| 51 | } |
| 52 | } |