Refactor: move telemetry config from componentCfg to configs.xml

1. Support to export the metrics to multiple targets
2. Add a set of properties to kafka config (key, topic, etc.)
3. Add distributedStore to manage telemetry configs
4. Add CLI to query stored telemetry configs
5. Add a set of telemetry loaders to import xml definitions
6. Add unit tests for telemetry cfg, xml cfg loader and dist store
7. Add missing javadoc for a set of implementation classes

Change-Id: I39480c9a6ac07357184d2e1094b9c9f4d36fd8b1
diff --git a/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/grpc-configs.xml b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/grpc-configs.xml
new file mode 100644
index 0000000..681dfc7
--- /dev/null
+++ b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/grpc-configs.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ 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.
+  -->
+<configs>
+    <config name="grpc" type="grpc" manufacturer="grpc.io" swVersion="master">
+        <property name="address">127.0.0.1</property>
+        <property name="port">50051</property>
+        <property name="usePlaintext">true</property>
+        <property name="maxInboundMsgSize">4194304</property>
+    </config>
+</configs>
\ No newline at end of file
diff --git a/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/influxdb-configs.xml b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/influxdb-configs.xml
new file mode 100644
index 0000000..d702a44
--- /dev/null
+++ b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/influxdb-configs.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ 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.
+  -->
+<configs>
+    <config name="influxdb" type="influxdb" manufacturer="influxdata.com" swVersion="master">
+        <property name="address">127.0.0.1</property>
+        <property name="port">8086</property>
+        <property name="username">onos</property>
+        <property name="password">onos</property>
+    </config>
+    <config name="sona-influxdb-connector" manufacturer="SK Telecom"
+            swVersion="1.0" extends="influxdb" enabled="false">
+        <property name="database">ost</property>
+        <property name="measurement">sonaflow</property>
+        <property name="enableBatch">true</property>
+    </config>
+</configs>
\ No newline at end of file
diff --git a/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/kafka-configs.xml b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/kafka-configs.xml
new file mode 100644
index 0000000..7429ac2
--- /dev/null
+++ b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/kafka-configs.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ 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.
+  -->
+<configs>
+    <config name="kafka" type="kafka" manufacturer="kafka.apache.org" swVersion="master">
+        <property name="address">127.0.0.1</property>
+        <property name="port">9092</property>
+        <property name="retries">0</property>
+    </config>
+    <config name="tina-kafka-exporter" manufacturer="SK Telecom"
+            swVersion="1.0" extends="kafka" enabled="false">
+        <property name="batchSize">16384</property>
+        <property name="lingerMs">1</property>
+        <property name="memoryBuffer">33554432</property>
+        <property name="requiredAcks">all</property>
+        <property name="keySerializer">
+            org.apache.kafka.common.serialization.StringSerializer
+        </property>
+        <property name="valueSerializer">
+            org.apache.kafka.common.serialization.ByteArraySerializer
+        </property>
+        <property name="topic">sona.flow</property>
+        <property name="key">flowdata</property>
+        <property name="codec">TinaMessageByteBufferCodec</property>
+    </config>
+</configs>
\ No newline at end of file
diff --git a/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/prometheus-configs.xml b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/prometheus-configs.xml
new file mode 100644
index 0000000..0459f6a
--- /dev/null
+++ b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/prometheus-configs.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ 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.
+  -->
+<configs>
+    <config name="prometheus" type="prometheus" manufacturer="prometheus.io" swVersion="master">
+        <property name="address">127.0.0.1</property>
+        <property name="port">50051</property>
+    </config>
+
+    <config name="sona-prometheus-exporter" manufacturer="SK Telecom"
+            swVersion="1.0" extends="prometheus" enabled="false">
+    </config>
+</configs>
\ No newline at end of file
diff --git a/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/rest-configs.xml b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/rest-configs.xml
new file mode 100644
index 0000000..ca1dc57
--- /dev/null
+++ b/apps/openstacktelemetry/app/src/main/resources/org/onosproject/openstacktelemetry/impl/rest-configs.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ 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.
+  -->
+<configs>
+    <config name="rest" type="rest" manufacturer="N/A" swVersion="master">
+        <property name="address">127.0.0.1</property>
+        <property name="port">80</property>
+        <property name="requestMediaType">application/json</property>
+        <property name="responseMediaType">application/json</property>
+    </config>
+    <config name="rest-connector" swVersion="1.0" extends="rest" enabled="false">
+        <property name="endpoint">telemetry</property>
+        <property name="method">POST</property>
+    </config>
+</configs>
\ No newline at end of file