2 * ============LICENSE_START=======================================================
3 * PNF-REGISTRATION-HANDLER
4 * ================================================================================ Copyright (C)
5 * 2018 NOKIA Intellectual Property. All rights reserved.
6 * ================================================================================ Licensed under
7 * the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
15 * the License. ============LICENSE_END=========================================================
18 package org.onap.pnfsimulator.netconfmonitor.netconf;
20 import com.tailf.jnc.JNCException;
21 import com.tailf.jnc.NetconfSession;
22 import java.io.IOException;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
27 public class NetconfConfigurationReader {
29 private static final Logger LOGGER = LoggerFactory.getLogger(NetconfConfigurationReader.class);
30 private final NetconfSession session;
31 private final String netconfModelPath;
33 public NetconfConfigurationReader(NetconfSession session, String netconfModelPath) {
34 LOGGER.warn("netconfModelPath: {}", netconfModelPath);
35 this.session = session;
36 this.netconfModelPath = netconfModelPath;
39 public String read() throws IOException, JNCException {
40 return session.getConfig(netconfModelPath).first().toXMLString();