blob: 09eb63e60fc8687bda77d36ac2ebf2b339c845c1 [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
18import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.component.DefaultConfig;
19
20/**
21 * Utility class to deal with OPENCONFIG Componet/Config ModelObject & Annotation.
22 */
23public final class OpenConfigConfigOfComponentHandler
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";
28
29 /**
30 * OpenConfigConfigOfComponentHandler Constructor.
31 *
32 * @param parent OpenConfigTransceiverHandler of parent OPENCONFIG(component)
33 */
34 public OpenConfigConfigOfComponentHandler(OpenConfigComponentHandler 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 name to modelObject of target OPENCONFIG.
44 *
45 * @param name String to be set for modelObject
46 * @return OpenConfigConfigOfComponentHandler of target OPENCONFIG
47 */
48 public OpenConfigConfigOfComponentHandler addName(String name) {
49 modelObject.name(name);
50 return this;
51 }
52}