diff --git a/.gitattributes b/.gitattributes index c84216e9f156101033a68f3fc735b4d18fb961fc..71438b15763f7a84cf42db5a65e70308072ca911 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4639,25 +4639,7 @@ SAS/OTDB_Services/test/t_TreeStatusEvents.sh -text svneol=unset#application/x-sh SAS/OTDB_Services/treeService -text SAS/OTDB_Services/treeStatusEvents -text SAS/QPIDInfrastructure/CMakeLists.txt -text -SAS/QPIDInfrastructure/README -text -SAS/QPIDInfrastructure/bin/CMakeLists.txt -text -SAS/QPIDInfrastructure/bin/addtoQPIDDB.py -text -SAS/QPIDInfrastructure/bin/amqp-infra-setup.sh -text -SAS/QPIDInfrastructure/bin/compareQPIDwithDB.py -text -SAS/QPIDInfrastructure/bin/configQPIDfromDB.py -text -SAS/QPIDInfrastructure/bin/gatherfrombrokers.sh -text -SAS/QPIDInfrastructure/bin/populateDB.sh -text -SAS/QPIDInfrastructure/bin/qpidinfra_dump.sql -text -SAS/QPIDInfrastructure/bin/route_to_struct.py -text -SAS/QPIDInfrastructure/doc/QPID_infrastracture.md -text -SAS/QPIDInfrastructure/doc/package.dox -text -SAS/QPIDInfrastructure/lib/CMakeLists.txt -text -SAS/QPIDInfrastructure/lib/QPIDDB.py -text -SAS/QPIDInfrastructure/lib/__init__.py -text -SAS/QPIDInfrastructure/lib/psqlQPIDDB.py -text -SAS/QPIDInfrastructure/sql/CMakeLists.txt -text -SAS/QPIDInfrastructure/sql/qpidinfradb.sql -text -SAS/QPIDInfrastructure/test/test_qpid_database.sh -text +SAS/QPIDInfrastructure/amqp-infra-setup.sh -text SAS/ResourceAssignment/CMakeLists.txt -text SAS/ResourceAssignment/Common/CMakeLists.txt -text SAS/ResourceAssignment/Common/doc/package.dox -text diff --git a/SAS/QPIDInfrastructure/CMakeLists.txt b/SAS/QPIDInfrastructure/CMakeLists.txt index f65d3a3cc3d599f55caef1a29c7d7db801a7d7ab..9183bf08d0c02cfb91dfa6948fe5da9f6cc6e027 100644 --- a/SAS/QPIDInfrastructure/CMakeLists.txt +++ b/SAS/QPIDInfrastructure/CMakeLists.txt @@ -1,10 +1,5 @@ # $Id: CMakeLists.txt 30355 2014-11-04 13:46:05Z loose $ -lofar_package(QPIDInfrastructure 0.1 DEPENDS PyCommon) +lofar_package(QPIDInfrastructure 0.2) -include(PythonInstall) - -add_subdirectory(lib) -add_subdirectory(bin) -add_subdirectory(sql) -# add_subdirectory(test) +lofar_add_bin_scripts(ampq-infra-setup.sh) diff --git a/SAS/QPIDInfrastructure/README b/SAS/QPIDInfrastructure/README deleted file mode 100644 index 3c3607333cb4d171c636a637a2ea2c485cdc1e82..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/README +++ /dev/null @@ -1,23 +0,0 @@ -QPIDinfra Database - -bin: - addtoQPIDDB.py Tool to add information in the database - configQPIDfromDB.py Tool to create a buildscript from the database - populateDB.sh Script to insert LOFAR config into database - compareQPIDwithDB.py WIP: Tool to read database and compare with QPID brokers - gatherfrombrokers.sh WIP: Tool to retrieve info from brokers and insert in database - route_to_struct.py - -lib: - psqlQPIDDB.py Low level interface to QPIDInfra Database - QPIDDB.py High level interface to QPIDInfra Database - -sql: - qpidinfradb.sql SQL script to setup the database - -test: - test_qpid_database.sh script to verify a newly created Database. - - - - diff --git a/SAS/QPIDInfrastructure/amqp-infra-setup.sh b/SAS/QPIDInfrastructure/amqp-infra-setup.sh new file mode 100644 index 0000000000000000000000000000000000000000..1016e5ffe13e9a1b3efd0641df8379c288f6a07f --- /dev/null +++ b/SAS/QPIDInfrastructure/amqp-infra-setup.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +# ----------------------------------------- +# Configuration +# ----------------------------------------- + +# Whether to modify production (true) or test (false) +if [ "$LOFARENV" == "PRODUCTION" ]; then + PROD=true + PREFIX= +elif [ "$LOFARENV" == "TEST" ]; then + PROD=false + PREFIX="test." +else + PROD=false + PREFIX="devel." +fi + + +# Host names to use +if $PROD; then + echo "----------------------------------------------" + echo "Populating database for PRODUCTION environment" + echo "" + echo "Press ENTER to continue, or ^C to abort" + echo "----------------------------------------------" + read + + CCU=ccu001.control.lofar + MCU=mcu001.control.lofar + SCU=scu001.control.lofar + LEXAR=lexar003.offline.lofar + + MOM_SYSTEM=lcs023.control.lofar + MOM_INGEST=lcs029.control.lofar +else + CCU=ccu199.control.lofar + MCU=mcu199.control.lofar + SCU=scu199.control.lofar + LEXAR=lexar004.offline.lofar + + MOM_SYSTEM=lcs028.control.lofar + MOM_INGEST=lcs028.control.lofar +fi + +# MessageBus +qpid-config -b $CCU add queue mac.task.feedback.state --durable +qpid-config -b $MCU add queue otdb.task.feedback.dataproducts --durable +qpid-config -b $MCU add queue otdb.task.feedback.processing --durable +qpid-config -b $MCU add queue lofar.task.specification.system --durable +qpid-config -b $CCU add queue lofar.task.specification.system --durable +qpid-config -b $CCU add queue mom.task.specification.system --durable +qpid-config -b $MOM_SYSTEM add queue mom.task.specification.system --durable +qpid-config -b $CCU add queue mom.command --durable +qpid-config -b $MOM_SYSTEM add queue mom.command --durable +qpid-config -b $CCU add queue mom.importxml --durable +qpid-config -b $MOM_SYSTEM add queue mom.importxml --durable +qpid-config -b $MOM_SYSTEM add queue mom-otdb-adapter.importxml --durable +qpid-config -b $CCU add queue mom-otdb-adapter.importxml --durable +qpid-config -b $MOM_SYSTEM add exchange topic lofar.mom.bus --durable +qpid-config -b $MOM_INGEST add exchange topic lofar.mom.bus --durable +qpid-config -b $MOM_SYSTEM add exchange topic lofar.mom.command --durable +qpid-config -b $MOM_SYSTEM add exchange topic lofar.mom.notification --durable +qpid-config -b $SCU add exchange topic lofar.mom.bus --durable +qpid-config -b $SCU add exchange topic lofar.mom.command --durable +qpid-config -b $SCU add exchange topic lofar.mom.notification --durable +qpid-route -d route del $MOM_SYSTEM $SCU lofar.mom.bus '#' +qpid-route -d dynamic del $MOM_SYSTEM $SCU lofar.mom.bus +qpid-route -d route add $MOM_SYSTEM $SCU lofar.mom.bus '#' +qpid-route -d route del $MOM_SYSTEM $SCU lofar.mom.command '#' +qpid-route -d dynamic del $MOM_SYSTEM $SCU lofar.mom.command +qpid-route -d route add $MOM_SYSTEM $SCU lofar.mom.command '#' +qpid-route -d route del $SCU $MOM_SYSTEM lofar.mom.notification '#' +qpid-route -d dynamic del $SCU $MOM_SYSTEM lofar.mom.notification +qpid-route -d route add $SCU $MOM_SYSTEM lofar.mom.notification '#' +qpid-route -d route del $SCU $LEXAR lofar.lta.ingest.notification '#' +qpid-route -d dynamic del $SCU $LEXAR lofar.lta.ingest.notification +qpid-route -d route add $SCU $LEXAR lofar.lta.ingest.notification '#' +qpid-route -d queue del $CCU $MCU '' 'lofar.task.specification.system' +qpid-route -d queue add $CCU $MCU '' 'lofar.task.specification.system' +qpid-route -d queue del $MOM_SYSTEM $CCU '' 'mom.task.specification.system' +qpid-route -d queue add $MOM_SYSTEM $CCU '' 'mom.task.specification.system' +qpid-route -d queue del $MOM_SYSTEM $CCU '' 'mom.command' +qpid-route -d queue add $MOM_SYSTEM $CCU '' 'mom.command' +qpid-route -d queue del $MOM_SYSTEM $CCU '' 'mom.importxml' +qpid-route -d queue add $MOM_SYSTEM $CCU '' 'mom.importxml' +qpid-route -d queue del $CCU $MOM_SYSTEM '' 'mom-otdb-adapter.importxml' +qpid-route -d queue add $CCU $MOM_SYSTEM '' 'mom-otdb-adapter.importxml' + +# Messaging (to JAVA) +qpid-config -b $SCU add queue mom.importxml --durable +qpid-route -d queue del $MOM_SYSTEM $SCU '' 'mom.importxml' +qpid-route -d queue add $MOM_SYSTEM $SCU '' 'mom.importxml' + +# Messaging + +# Strategy: +# - 1 exchange ("lofar", possibly prefixed with "test." or "devel.") +# - 1 broker (scu001/scu099/localhost) +# - each notification listener creates its own temp/permanent queue on the relevant exchange ("lofar.notification.for.XXXX") +# - each RPC server creates its own temp/permanent queue on the relevant exchange ("lofar.command.XXXX") +# - both setup bindings to forward the right messages to their queue + +ssh $SCU rabbitmqadmin declare exchange name=lofar.command type=topic diff --git a/SAS/QPIDInfrastructure/bin/CMakeLists.txt b/SAS/QPIDInfrastructure/bin/CMakeLists.txt deleted file mode 100644 index cf062009e8be156d0b5dfe65dc7269b7cc3025bb..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# $Id: CMakeLists.txt 32341 2015-08-28 11:59:26Z schaap $ - -lofar_add_bin_scripts(addtoQPIDDB.py - populateDB.sh - compareQPIDwithDB.py - configQPIDfromDB.py - gatherfrombrokers.sh - route_to_struct.py) - -install_files(/share/qpidinfrastructure/sql qpidinfra_dump.sql) diff --git a/SAS/QPIDInfrastructure/bin/addtoQPIDDB.py b/SAS/QPIDInfrastructure/bin/addtoQPIDDB.py deleted file mode 100755 index 0e38b0d9d9219e9f19bc4839f98cc9090666cf34..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/addtoQPIDDB.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python3 - -import sys -from lofar.qpidinfrastructure.QPIDDB import qpidinfra -from lofar.common import dbcredentials - -from optparse import OptionParser - -if __name__ == '__main__': - parser = OptionParser('%prog [options]', - description='Add items to the QPIDinfra database from the commandline') - parser.add_option('-b', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker (required)') - parser.add_option('-f', '--federation', dest='federation' , type='string', default=None, help='Address of the federated broker') - parser.add_option('-q', '--queue', dest='queue', type='string', default=None, help='Name of the queue on the broker') - parser.add_option('-e', '--exchange', dest='exchange', type='string', default=None, help='Name of the exchange on the broker') - parser.add_option('-k', '--routingkey', dest='routingkey', type='string', default='#', help='(Federation) routing key') - parser.add_option('-d', '--dynamic', dest='dynamic', action="store_true", default=False, help='Create a dynamic route') - parser.add_option('--bind', 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) - - if (options.bind): - if options.exchange == None or options.queue == None or options.broker == None: - print() - print('ERROR: When binding an exchange to a queue, you need to specify options: -e, -q, -k, -b') - print() - parser.print_help() - sys.exit(1) - - #queue and exchange were already added to db above. - #here, just add the qpid-bind link - QPIDinfra.bindexchangetoqueueonhost(options.exchange,options.queue,options.broker,options.routingkey) - - if (options.federation): - QPIDinfra.addhost(options.federation) - if (options.queue): - QPIDinfra.addqueue(options.queue) # should be superfluous - exchange='' - if (options.exchange): - QPIDinfra.addexchange(options.exchange) - exchange=options.exchange - - QPIDinfra.bindqueuetohost(options.queue,options.federation) - QPIDinfra.setqueueroute(options.queue,options.broker,options.federation,exchange) - else: - if (options.exchange): - QPIDinfra.addexchange(options.exchange) # should be superfluous - QPIDinfra.bindexchangetohost(options.exchange,options.federation) - QPIDinfra.setexchangeroute(options.exchange,options.routingkey,options.broker,options.federation,dynamic=options.dynamic) - else: - raise Exception("federation can only be setup with a queue or an exchange") diff --git a/SAS/QPIDInfrastructure/bin/amqp-infra-setup.sh b/SAS/QPIDInfrastructure/bin/amqp-infra-setup.sh deleted file mode 100644 index c63178e19686289e937dc93d5e7b8caa9f4b46d6..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/amqp-infra-setup.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash - -# MessageBus -qpid-config -b ccu001.control.lofar add queue mac.task.feedback.state --durable -qpid-config -b mcu001.control.lofar add queue otdb.task.feedback.dataproducts --durable -qpid-config -b mcu001.control.lofar add queue otdb.task.feedback.processing --durable -qpid-config -b mcu001.control.lofar add queue lofar.task.specification.system --durable -qpid-config -b ccu001.control.lofar add queue lofar.task.specification.system --durable -qpid-config -b ccu001.control.lofar add queue mom.task.specification.system --durable -qpid-config -b lcs023.control.lofar add queue mom.task.specification.system --durable -qpid-config -b ccu001.control.lofar add queue mom.command --durable -qpid-config -b lcs023.control.lofar add queue mom.command --durable -qpid-config -b ccu001.control.lofar add queue mom.importxml --durable -qpid-config -b lcs023.control.lofar add queue mom.importxml --durable -qpid-config -b lcs023.control.lofar add queue mom-otdb-adapter.importxml --durable -qpid-config -b ccu001.control.lofar add queue mom-otdb-adapter.importxml --durable -qpid-config -b lcs023.control.lofar add exchange topic lofar.mom.bus --durable -qpid-config -b lcs029.control.lofar add exchange topic lofar.mom.bus --durable -qpid-config -b lcs023.control.lofar add exchange topic lofar.mom.command --durable -qpid-config -b lcs023.control.lofar add exchange topic lofar.mom.notification --durable -qpid-config -b scu001.control.lofar add exchange topic lofar.mom.bus --durable -qpid-config -b scu001.control.lofar add exchange topic lofar.mom.command --durable -qpid-config -b scu001.control.lofar add exchange topic lofar.mom.notification --durable -qpid-route -d route del lcs023.control.lofar scu001.control.lofar lofar.mom.bus '#' -qpid-route -d dynamic del lcs023.control.lofar scu001.control.lofar lofar.mom.bus -qpid-route -d route add lcs023.control.lofar scu001.control.lofar lofar.mom.bus '#' -qpid-route -d route del lcs023.control.lofar scu001.control.lofar lofar.mom.command '#' -qpid-route -d dynamic del lcs023.control.lofar scu001.control.lofar lofar.mom.command -qpid-route -d route add lcs023.control.lofar scu001.control.lofar lofar.mom.command '#' -qpid-route -d route del scu001.control.lofar lcs023.control.lofar lofar.mom.notification '#' -qpid-route -d dynamic del scu001.control.lofar lcs023.control.lofar lofar.mom.notification -qpid-route -d route add scu001.control.lofar lcs023.control.lofar lofar.mom.notification '#' -qpid-route -d route del scu001.control.lofar lexar003.offline.lofar lofar.lta.ingest.notification '#' -qpid-route -d dynamic del scu001.control.lofar lexar003.offline.lofar lofar.lta.ingest.notification -qpid-route -d route add scu001.control.lofar lexar003.offline.lofar lofar.lta.ingest.notification '#' -qpid-route -d queue del ccu001.control.lofar mcu001.control.lofar '' 'lofar.task.specification.system' -qpid-route -d queue add ccu001.control.lofar mcu001.control.lofar '' 'lofar.task.specification.system' -qpid-route -d queue del lcs023.control.lofar ccu001.control.lofar '' 'mom.task.specification.system' -qpid-route -d queue add lcs023.control.lofar ccu001.control.lofar '' 'mom.task.specification.system' -qpid-route -d queue del lcs023.control.lofar ccu001.control.lofar '' 'mom.command' -qpid-route -d queue add lcs023.control.lofar ccu001.control.lofar '' 'mom.command' -qpid-route -d queue del lcs023.control.lofar ccu001.control.lofar '' 'mom.importxml' -qpid-route -d queue add lcs023.control.lofar ccu001.control.lofar '' 'mom.importxml' -qpid-route -d queue del ccu001.control.lofar lcs023.control.lofar '' 'mom-otdb-adapter.importxml' -qpid-route -d queue add ccu001.control.lofar lcs023.control.lofar '' 'mom-otdb-adapter.importxml' - -# Messaging (to JAVA) -qpid-config -b scu001.control.lofar add queue mom.importxml --durable -qpid-route -d queue del lcs023.control.lofar scu001.control.lofar '' 'mom.importxml' -qpid-route -d queue add lcs023.control.lofar scu001.control.lofar '' 'mom.importxml' - -# Messaging - -# Strategy: -# - 1 exchange ("lofar", possibly prefixed with "test." or "devel.") -# - 1 broker (scu001/scu099/localhost) -# - each notification listener creates its own temp/permanent queue on the relevant exchange ("lofar.notification.for.XXXX") -# - each RPC server creates its own temp/permanent queue on the relevant exchange ("lofar.command.XXXX") -# - both setup bindings to forward the right messages to their queue - -rabbitmqadmin declare exchange name=lofar.command type=topic - -if false; then -rabbitmqadmin declare exchange name=lofar.notification type=topic - -# was: lofar.ra.command -rabbitmqadmin declare queue name=lofar.command.ra -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.ra routing_key='RAService.#' -rabbitmqadmin declare queue name=lofar.command.resourceestimator -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.resourceestimator routing_key='ResourceEstimation.#' -rabbitmqadmin declare queue name=lofar.command.radb -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.radb routing_key='RADBService.#' -rabbitmqadmin declare queue name=lofar.command.momquery -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.momquery routing_key='momqueryservice.#' - -# was: lofar.lta.command -rabbitmqadmin declare queue name=lofar.command.lta -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.lta routing_key='LTAIngest.#' - -# was: lofar.otdb.command -rabbitmqadmin declare queue name=lofar.command.otdb -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.otdb routing_key='OTDBService.#' - -# was: lofar.otdb.notification.for.qa_service -rabbitmqadmin declare queue name=lofar.notification.otdb.qa_service -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.otdb.qa_service routing_key='TaskStatus.#' -rabbitmqadmin declare queue name=lofar.notification.otdb.pipelinecontrol -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.otdb.pipelinecontrol routing_key='TaskStatus.#' -rabbitmqadmin declare queue name=lofar.notification.otdb.storagequery -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.otdb.storagequery routing_key='TaskStatus.#' -rabbitmqadmin declare queue name=lofar.notification.otdb.rae -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.otdb.rae routing_key='TaskStatus.#' -rabbitmqadmin declare queue name=lofar.notification.otdb.triggercancellation -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.otdb.triggercancellation routing_key='TaskStatus.#' - - -# was: lofar.dm.command -rabbitmqadmin declare queue name=lofar.command.dm -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.dm routing_key='DM.#' -rabbitmqadmin declare queue name=lofar.command.storagequery -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.storagequery routing_key='StorageQueryService.#' -rabbitmqadmin declare queue name=lofar.command.cleanup -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.cleanup routing_key='CleanupService.#' - -rabbitmqadmin declare queue name=lofar.notification.dm.storagequery -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.dm.storagequery routing_key='DM.#' -rabbitmqadmin declare queue name=lofar.notification.dm.rae -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.dm.rae routing_key='DM.#' - -# was: lofar.spec.command -rabbitmqadmin declare queue name=lofar.command.specificationvalidationvalidation -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.specificationvalidation routing_key='specificationvalidationservice.#' -rabbitmqadmin declare queue name=lofar.command.specificationvalidation -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.specification routing_key='specificationservice.#' -rabbitmqadmin declare queue name=lofar.command.specificationvalidationtranslation -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.specficationtranslation routing_key='specificationtranslationservice.#' - -# was: lofar.trigger.command -rabbitmqadmin declare queue name=lofar.command.trigger -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.trigger routing_key='triggerservice.#' - -# was: lofar.mac.command -rabbitmqadmin declare queue name=lofar.command.observationcontrol -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.observationcontrol routing_key='ObservationControl2.#' - -# was: lofar.mac.services.taskmanagement -rabbitmqadmin declare queue name=lofar.command.taskmanagement -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.taskmanagement routing_key='TaskManagement.#' - -# was: lofar.tbb.command -rabbitmqadmin declare queue name=lofar.command.tbb -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.tbb routing_key='TBBService.#' - -# was lofar.lta.ingest.command -rabbitmqadmin declare queue name=lofar.command.lta.ingest -rabbitmqadmin declare binding source=lofar.command destination=lofar.command.lta.ingest routing_key='IngestService.#' - -# dedicated queue names for specific queues -rabbitmqadmin declare queue name=lofar.lta.ingest.jobs -rabbitmqadmin declare queue name=lofar.lta.ingest.jobs.for_transfer - -# was lofar.lta.ingest.notification.* -rabbitmqadmin declare queue name=lofar.notification.lta.momingestadapter -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.lta.momingestadapter routing_key='LTAIngest.#' -rabbitmqadmin declare queue name=lofar.notification.lta.jobmanager -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.lta.jobmanager routing_key='LTAIngest.#' -rabbitmqadmin declare queue name=lofar.notification.lta.autocleanupservice -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.lta.autocleanupservice routing_key='LTAIngest.#' -rabbitmqadmin declare queue name=lofar.notification.lta.ltastorageoverview -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.lta.ltastorageoverview routing_key='LTAIngest.#' -rabbitmqadmin declare queue name=lofar.notification.lta.rae -rabbitmqadmin declare binding source=lofar.notification destination=lofar.notification.lta.rae routing_key='LTAIngest.#' - -fi diff --git a/SAS/QPIDInfrastructure/bin/compareQPIDwithDB.py b/SAS/QPIDInfrastructure/bin/compareQPIDwithDB.py deleted file mode 100755 index 78f74cd99ce5a1589884f1d7c2ca517ecd227125..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/compareQPIDwithDB.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python3 - -from lofar.qpidinfrastructure.QPIDDB import qpidinfra -from lofar.common import dbcredentials - -S_INDB = 1 -S_ONQPID = 2 - -class host: - def __init__(self): - self.queues={} - self.exchanges={} - self.queueroutes={} - self.exchangeroutes={} - - def __repr__(self): - return "<host: queues: '%s' exchanges '%s' queueroutes '%s' exchangeroutes '%s' >" \ - %(self.queues.__repr__(), self.exchanges.__repr__(), self.queueroutes.__repr__(),\ - self.exchangeroutes.__repr__() ) - - def __str__(self): - return "HOST: queues=%s exchanges=%s queueroutes=%s exchangeroutes=%s\n" \ - %(self.queues, self.exchanges, self.queueroutes, self.exchangeroutes) - - def tag(self,item,index,state): - item[index]=item.get(index,0) | state - - def untag(self,item,index,state): - self.queue[index]=item.get(index,0) & ~state - - def tagqueue(self,queue,state): - self.tag(self.queues,queue,state) - - def untagqueue(self,queue,state): - self.untag(self.queues,queue,state) - - def tagexchange(self,exchange,state): - self.tag(self.exchanges,exchange,state) - - def untagexchange(self,exchange,state): - self.untag(self.exchanges,exchange,state) - - def tagqueueroute(self,tohost,queue,state): - index=tohost+':'+queue - self.tag(self.queueroutes,index,state) - - def untagqueueroute(self,tohost,queue,state): - index=tohost+':'+queue - self.untag(self.queueroutes,index,state) - - def tagexchangeroute(self,tohost,exchange,key,state): - index=tohost+':'+exchange+':'+key - self.tag(self.exchangeroutes,index,state) - - def untagexchangeroute(self,tohost,exchange,key,state): - index=tohost+':'+exchange+':'+key - self.untag(self.exchangeroutes,index,state) - -Hosts={} - -DEFINED=1 -SEEN=2 - - -def Host(hostname): - if hostname not in Hosts: - Hosts[hostname]=host() - return Hosts[hostname] - - - -def qpidconfig_add_queue(settings): - Host(settings['hostname']).tagqueue(settings['queuename'],DEFINED) - -def qpidconfig_add_topic(settings): - Host(settings['hostname']).tagexchange(settings['exchangename'],DEFINED) - -def qpidroute_add(settings): - Host(settings['fromhost']).tagexchangeroute(settings['tohost'],settings['exchangename'],settings['routingkey'],DEFINED) - -def qpidQroute_add(settings): - Host(settings['fromhost']).tagqueueroute(settings['tohost'],settings['queuename'],DEFINED) - - -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) - -print(Hosts) -print(" - ") -print("Done.") -print(" ------------------------------------------") -print("QPIDinfra config fetched from DB") -print("Next step: retrieve config from brokers. TBD.") -print(" ------------------------------------------") diff --git a/SAS/QPIDInfrastructure/bin/configQPIDfromDB.py b/SAS/QPIDInfrastructure/bin/configQPIDfromDB.py deleted file mode 100755 index e140f0d1c55d66988be704609144f324d815b0ac..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/configQPIDfromDB.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python3 - -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): - cmd = "dynamic" if settings['dynamic'] else "route" - - print(("qpid-route -d route del %s %s %s \'%s\' " %(settings['tohost'],settings['fromhost'],settings['exchangename'],settings['routingkey']))) - print(("qpid-route -d dynamic del %s %s %s" %(settings['tohost'],settings['fromhost'],settings['exchangename']))) - - if settings['dynamic']: - print(("qpid-route -d dynamic add %s %s %s" %(settings['tohost'],settings['fromhost'],settings['exchangename']))) - else: - 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']))) - -def qpidconfig_add_binding(settings): - print(("qpid-config --durable -b %s bind %s %s %s" %(settings['hostname'],settings['exchangename'],settings['queuename'],settings['routingkey']))) - -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) -QPIDinfra.perqpidbinding(qpidconfig_add_binding) - diff --git a/SAS/QPIDInfrastructure/bin/gatherfrombrokers.sh b/SAS/QPIDInfrastructure/bin/gatherfrombrokers.sh deleted file mode 100755 index a40c31c46fba7ddfce84dea889c768f5c5afee10..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/gatherfrombrokers.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - - -# insert mcu005 exchanges - -#for i in $(qpid-stat -e -b mcu005.control.lofar |grep lofar |awk ' { print $1 } ') -#do -# echo ./AddHostToQPIDDB.py -b mcu005.control.lofar -e $i -# ./AddHostToQPIDDB.py -b mcu005.control.lofar -e $i -#done - -for host in lhn001.cep2.lofar ccu001.control.lofar mcu001.control.lofar lcs023.control.lofar sas001.control.lofar locus{001..094}.cep2.lofar -do - for i in $(qpid-stat -q -b $host |grep -v '_' |grep "task\|mom" |awk ' { print $1 } ') - do - echo ./addtoQPIDDB.py -b $host -q $i - ./addtoQPIDDB.py -b $host -q $i - done -done diff --git a/SAS/QPIDInfrastructure/bin/populateDB.sh b/SAS/QPIDInfrastructure/bin/populateDB.sh deleted file mode 100755 index 057a67cea2f2934a014ada932a15e0b96137ecbe..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/populateDB.sh +++ /dev/null @@ -1,260 +0,0 @@ -#!/bin/bash -# -# To DB first, wipe, use -# -# psql -U postgres -h sasdb --dbname=qpidinfra --file=$LOFARROOT/share/qpidinfrastructure/sql/qpidinfradb.sql -# - - -# ----------------------------------------- -# Configuration -# ----------------------------------------- - -# Whether to modify production (true) or test (false) -if [ "$LOFARENV" == "PRODUCTION" ]; then - PROD=true - PREFIX= -elif [ "$LOFARENV" == "TEST" ]; then - PROD=false - PREFIX="test." -else - PROD=false - PREFIX="devel." -fi - - -# Host names to use -if $PROD; then - echo "----------------------------------------------" - echo "Populating database for PRODUCTION environment" - echo "" - echo "Press ENTER to continue, or ^C to abort" - echo "----------------------------------------------" - read - - CCU=ccu001.control.lofar - MCU=mcu001.control.lofar - SCU=scu001.control.lofar - LEXAR=lexar003.offline.lofar - - MOM_SYSTEM=lcs023.control.lofar - MOM_INGEST=lcs029.control.lofar - - COBALT="`seq -f cbm%03.0f.control.lofar 1 8`" - - CEP4="`seq -f cpu%02.0f.cep4.control.lofar 1 50`" - CEP4HEAD="head01.cep4.control.lofar head02.cep4.control.lofar" - - DRAGNET="`seq -f drg%02.0f.control.lofar 1 23` dragproc.control.lofar" - DRAGNETHEAD="dragnet.control.lofar" -else - CCU=ccu199.control.lofar - MCU=mcu199.control.lofar - SCU=scu199.control.lofar - LEXAR=lexar004.offline.lofar - - MOM_SYSTEM=lcs028.control.lofar - MOM_INGEST=lcs028.control.lofar - - COBALT="cbm009.control.lofar" - - CEP4="`seq -f cpu%02.0f.cep4.control.lofar 1 50`" - CEP4HEAD="head01.cep4.control.lofar head02.cep4.control.lofar" - - DRAGNET="`seq -f drg%02.0f.control.lofar 21 23` dragproc.control.lofar" - DRAGNETHEAD="dragproc.control.lofar" -fi - -# ----------------------------------------- -# Cobalt GPUProc -> MessageRouter -# ----------------------------------------- - -for fnode in $COBALT -do - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.dataproducts --federation $CCU - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.processing --federation $CCU - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.state --federation $CCU -done - - -# ----------------------------------------- -# Cobalt OutputProc & Pipelines -> MessageRouter -# ----------------------------------------- - -for tnode in $CEP4HEAD -do - # CEP4 -> CEP4HEAD - for fnode in $CEP4 - do - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.dataproducts --federation $tnode - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.processing --federation $tnode - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.state --federation $tnode - done - - # CEP4HEAD -> CCU - addtoQPIDDB.py --broker $tnode --queue ${PREFIX}lofar.task.feedback.dataproducts --federation $CCU - addtoQPIDDB.py --broker $tnode --queue ${PREFIX}lofar.task.feedback.processing --federation $CCU - addtoQPIDDB.py --broker $tnode --queue ${PREFIX}lofar.task.feedback.state --federation $CCU -done - -# ----------------------------------------- -# DRAGNET GPUProc & OutputProc -> MessageRouter -# ----------------------------------------- - -for tnode in $DRAGNETHEAD -do - # DRAGNET -> DRAGNETHEAD - for fnode in $DRAGNET - do - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.dataproducts --federation $tnode - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.processing --federation $tnode - addtoQPIDDB.py --broker $fnode --queue ${PREFIX}lofar.task.feedback.state --federation $tnode - done - - # DRAGNETHEAD -> CCU - addtoQPIDDB.py --broker $tnode --queue ${PREFIX}lofar.task.feedback.dataproducts --federation $CCU - addtoQPIDDB.py --broker $tnode --queue ${PREFIX}lofar.task.feedback.processing --federation $CCU - addtoQPIDDB.py --broker $tnode --queue ${PREFIX}lofar.task.feedback.state --federation $CCU -done - -# ----------------------------------------- -# Cobalt DataTapping (piggy-backing) -# ----------------------------------------- - -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.datatap.command # COBALT piggy-backing request-reply -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.datatap.notification # notification who has been granted COBALT piggy-backing - -# ----------------------------------------- -# MessageRouter -> MoM -# ----------------------------------------- - -addtoQPIDDB.py --broker $CCU --queue ${PREFIX}mom.task.feedback.dataproducts --federation $MOM_SYSTEM -addtoQPIDDB.py --broker $CCU --queue ${PREFIX}mom.task.feedback.processing --federation $MOM_SYSTEM -addtoQPIDDB.py --broker $CCU --queue ${PREFIX}mom.task.feedback.state --federation $MOM_SYSTEM - -# ----------------------------------------- -# MessageRouter -> OTDB -# ----------------------------------------- - -addtoQPIDDB.py --broker $CCU --queue ${PREFIX}otdb.task.feedback.dataproducts --federation $MCU -addtoQPIDDB.py --broker $CCU --queue ${PREFIX}otdb.task.feedback.processing --federation $MCU - -# ----------------------------------------- -# MessageRouter -> MAC -# ----------------------------------------- - -addtoQPIDDB.py --broker $CCU --exchange ${PREFIX}mac.task.feedback.state - -# ----------------------------------------- -# MACScheduler -> MessageRouter -> MoM -# ----------------------------------------- - -addtoQPIDDB.py --broker $MCU --queue ${PREFIX}lofar.task.specification.system --federation $CCU -addtoQPIDDB.py --broker $CCU --queue ${PREFIX}mom.task.specification.system --federation $MOM_SYSTEM - -# ----------------------------------------- -# MoM <-> MoM-OTDB-Adapter -# ----------------------------------------- - -addtoQPIDDB.py --broker $CCU --queue mom.command --federation $MOM_SYSTEM -addtoQPIDDB.py --broker $CCU --queue mom.importxml --federation $MOM_SYSTEM -addtoQPIDDB.py --broker $MOM_SYSTEM --queue mom-otdb-adapter.importxml --federation $CCU - -# ----------------------------------------- -# MoM Services -# ----------------------------------------- -addtoQPIDDB.py --broker $MOM_SYSTEM --exchange ${PREFIX}lofar.mom.bus -addtoQPIDDB.py --broker $MOM_INGEST --exchange ${PREFIX}lofar.mom.bus -addtoQPIDDB.py --broker $MOM_SYSTEM --exchange ${PREFIX}lofar.mom.command -addtoQPIDDB.py --broker $MOM_SYSTEM --exchange ${PREFIX}lofar.mom.notification - -# ----------------------------------------- -# MoM Services <-> ResourceAssignment -# ----------------------------------------- - -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.mom.bus --federation $MOM_SYSTEM -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.mom.command --federation $MOM_SYSTEM -addtoQPIDDB.py --broker $MOM_SYSTEM --exchange ${PREFIX}lofar.mom.notification --federation $SCU - -# ----------------------------------------- -# Ingest -# ----------------------------------------- - -addtoQPIDDB.py --broker $LEXAR --exchange ${PREFIX}lofar.lta.ingest.command -addtoQPIDDB.py --broker $LEXAR --exchange ${PREFIX}lofar.lta.ingest.notification -addtoQPIDDB.py --broker $LEXAR --queue ${PREFIX}lofar.lta.ingest.jobs -addtoQPIDDB.py --broker $LEXAR --queue ${PREFIX}lofar.lta.ingest.jobs.for_transfer -addtoQPIDDB.py --broker $LEXAR --queue ${PREFIX}lofar.lta.ingest.notification.jobmanager -addtoQPIDDB.py --broker $LEXAR --bind --exchange ${PREFIX}lofar.lta.ingest.notification --queue ${PREFIX}lofar.lta.ingest.notification.momingestadapter --routingkey LTAIngest.# -addtoQPIDDB.py --broker $LEXAR --bind --exchange ${PREFIX}lofar.lta.ingest.notification --queue ${PREFIX}lofar.lta.ingest.notification.jobmanager --routingkey LTAIngest.# - - -# ----------------------------------------- -# ResourceAssignment -# ----------------------------------------- -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.ra.command -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.ra.notification -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.otdb.command -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.otdb.notification -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.dm.command -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.dm.notification - -# ----------------------------------------- -# QA -# ----------------------------------------- - -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.qa.notification - - -# ----------------------------------------- -# Specification & Trigger Services -# ----------------------------------------- -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.spec.command -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.spec.notification -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.trigger.command -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.trigger.notification -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.mac.command -addtoQPIDDB.py --broker $SCU --exchange ${PREFIX}lofar.mac.notification - -# ----------------------------------------- -# Specification -> MoM -# ----------------------------------------- -addtoQPIDDB.py --broker $SCU --queue mom.importxml --federation $MOM_SYSTEM - -# ----------------------------------------- -# Ingest -> SCU -# ----------------------------------------- - -addtoQPIDDB.py --broker $LEXAR --exchange ${PREFIX}lofar.lta.ingest.notification --federation $SCU - -# ----------------------------------------- -# Ingest -> ResourceAssignment @ SCU -# ----------------------------------------- - -addtoQPIDDB.py --broker $SCU --queue ${PREFIX}lofar.lta.ingest.notification.autocleanupservice -addtoQPIDDB.py --broker $SCU --bind --exchange ${PREFIX}lofar.lta.ingest.notification --queue ${PREFIX}lofar.lta.ingest.notification.autocleanupservice --routingkey LTAIngest.# - -# ----------------------------------------- -# Ingest -> LTA-storage-overview @ SCU -# ----------------------------------------- - -addtoQPIDDB.py --broker $SCU --queue ${PREFIX}lofar.lta.ingest.notification.for.ltastorageoverview -addtoQPIDDB.py --broker $SCU --bind --exchange ${PREFIX}lofar.lta.ingest.notification --queue ${PREFIX}lofar.lta.ingest.notification.for.ltastorageoverview --routingkey LTAIngest.# - - -# ----------------------------------------- -# CEP4 cpu nodes -# ----------------------------------------- - -for head in head01.cep4.control.lofar -do - for cpu in $CEP4 - do - addtoQPIDDB.py --dynamic --broker $cpu --exchange ${PREFIX}lofar.otdb.command --federation $head - addtoQPIDDB.py --dynamic --broker $head --exchange ${PREFIX}lofar.otdb.command --federation $cpu - done - - addtoQPIDDB.py --dynamic --broker $head --exchange ${PREFIX}lofar.otdb.command --federation $SCU - addtoQPIDDB.py --dynamic --broker $SCU --exchange ${PREFIX}lofar.otdb.command --federation $head -done - diff --git a/SAS/QPIDInfrastructure/bin/qpidinfra_dump.sql b/SAS/QPIDInfrastructure/bin/qpidinfra_dump.sql deleted file mode 100644 index c68605aa90a8d842d030202e13d61d1894817698..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/qpidinfra_dump.sql +++ /dev/null @@ -1,1002 +0,0 @@ --- --- PostgreSQL database dump --- - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SET check_function_bodies = false; -SET client_min_messages = warning; - --- --- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: --- - -CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; - - --- --- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; - - -SET search_path = public, pg_catalog; - -SET default_tablespace = ''; - -SET default_with_oids = false; - --- --- Name: exchangeroutes; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE exchangeroutes ( - erouteid integer NOT NULL, - fromhost bigint NOT NULL, - tohost bigint NOT NULL, - eid bigint NOT NULL, - routingkey character varying(512) NOT NULL -); - - -ALTER TABLE public.exchangeroutes OWNER TO peterzon; - --- --- Name: exchangeroutes_erouteid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE exchangeroutes_erouteid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.exchangeroutes_erouteid_seq OWNER TO peterzon; - --- --- Name: exchangeroutes_erouteid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE exchangeroutes_erouteid_seq OWNED BY exchangeroutes.erouteid; - - --- --- Name: exchanges; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE exchanges ( - exchangeid integer NOT NULL, - exchangename character varying(512) NOT NULL -); - - -ALTER TABLE public.exchanges OWNER TO peterzon; - --- --- Name: exchanges_exchangeid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE exchanges_exchangeid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.exchanges_exchangeid_seq OWNER TO peterzon; - --- --- Name: exchanges_exchangeid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE exchanges_exchangeid_seq OWNED BY exchanges.exchangeid; - - --- --- Name: hosts; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE hosts ( - hostid integer NOT NULL, - hostname character varying(512) NOT NULL -); - - -ALTER TABLE public.hosts OWNER TO peterzon; - --- --- Name: hosts_hostid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE hosts_hostid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.hosts_hostid_seq OWNER TO peterzon; - --- --- Name: hosts_hostid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE hosts_hostid_seq OWNED BY hosts.hostid; - - --- --- Name: persistentexchanges; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE persistentexchanges ( - pexid integer NOT NULL, - eid bigint NOT NULL, - hid bigint NOT NULL -); - - -ALTER TABLE public.persistentexchanges OWNER TO peterzon; - --- --- Name: persistentexchanges_pexid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE persistentexchanges_pexid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.persistentexchanges_pexid_seq OWNER TO peterzon; - --- --- Name: persistentexchanges_pexid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE persistentexchanges_pexid_seq OWNED BY persistentexchanges.pexid; - - --- --- Name: persistentqueues; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE persistentqueues ( - pquid integer NOT NULL, - qid bigint NOT NULL, - hid bigint NOT NULL -); - - -ALTER TABLE public.persistentqueues OWNER TO peterzon; - --- --- Name: persistentqueues_pquid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE persistentqueues_pquid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.persistentqueues_pquid_seq OWNER TO peterzon; - --- --- Name: persistentqueues_pquid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE persistentqueues_pquid_seq OWNED BY persistentqueues.pquid; - - --- --- Name: queuelistener; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE queuelistener ( - qlistenid integer NOT NULL, - fromhost bigint NOT NULL, - eid bigint NOT NULL, - qid bigint NOT NULL, - subject character varying(512) NOT NULL -); - - -ALTER TABLE public.queuelistener OWNER TO peterzon; - --- --- Name: queuelistener_qlistenid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE queuelistener_qlistenid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.queuelistener_qlistenid_seq OWNER TO peterzon; - --- --- Name: queuelistener_qlistenid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE queuelistener_qlistenid_seq OWNED BY queuelistener.qlistenid; - - --- --- Name: queueroutes; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE queueroutes ( - qrouteid integer NOT NULL, - fromhost bigint NOT NULL, - tohost bigint NOT NULL, - qid bigint NOT NULL -); - - -ALTER TABLE public.queueroutes OWNER TO peterzon; - --- --- Name: queueroutes_qrouteid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE queueroutes_qrouteid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.queueroutes_qrouteid_seq OWNER TO peterzon; - --- --- Name: queueroutes_qrouteid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE queueroutes_qrouteid_seq OWNED BY queueroutes.qrouteid; - - --- --- Name: queues; Type: TABLE; Schema: public; Owner: peterzon; Tablespace: --- - -CREATE TABLE queues ( - queueid integer NOT NULL, - queuename character varying(512) NOT NULL -); - - -ALTER TABLE public.queues OWNER TO peterzon; - --- --- Name: queues_queueid_seq; Type: SEQUENCE; Schema: public; Owner: peterzon --- - -CREATE SEQUENCE queues_queueid_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.queues_queueid_seq OWNER TO peterzon; - --- --- Name: queues_queueid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: peterzon --- - -ALTER SEQUENCE queues_queueid_seq OWNED BY queues.queueid; - - --- --- Name: erouteid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY exchangeroutes ALTER COLUMN erouteid SET DEFAULT nextval('exchangeroutes_erouteid_seq'::regclass); - - --- --- Name: exchangeid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY exchanges ALTER COLUMN exchangeid SET DEFAULT nextval('exchanges_exchangeid_seq'::regclass); - - --- --- Name: hostid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY hosts ALTER COLUMN hostid SET DEFAULT nextval('hosts_hostid_seq'::regclass); - - --- --- Name: pexid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY persistentexchanges ALTER COLUMN pexid SET DEFAULT nextval('persistentexchanges_pexid_seq'::regclass); - - --- --- Name: pquid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY persistentqueues ALTER COLUMN pquid SET DEFAULT nextval('persistentqueues_pquid_seq'::regclass); - - --- --- Name: qlistenid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY queuelistener ALTER COLUMN qlistenid SET DEFAULT nextval('queuelistener_qlistenid_seq'::regclass); - - --- --- Name: qrouteid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY queueroutes ALTER COLUMN qrouteid SET DEFAULT nextval('queueroutes_qrouteid_seq'::regclass); - - --- --- Name: queueid; Type: DEFAULT; Schema: public; Owner: peterzon --- - -ALTER TABLE ONLY queues ALTER COLUMN queueid SET DEFAULT nextval('queues_queueid_seq'::regclass); - - --- --- Data for Name: exchangeroutes; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY exchangeroutes (erouteid, fromhost, tohost, eid, routingkey) FROM stdin; -\. - - --- --- Name: exchangeroutes_erouteid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('exchangeroutes_erouteid_seq', 1, false); - - --- --- Data for Name: exchanges; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY exchanges (exchangeid, exchangename) FROM stdin; -1 lofar.ra.command -2 lofar.ra.notification -3 lofar.otdb.command -4 lofar.otdb.notification -5 lofar.sm.command -6 lofar.sm.notification -7 lofar.mom.command -8 lofar.mom.notification -\. - - --- --- Name: exchanges_exchangeid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('exchanges_exchangeid_seq', 8, true); - - --- --- Data for Name: hosts; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY hosts (hostid, hostname) FROM stdin; -1 scu001.control.lofar -2 ccu001.control.lofar -3 head01.control.lofar -4 lhn001.cep2.lofar -5 mcu001.control.lofar -6 lcs023.control.lofar -7 sas001.control.lofar -8 locus001.cep2.lofar -9 locus002.cep2.lofar -10 locus003.cep2.lofar -11 locus004.cep2.lofar -12 locus005.cep2.lofar -13 locus006.cep2.lofar -14 locus007.cep2.lofar -15 locus008.cep2.lofar -16 locus009.cep2.lofar -17 locus010.cep2.lofar -18 locus011.cep2.lofar -19 locus012.cep2.lofar -20 locus013.cep2.lofar -21 locus014.cep2.lofar -22 locus015.cep2.lofar -23 locus016.cep2.lofar -24 locus017.cep2.lofar -25 locus018.cep2.lofar -26 locus019.cep2.lofar -27 locus020.cep2.lofar -28 locus021.cep2.lofar -29 locus022.cep2.lofar -30 locus023.cep2.lofar -31 locus024.cep2.lofar -32 locus025.cep2.lofar -33 locus026.cep2.lofar -34 locus027.cep2.lofar -35 locus028.cep2.lofar -36 locus029.cep2.lofar -37 locus030.cep2.lofar -38 locus031.cep2.lofar -39 locus032.cep2.lofar -40 locus033.cep2.lofar -41 locus034.cep2.lofar -42 locus035.cep2.lofar -43 locus036.cep2.lofar -44 locus037.cep2.lofar -45 locus038.cep2.lofar -46 locus039.cep2.lofar -47 locus040.cep2.lofar -48 locus041.cep2.lofar -49 locus042.cep2.lofar -50 locus043.cep2.lofar -51 locus044.cep2.lofar -52 locus045.cep2.lofar -53 locus046.cep2.lofar -54 locus047.cep2.lofar -55 locus048.cep2.lofar -56 locus049.cep2.lofar -57 locus050.cep2.lofar -58 locus051.cep2.lofar -59 locus052.cep2.lofar -60 locus053.cep2.lofar -61 locus054.cep2.lofar -62 locus055.cep2.lofar -63 locus056.cep2.lofar -64 locus057.cep2.lofar -65 locus058.cep2.lofar -66 locus059.cep2.lofar -67 locus060.cep2.lofar -68 locus061.cep2.lofar -69 locus062.cep2.lofar -70 locus063.cep2.lofar -71 locus064.cep2.lofar -72 locus065.cep2.lofar -73 locus066.cep2.lofar -74 locus067.cep2.lofar -75 locus068.cep2.lofar -76 locus069.cep2.lofar -77 locus070.cep2.lofar -78 locus071.cep2.lofar -79 locus072.cep2.lofar -80 locus073.cep2.lofar -81 locus074.cep2.lofar -82 locus075.cep2.lofar -83 locus076.cep2.lofar -84 locus077.cep2.lofar -85 locus078.cep2.lofar -86 locus079.cep2.lofar -87 locus080.cep2.lofar -88 locus081.cep2.lofar -89 locus082.cep2.lofar -90 locus083.cep2.lofar -91 locus084.cep2.lofar -92 locus085.cep2.lofar -93 locus086.cep2.lofar -94 locus087.cep2.lofar -95 locus088.cep2.lofar -96 locus089.cep2.lofar -97 locus090.cep2.lofar -98 locus091.cep2.lofar -99 locus092.cep2.lofar -100 locus093.cep2.lofar -101 locus094.cep2.lofar -\. - - --- --- Name: hosts_hostid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('hosts_hostid_seq', 101, true); - - --- --- Data for Name: persistentexchanges; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY persistentexchanges (pexid, eid, hid) FROM stdin; -1 1 1 -2 2 1 -3 3 1 -4 4 1 -5 5 1 -6 6 1 -7 7 1 -8 8 1 -\. - - --- --- Name: persistentexchanges_pexid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('persistentexchanges_pexid_seq', 8, true); - - --- --- Data for Name: persistentqueues; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY persistentqueues (pquid, qid, hid) FROM stdin; -1 1 1 -2 2 1 -3 3 1 -4 4 4 -5 5 4 -6 6 4 -7 4 2 -8 5 2 -9 6 2 -10 7 2 -11 8 2 -12 9 2 -13 10 2 -14 11 2 -15 12 2 -16 13 2 -17 7 5 -18 12 5 -19 13 5 -20 14 6 -21 15 6 -22 16 6 -23 8 6 -24 9 6 -25 10 6 -26 11 6 -27 14 7 -28 15 7 -29 16 7 -30 4 8 -31 5 8 -32 6 8 -33 4 9 -34 5 9 -35 6 9 -36 4 10 -37 5 10 -38 6 10 -39 4 11 -40 5 11 -41 6 11 -42 4 12 -43 5 12 -44 6 12 -45 4 13 -46 5 13 -47 6 13 -48 4 14 -49 5 14 -50 6 14 -51 4 15 -52 5 15 -53 6 15 -54 4 16 -55 5 16 -56 6 16 -57 4 17 -58 5 17 -59 6 17 -60 4 18 -61 5 18 -62 6 18 -63 4 19 -64 5 19 -65 6 19 -66 4 20 -67 5 20 -68 6 20 -69 4 21 -70 5 21 -71 6 21 -72 4 22 -73 5 22 -74 6 22 -75 4 23 -76 5 23 -77 6 23 -78 4 24 -79 5 24 -80 6 24 -81 4 25 -82 5 25 -83 6 25 -84 4 26 -85 5 26 -86 6 26 -87 4 27 -88 5 27 -89 6 27 -90 4 28 -91 5 28 -92 6 28 -93 4 29 -94 5 29 -95 6 29 -96 4 30 -97 5 30 -98 6 30 -99 4 31 -100 5 31 -101 6 31 -102 4 32 -103 5 32 -104 6 32 -105 4 33 -106 5 33 -107 6 33 -108 4 34 -109 5 34 -110 6 34 -111 4 35 -112 5 35 -113 6 35 -114 4 36 -115 5 36 -116 6 36 -117 4 37 -118 5 37 -119 6 37 -120 4 38 -121 5 38 -122 6 38 -123 4 39 -124 5 39 -125 6 39 -126 4 40 -127 5 40 -128 6 40 -129 4 41 -130 5 41 -131 6 41 -132 4 42 -133 5 42 -134 6 42 -135 4 43 -136 5 43 -137 6 43 -138 4 44 -139 5 44 -140 6 44 -141 4 45 -142 5 45 -143 6 45 -144 4 46 -145 5 46 -146 6 46 -147 4 47 -148 5 47 -149 6 47 -150 4 48 -151 5 48 -152 6 48 -153 4 49 -154 5 49 -155 6 49 -156 4 50 -157 5 50 -158 6 50 -159 4 51 -160 5 51 -161 6 51 -162 4 52 -163 5 52 -164 6 52 -165 4 53 -166 5 53 -167 6 53 -168 4 54 -169 5 54 -170 6 54 -171 4 55 -172 5 55 -173 6 55 -174 4 56 -175 5 56 -176 6 56 -177 4 57 -178 5 57 -179 6 57 -180 4 58 -181 5 58 -182 6 58 -183 4 59 -184 5 59 -185 6 59 -186 4 60 -187 5 60 -188 6 60 -189 4 61 -190 5 61 -191 6 61 -192 4 62 -193 5 62 -194 6 62 -195 4 63 -196 5 63 -197 6 63 -198 4 64 -199 5 64 -200 6 64 -201 4 65 -202 5 65 -203 6 65 -204 4 66 -205 5 66 -206 6 66 -207 4 67 -208 5 67 -209 6 67 -210 4 68 -211 5 68 -212 6 68 -213 4 69 -214 5 69 -215 6 69 -216 4 70 -217 5 70 -218 6 70 -219 4 71 -220 5 71 -221 6 71 -222 4 72 -223 5 72 -224 6 72 -225 4 73 -226 5 73 -227 6 73 -228 4 74 -229 5 74 -230 6 74 -231 4 75 -232 5 75 -233 6 75 -234 4 76 -235 5 76 -236 6 76 -237 4 77 -238 5 77 -239 6 77 -240 4 78 -241 5 78 -242 6 78 -243 4 79 -244 5 79 -245 6 79 -246 4 80 -247 5 80 -248 6 80 -249 4 81 -250 5 81 -251 6 81 -252 4 82 -253 5 82 -254 6 82 -255 4 83 -256 5 83 -257 6 83 -258 4 84 -259 5 84 -260 6 84 -261 4 85 -262 5 85 -263 6 85 -264 4 86 -265 5 86 -266 6 86 -267 4 87 -268 5 87 -269 6 87 -270 4 88 -271 5 88 -272 6 88 -273 4 89 -274 5 89 -275 6 89 -276 4 90 -277 5 90 -278 6 90 -279 4 91 -280 5 91 -281 6 91 -282 4 92 -283 5 92 -284 6 92 -285 4 93 -286 5 93 -287 6 93 -288 4 94 -289 5 94 -290 6 94 -291 4 95 -292 5 95 -293 6 95 -294 4 96 -295 5 96 -296 6 96 -297 4 97 -298 5 97 -299 6 97 -300 4 98 -301 5 98 -302 6 98 -303 4 99 -304 5 99 -305 6 99 -306 4 100 -307 5 100 -308 6 100 -309 4 101 -310 5 101 -311 6 101 -\. - - --- --- Name: persistentqueues_pquid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('persistentqueues_pquid_seq', 311, true); - - --- --- Data for Name: queuelistener; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY queuelistener (qlistenid, fromhost, eid, qid, subject) FROM stdin; -\. - - --- --- Name: queuelistener_qlistenid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('queuelistener_qlistenid_seq', 1, false); - - --- --- Data for Name: queueroutes; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY queueroutes (qrouteid, fromhost, tohost, qid) FROM stdin; -\. - - --- --- Name: queueroutes_qrouteid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('queueroutes_qrouteid_seq', 1, false); - - --- --- Data for Name: queues; Type: TABLE DATA; Schema: public; Owner: peterzon --- - -COPY queues (queueid, queuename) FROM stdin; -1 TreeStatus -2 TaskSpecified -3 ResourceAssigner -4 lofar.task.feedback.dataproducts -5 lofar.task.feedback.processing -6 lofar.task.feedback.state -7 lofar.task.specification.system -8 mom.task.feedback.dataproducts -9 mom.task.feedback.processing -10 mom.task.feedback.state -11 mom.task.specification.system -12 otdb.task.feedback.dataproducts -13 otdb.task.feedback.processing -14 mom-otdb-adapter.importxml -15 mom.command -16 mom.importxml -\. - - --- --- Name: queues_queueid_seq; Type: SEQUENCE SET; Schema: public; Owner: peterzon --- - -SELECT pg_catalog.setval('queues_queueid_seq', 16, true); - - --- --- Name: exchangeroutes_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY exchangeroutes - ADD CONSTRAINT exchangeroutes_pkey PRIMARY KEY (erouteid); - - --- --- Name: exchanges_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY exchanges - ADD CONSTRAINT exchanges_pkey PRIMARY KEY (exchangeid); - - --- --- Name: hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY hosts - ADD CONSTRAINT hosts_pkey PRIMARY KEY (hostid); - - --- --- Name: persistentexchanges_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY persistentexchanges - ADD CONSTRAINT persistentexchanges_pkey PRIMARY KEY (pexid); - - --- --- Name: persistentqueues_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY persistentqueues - ADD CONSTRAINT persistentqueues_pkey PRIMARY KEY (pquid); - - --- --- Name: queuelistener_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY queuelistener - ADD CONSTRAINT queuelistener_pkey PRIMARY KEY (qlistenid); - - --- --- Name: queueroutes_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY queueroutes - ADD CONSTRAINT queueroutes_pkey PRIMARY KEY (qrouteid); - - --- --- Name: queues_pkey; Type: CONSTRAINT; Schema: public; Owner: peterzon; Tablespace: --- - -ALTER TABLE ONLY queues - ADD CONSTRAINT queues_pkey PRIMARY KEY (queueid); - - --- --- Name: public; Type: ACL; Schema: -; Owner: postgres --- - -REVOKE ALL ON SCHEMA public FROM PUBLIC; -REVOKE ALL ON SCHEMA public FROM postgres; -GRANT ALL ON SCHEMA public TO postgres; -GRANT ALL ON SCHEMA public TO PUBLIC; - - --- --- PostgreSQL database dump complete --- - diff --git a/SAS/QPIDInfrastructure/bin/route_to_struct.py b/SAS/QPIDInfrastructure/bin/route_to_struct.py deleted file mode 100755 index 5a169c06ff4f31c26df38136272c786e963717f2..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/bin/route_to_struct.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python3 - -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 - -def to_exchangename(s): - exchangename=s.split('=')[1].split(')')[0] - print((" found exchangename '%s'" %(exchangename))) - return exchangename - - -print((" Num lines %d " %(numlines))) - -offset=0 - -while (tosearch[offset] != 'Static Routes:\n'): - #print ( "'%s'" %( tosearch[offset])) - offset += 1 - if (offset==numlines): - print("notfound") - break - -if (offset!=numlines): - for offset in range(offset,numlines): - s = tosearch[offset].split(' ') - if ( len(s) ==5 ): # valid description - hosta=to_hostname(s[2]) - exchangename=to_exchangename(s[2]) - if (exchangename == ''): - exchangename='lofar.default.bus' - queuename=s[4].split('=')[1].split(')')[0] - hostb=to_hostname(s[4]) #.split(':')[0].split('.') - if (s[3]=='<='): - todb.bindexchangetohost(exchangename,hosta) - todb.bindexchangetohost(exchangename,hostb) - todb.bindqueuetohost(queuename,hosta) - todb.bindqueuetohost(queuename,hostb) - todb.setqueueroute(queuename,hostb,hosta,exchangename) - print(("# queue %s from %s to %s" %(queuename,hostb,hosta))) - if (s[3]=='=>'): - todb.bindqueuetohost(queuename,hosta) - todb.bindqueuetohost(queuename,hostb) - todb.setqueueroute(queuename,hosta,hostb) - print(("# queue %s from %s to %s" %(queuename,hosta,hostb))) diff --git a/SAS/QPIDInfrastructure/doc/QPID_infrastracture.md b/SAS/QPIDInfrastructure/doc/QPID_infrastracture.md deleted file mode 100644 index 9292dcc6af506bf747e30c07257f0aa31b7d1869..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/doc/QPID_infrastracture.md +++ /dev/null @@ -1,95 +0,0 @@ -# QPID Infrastructure {#qpid_infrastructure} - -*This page provides the template for documenting software modules, where modules can be for example a library, service, -or an application.* - -*In order to use this template, copy its source (it is written in Markdown language) and edit it accordingy. Feel free to -remove any explanatory text written in Italic like this text, but in case some subject is not applicable to your module: -consider not removing its header, but add a rationale about why it is not applicable instead.* - -# Software Module X - -## GENERAL - -### Description -- *What does it do?* -- *Why is it needed?* - -### Author/Owner - -### Overview -- *Add a diagram* -- *Add a link to the overview diagram* -- *Add a link in the overview diagram to link back to this documentation*. - -- - - - -## DEVELOPMENT - -### Analyses -*Add non-technical information and functional considerations here, like user requirements and links to minutes of -meetings with stakeholders.* - -### Design -*Add technical considerations and design choices here* - -### Source Code -- *Add a link to svn (trunk).* -- *Add a link to (generated?) source code documentation.* - -### Testing -- *How do you run unit tests?* -- *How do you run integration tests?* -- *Add a link to Jenkins jobs (if available)* - -### Build & Deploy -- *Add a link to general instructions or describe specifics here.* -- *Add a link to Jenkins jobs (if available)* - -- - - - -## OPERATIONS - -### Configuration -- *Where is the configuration file?* -- *What are the configuration options?* - -### Log Files -- *Where are the log files?* - -### Runtime -- *Where does it run? (which user@machine)* -- *How do I run it? (user documentation? examples? commandline parameters?)* -- *Other considerations? (what happens elsewhere when I start or stop it?)* - -### Interfaces (API) -- *Describe interfaces to other applications (REST API? http requests? Messagebus?)* -- *Other communication (user? import/export?)* - -### Files/Databases -- *Which databases are used?* -- *Which files are used?* - -### Dependencies -- *To/from other applications?* -- *Files?* -- *Network locations?* -- *Other?* - -### Security -- *Special privileges needed?* -- *User login?* -- *Certificates needed?* -- *Other considerations?* - -- - - - -## ADDITIONAL INFORMATION - -### User Documentation - -*e.g. Please refer to URL X for the User Documentation* - -### Operations Documentation - -*e.g. Please refer to URL X for Operations Documentation* diff --git a/SAS/QPIDInfrastructure/doc/package.dox b/SAS/QPIDInfrastructure/doc/package.dox deleted file mode 100644 index 7d34cedad7e26d95e16f2b57c61a61d927177f53..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/doc/package.dox +++ /dev/null @@ -1,6 +0,0 @@ -/** - -\ingroup SAS -\defgroup QPIDInfrastructure QPIDInfrastructure -\ref qpid_infrastructure -*/ diff --git a/SAS/QPIDInfrastructure/lib/CMakeLists.txt b/SAS/QPIDInfrastructure/lib/CMakeLists.txt deleted file mode 100644 index 8a6a29bb1d8ea4ce18d947a50cf138e498005b50..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/lib/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# $Id: CMakeLists.txt 32905 2015-11-17 15:31:54Z schaap $ - -python_install( - __init__.py - psqlQPIDDB.py - QPIDDB.py - DESTINATION lofar/qpidinfrastructure) - diff --git a/SAS/QPIDInfrastructure/lib/QPIDDB.py b/SAS/QPIDInfrastructure/lib/QPIDDB.py deleted file mode 100755 index f9fe543ec8c8b2e283e7e5c3a4cb83ab5fc0e27e..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/lib/QPIDDB.py +++ /dev/null @@ -1,337 +0,0 @@ -#!/usr/bin/env python3 - -from .psqlQPIDDB import psqlQPIDDB - -class qpidinfra: - """ Class to access and edit the QPIDInfra database. - """ - def __init__(self, dbcreds): - """ Initialize the database connection. - """ - self.db=psqlQPIDDB(dbcreds) - - def perqueue(self,callback): - """ Iterate over all queues defined in the database. - example: - def callback(item): - print(" Host %s has Queue %s " %(item['hostname'],item['queuename'])) - - qpidinfra.perqueue(callback) - - the example will print a full list of hostnames and queuenames - """ - ret=self.db.doquery("select hostname,queuename from persistentqueues INNER join hosts on (hid=hostid) INNER JOIN queues on (qid=queueid);") - for item in ret: - callback(item) - - def perexchange(self,callback): - """ Iterate over all queues defined in the database. - example: - def callback(item): - print(" Host %s has Exchange %s " %(item['hostname'],item['queuename'])) - - qpidinfra.perexchange(callback) - - the example will print a full list of hostnames and exchange names - """ - ret= self.db.doquery("select hostname,exchangename from persistentexchanges INNER join hosts on (hid=hostid) INNER JOIN exchanges on (eid=exchangeid);") - for item in ret: - callback(item) - - - def perfederationexchange(self,callback): - """ Iterate over all routingkeys defined in all federated exchanges. - example: - def callback(item): - fedtype = "Dynamic" if item['dynamic'] else "Static" - print(" %s Federation from %s to %s with routingkey %s for exchange %s" \ - %(fedtype,item['fromhost'],item['tohost'],item['routingkey'],item['exchangename'])) - - qpidinfra.perfederationexchange(callback) - - the example will return a full list of the federated exchanges. - """ - ret=self.db.doquery("select h1.hostname as fromhost ,h2.hostname as tohost , exchangename , dynamic , routingkey from exchangeroutes JOIN hosts as h1 on (fromhost=h1.hostid) JOIN hosts as h2 on (tohost=h2.hostid) JOIN exchanges on (exchangeid=eid);") - for item in ret: - callback(item) - - def perfederationqueue(self,callback): - """ Iterate over all federated queues. - example: - def callback(item): - print(" Federation for queue %s from %s to %s using exchange %s" \ - %(item['queuename'],item['fromhost'],item['tohost'],item['exchangename'])) - - qpidinfra.perfederationqueue(callback) - - the example will return a full list of the federated queues. - """ - - ret=self.db.doquery("select h1.hostname as fromhost ,h2.hostname as tohost , queuename, exchangename from queueroutes JOIN hosts as h1 on (fromhost=h1.hostid) JOIN hosts as h2 on (tohost=h2.hostid) JOIN queues on (queueid=qid) JOIN exchanges on (exchangeid=eid);") - for item in ret: - callback(item) - - def perqpidbinding(self,callback): - """ Iterate over all exchange->queue bindings defined in the database. - """ - ret= self.db.doquery("""SELECT h.hostname as hostname, e.exchangename as exchangename, q.queuename as queuename, subject as routingkey - FROM queuelistener - INNER JOIN hosts h on fromhost=h.hostid - INNER JOIN exchanges e on eid=e.exchangeid - INNER JOIN queues q on qid=q.queueid - ;""") - for item in ret: - callback(item) - - def gethostid(self,hostname): - """ return the database id of the given hostname or 0 if non existant. - example: - id = gethostid('myhost.my.domain') - """ - return self.db.getid('host',hostname) - - def getqueueid(self,queuename): - """ return the database id of the given queuename or 0 if non existant. - example: - id = getqueueid('my.queue.name') - """ - return self.db.getid('queue',queuename) - - def getexchangeid(self,exchangename): - """ return the id of the given exchangename or 0 if non existant. - example: - id = getexchangeid('my.exchange.name') - """ - return self.db.getid('exchange',exchangename) - - def addhost(self,hostname,verbose=True): - """ Add a hostname to the database. Hostnames will be stored in lowercase. Returns the id of the new entry. - example: - id = addhost('myhost.my.domain') - """ - return self.db.additem('host',hostname,verbose) - - def addqueue(self,queue, verbose=True): - """ Add a queuename to the database. Returns the id of the new entry. - example: - id = addqueue('my.queue.name') - """ - return self.db.additem('queue',queue,verbose) - - def addexchange(self,exchange, verbose=True): - """ Add a exchangename to the database. Returns the id of the new entry. - example: - id = addexchange('my.exchange.name') - """ - - return self.db.additem('exchange',exchange,verbose) - - def delhost(self,hostname, verbose=True): - """ Delete the entry for the hostname and its associated bindings/federations. - example: - delhost('myhost.my.domain') - """ - return self.db.delitem('host',hostname,verbose) - - def delqueue(self,queuename, verbose=True): - """ Delete the queue definition from the list of available queuenames and remove all related bindings and federations. - Use with care because this removes ALL the occurances of this queue on ALL hosts and related bindings/federations. - example: - delqueue('my.queue.name') - """ - return self.db.delitem('queue',queuename) - - def delexchange(self,exchangename, verbose=True): - """ Delete the exchange definition from the list of available exchangenames and remove all related bindings and federations. - Use with care because this removes ALL the occurances of this exchange on ALL hosts and related bindings/federations. - example: - delexchange('my.queue.name') - """ - return self.db.delitem('exchange',exchangename) - - def getqueuebinding(self,queueid,hostid): - """ Retrieve the binding description for the given queueid and host id. - returns 0 if none found. - """ - ret=self.db.doquery("select * from persistentqueues where qid=%s and hid=%s;" %(queueid,hostid)) - if (ret==[]): - return 0 - return ret[0]['pquid'] - - def addqueuebinding(self,queueid,hostid): - """ Add a binding for the given queueid and hostid. - """ - if (self.getqueuebinding(queueid,hostid)==0): - self.db.docommit("insert into persistentqueues (qid,hid) VALUES (%d,%d);" %(queueid,hostid)) - - def delqueuebinding(self,queueid,hostid): - """ Delete the binding (if any) for the given queueid and hostid. - """ - id = self.getqueuebinding(queueid,hostid) - if (id): - print(("Deleting binding for queue %d on host %d" %(queueid,hostid))) - self.db.docommit("delete from persistentqueues where pquid=%d and qid=%d and hid=%d;" %(id,queueid,hostid)) - return 0 - return 1 - - def getexchangebinding(self,exchangeid,hostid): - """ Retrieve the info on the exchange binding for the given exchangeid and hostid. - Returns 0 if none found. - """ - ret=self.db.doquery("select * from persistentexchanges where eid=%s and hid=%s;" %(exchangeid,hostid)) - if (ret==[]): - return 0 - return ret[0]['pexid'] - - def addexchangebinding(self,exchangeid,hostid): - """ Add an binding for the given exchangeid and hostid. - """ - if (self.getexchangebinding(exchangeid,hostid)==0): - self.db.docommit("insert into persistentexchanges (eid,hid) VALUES ( %s , %s ) ;" %(exchangeid,hostid)) - - def delexchangebinding(self,exchangeid,hostid): - """ Delete the binding for the given exchangeid and hostid. - Returns 0 if the binding existed. - Returns 1 if the binding did not exist. - """ - id = self.getexchangebinding(exchangeid,hostid) - if (id!=0): - print(("Deleting binding for exchange %d on host %d" %(exchangeid,hostid))) - self.db.docommit("delete from persistentexchanges where pexid=%d and eid=%d and hid=%d;" %(id,exchangeid,hostid)) - return 0 - return 1 - - def getqueueroute(self,queueid,fromid,toid): - """ Retrieve the queueroute information for the given queueid, fromid and toid. - fromid and toid are hostid for the sending and the receiving host respectively. - """ - ret=self.db.doquery("select * from queueroutes where qid=%s and fromhost=%s and tohost=%s;" %(queueid,fromid,toid)) - if (ret==[]): - return 0 - return ret[0]['qrouteid'] - - def addqueueroute(self,queueid,fromid,toid,exchangeid): - """ Add a queue route for the given queueid, fromid, toid and exchangeid. - """ - if (self.getqueueroute(queueid,fromid,toid)==0): - self.db.docommit("insert into queueroutes (qid,fromhost,tohost,eid) VALUES ( %s , %s , %s, %s );" %(queueid,fromid,toid,exchangeid)) - - def delqueueroute(self,queueid,fromid,toid): - """ Delete the queueroute for the given queueid,fromid and toid - """ - id=self.getqueueroute(queueid,fromid,toid) - if (id!=0): - print(("Removing queueroute for queue %d from host %d to host %d" %(queueid,fromid,toid))) - self.db.docommit("delete from queueroutes where qrouteid=%d;" %(queuerouteid)) - - def getexchangeroute(self,exchangeid,routingkey,fromid,toid): - """ Retrieve the exchange route information for the give exchangeid, routingkey, fromid and toid. - """ - ret=self.db.doquery("select * from exchangeroutes where eid=%s and fromhost=%s and tohost=%s and routingkey='%s';" %(exchangeid,fromid,toid,routingkey)) - if (ret==[]): - return 0 - return ret[0]['erouteid'] - - def addexchangeroute(self,exchangeid,routingkey,fromid,toid,dynamic=False): - """ Add an exchange route for the given exchangeid with routingkey, fromid, toid and dynamic (bool). - If dynamic is set to True the routing key won't have any effect since teh routing is assumed dynamic. - """ - if (self.getexchangeroute(exchangeid,routingkey,fromid,toid)==0): - self.db.docommit("insert into exchangeroutes (eid,fromhost,tohost,routingkey,dynamic) values (%s, %s, %s, '%s', %s);" %(exchangeid,fromid,toid,routingkey,dynamic)) - - def delexchangeroute(self,exchangeid,routingkey,fromid,toid,dynamic=False): - """ Delete the exchange route for exchangeid,routingkey,fromid,toid and dynamic(bool). - """ - id = self.getexchangeroute(exchangeid,routingkey,fromid,toid) - if (id!=0): - print(("Removing exchangeroute for key %s and exchange %s from host %s to host %s" %(routingkey,exchangekey,fromid,toid))) - self.db.docommit("delete from exchangeroutes where erouteid=%d;" %(id)) - - def getexchangetoqueuebinding(self,exchangeid,queueid,hostid,routingkey): - """ Retrieve the info on the exchange binding for the given exchangeid and queueid. - Returns 0 if none found. - """ - ret=self.db.doquery("select * from queuelistener where eid=%s and qid=%s and fromhost=%s and subject=\'%s\';" %(exchangeid,queueid,hostid,routingkey)) - if (ret==[]): - return 0 - return ret[0]['qlistenid'] - - def addexchangetoqueuebinding(self,exchangeid,queueid,hostid,routingkey='#'): - """ Add a qpid binding from the given exchangeid to the given queueid on the broker at hostid. - """ - if (self.getexchangetoqueuebinding(exchangeid,queueid,hostid,routingkey)==0): - self.db.docommit("insert into queuelistener (fromhost,eid,qid,subject) VALUES ( %s , %s , %s , \'%s\' ) ;" %(hostid,exchangeid,queueid,routingkey)) - - def bindqueuetohost(self,queue,host): - """ Insert a binding in the database for queue on host. - Both queue and host will be added to the database if needed. - """ - hostid=self.addhost(host) - queueid=self.addqueue(queue) - bindid=self.getqueuebinding(queueid,hostid) - if (bindid==0): # not found - self.addqueuebinding(queueid,hostid) - else: - print(("Queue %s already binded with broker %s in database" %(queue,host))) - - def bindexchangetohost(self,exchange,host): - """ Insert a binding in the database for exchange on host. - Both exchange and host will be added to the database if needed. - """ - hostid=self.addhost(host,verbose=False) - exchangeid=self.addexchange(exchange,verbose=False) - if (self.getexchangebinding(exchangeid,hostid)==0): - self.addexchangebinding(exchangeid,hostid) - else: - print(("Exchange %s already binded with broker %s in database" %(exchange,host))) - - def bindexchangetoqueueonhost(self,exchange,queue,host,routingkey='#'): - """ Insert a qpid-binding in the database from an exchange to a queue on host with the given routingkey. - Exchange, queue and/or host will be added to the database if needed. - """ - #add exchange, queue to db if needed, and hook to given host if needed. - self.bindexchangetohost(exchange, host) - self.bindqueuetohost(queue, host) - - #get the id's of exchange,queue,host (the add just returns the existing id's) - hostid=self.addhost(host,verbose=False) - exchangeid=self.addexchange(exchange,verbose=False) - queueid=self.addqueue(queue,verbose=False) - - #check if this qpid-route is already available, else add - if (self.getexchangetoqueuebinding(exchangeid,queueid,hostid,routingkey)==0): - self.addexchangetoqueuebinding(exchangeid,queueid,hostid,routingkey) - else: - print(("Exchange \'%s\' to queue \'%s\' binding with routingkey \'%s\' on broker \'%s\' is already known in database" %(exchange,queue,routingkey,host))) - - def setqueueroute(self,queuename,fromname,toname,exchange): - """ Insert a queue route in the database for queuename,fromname,toname,exchange. - Queues, hosts and exchanges will be added to the database if needed. - """ - fromid = self.addhost(fromname) - toid = self.addhost(toname) - queueid = self.addqueue(queuename) - exchangeid = self.addexchange(exchange) - self.addqueueroute(queueid,fromid,toid,exchangeid) - - def setexchangeroute(self,exchangename,routingkey,fromname,toname,dynamic=False): - """ Insert an exchangeroute for exchangename,routingkey,fromname,toname,dynamic (bool). - Hosts and exchanges will be added to the database if needed. - """ - exchangeid = self.addexchange(exchangename) - fromid = self.addhost(fromname) - toid = self.addhost(toname) - self.addexchangeroute(exchangeid,routingkey,fromid,toid,dynamic) - - def renamequeue(self,oldqueuename,newqueuename): - """ rename the queue oldqueuename to newqueuename. - This will impact all references to the oldqueuename. - """ - self.db.docommit("update queues set queuename='%s' where queuename='%s';" %(newqueuename,oldqueuename)) - - def renameexchange(self,oldexchangename,newexchangename): - """ rename the exchange oldexchangename to newexchangename. - This will impact all references to the oldexchangename. - """ - self.db.docommit("update exchanges set exchangename='%s' where exchangename='%s';" %(newexchangename,oldexchangename)) - diff --git a/SAS/QPIDInfrastructure/lib/__init__.py b/SAS/QPIDInfrastructure/lib/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/SAS/QPIDInfrastructure/lib/psqlQPIDDB.py b/SAS/QPIDInfrastructure/lib/psqlQPIDDB.py deleted file mode 100755 index ed118c43bcf76ffa2454e9a5a403f501ea48eb30..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/lib/psqlQPIDDB.py +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env python3 - -import psycopg2 as pg -import psycopg2.extras as pgdefs - -class psqlQPIDDB: - """ psqlQPIDDB class - defines low level database interaction with the - postgres database that holds the QPID infra configuration. - - """ - def __init__(self, dbcreds=None): - """ Init the class with the name of the database - example: db = psqlQPIDDB(dbcreds) - where `dbcreds' is an lofar.common.dbcredentials.Credentials object. - """ - self.dbcreds = dbcreds - self.conn = None - - self.ensure_connect() - - def ensure_connect(self): - """ ensure that the database is still connected. - raises an exception "ERROR: Failed to connect to database XXX" - if the reconnect failed. - """ - - if self.conn and self.conn.status==1: - return - - self.conn = pg.connect(**self.dbcreds.psycopg2_connect_options()) - - if self.conn and self.conn.status==1: - return - else: - raise Exception("ERROR: Failed to reconnect to database %s" % (self.dbcreds,)) - - def doquery(self,query): - """ execute a query on the database and return reult as a list of dicts. - This assumes nothing needs to be committed and thus - useful for fetching infromation from the database. - usage: ret=doquery("select * from table;") - """ - - self.ensure_connect() - cur = self.conn.cursor(cursor_factory = pgdefs.RealDictCursor) - cur.execute(query) - return cur.fetchall() - - def docommit(self,query): - """ execute a database query that needs a commit to update the database. - example: docommit("INSERT INTO table (one,two) VALUES ('one','two');") - """ - - self.ensure_connect() - cur = self.conn.cursor() - cur.execute(query) - print(cur.statusmessage) - self.conn.commit() - - def getid(self,itemtype,itemname): - """ retrieve an id from a table with assumptions on table layout. - the query is done by substituting the table name with the itemtype with 's' appended. - example: - id = getid('shoe','myshoe') - the used query will be: - "select * from shoes where shoename='myshoe';" - """ - tmp=self.doquery("select * from %ss where %sname='%s';" %(itemtype,itemtype,itemname)) - if (tmp==[]): - return 0 - return tmp[0]["%sid" %(itemtype)] - - def delid(self,itemtype,itemid): - """ delete a record from a table with assumptions on table layout. - the query is done by substituting the table name with the itemtype with 's' appended. - example: - id = getid('shoe',245) - the used query will be: - "delete from shoes where shoeid=245;" - """ - if (id!=0): - self.docommit("delete from %ss where %sid=%d;"(itemtype,itemtype,itemid)) - - def delname(self,itemtype,itemname, verbose=True): - """ delete a record from a table with assumptions on table layout. - the query is done by substituting the table name with the itemtype with 's' appended. - example: - id = getid('shoe','myshoe') - the used query will be: - "delete from shoes where shoename='myshoe';" - """ - id= self.getid(itemtype,itemname) - if (id): - if verbose: - print(("Deleting %s from table %ss." %(itemname,itemtype))) - self.docommit("delete from %ss where %sid=%d and %sname='%s'" %(itemtype,itemtype,itemtype,itemname)) - else: - print(("%s %s not found in database." %(itemtype,itemname))) - - def getname(self,itemtype,itemid): - """ retrieve name from database table for index. - example: - name = getname('shoe',245); - the used query will be: - "SELECT shoename FROM shoes WHERE shoeid=245;" - """ - res=self.doquery("select %sname from %ss where %sid=%d;" %(itemtype,itemtype,itemtype,itemid)) - if (res!=[]): - return res[0]["%sname" %(itemtype)] - return 'NotAvailableInDatabase' - - def additem(self,itemtype,itemname,verbose=True): - """ Insert a record in the database with assumptions on the table layout. - example: - additem('shoe','myshoe',verbose=False) - the used query will be: - "INSERT INTO shoes (shoename) VALUES ('myshoe');" - """ - id = self.getid(itemtype,itemname) - if (id!=0): - if verbose: - print(("%s %s already available in database." %(itemtype,itemname))) - return id - self.docommit("insert into %ss (%sname) values ('%s');" %(itemtype,itemtype,itemname)) - if verbose: - print((" added %s %s to DB" %(itemtype,itemname))) - return self.getid(itemtype,itemname) - - def delitem(self,itemtype,itemname,verbose=True): - """ Delete a record from the database with assumptions on the table layout. - example: - delitem('shoe','myshoe',verbose=False) - the used query will be: - "DELETE FROM shoes WHERE shoename='myshoe';" - """ - - id = self.getid(itemtype,itemname) - if (id!=0): - if verbose: - print(("Deleting from table %s the item %s." %(itemtype,itemname))) - self.docommit("delete from %ss where %sid=%d and %sname='%s';" %(itemtype,itemtype,id,itemtype,itemname)) - return 0; - print(("%s %s not found in the database" %(itemtype,itemname))) diff --git a/SAS/QPIDInfrastructure/sql/CMakeLists.txt b/SAS/QPIDInfrastructure/sql/CMakeLists.txt deleted file mode 100644 index 92af7c13c0d3697af8ea6e9bdf1b711a1c7fc7e0..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/sql/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# $Id: CMakeLists.txt 32341 2015-08-28 11:59:26Z schaap $ - -install_files(/share/qpidinfrastructure/sql qpidinfradb.sql) - diff --git a/SAS/QPIDInfrastructure/sql/qpidinfradb.sql b/SAS/QPIDInfrastructure/sql/qpidinfradb.sql deleted file mode 100644 index 2c467a92abf6be5cabda59cd9bebe3dac966c5ba..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/sql/qpidinfradb.sql +++ /dev/null @@ -1,73 +0,0 @@ --- Usage: --- --- psql --command="CREATE DATABASE qpidinfra" --- psql --dbname=qpidinfra --file=qpidinfradb.sql - -DROP TABLE IF EXISTS exchanges CASCADE; -DROP TABLE IF EXISTS queues CASCADE; -DROP TABLE IF EXISTS hosts CASCADE; -DROP TABLE IF EXISTS persistentexchanges CASCADE; -DROP TABLE IF EXISTS persistentqueues CASCADE; -DROP TABLE IF EXISTS queueroutes CASCADE; -DROP TABLE IF EXISTS exchangeroutes CASCADE; -DROP TABLE IF EXISTS queuelistener CASCADE; - -CREATE TABLE exchanges( - exchangeid SERIAL, - exchangename varchar(512) NOT NULL, - PRIMARY KEY (exchangeid) -); -CREATE TABLE queues( - queueid SERIAL, - queuename varchar(512) NOT NULL, - PRIMARY KEY (queueid) -); -CREATE TABLE hosts( - hostid SERIAL, - hostname varchar(512) NOT NULL, - PRIMARY KEY (hostid) -); - -CREATE TABLE persistentexchanges ( - pexid SERIAL, - eid bigint references exchanges(exchangeid) ON DELETE CASCADE, - hid bigint references hosts(hostid) ON DELETE CASCADE, - PRIMARY KEY (pexid) -); - -CREATE TABLE persistentqueues ( - pquid SERIAL, - qid bigint references queues(queueid) ON DELETE CASCADE, - hid bigint references hosts(hostid) ON DELETE CASCADE, - PRIMARY KEY (pquid) -); - -CREATE TABLE queueroutes( - qrouteid SERIAL, - fromhost bigint references hosts(hostid) ON DELETE CASCADE, - tohost bigint references hosts(hostid) ON DELETE CASCADE, - qid bigint references queues(queueid) ON DELETE CASCADE, - eid bigint references exchanges(exchangeid) ON DELETE CASCADE, - PRIMARY KEY (qrouteid) -); - -CREATE TABLE exchangeroutes( - erouteid SERIAL, - fromhost bigint references hosts(hostid) ON DELETE CASCADE, - tohost bigint references hosts(hostid) ON DELETE CASCADE, - eid bigint references exchanges(exchangeid) ON DELETE CASCADE, - dynamic bool default false, - routingkey varchar(512) default '#', - PRIMARY KEY (erouteid) -); - -CREATE TABLE queuelistener( - qlistenid SERIAL, - fromhost bigint references hosts(hostid) ON DELETE CASCADE, - eid bigint references exchanges(exchangeid) ON DELETE CASCADE, - qid bigint references queues(queueid) ON DELETE CASCADE, - subject varchar(512) NOT NULL, - PRIMARY KEY (qlistenid) -); - -COMMIT; diff --git a/SAS/QPIDInfrastructure/test/test_qpid_database.sh b/SAS/QPIDInfrastructure/test/test_qpid_database.sh deleted file mode 100755 index 91e0ff214d63c4d8c4981e915dc1e8a2df7eb9c5..0000000000000000000000000000000000000000 --- a/SAS/QPIDInfrastructure/test/test_qpid_database.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - - -QUEUES=`echo "select hostname,queuename from persistentqueues INNER join hosts on (hid=hostid) INNER JOIN queues on (qid=queueid);" | psql qpidinfra` -EXCHANGES=`echo "select hostname,exchangename from persistentexchanges INNER join hosts on (hid=hostid) INNER JOIN exchanges on (eid=exchangeid);" | psql qpidinfra` -QUEUEANS=" hostname | queuename -----------------------+------------------ - scu001.control.lofar | TreeStatus - scu001.control.lofar | TaskSpecified - scu001.control.lofar | ResourceAssigner -(3 rows)" - -EXCHANS=" hostname | exchangename -----------------------+------------------------- - scu001.control.lofar | lofar.ra.command - scu001.control.lofar | lofar.ra.notification - scu001.control.lofar | lofar.otdb.command - scu001.control.lofar | lofar.otdb.notification - scu001.control.lofar | lofar.sm.command - scu001.control.lofar | lofar.sm.notification - scu001.control.lofar | lofar.mom.command - scu001.control.lofar | lofar.mom.notification -(8 rows)" - - -ret=0 -if [ "$QUEUES" != "$QUEUEANS" ] -then - echo "Queues failed test" - ret=1 -else - echo "Queues test passed" -fi - -if [ "$EXCHANGES" != "$EXCHANS" ] -then - echo "Exchanges failed test" - ret=1 -else - echo "Exchanges test passed" -fi - -exit $ret - - - -