aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/mass-pnf-sim/pnf-sim-lightweight/src/main/java/org/onap/pnfsimulator/ConfigurationProvider.java
blob: 4b293e8978319ce3e9ac65aaaf6744a8bcceaec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.onap.pnfsimulator;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import java.io.File;

public class ConfigurationProvider {
    static PnfSimConfig conf = null;

    String IpVes = null;
    String IpSftp = null;
    String IpFtps = null;
    String IpPnfsim = null;

    public static PnfSimConfig getConfigInstance() {

        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        try {
            File file = new File("./config/config.yml");

            conf = mapper.readValue(file, PnfSimConfig.class);
            System.out.println("Ves IP: " + conf.getVesip());
            System.out.println("SFTP IP: " + conf.getIpsftp());
            System.out.println("FTPS IP: " + conf.getIpftps());
            System.out.println("FTPS IP: " + conf.getIppnfsim());

        } catch (Exception e) {
            e.printStackTrace();
        }
        return conf;
    }

}