Add HTTPS as new protocol to collect files from xNFs
[dcaegen2.git] / docs / sections / services / dfc / configuration.rst
index 22f50ee..b5c7f97 100644 (file)
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.\r
 .. http://creativecommons.org/licenses/by/4.0\r
 \r
+=============================\r
+Configuration and Performance\r
+=============================\r
+The DataFile Collector (DFC) gets fileReady messages from the Message Router (MR) sent from xNFs, via the VES Collector.\r
+These messages contains data about files ready to get from the xNF. DFC then collects these files from the xNF and\r
+publishes them to the DataRouter (DR) on a feed. Consumers can subscribe to the feed from DR and process the file for\r
+its specific purpose. The connection between a file type and the feed it will be published to is the\r
+**changeIdentifier**. DFC can handle multiple **changeIdentifier**/feed combinations, see picture below.\r
+\r
+.. image:: ../../images/DFC_config.png\r
+\r
+\r
+\r
 Configuration\r
-=============\r
-\r
-**datafile** configuration is controlled via a single JSON file called datafile_endpoints.json.\r
-This is located under datafile-app-server/config.\r
-\r
-JSON CONFIGURATION EXPLAINED\r
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
-\r
-Variables of interest (e.g. variables that should be inspected/modifed for a specific runtime environment) are listed below for convenience.  The entire file is provided later in this page for reference.\r
-\r
-dmaapConsumerConfiguration\r
-""""""""""""""""""""""""""\r
-\r
-.. code-block:: json\r
-\r
-  "dmaapHostName": <name of DMaaP/MR host>\r
-  "dmaapPortNumber": <DMaaP/MR host port>\r
-  "dmaapTopicName": "/events/unauthenticated.VES_NOTIFICATION_OUTPUT"\r
-  "dmaapProtocol": "http"\r
-  "dmaapUserName": ""\r
-  "dmaapUserPassword": ""\r
-  "dmaapContentType": "application/json"\r
-  "consumerId": "C12"\r
-  "consumerGroup": "OpenDcae-c12"\r
-  "timeoutMS": -1\r
-  "messageLimit": 1\r
-\r
-dmaapProducerConfiguration\r
-""""""""""""""""""""""""""\r
-\r
-.. code-block:: json\r
-\r
-  "dmaapHostName": <name of DMaaP/DR host>\r
-  "dmaapPortNumber": <DMaaP/DR host port>\r
-  "dmaapTopicName": "publish"\r
-  "dmaapProtocol": "httpa"\r
-  "dmaapUserName": "dradmin"\r
-  "dmaapUserPassword": "dradmin"\r
-  "dmaapContentType": "application/octet-stream"\r
-\r
-ftpesConfiguration\r
-""""""""""""""""""\r
-\r
-.. code-block:: json\r
-\r
-  "keyCert": <path to DFC certificate>\r
-  "keyPassword": <password for DFC certificate>\r
-  "trustedCa": <path to xNF certificate>\r
-  "trustedCaPassword": <password for xNF certificate>\r
-\r
-securityConfiguration\r
-"""""""""""""""""""""\r
-\r
-.. code-block:: json\r
-\r
-  "trustStorePath": <path to trust store>\r
-  "trustStorePasswordPath": <path to trsust store password>\r
-  "keyStorePath": <path to key store>\r
-  "keyStorePasswordPath": <path to key store password>\r
-  "enableDmaapCertAuth": <boolean>. If false, all information above are ignored.\r
-\r
-\r
-\r
-Sample JSON configuration\r
-"""""""""""""""""""""""""\r
-\r
-The format of the JSON configuration that drives all behavior of DFC is probably best described using an example:\r
-\r
-.. code-block:: json\r
-\r
-  {\r
-    "configs": {\r
-      "dmaap": {\r
-        "dmaapConsumerConfiguration": {\r
-          "dmaapHostName": "localhost",\r
-          "dmaapPortNumber": 2222,\r
-          "dmaapTopicName": "/events/unauthenticated.VES_NOTIFICATION_OUTPUT",\r
-          "dmaapProtocol": "http",\r
-          "dmaapUserName": "",\r
-          "dmaapUserPassword": "",\r
-          "dmaapContentType": "application/json",\r
-          "consumerId": "C12",\r
-          "consumerGroup": "OpenDcae-c12",\r
-          "timeoutMS": -1,\r
-          "messageLimit": 1\r
-        },\r
-        "dmaapProducerConfiguration": {\r
-          "dmaapHostName": "localhost",\r
-          "dmaapPortNumber": 3907,\r
-          "dmaapTopicName": "publish",\r
-          "dmaapProtocol": "https",\r
-          "dmaapUserName": "dradmin",\r
-          "dmaapUserPassword": "dradmin",\r
-          "dmaapContentType": "application/octet-stream"\r
-        }\r
-      },\r
-      "ftp": {\r
-            "ftpesConfiguration": {\r
-                "keyCert": "config/dfc.jks",\r
-                "keyPassword": "secret",\r
-                "trustedCa": "config/ftp.jks",\r
-                "trustedCaPassword": "secret"\r
-            }\r
-      },\r
-        "security": {\r
-            "trustStorePath" : "change it",\r
-            "trustStorePasswordPath" : "change it",\r
-            "keyStorePath" : "change it",\r
-            "keyStorePasswordPath" : "change it",\r
-            "enableDmaapCertAuth" : "false"\r
-        }\r
-    }\r
-  }\r
+^^^^^^^^^^^^^\r
+By default, DFC handles the "PM_MEAS_FILES" change identifier and publishes these files on the "bulk_pm_feed" feed.\r
+But it can also be configured to handle more/other change identifiers and publish them to more/other feeds. The\r
+configuration of DFC is controlled via a blueprint.\r
+\r
+Blueprint Configuration Explained\r
+"""""""""""""""""""""""""""""""""\r
+\r
+For the communication with the Message Router, the user must provide the **host name**, **port**, and **protocol** of\r
+the DMaaP Message router.\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 2,6,10\r
+\r
+    inputs:\r
+      dmaap_mr_host:\r
+        type: string\r
+        description: dmaap messagerouter host\r
+        default: message-router.onap.svc.cluster.local\r
+      dmaap_mr_port:\r
+        type: integer\r
+        description: dmaap messagerouter port\r
+        default: 3904\r
+      dmaap_mr_protocol:\r
+        type: string\r
+        description: dmaap messagerouter protocol\r
+        default: "http"\r
+\r
+The user can also specify which version of DFC to use.\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 2\r
+\r
+    inputs:\r
+      tag_version:\r
+        type: string\r
+        description: DFC image tag/version\r
+        default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.datafile.datafile-app-server:1.2.0"\r
+\r
+The user can also enable secure communication with the DMaaP Message Router.\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 2\r
+\r
+    inputs:\r
+      secureEnableCert:\r
+        type: boolean\r
+        description: enable certificate based connection with DMaap\r
+        default: false\r
+\r
+DFC can handle multiple change identifiers. For each change identifier/feed combination the user must provide the\r
+**change identifier**, **feed name**, and **feed location**.\r
+\r
+**Note!** The **feed name** provided should be used by the consumer/s to set up the subscription to the feed.\r
+\r
+The **feed name** and **feed location** are defined as inputs for the user to provide.\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 2,6\r
+\r
+    inputs:\r
+      feed0_name:\r
+        type: string\r
+        description: The name of the feed the files will be published to. Should be used by the subscriber.\r
+        default: "bulk_pm_feed"\r
+      feed0_location:\r
+        type: string\r
+        description: The location of the feed.\r
+        default: "loc00"\r
+\r
+The **feed name** shall be used in the definition of the feed for the DMaaP plugin under the "**node_templates**"\r
+section under a tag for the  internal "**feed identifier**" for the feed (feed0 in the example).\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 1,5\r
+\r
+    feed0:\r
+      type: ccsdk.nodes.Feed\r
+      properties:\r
+        feed_name:\r
+          get_input: feed0_name\r
+        useExisting: true\r
+\r
+The **feed location** shall be used under the **streams_publishes** section under a tag for the internal\r
+"**feed identifier**" for the feed.\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 2,4\r
+\r
+      streams_publishes:\r
+      - name: feed0\r
+        location:\r
+          get_input: feed0_location\r
+        type: data_router\r
+\r
+The **change identifier** shall be defined as an item under the **streams_publishes** tag in the "**application_config**"\r
+section. Under this tag the internal "**feed identifier**" for the feed shall also be added to get the\r
+info about the feed substituted in by CBS (that's what the <<>> tags are for).\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 4,5\r
+\r
+      application_config:\r
+        service_calls: []\r
+        streams_publishes:\r
+          PM_MEAS_FILES:\r
+            dmaap_info: <<feed0>>\r
+            type: data_router\r
+\r
+And, lastly, to set up the publication relationship for the feed, the "**feed identifier**" must be added to the\r
+"**relationships**" section of the blueprint.\r
+\r
+.. code-block:: yaml\r
+  :emphasize-lines: 3\r
+\r
+   relationships:\r
+    - type: ccsdk.relationships.publish_files\r
+      target: feed0\r
+\r
+Sample blueprint configuration\r
+""""""""""""""""""""""""""""""\r
+\r
+The format of the blueprint configuration that drives all behavior of DFC is probably best described using an example.\r
+The blueprint below configures DFC to handle the two feeds shown in the picture above.\r
+\r
+.. code-block:: yaml\r
+\r
+    inputs:\r
+      dmaap_mr_host:\r
+        type: string\r
+        description: dmaap messagerouter host\r
+        default: message-router.onap.svc.cluster.local\r
+      dmaap_mr_port:\r
+        type: integer\r
+        description: dmaap messagerouter port\r
+        default: 3904\r
+      dmaap_mr_protocol:\r
+        type: string\r
+        description: dmaap messagerouter protocol\r
+        default: "http"\r
+      tag_version:\r
+        type: string\r
+        description: DFC image tag/version\r
+        default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.datafile.datafile-app-server:1.2.0"\r
+      replicas:\r
+        type: integer\r
+        description: number of instances\r
+        default: 1\r
+      secureEnableCert:\r
+        type: boolean\r
+        description: enable certificate based connection with DMaap\r
+        default: false\r
+      envs:\r
+        default: {}\r
+      feed0_name:\r
+        type: string\r
+        description: The name of the feed the files will be published to. Should be used by the subscriber.\r
+        default: "bulk_pm_feed"\r
+      feed0_location:\r
+        type: string\r
+        description: The location of the feed.\r
+        default: "loc00"\r
+      feed1_name:\r
+        type: string\r
+        description: The name of the feed the files will be published to. Should be used by the subscriber.\r
+        default: "log_feed"\r
+      feed1_location:\r
+        type: string\r
+        description: The location of the feed.\r
+        default: "loc00"\r
+    node_templates:\r
+      datafile-collector:\r
+        type: dcae.nodes.ContainerizedServiceComponentUsingDmaap\r
+        interfaces:\r
+          cloudify.interfaces.lifecycle:\r
+            start:\r
+              inputs:\r
+            envs:\r
+              get_input: envs\r
+        properties:\r
+          application_config:\r
+            service_calls: []\r
+            dmaap.security.enableDmaapCertAuth: { get_input: secureEnableCert }\r
+            streams_subscribes:\r
+              dmaap_subscriber:\r
+                dmaap_info:\r
+                  topic_url:\r
+                    { concat: [{ get_input: dmaap_mr_protocol },"://",{ get_input: dmaap_mr_host },\r
+                               ":",{ get_input: dmaap_mr_port },"/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12"]}\r
+            streams_publishes:\r
+              PM_MEAS_FILES:\r
+                dmaap_info: <<feed0>>\r
+                type: data_router\r
+              LOG_FILES:\r
+                dmaap_info: <<feed1>>\r
+                type: data_router\r
+          image:\r
+            get_input: tag_version\r
+          service_component_type: datafile-collector\r
+          streams_publishes:\r
+          - name: feed0\r
+            location:\r
+              get_input: feed0_location\r
+            type: data_router\r
+          - name: feed1\r
+            location:\r
+              get_input: feed1_location\r
+            type: data_router\r
+        relationships:\r
+          - type: ccsdk.relationships.publish_files\r
+            target: feed0\r
+          - type: ccsdk.relationships.publish_files\r
+            target: feed1\r
+      feed0:\r
+        type: ccsdk.nodes.Feed\r
+        properties:\r
+          feed_name:\r
+            get_input: feed0_name\r
+          useExisting: true\r
+      feed1:\r
+        type: ccsdk.nodes.Feed\r
+        properties:\r
+          feed_name:\r
+            get_input: feed1_name\r
+          useExisting: true\r
+\r
+.. _strict_host_checking_config:\r
+\r
+Turn On/Off StrictHostChecking\r
+------------------------------\r
+**StrictHostChecking** is a SSH connection option which prevents Man in the Middle (MitM) attacks. If it is enabled, client checks HostName and public key provided by server and compares it with keys stored locally. Only if matching entry is found, SSH connection can be established.\r
+By default in DataFile Collector this option is enabled (true) and requires to provide known_hosts list to DFC container.\r
+\r
+**Important: DFC requires public keys in sha-rsa KeyAlgorithm** \r
+\r
+**Known_hosts file** is a list in following format:\r
+\r
+.. code-block:: bash\r
+\r
+  <HostName/HostIP> <KeyAlgorithms> <Public Key>\r
+\r
+e.g: \r
+\r
+.. code-block:: bash\r
+\r
+  172.17.0.3 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDRibxPenQC//2hzTuscdQDUA7P3gB9k4E8IgwCJxZM8YrJ2vqHomN8boByubebvo0L8+DWqzAtjy0nvgzsoEme9Y3lLWZ/2g9stlsOurwm+nFmWn/RPnwjqsAGNQjukV8C9D82rPMOYRES6qSGactFw4i8ZWLH8pmuJ3js1jb91HSlwr4zbZZd2XPKHk3nudyh8/Mwf3rndCU5FSnzjpBo55m48nsl2M1Tb6Xj1R0jQc5LWN0fsbrm5m+szsk4ccgHw6Vj9dr0Jh4EaIpNwA68k4LzrW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u+h2KsYBAtrP88LqW562OQ6T7VkfoAYwOjx9WV3/y5qonsStPhhzmJHDF22oBh5E5tZQxRcIlQF+5kHmXnFRUZtWshFnQATBh3yhOzJbh66CXn7aPj5Kl8TuuSN48zuI2lulVVqcv7GmTS0tWNpbxpzw==\r
+\r
+\r
+\r
+To provide known_hosts list to DFC, execute following steps:\r
+\r
+1. Create file called known_hosts with desired entries.\r
+\r
+2. Mount file using Kubernetes Config Map.\r
+\r
+.. code-block:: bash\r
+\r
+  kubectl -n <ONAP NAMESPACE> create cm <config map name> --from-file <path to known_hosts file>\r
+\r
+e.g:\r
+\r
+.. code-block:: bash\r
+\r
+  kubectl -n onap create cm onap-dcae-dfc-known-hosts --from-file /home/ubuntu/.ssh/known_hosts\r
+\r
+\r
+3. Mount newly created Config Map as Volume to DFC by editing DFC deployment. **DFC deployment contains 3 containers, pay attention to mount the file to the appropriate container.**\r
+\r
+.. code-block:: yaml\r
+  \r
+  ...\r
+  kind: Deployment\r
+  metadata:\r
+  ...\r
+  spec:\r
+    ...\r
+    template:\r
+      ...\r
+      spec:\r
+        containers:\r
+        - image: <DFC image>\r
+          ...\r
+          volumeMounts:\r
+            ...\r
+          - mountPath: /home/datafile/.ssh/\r
+            name: onap-dcae-dfc-known-hosts\r
+            ...\r
+        volumes:\r
+        ...\r
+        - configMap:\r
+            name: <config map name, same as in step 1, e.g. onap-dcae-dfc-known-hosts>\r
+          name: onap-dcae-dfc-known-hosts\r
+      ...\r
+\r
+Known_hosts file path can be controlled by Environment Variable *KNOWN_HOSTS_FILE_PATH*. Full (absolute) path has to be provided. Sample deployment with changed known_hosts file path can be seen below.\r
+\r
+.. code-block:: yaml\r
+  \r
+  ...\r
+  kind: Deployment\r
+  metadata:\r
+  ...\r
+  spec:\r
+    ...\r
+    template:\r
+      ...\r
+      spec:\r
+        containers:\r
+        - image: <DFC image>\r
+          envs: \r
+            - name: KNOWN_HOSTS_FILE_PATH\r
+              value: /home/datafile/.ssh/new/path/<known_hosts file name, e.g. my_custom_keys>\r
+          ...\r
+          volumeMounts:\r
+            ...\r
+          - mountPath: /home/datafile/.ssh/new/path\r
+            name: onap-dcae-dfc-known-hosts\r
+            ...\r
+        volumes:\r
+        ...\r
+        - configMap:\r
+            name: <config map name, same as in step 1, e.g. onap-dcae-dfc-known-hosts>\r
+          name: onap-dcae-dfc-known-hosts\r
+      ...\r
+\r
+To change mounted known_hosts list, edit existing Config Map or delete and create it again. **The DFC container may refresh changes with a delay.** Pod, nor container restart is NOT required.\r
+\r
+To edit Config Map execute:\r
+\r
+.. code-block:: bash\r
+\r
+  kubectl -n <ONAP NAMESPACE> edit cm <config map name>\r
+\r
+e.g:\r
+\r
+.. code-block:: bash\r
+\r
+   kubectl -n onap edit cm onap-dcae-dfc-known-hosts\r
+\r
+To delete and create again Config Map execute: \r
+\r
+.. code-block:: bash\r
+\r
+  kubectl -n <ONAP NAMESPACE> delete cm <config map name>\r
+  kubectl -n <ONAP NAMESPACE> create cm <config map name> --from-file <path to known_hosts file>\r
+\r
+e.g:\r
+\r
+.. code-block:: bash\r
+\r
+  kubectl -n onap delete cm onap-dcae-dfc-known-hosts\r
+  kubectl -n onap create cm onap-dcae-dfc-known-hosts --from-file /home/ubuntu/.ssh/known_hosts\r
+\r
+\r
+To turn off StrictHostChecking, set below option to false. It could be changed in DCAE Config Binding Service (CBS).\r
+\r
+**WARNING: such operation is not recommended as it decreases DFC security and exposes DFC to MitM attacks.**\r
+\r
+.. code-block:: bash\r
+\r
+  "sftp.security.strictHostKeyChecking": false\r
+\r
+\r
+Performance\r
+^^^^^^^^^^^\r
+\r
+To see the performance of DFC, see "`Datafile Collector (DFC) performance baseline results`_".\r
+\r
+.. _Datafile Collector (DFC) performance baseline results: https://wiki.onap.org/display/DW/Datafile+Collector+%28DFC%29+performance+baseline+results\r