Yuta HIGUCHI | 48f4cb7 | 2018-03-29 20:30:56 -0700 | [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 | */ |
Yuta HIGUCHI | d0f8d89 | 2018-04-09 12:14:00 -0700 | [diff] [blame] | 16 | package org.onosproject.odtn.utils.openconfig; |
Yuta HIGUCHI | 48f4cb7 | 2018-03-29 20:30:56 -0700 | [diff] [blame] | 17 | |
| 18 | import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | |
| 20 | import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.Component; |
| 21 | import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.DefaultComponent; |
| 22 | import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.component.Config; |
| 23 | import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.openconfigplatform.platformcomponenttop.components.component.DefaultConfig; |
| 24 | |
| 25 | import 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 |
| 33 | public 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 | } |