d90c60d58b4ca95d73b4a7cc2035338e6ef9b4d8
[integration.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * PNF-REGISTRATION-HANDLER
4  * ================================================================================
5  * Copyright (C) 2018 Nokia. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.netconfsimulator.netconfcore.configuration;
22
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25 import org.springframework.beans.factory.annotation.Value;
26 import org.springframework.context.annotation.Bean;
27 import org.springframework.context.annotation.Configuration;
28
29 @Configuration
30 class NetconfBeanConfiguration {
31
32     private static final Logger LOGGER = LoggerFactory.getLogger(NetconfBeanConfiguration.class);
33
34     @Value("${netconf.port}")
35     private Integer netconfPort;
36
37     @Value("${netconf.address}")
38     private String netconfAddress;
39
40     @Value("${netconf.user}")
41     private String netconfUser;
42
43     @Value("${netconf.password}")
44     private String netconfPassword;
45
46     @Bean
47     NetconfConfigurationReader configurationReader() {
48         NetconfConnectionParams params = new NetconfConnectionParams(netconfAddress, netconfPort, netconfUser, netconfPassword);
49         LOGGER.info("Configuration params are : {}", params);
50         return new NetconfConfigurationReader(params, new NetconfSessionHelper());
51     }
52
53     @Bean
54     NetconfConfigurationEditor configurationEditor() {
55         NetconfConnectionParams params =
56                 new NetconfConnectionParams(netconfAddress, netconfPort, netconfUser, netconfPassword);
57         return new NetconfConfigurationEditor(params, new NetconfSessionHelper());
58     }
59
60 }