#!/usr/bin/python from lofar.qpidinfrastructure.QPIDDB import qpidinfra from lofar.common import dbcredentials def qpidconfig_add_queue(settings): print ("qpid-config -b %s add queue %s --durable" %(settings['hostname'],settings['queuename'])) def qpidconfig_add_topic(settings): print ("qpid-config -b %s add exchange topic %s --durable" %(settings['hostname'],settings['exchangename'])) def qpidroute_add(settings): print ("qpid-route -d route del %s %s %s \'%s\' " %(settings['tohost'],settings['fromhost'],settings['exchangename'],settings['routingkey'])) print ("qpid-route -d route add %s %s %s \'%s\' " %(settings['tohost'],settings['fromhost'],settings['exchangename'],settings['routingkey'])) def qpidQroute_add(settings): print ("qpid-route -d queue del %s %s '%s' '%s'" %(settings['tohost'],settings['fromhost'],settings['exchangename'],settings['queuename'])) print ("qpid-route -d queue add %s %s '%s' '%s'" %(settings['tohost'],settings['fromhost'],settings['exchangename'],settings['queuename'])) dbcreds = dbcredentials.DBCredentials().get("qpidinfra") QPIDinfra = qpidinfra(dbcreds) QPIDinfra.perqueue(qpidconfig_add_queue) QPIDinfra.perexchange(qpidconfig_add_topic) QPIDinfra.perfederationexchange(qpidroute_add) QPIDinfra.perfederationqueue(qpidQroute_add)
#!/usr/bin/python import sys from lofar.qpidinfrastructure.QPIDDB import qpidinfra from lofar.common import dbcredentials dbcreds = dbcredentials.DBCredentials().get("qpidinfra") todb=qpidinfra(dbcreds) tosearch = sys.stdin.readlines() numlines = len(tosearch) #fqdn=['lhn001.cep2.lofar', # 'ccu001.control.lofar', # 'sas001.control.lofar', # 'cbm001.control.lofar', # 'cbm001.control.lofar', # 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', def to_hostname(s): leafname=s.split(':')[0].split('.')[0].lower() fqdn="%s.control.lofar" %(leafname) #print leafname[0:5] if (leafname[0:5]=='locus'): fqdn="%s.cep2.lofar" %(leafname) if (leafname=='lhn001'): fqdn="%s.cep2.lofar" %(leafname) return fqdn
#!/usr/bin/python import sys from lofar.qpidinfrastructure.QPIDDB import qpidinfra from lofar.common import dbcredentials dbcreds = dbcredentials.DBCredentials().get("qpidinfra") todb = qpidinfra(dbcreds) tosearch = sys.stdin.readlines() numlines = len(tosearch) #fqdn=['lhn001.cep2.lofar', # 'ccu001.control.lofar', # 'sas001.control.lofar', # 'cbm001.control.lofar', # 'cbm001.control.lofar', # 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', 'cbm001.control.lofar', def to_hostname(s): leafname = s.split(':')[0].split('.')[0].lower() fqdn = "%s.control.lofar" % (leafname) #print leafname[0:5] if (leafname[0:5] == 'locus'): fqdn = "%s.cep2.lofar" % (leafname) if (leafname == 'lhn001'): fqdn = "%s.cep2.lofar" % (leafname) return fqdn
dest='bind', action="store_true", default=False, help= 'bind given exchange (with -e) to given queue (with -q) with given routing key (with -k)' ) parser.add_option_group(dbcredentials.options_group(parser, "qpidinfra")) (options, args) = parser.parse_args() if (len(sys.argv) < 2): parser.print_help() sys.exit(0) dbcreds = dbcredentials.parse_options(options) QPIDinfra = qpidinfra(dbcreds) if (options.broker == None): parser.print_help() sys.exit(1) else: QPIDinfra.addhost(options.broker) if (options.queue): QPIDinfra.addqueue(options.queue) QPIDinfra.bindqueuetohost(options.queue, options.broker) if (options.exchange): QPIDinfra.addexchange(options.exchange) QPIDinfra.bindexchangetohost(options.exchange, options.broker)