The common lib provides base functionality for:

  • configuration
  • database requests
  • http client requests
  • java resource access
  • assertions


Configuration

The configuration part is widely used over all our bundles, e.g. data-provider, devicemanager or mountpoint-registrar.

example config file:

[es]
#hosturl
esHosts=${SDNRDBURL}
#time limit to keep increasing data in database [in seconds]
#60*60*24*30 (30days)
esArchiveLifetimeSeconds=2592000
esCluster=
esArchiveCheckIntervalSeconds=0
esNode=elasticsearchnode
esAuthUsername=${SDNRDBUSERNAME}
esAuthPassword=${SDNRDBPASSWORD}
esTrustAllCerts=${SDNRDBTRUSTALLCERTS}

A config file is separated into Sections.

  • each section starts with a keyword in square brackets
  • each parameter in a seperate line
  • comments with starting #
  • values as environment variables with encosing ${}


Code example for a specific config implementation:

https://gerrit.onap.org/r/gitweb?p=ccsdk/features.git;a=blob;f=sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/EsConfig.java;h=fc37010996e9a4551986ee85295b5fa2171382dc;hb=refs/heads/frankfurt

usage:

final ConfigurationFileRepresentation configuration = new ConfigurationFileRepresentation("etc/dataprovider.properties");
final EsConfig esConfig = new EsConfig(configuration);
ElasticSearchDataProvider dataProvider = new ElasticSearchDataProvider(esConfig.getHosts(),esConfig.getBasicAuthUsername(),esConfig.getBasicAuthPassword());



  • No labels