Creating datafile

Datafile collector, wich is moved from the prototype repo.

Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-852
Change-Id: I1b91a51e328dc8cd11c14b290fe7296ed165ddf4
diff --git a/datafilecollector/config/README b/datafilecollector/config/README
new file mode 100644
index 0000000..cfde02e
--- /dev/null
+++ b/datafilecollector/config/README
@@ -0,0 +1,43 @@
+The keystore.jks and truststore.jks files are created by using the following commands (note that this is an example):
+
+1) Create a CA certificate and a private key:
+
+openssl genrsa -des3 -out CA-key.pem 2048
+openssl req -new -key CA-key.pem -x509 -days 3600 -out CA-cert.pem
+
+2) Create a keystore with a private key entry that is signed by the CA:
+
+Note: your name must be "localhost"
+
+keytool -genkeypair -alias policy_agent -keyalg RSA -keysize 2048 -keystore keystore.jks -validity 3650 -storepass policy_agent
+keytool -certreq -alias policy_agent -file request.csr -keystore keystore.jks -ext san=dns:your.domain.com -storepass policy_agent
+openssl x509 -req -days 3650 -in request.csr -CA CA-cert.pem -CAkey CA-key.pem -CAcreateserial -out ca_signed-cert.pem
+keytool -importcert -alias ca_cert -file CA-cert.pem -keystore keystore.jks -trustcacerts -storepass policy_agent
+keytool -importcert -alias policy_agent -file ca_signed-cert.pem -keystore keystore.jks -trustcacerts -storepass policy_agent
+
+
+3) Create a trust store containing the CA cert (to trust all certs signed by the CA):
+
+keytool -genkeypair -alias not_used -keyalg RSA -keysize 2048 -keystore truststore.jks -validity 3650 -storepass policy_agent
+keytool -importcert -alias ca_cert -file CA-cert.pem -keystore truststore.jks -trustcacerts -storepass policy_agent
+
+
+4) Command for listing of the contents of jks files, examples:
+keytool -list -v -keystore keystore.jks -storepass policy_agent
+keytool -list -v -keystore truststore.jks -storepass policy_agent
+
+## License
+
+Copyright (C) 2022 Nordix Foundation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
diff --git a/datafilecollector/config/application.yaml b/datafilecollector/config/application.yaml
new file mode 100644
index 0000000..71f3172
--- /dev/null
+++ b/datafilecollector/config/application.yaml
@@ -0,0 +1,56 @@
+spring:
+  profiles:
+    active: prod
+management:
+  endpoints:
+    web:
+      exposure:
+        include: "loggers,logfile,health,info,metrics"
+server:
+  port: 8433
+  ssl:
+      key-store-type: JKS
+      key-store-password: policy_agent
+      key-store: config/keystore.jks
+      key-password: policy_agent
+      key-alias: policy_agent
+logging:
+  level:
+    ROOT: WARN
+    org.onap: WARN
+    org.springframework: WARN
+    org.springframework.data: WARN
+    org.springframework.web.reactive.function.client.ExchangeFunctions: WARN
+    org.onap.dcaegen2.collectors.datafile: INFO
+
+  file:
+    name: /var/log/ONAP/application.log
+app:
+  filepath: config/datafile_endpoints_test.json
+  collected-files-path: "/tmp/onap_datafile/"
+   # KAFKA boostrap servers. This is only needed if there are Information Types that uses a kafkaInputTopic
+  # several redundant boostrap servers can be specified, separated by a comma ','.
+  kafka:
+    bootstrap-servers: localhost:9092
+    # output topic
+    collected-file-topic: collected-file
+    client-id: datafile-1
+    # input topic
+    file-ready-event-topic: file-ready
+  sftp:
+    known-hosts-file-path:
+    strict-host-key-checking: false
+  ssl:
+     key-store-password-file: /opt/app/datafile/config/ftps_keystore.pass
+     key-store: /opt/app/datafile/config/ftps_keystore.p12
+     trust-store-password-file: /opt/app/datafile/config/truststore.pass
+     trust-store: /opt/app/datafile/config/truststore.jks
+  s3:
+    endpointOverride:
+    accessKeyId:
+    secretAccessKey:
+    bucket:
+    locksBucket:
+springdoc:
+  show-actuator: true
+  swagger-ui.disable-swagger-default-url: true
\ No newline at end of file
diff --git a/datafilecollector/config/ftps_keystore.p12 b/datafilecollector/config/ftps_keystore.p12
new file mode 100755
index 0000000..b847707
--- /dev/null
+++ b/datafilecollector/config/ftps_keystore.p12
Binary files differ
diff --git a/datafilecollector/config/ftps_keystore.pass b/datafilecollector/config/ftps_keystore.pass
new file mode 100755
index 0000000..1e7befc
--- /dev/null
+++ b/datafilecollector/config/ftps_keystore.pass
@@ -0,0 +1 @@
+HVpAf0kHGl4P#fdpblJLka6b
\ No newline at end of file
diff --git a/datafilecollector/config/keystore.jks b/datafilecollector/config/keystore.jks
new file mode 100644
index 0000000..563c67b
--- /dev/null
+++ b/datafilecollector/config/keystore.jks
Binary files differ
diff --git a/datafilecollector/config/truststore.jks b/datafilecollector/config/truststore.jks
new file mode 100644
index 0000000..50a0f9e
--- /dev/null
+++ b/datafilecollector/config/truststore.jks
Binary files differ
diff --git a/datafilecollector/config/truststore.pass b/datafilecollector/config/truststore.pass
new file mode 100755
index 0000000..b915b0f
--- /dev/null
+++ b/datafilecollector/config/truststore.pass
@@ -0,0 +1 @@
+policy_agent
\ No newline at end of file