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;
19 import io.fd.honeycomb.transportpce.device.tools.DefaultPmListFactory;
20 import io.fd.honeycomb.transportpce.test.common.DataStoreContext;
21 import io.fd.honeycomb.transportpce.test.common.DataStoreContextImpl;
25 import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.CurrentPmlist;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
29 import net.jmob.guice.conf.core.BindConfig;
30 import net.jmob.guice.conf.core.InjectConfig;
31 import net.jmob.guice.conf.core.Syntax;
34 * Class containing static configuration for honeynode-plugin module<br>
36 * Further documentation for the configuration injection can be found at:
37 * https://github.com/yyvess/gconf
39 @BindConfig(value = "honeycomb", syntax = Syntax.JSON)
40 public final class PmConfiguration {
41 private static final Logger LOG = LoggerFactory.getLogger(PmConfiguration.class);
43 private DataStoreContext dataStoreContextUtil;
44 private DefaultPmListFactory defaultPmListFactory;
45 private ClassLoader classLoader;
47 @InjectConfig("netconf-initial-config-xml")
48 public String PM_DATA_SAMPLE_OPER_XML;
50 public PmConfiguration() {
51 classLoader = Thread.currentThread().getContextClassLoader();
52 dataStoreContextUtil = new DataStoreContextImpl();
53 defaultPmListFactory = new DefaultPmListFactory();
56 public String getNetconfInitialPmXml() {
57 return PM_DATA_SAMPLE_OPER_XML;
60 public CurrentPmlist getDataPm() {
61 CurrentPmlist result = null;
62 File pm_list_data = new File(classLoader.getResource(PM_DATA_SAMPLE_OPER_XML).getFile());
63 result = defaultPmListFactory.createDefaultPmList(dataStoreContextUtil,pm_list_data);
65 LOG.info("result pm list size : {}", result.getCurrentPm().size());