Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-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.models.common; |
| 17 | |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 18 | import com.google.common.collect.ImmutableMap; |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 19 | import org.onosproject.yang.AbstractYangModelRegistrator; |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 20 | import org.onosproject.yang.gen.v1.ietfinettypes.rev20130715.IetfInetTypes; |
| 21 | import org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes; |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 22 | import org.apache.felix.scr.annotations.Component; |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 23 | import org.onosproject.yang.model.DefaultYangModuleId; |
| 24 | import org.onosproject.yang.model.YangModuleId; |
| 25 | import org.onosproject.yang.runtime.AppModuleInfo; |
| 26 | import org.onosproject.yang.runtime.DefaultAppModuleInfo; |
| 27 | |
| 28 | import java.util.HashMap; |
| 29 | import java.util.Map; |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 30 | |
| 31 | @Component(immediate = true) |
| 32 | public class YangModelRegistrator extends AbstractYangModelRegistrator { |
| 33 | public YangModelRegistrator() { |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 34 | super(YangModelRegistrator.class, getAppInfo()); |
| 35 | } |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 36 | |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 37 | private static Map<YangModuleId, AppModuleInfo> getAppInfo() { |
| 38 | Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>(); |
| 39 | appInfo.put(new DefaultYangModuleId("ietf-inet-types", "2013-07-15"), |
| 40 | new DefaultAppModuleInfo(IetfInetTypes.class, null)); |
| 41 | appInfo.put(new DefaultYangModuleId("ietf-yang-types", "2013-07-15"), |
| 42 | new DefaultAppModuleInfo(IetfYangTypes.class, null)); |
| 43 | return ImmutableMap.copyOf(appInfo); |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 44 | // TODO: Do some other registration tasks... |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 45 | } |
| 46 | } |