blob: e8a99cc2c82e183fe732f221a5629dc62e930587 [file] [log] [blame]
Ai Hamanobd51cdd2018-10-18 11:30:07 +09001/*
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 */
16package org.onosproject.odtn.utils.openconfig;
17
hiroki096259b2018-12-07 09:33:24 -080018import org.onosproject.yang.gen.v1.openconfigplatformtransceiver.rev20180515.openconfigplatformtransceiver.porttransceivertop.DefaultTransceiver;
Ai Hamanobd51cdd2018-10-18 11:30:07 +090019
20/**
21 * Utility class to deal with OPENCONFIG Transceiver ModelObject & Annotation.
22 */
23public final class OpenConfigTransceiverHandler
24 extends OpenConfigObjectHandler<DefaultTransceiver> {
25
26 private static final String OPENCONFIG_NAME = "transceiver";
27 private static final String NAME_SPACE = "http://openconfig.net/yang/platform/transceiver";
28
29 /**
30 * OpenConfigTransceiverHandler Constructor.
31 *
32 * @param parent OpenConfigComponentHandler of parent OPENCONFIG(component)
33 */
34 public OpenConfigTransceiverHandler(OpenConfigComponentHandler parent) {
35 modelObject = new DefaultTransceiver();
36 setResourceId(OPENCONFIG_NAME, NAME_SPACE, null, parent.getResourceIdBuilder());
37 annotatedNodeInfos = parent.getAnnotatedNodeInfoList();
38
39 parent.addTransceiver(this);
40 }
41
42 /**
43 * Add Config to modelObject of target OPENCONFIG.
44 *
45 * @param config OpenConfigConfigOfTransceiverHandler having Config to be set for modelObject
46 * @return OpenConfigTransceiverHandler of target OPENCONFIG
47 */
48 public OpenConfigTransceiverHandler addConfig(OpenConfigConfigOfTransceiverHandler config) {
49 modelObject.config(config.getModelObject());
50 return this;
51 }
52}