-
Notifications
You must be signed in to change notification settings - Fork 27
/
qtest.py
71 lines (57 loc) · 1.94 KB
/
qtest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from oslo.config import cfg
from designate.openstack.common import log as logging
from oslo import messaging
import pprint
import sys
from designate import utils
CONF = cfg.CONF
class NotificationEndpoint(object):
def warn(self, ctxt, publisher_id, event_type, payload, metadata):
print "warn"
pprint.pprint(payload)
sys.stdout.flush()
def error(self, ctxt, publisher_id, event_type, payload, metadata):
print "error"
pprint.pprint(payload)
sys.stdout.flush()
def audit(self, ctxt, publisher_id, event_type, payload, metadata):
print "audit"
pprint.pprint(payload)
sys.stdout.flush()
def debug(self, ctxt, publisher_id, event_type, payload, metadata):
print "debug"
pprint.pprint(payload)
sys.stdout.flush()
def info(self, ctxt, publisher_id, event_type, payload, metadata):
print "info"
pprint.pprint(payload)
sys.stdout.flush()
def critical(self, ctxt, publisher_id, event_type, payload, metadata):
print "critical"
pprint.pprint(payload)
sys.stdout.flush()
def sample(self, ctxt, publisher_id, event_type, payload, metadata):
print "sample"
pprint.pprint(payload)
sys.stdout.flush()
TRANSPORT_ALIASES = {
'designate.openstack.common.rpc.impl_kombu': 'rabbit',
'designate.openstack.common.rpc.impl_qpid': 'qpid',
'designate.openstack.common.rpc.impl_zmq': 'zmq',
'designate.rpc.impl_kombu': 'rabbit',
'designate.rpc.impl_qpid': 'qpid',
'designate.rpc.impl_zmq': 'zmq',
}
utils.read_config('designate', sys.argv)
logging.setup('designate')
transport = messaging.get_transport(cfg.CONF, aliases=TRANSPORT_ALIASES)
targets = [
messaging.Target(exchange='nova', topic='notifications'),
messaging.Target(exchange='neutron', topic='notifications')
]
endpoints = [
NotificationEndpoint()
]
server = messaging.get_notification_listener(transport, targets, endpoints)
server.start()
server.wait()