Add ability to insert custom sources and sinks

Closes-bug: PROD-35310
Change-Id: I3e9877f4aa48cee23c6839e5ab33f01a02e4bcd4
diff --git a/README.rst b/README.rst
index 8cebe7e..2e3ded9 100644
--- a/README.rst
+++ b/README.rst
@@ -415,6 +415,49 @@
           coordination:
             max_retry_interval: 30
 
+Configure additional event sources and sinks
+============================================
+
+Starting from 2019.2.10 cloud operator is able to configure custom
+event sources and sinks in pipeline.yaml and events_pipeline.yaml.
+The values could be configured via following pillars:
+
+.. code-block:: yaml
+
+    #pipeline.yaml
+    ceilometer:server:extra_meter_sources_list
+    ceilometer:server:extra_meter_sinks_list
+    #events_pipeline.yaml
+    ceilometer:server:extra_event_sources_list
+    ceilometer:server:extra_event_sinks_list
+
+The values will be passed to corresponding files as plain yaml data
+WITHOUT any validation. Cloud operator should ensure that the data is valid.
+The data passes to configuration files AS IS.
+
+.. code-block:: yaml
+
+    ceilometer:
+      server:
+        extra_meter_sources_list:
+        - name: cpu_source2
+          meters:
+            - "cpu"
+          sinks:
+            - cpu_sink2
+        extra_meter_sinks_list:
+        - name: cpu_sink2
+          publishers:
+            - rmq://ip:port
+          transformers:
+            - name: "rate_of_change"
+              parameters:
+                target:
+                    name: "cpu_util"
+                    unit: "%"
+        - name: cpu_sink3
+
+
 More Information
 ================
 
diff --git a/ceilometer/files/pike/event_pipeline.yaml b/ceilometer/files/pike/event_pipeline.yaml
index aa0ea46..7dfb6f9 100644
--- a/ceilometer/files/pike/event_pipeline.yaml
+++ b/ceilometer/files/pike/event_pipeline.yaml
@@ -19,6 +19,9 @@
 {%- else %}
 {%- do publisher_lst.append( 'notifier://' ) %}
 {%- endif %}
+{# #}
+{%- set extra_event_sources_list = server.get("extra_event_sources_list",[]) %}
+{%- set extra_event_sinks_list = server.get("extra_event_sinks_list",[]) %}
 ---
 sources:
     - name: event_source
@@ -26,8 +29,14 @@
           - "*"
       sinks:
           - event_sink
+    {%- if extra_event_sources_list %}
+    {{ extra_event_sources_list|yaml(False)|indent(4) }}
+    {%- endif %}
 sinks:
     - name: event_sink
       transformers:
       publishers:
           {{ publisher_lst|yaml(False)|indent(10) }}
+    {%- if extra_event_sinks_list %}
+    {{ extra_event_sinks_list|yaml(False)|indent(4) }}
+    {%- endif %}
diff --git a/ceilometer/files/pike/pipeline.yaml b/ceilometer/files/pike/pipeline.yaml
index 96ca2a9..3542716 100644
--- a/ceilometer/files/pike/pipeline.yaml
+++ b/ceilometer/files/pike/pipeline.yaml
@@ -21,6 +21,9 @@
 {%- else %}
 {%- do publisher_lst.append( 'notifier://' ) %}
 {%- endif %}
+{# #}
+{%- set extra_meter_sources_list = server.get("extra_meter_sources_list",[]) %}
+{%- set extra_meter_sinks_list = server.get("extra_meter_sinks_list",[]) %}
 ---
 sources:
     - name: meter_source
@@ -54,6 +57,9 @@
           - "network.outgoing.packets"
       sinks:
           - network_sink
+    {%- if extra_meter_sources_list %}
+    {{ extra_meter_sources_list|yaml(False)|indent(4) }}
+    {%- endif %}
 sinks:
     - name: meter_sink
       transformers:
@@ -110,3 +116,6 @@
                     type: "gauge"
       publishers:
           {{ publisher_lst|yaml(False)|indent(10) }}
+    {%- if extra_meter_sinks_list %}
+    {{ extra_meter_sinks_list|yaml(False)|indent(4) }}
+    {%- endif %}
diff --git a/ceilometer/files/queens/event_pipeline.yaml b/ceilometer/files/queens/event_pipeline.yaml
index aa0ea46..7dfb6f9 100644
--- a/ceilometer/files/queens/event_pipeline.yaml
+++ b/ceilometer/files/queens/event_pipeline.yaml
@@ -19,6 +19,9 @@
 {%- else %}
 {%- do publisher_lst.append( 'notifier://' ) %}
 {%- endif %}
+{# #}
+{%- set extra_event_sources_list = server.get("extra_event_sources_list",[]) %}
+{%- set extra_event_sinks_list = server.get("extra_event_sinks_list",[]) %}
 ---
 sources:
     - name: event_source
@@ -26,8 +29,14 @@
           - "*"
       sinks:
           - event_sink
+    {%- if extra_event_sources_list %}
+    {{ extra_event_sources_list|yaml(False)|indent(4) }}
+    {%- endif %}
 sinks:
     - name: event_sink
       transformers:
       publishers:
           {{ publisher_lst|yaml(False)|indent(10) }}
+    {%- if extra_event_sinks_list %}
+    {{ extra_event_sinks_list|yaml(False)|indent(4) }}
+    {%- endif %}
diff --git a/ceilometer/files/queens/pipeline.yaml b/ceilometer/files/queens/pipeline.yaml
index 96ca2a9..3542716 100644
--- a/ceilometer/files/queens/pipeline.yaml
+++ b/ceilometer/files/queens/pipeline.yaml
@@ -21,6 +21,9 @@
 {%- else %}
 {%- do publisher_lst.append( 'notifier://' ) %}
 {%- endif %}
+{# #}
+{%- set extra_meter_sources_list = server.get("extra_meter_sources_list",[]) %}
+{%- set extra_meter_sinks_list = server.get("extra_meter_sinks_list",[]) %}
 ---
 sources:
     - name: meter_source
@@ -54,6 +57,9 @@
           - "network.outgoing.packets"
       sinks:
           - network_sink
+    {%- if extra_meter_sources_list %}
+    {{ extra_meter_sources_list|yaml(False)|indent(4) }}
+    {%- endif %}
 sinks:
     - name: meter_sink
       transformers:
@@ -110,3 +116,6 @@
                     type: "gauge"
       publishers:
           {{ publisher_lst|yaml(False)|indent(10) }}
+    {%- if extra_meter_sinks_list %}
+    {{ extra_meter_sinks_list|yaml(False)|indent(4) }}
+    {%- endif %}
diff --git a/tests/pip_requirements.txt b/tests/pip_requirements.txt
index 940ecbb..4d8fa16 100644
--- a/tests/pip_requirements.txt
+++ b/tests/pip_requirements.txt
@@ -1,2 +1,3 @@
 jsonschema
 setuptools<45.0.0
+msgpack<1