blob: 68326b5d8c5dc37c42ecb997866c19a3298b78c8 [file] [log] [blame]
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01001========================
elinuxhenrikb511dbc2018-09-20 13:05:18 +02002DFC (DataFile Collector)
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01003========================
elinuxhenrikb511dbc2018-09-20 13:05:18 +02004
5:Date: 2018-09-21
6
7.. contents::
8 :depth: 3
9..
10
11Overview
12========
13
14DFC will orchestrate the collection of bulk PM data flow:
15 1. Subscribes to fileReady DMaaP topic
16 2. Collects the file from the xNF
17 3. Sends new event to DataRouter with file.
18
19Introduction
20============
21
22DFC is delivered as one **Docker container** which hosts application server and can be started by `docker-compose`.
23
24Functionality
25=============
Chengkai Yan285e47c2018-10-18 10:40:14 +020026.. image:: ../images/DFC.png
elinuxhenrikb511dbc2018-09-20 13:05:18 +020027
28
29Paths
30=====
31
32GET /events/unauthenticated.VES_NOTIFICATION_OUTPUT
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010033---------------------------------------------------
elinuxhenrikb511dbc2018-09-20 13:05:18 +020034
35Description
36~~~~~~~~~~~
37
38Reads fileReady events from DMaaP (Data Movement as a Platform)
39
40
41Responses
42~~~~~~~~~
43
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010044+-----------+---------------------+
45| HTTP Code | Description |
46+===========+=====================+
47| **200** | successful response |
48+-----------+---------------------+
elinuxhenrikb511dbc2018-09-20 13:05:18 +020049
50
51
52POST /publish
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010053-------------
elinuxhenrikb511dbc2018-09-20 13:05:18 +020054
55Description
56~~~~~~~~~~~
57
58Publish the collected file/s as a stream to DataRouter
59 - file as stream
60 - compression
61 - fileFormatType
62 - fileFormatVersion
63
64
65Responses
66~~~~~~~~~
67
Chengkai Yan54d8a3b2018-11-01 12:06:26 +010068+-----------+---------------------+
69| HTTP Code | Description |
70+===========+=====================+
71| **200** | successful response |
72+-----------+---------------------+
elinuxhenrikb511dbc2018-09-20 13:05:18 +020073
74Compiling DFC
75=============
76
77Whole project (top level of DFC directory) and each module (sub module directory) can be compiled using
78`mvn clean install` command.
79
Chengkai Yan285e47c2018-10-18 10:40:14 +020080Configuration file: Config/datafile_endpoints.json
81
82Main API Endpoints
83==================
84
85Running with dev-mode of DFC
86 - Heartbeat: **http://<container_address>:8100/heartbeat** or **https://<container_address>:8433/heartbeat**
87 - Start DFC: **http://<container_address>:8100/start** or **https://<container_address>:8433/start**
88 - Stop DFC: **http://<container_address>:8100/stopDatafile** or **https://<container_address>:8433/stopDatafile**
89
90The external port allocated for 8100 (http) is 30245.
91
elinuxhenrikb511dbc2018-09-20 13:05:18 +020092Maven GroupId:
93==============
94
95org.onap.dcaegen2.collectors
96
97Maven Parent ArtifactId:
98========================
99
100dcae-collectors
101
102Maven Children Artifacts:
103=========================
104
1051. datafile-app-server: DFC server
1062. datafile-dmaap-client: Contains implementation of DmaaP client
1073. datafile-commons: Common code for whole DFC modules
Chengkai Yan285e47c2018-10-18 10:40:14 +02001084. docker-compose: Contains the docker-compose
elinuxhenrikb511dbc2018-09-20 13:05:18 +0200109
Chengkai Yan285e47c2018-10-18 10:40:14 +0200110Configuration of Certificates in test environment(For FTP over TLS):
111====================================================================
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100112
Chengkai Yan285e47c2018-10-18 10:40:14 +0200113DFC supports two protocols: FTPES and SFTP.
114For FTPES, it is mutual authentication with certificates.
115In our test environment, we use vsftpd to simulate xNF, and we generate self-signed
116keys & certificates on both vsftpd server and DFC.
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100117
1181. Generate key/certificate with openssl for DFC:
119-------------------------------------------------
120.. code:: bash
121
Chengkai Yan285e47c2018-10-18 10:40:14 +0200122 openssl genrsa -out dfc.key 2048
123 openssl req -new -out dfc.csr -key dfc.key
124 openssl x509 -req -days 365 -in dfc.csr -signkey dfc.key -out dfc.crt
elinuxhenrikb511dbc2018-09-20 13:05:18 +0200125
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01001262. Generate key & certificate with openssl for vsftpd:
127------------------------------------------------------
128.. code:: bash
Chengkai Yan285e47c2018-10-18 10:40:14 +0200129
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100130 openssl genrsa -out ftp.key 2048
131 openssl req -new -out ftp.csr -key ftp.key
132 openssl x509 -req -days 365 -in ftp.csr -signkey ftp.key -out ftp.crt
133
1343. Configure java keystore in DFC:
135----------------------------------
136We have two keystore files, one for TrustManager, one for KeyManager.
137
138**For TrustManager:**
139
1401. First, create a jks keystore for TrustManager:
141
142 .. code:: bash
143
144 keytool -keystore ftp.jks -genkey -alias ftp
145
1462. Second, convert your certificate in a DER format :
147
148 .. code:: bash
149
150 openssl x509 -outform der -in ftp.crt -out ftp.der
151
1523. And after, import it in the keystore :
153
154 .. code:: bash
155
156 keytool -import -alias ftp -keystore ftp.jks -file ftp.der
157
158**For KeyManager:**
159
1601. First, create a jks keystore:
161
162 .. code:: bash
163
164 keytool -keystore dfc.jks -genkey -alias dfc
165
1662. Second, import dfc.crt and dfc.key to dfc.jks. This is a bit troublesome.
167
168 1). Step one: Convert x509 Cert and Key to a pkcs12 file
169
170 .. code:: bash
171
172 openssl pkcs12 -export -in dfc.crt -inkey dfc.key -out dfc.p12 -name [some-alias]
173
174 Note: Make sure you put a password on the p12 file - otherwise you'll get a null reference exception when yy to import it. (In case anyone else had this headache).
175
176 Note 2: You might want to add the -chainoption to preserve the full certificate chain.
177
178 2). Step two: Convert the pkcs12 file to a java keystore:
179
180 .. code:: bash
181
182 keytool -importkeystore -deststorepass [changeit] -destkeypass [changeit] -destkeystore dfc.jks -srckeystore dfc.p12 -srcstoretype PKCS12 -srcstorepass [some-password] -alias [some-alias]
183
1843. Finished
185
1864. Configure vsftpd:
187--------------------
Chengkai Yan285e47c2018-10-18 10:40:14 +0200188 update /etc/vsftpd/vsftpd.conf:
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100189
190 .. code-block:: javascript
191
Chengkai Yan285e47c2018-10-18 10:40:14 +0200192 rsa_cert_file=/etc/ssl/private/ftp.crt
193 rsa_private_key_file=/etc/ssl/private/ftp.key
194 ssl_enable=YES
195 allow_anon_ssl=NO
196 force_local_data_ssl=YES
197 force_local_logins_ssl=YES
198
199 ssl_tlsv1=YES
200 ssl_sslv2=YES
201 ssl_sslv3=YES
202
203 require_ssl_reuse=NO
204 ssl_ciphers=HIGH
205
206 require_cert=YES
207 ssl_request_cert=YES
208 ca_certs_file=/home/vsftpd/myuser/dfc.crt
209
Chengkai Yan54d8a3b2018-11-01 12:06:26 +01002105. Configure config/datafile_endpoints.json:
211--------------------------------------------
Chengkai Yan285e47c2018-10-18 10:40:14 +0200212 Update the file accordingly:
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100213
214 .. code-block:: javascript
215
Chengkai Yan285e47c2018-10-18 10:40:14 +0200216 "ftpesConfiguration": {
217 "keyCert": "/config/dfc.jks",
218 "keyPassword": "[yourpassword]",
219 "trustedCA": "/config/ftp.jks",
220 "trustedCAPassword": "[yourpassword]"
221 }
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100222
Chengkai Yan285e47c2018-10-18 10:40:14 +02002236. This has been tested with vsftpd and dfc, with self-signed certificates.
Chengkai Yan54d8a3b2018-11-01 12:06:26 +0100224---------------------------------------------------------------------------
225 In real deployment, we should use ONAP-CA signed certificate for DFC, and vendor-CA signed certificate for xNF