blob: 0997632c40e37ec0cc3192a2b332d7647df60e79 [file] [log] [blame]
Yuta HIGUCHI48f4cb72018-03-29 20:30:56 -07001/*
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 */
Yuta HIGUCHId0f8d892018-04-09 12:14:00 -070016package org.onosproject.odtn.utils.openconfig;
Yuta HIGUCHI48f4cb72018-03-29 20:30:56 -070017
18import static com.google.common.base.Preconditions.checkNotNull;
19
20import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.Component;
21import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.DefaultComponent;
22import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.component.Config;
23import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.component.DefaultConfig;
24
25import com.google.common.annotations.Beta;
26
27/**
28 * Utility methods dealing with OpenConfig component.
29 * <p>
30 * Split into classes for the purpose of avoiding "Config" class collisions.
31 */
32@Beta
33public abstract class PlainPlatform {
34
35 public static Component componentWithName(String componentName) {
36 checkNotNull(componentName, "componentName cannot be null");
37
38 Component component = new DefaultComponent();
39 component.name(componentName);
40 Config config = new DefaultConfig();
41 config.name(componentName);
42 component.config(config);
43 return component;
44 }
45}