Initial commit of PassiveTest
Change-Id: Idcd9a0c72df5eae6b4eedc544e473ebc9763ccdb
diff --git a/files/ext_services/passivetest/notifications.py b/files/ext_services/passivetest/notifications.py
new file mode 100644
index 0000000..8645820
--- /dev/null
+++ b/files/ext_services/passivetest/notifications.py
@@ -0,0 +1,54 @@
+# 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.
+
+import oslo_messaging
+from oslo_config import cfg
+
+from ceilometer.agent import plugin_base
+from oslo_log import log
+from ceilometer import sample
+
+OPTS = [
+ cfg.StrOpt('passivetestservice_control_exchange',
+ default='passivetestservice',
+ help="Exchange name for PassiveTest notifications."),
+]
+
+cfg.CONF.register_opts(OPTS)
+
+LOG = log.getLogger(__name__)
+
+class PassiveTestNotification(plugin_base.NotificationBase):
+
+ resource_name = None
+ event_types = ['passivetest.stats']
+
+ def get_targets(self,conf):
+ """Return a sequence of oslo.messaging.Target
+
+ This sequence is defining the exchange and topics to be connected for
+ this plugin.
+ """
+
+ return [oslo_messaging.Target(topic=topic,
+ exchange=conf.passivetestservice_control_exchange)
+ for topic in self.get_notification_topics(conf)]
+
+
+ def process_notification(self, message):
+ LOG.debug('Received Passivetest event passivetest.stats')
+
+ if message['payload']:
+ message['payload']['volume']=float(message['payload']['volume'])
+ yield sample.Sample.from_notification(
+ message=message,
+ **message['payload'])