Yuta HIGUCHI | 5aeb0fe | 2018-03-30 16:22:02 -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 | */ |
| 16 | package org.onosproject.models.openconfig; |
| 17 | |
| 18 | import static org.slf4j.LoggerFactory.getLogger; |
| 19 | |
| 20 | import java.util.Map; |
| 21 | import org.apache.felix.scr.annotations.Component; |
| 22 | import org.onosproject.yang.AbstractYangModelRegistrator; |
| 23 | import org.onosproject.yang.gen.v1.ianaiftype.rev20170330.IanaIfType; |
| 24 | import org.onosproject.yang.gen.v1.ietfyangtypes.rev20130715.IetfYangTypes; |
| 25 | import org.onosproject.yang.gen.v1.openconfiginterfaces.rev20170714.OpenconfigInterfaces; |
| 26 | import org.onosproject.yang.gen.v1.openconfigplatform.rev20161222.OpenconfigPlatform; |
| 27 | import org.onosproject.yang.gen.v1.openconfigplatformlinecard.rev20170803.OpenconfigPlatformLinecard; |
| 28 | import org.onosproject.yang.gen.v1.openconfigplatformport.rev20161024.OpenconfigPlatformPort; |
| 29 | import org.onosproject.yang.gen.v1.openconfigplatformtransceiver.rev20170708.OpenconfigPlatformTransceiver; |
| 30 | import org.onosproject.yang.gen.v1.openconfigterminaldevice.rev20170708.OpenconfigTerminalDevice; |
| 31 | import org.onosproject.yang.gen.v1.openconfigtransportlinecommon.rev20170708.OpenconfigTransportLineCommon; |
| 32 | import org.onosproject.yang.gen.v1.openconfigtransporttypes.rev20170816.OpenconfigTransportTypes; |
| 33 | import org.onosproject.yang.gen.v1.openconfigtypes.rev20170816.OpenconfigTypes; |
| 34 | import org.onosproject.yang.model.DefaultYangModuleId; |
| 35 | import org.onosproject.yang.model.YangModuleId; |
| 36 | import org.onosproject.yang.runtime.AppModuleInfo; |
| 37 | import org.onosproject.yang.runtime.DefaultAppModuleInfo; |
| 38 | import org.slf4j.Logger; |
| 39 | |
| 40 | import com.google.common.collect.ImmutableMap; |
| 41 | |
| 42 | @Component(immediate = true) |
| 43 | public class OpenConfigModelRegistrator extends AbstractYangModelRegistrator { |
| 44 | |
| 45 | private static final Logger log = getLogger(OpenConfigModelRegistrator.class); |
| 46 | |
| 47 | public OpenConfigModelRegistrator() { |
| 48 | super(OpenConfigModelRegistrator.class, getAppInfo()); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | private static Map<YangModuleId, AppModuleInfo> getAppInfo() { |
| 53 | |
| 54 | return ImmutableMap.<YangModuleId, AppModuleInfo>builder() |
| 55 | .put(new DefaultYangModuleId("iana-if-type", "2017-03-30"), |
| 56 | new DefaultAppModuleInfo(IanaIfType.class, null)) |
| 57 | |
| 58 | // FIXME requires entry for each .yangs not covered yet |
| 59 | |
| 60 | .put(new DefaultYangModuleId("openconfig-platform", "2016-12-22"), |
| 61 | new DefaultAppModuleInfo(OpenconfigPlatform.class, null)) |
| 62 | .put(new DefaultYangModuleId("openconfig-interfaces", "2017-07-14"), |
| 63 | new DefaultAppModuleInfo(OpenconfigInterfaces.class, null)) |
| 64 | .put(new DefaultYangModuleId("openconfig-transport-types", "2017-08-16"), |
| 65 | new DefaultAppModuleInfo(OpenconfigTransportTypes.class, null)) |
| 66 | .put(new DefaultYangModuleId("openconfig-types", "2017-08-16"), |
| 67 | new DefaultAppModuleInfo(OpenconfigTypes.class, null)) |
| 68 | // .put(new DefaultYangModuleId("openconfig-extensions", "2017-08-16"), |
| 69 | // new DefaultAppModuleInfo(OpenconfigEx.class, null)) |
| 70 | .put(new DefaultYangModuleId("ietf-yang-types", "2013-07-15"), |
| 71 | new DefaultAppModuleInfo(IetfYangTypes.class, null)) |
| 72 | |
| 73 | |
| 74 | // minimum required for the example |
| 75 | .put(new DefaultYangModuleId("openconfig-platform-linecard", "2017-08-03"), |
| 76 | new DefaultAppModuleInfo(OpenconfigPlatformLinecard.class, null)) |
| 77 | .put(new DefaultYangModuleId("openconfig-platform-port", "2016-10-24"), |
| 78 | new DefaultAppModuleInfo(OpenconfigPlatformPort.class, null)) |
| 79 | .put(new DefaultYangModuleId("openconfig-platform-transceiver", "2017-07-08"), |
| 80 | new DefaultAppModuleInfo(OpenconfigPlatformTransceiver.class, null)) |
| 81 | .put(new DefaultYangModuleId("openconfig-transport-line-common", "2017-07-08"), |
| 82 | new DefaultAppModuleInfo(OpenconfigTransportLineCommon.class, null)) |
| 83 | .put(new DefaultYangModuleId("openconfig-terminal-device", "2017-07-08"), |
| 84 | new DefaultAppModuleInfo(OpenconfigTerminalDevice.class, null)) |
| 85 | |
| 86 | .build(); |
| 87 | } |
| 88 | } |