blob: fcdc6440ab14d2ce706d33b8b791e226282ccc04 [file] [log] [blame]
Thomas Vachuska803278e2017-10-06 11:11:58 -07001/*
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 */
16package org.onosproject.models.common;
17
Gaurav Agrawald5631a62017-10-09 15:22:22 +053018import com.google.common.collect.ImmutableMap;
Thomas Vachuska803278e2017-10-06 11:11:58 -070019import org.onosproject.yang.AbstractYangModelRegistrator;
Gaurav Agrawald5631a62017-10-09 15:22:22 +053020import org.onosproject.yang.gen.v1.ietfinettypes.rev20130715.IetfInetTypes;
Vidyashree Rama6987e0e2017-11-28 16:05:51 +053021import org.onosproject.yang.gen.v1.ietfsystem.rev20140806.IetfSystem;
Gaurav Agrawald5631a62017-10-09 15:22:22 +053022import org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes;
Ray Milkeyd84f89b2018-08-17 14:54:17 -070023import org.osgi.service.component.annotations.Component;
Gaurav Agrawald5631a62017-10-09 15:22:22 +053024import org.onosproject.yang.model.DefaultYangModuleId;
25import org.onosproject.yang.model.YangModuleId;
26import org.onosproject.yang.runtime.AppModuleInfo;
27import org.onosproject.yang.runtime.DefaultAppModuleInfo;
28
Vidyashree Rama6987e0e2017-11-28 16:05:51 +053029import java.util.ArrayList;
Gaurav Agrawald5631a62017-10-09 15:22:22 +053030import java.util.HashMap;
Vidyashree Rama6987e0e2017-11-28 16:05:51 +053031import java.util.List;
Gaurav Agrawald5631a62017-10-09 15:22:22 +053032import java.util.Map;
Thomas Vachuska803278e2017-10-06 11:11:58 -070033
34@Component(immediate = true)
35public class YangModelRegistrator extends AbstractYangModelRegistrator {
36 public YangModelRegistrator() {
Gaurav Agrawald5631a62017-10-09 15:22:22 +053037 super(YangModelRegistrator.class, getAppInfo());
38 }
Thomas Vachuska803278e2017-10-06 11:11:58 -070039
Gaurav Agrawald5631a62017-10-09 15:22:22 +053040 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 Rama6987e0e2017-11-28 16:05:51 +053046
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 Agrawald5631a62017-10-09 15:22:22 +053053 return ImmutableMap.copyOf(appInfo);
Thomas Vachuska803278e2017-10-06 11:11:58 -070054 // TODO: Do some other registration tasks...
Thomas Vachuska803278e2017-10-06 11:11:58 -070055 }
56}