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; |
Vidyashree Rama | 6987e0e | 2017-11-28 16:05:51 +0530 | [diff] [blame] | 21 | import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystem; |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 22 | import org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes; |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 23 | import org.apache.felix.scr.annotations.Component; |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 24 | import org.onosproject.yang.model.DefaultYangModuleId; |
| 25 | import org.onosproject.yang.model.YangModuleId; |
| 26 | import org.onosproject.yang.runtime.AppModuleInfo; |
| 27 | import org.onosproject.yang.runtime.DefaultAppModuleInfo; |
| 28 | |
Vidyashree Rama | 6987e0e | 2017-11-28 16:05:51 +0530 | [diff] [blame] | 29 | import java.util.ArrayList; |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 30 | import java.util.HashMap; |
Vidyashree Rama | 6987e0e | 2017-11-28 16:05:51 +0530 | [diff] [blame] | 31 | import java.util.List; |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 32 | import java.util.Map; |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 33 | |
| 34 | @Component(immediate = true) |
| 35 | public class YangModelRegistrator extends AbstractYangModelRegistrator { |
| 36 | public YangModelRegistrator() { |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 37 | super(YangModelRegistrator.class, getAppInfo()); |
| 38 | } |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 39 | |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 40 | private static Map<YangModuleId, AppModuleInfo> getAppInfo() { |
| 41 | Map<YangModuleId, AppModuleInfo> appInfo = new HashMap<>(); |
| 42 | appInfo.put(new DefaultYangModuleId("ietf-inet-types", "2013-07-15"), |
| 43 | new DefaultAppModuleInfo(IetfInetTypes.class, null)); |
| 44 | appInfo.put(new DefaultYangModuleId("ietf-yang-types", "2013-07-15"), |
| 45 | new DefaultAppModuleInfo(IetfYangTypes.class, null)); |
Vidyashree Rama | 6987e0e | 2017-11-28 16:05:51 +0530 | [diff] [blame] | 46 | |
| 47 | List<String> systemFeatures = new ArrayList<>(); |
| 48 | systemFeatures.add("local-users"); |
| 49 | systemFeatures.add("authentication"); |
| 50 | systemFeatures.add("ntp"); |
| 51 | appInfo.put(new DefaultYangModuleId("ietf-system", "2014-08-06"), |
| 52 | new DefaultAppModuleInfo(IetfSystem.class, systemFeatures)); |
Gaurav Agrawal | d5631a6 | 2017-10-09 15:22:22 +0530 | [diff] [blame] | 53 | return ImmutableMap.copyOf(appInfo); |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 54 | // TODO: Do some other registration tasks... |
Thomas Vachuska | 803278e | 2017-10-06 11:11:58 -0700 | [diff] [blame] | 55 | } |
| 56 | } |