2 * Copyright (c) 2016 Cisco and/or its affiliates.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package io.fd.honeycomb.transportpce.device.configuration;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev181019.CurrentPmList;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
25 import io.fd.honeycomb.transportpce.device.tools.DefaultPmListFactory;
26 import io.fd.honeycomb.transportpce.test.common.DataStoreContext;
27 import io.fd.honeycomb.transportpce.test.common.DataStoreContextImpl;
28 import net.jmob.guice.conf.core.BindConfig;
29 import net.jmob.guice.conf.core.InjectConfig;
30 import net.jmob.guice.conf.core.Syntax;
33 * Class containing static configuration for honeynode-plugin module<br>
35 * Further documentation for the configuration injection can be found at:
36 * https://github.com/yyvess/gconf
38 @BindConfig(value = "honeycomb", syntax = Syntax.JSON)
39 public final class PmConfiguration {
40 private static final Logger LOG = LoggerFactory.getLogger(PmConfiguration.class);
42 private DataStoreContext dataStoreContextUtil;
43 private DefaultPmListFactory defaultPmListFactory;
44 private ClassLoader classLoader;
46 @InjectConfig("netconf-initial-config-xml")
47 public String PM_DATA_SAMPLE_OPER_XML;
49 public PmConfiguration() {
50 classLoader = Thread.currentThread().getContextClassLoader();
51 dataStoreContextUtil = new DataStoreContextImpl();
52 defaultPmListFactory = new DefaultPmListFactory();
55 public String getNetconfInitialPmXml() {
56 return PM_DATA_SAMPLE_OPER_XML;
59 public CurrentPmList getDataPm() {
60 CurrentPmList result = null;
61 File pm_list_data = new File(classLoader.getResource(PM_DATA_SAMPLE_OPER_XML).getFile());
62 result = defaultPmListFactory.createDefaultPmList(dataStoreContextUtil, pm_list_data);
64 LOG.info("result pm list size : {}", result.getCurrentPmEntry().size());
66 LOG.warn("Failed to get PM info !");