Update messaging intermediaries for amqp1 tests

This patch messaging intermediaries used for the amqp1 driver
test. The combination of the apache qpid-dispatch-router (qdrouterd)
with an attached apache artemis broker is used in place of the qpidd
broker. The qdrouterd will directly message oslo.messaging rpc
communications and will link route oslo.messaging notify
communications to the artemis broker (e.g. for persistence).

This patch:
* updates the dependencies
* updates the test environment setup
* uses the pifpaf drivers to create servers

Change-Id: I9fb56450346fca84bc1573fa5e9b6fe81c14e33a
This commit is contained in:
Andy Smith 2018-12-13 12:59:50 -05:00
parent 472d483942
commit 8897e1584f
6 changed files with 28 additions and 210 deletions

View File

@ -15,20 +15,21 @@ rabbitmq-server [platform:dpkg rabbit]
rabbitmq-server [platform:rpm rabbit] rabbitmq-server [platform:rpm rabbit]
# AMQP1 dpkg # AMQP1 dpkg
qpidd [platform:dpkg amqp1] qdrouterd [platform:dpkg amqp1]
sasl2-bin [platform:dpkg amqp1] sasl2-bin [platform:dpkg amqp1]
uuid-dev [platform:dpkg amqp1] uuid-dev [platform:dpkg amqp1]
swig [platform:dpkg amqp1] swig [platform:dpkg amqp1]
libsasl2-modules [platform:dpkg amqp1] libsasl2-modules [platform:dpkg amqp1]
openjdk-8-jdk [platform:dpkg amqp1]
# AMQP1 rpm # AMQP1 rpm
qpid-cpp-server [platform:rpm amqp1] qpid-dispatch-router [platform:rpm amqp1]
qpid-proton-c-devel [platform:rpm amqp1]
python-qpid-proton [platform:rpm amqp1] python-qpid-proton [platform:rpm amqp1]
cyrus-sasl-lib [platform:rpm amqp1] cyrus-sasl-lib [platform:rpm amqp1]
cyrus-sasl-plain [platform:rpm amqp1] cyrus-sasl-plain [platform:rpm amqp1]
libuuid-devel [platform:rpm amqp1] libuuid-devel [platform:rpm amqp1]
swig [platform:rpm amqp1] swig [platform:rpm amqp1]
java-1.8.0-openjdk [platform:rpm amqp1]
# kafka dpkg # kafka dpkg
openjdk-8-jdk [platform:dpkg kafka] openjdk-8-jdk [platform:dpkg kafka]

View File

@ -54,7 +54,7 @@ Paste==2.0.2
PasteDeploy==1.5.0 PasteDeploy==1.5.0
pbr==2.0.0 pbr==2.0.0
pep8==1.5.7 pep8==1.5.7
pifpaf==0.10.0 pifpaf==2.2.0
prettytable==0.7.2 prettytable==0.7.2
pycparser==2.18 pycparser==2.18
pyflakes==0.8.1 pyflakes==0.8.1

View File

@ -35,7 +35,6 @@ that traffic can be partitioned based on its use.
import abc import abc
import logging import logging
from oslo_messaging._i18n import _LW
from oslo_messaging.target import Target from oslo_messaging.target import Target
__all__ = [ __all__ = [
@ -276,15 +275,6 @@ class AddresserFactory(object):
# overridden via the configuration. # overridden via the configuration.
product = remote_properties.get('product', 'qpid-cpp') product = remote_properties.get('product', 'qpid-cpp')
# TODO(kgiusti): Router support was added in Newton. Remove this
# warning post Newton, once the driver has stabilized.
if product == "qpid-dispatch-router":
w = _LW("This is the initial release of support for message"
" routing technology. Be aware that messages are not"
" queued and may be discarded if there are no consumers"
" present.")
LOG.warning(w)
if self._mode == 'legacy' or (self._mode == 'dynamic' and if self._mode == 'legacy' or (self._mode == 'dynamic' and
product == 'qpid-cpp'): product == 'qpid-cpp'):
return LegacyAddresser(self._default_exchange, return LegacyAddresser(self._default_exchange,

View File

@ -11,7 +11,7 @@ stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
pifpaf>=0.10.0 # Apache-2.0 pifpaf>=2.2.0 # Apache-2.0
# for test_impl_kafka # for test_impl_kafka
confluent-kafka>=0.11.6 # Apache-2.0 confluent-kafka>=0.11.6 # Apache-2.0

View File

@ -1,212 +1,41 @@
#!/bin/bash #!/bin/bash
# #
# Usage: setup-test-env-amqp.sh <command to run> # Configuration files for the qdrouterd and artemis backends generated
# where AMQP1_BACKEND is the AMQP 1.0 intermediary to use. Valid # by pifpaf driver fixtures (https://github.com/jd/pifpaf)
# values are "qdrouterd" for router and "qpidd" for broker.
set -e set -e
# router requires qdrouterd, sasl2-bin/cyrus-sasl-plain+cyrus-sasl-lib
# broker requires qpidd, qpid-tools sasl2-bin/cyrus-sasl-plain+cyrus-sasl-lib
. tools/functions.sh . tools/functions.sh
DATADIR=$(mktemp -d /tmp/OSLOMSG-${AMQP1_BACKEND}.XXXXX) ARTEMIS_VERSION=${ARTEMIS_VERSION:-"2.6.4"}
trap "clean_exit $DATADIR" EXIT
function _setup_qdrouterd_user { if [[ -z "$(which artemis)" ]]; then
echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qdrouterd.sasldb stackqpid DATADIR=$(mktemp -d /tmp/OSLOMSG-ARTEMIS.XXXXX)
} trap "clean_exit $DATADIR" EXIT
function _setup_qpidd_user { tarball=apache-artemis-${ARTEMIS_VERSION}-bin.tar.gz
echo secretqpid | saslpasswd2 -c -p -f ${DATADIR}/qpidd.sasldb -u QPID stackqpid
}
function _configure_qdrouterd { wget http://archive.apache.org/dist/activemq/activemq-artemis/${ARTEMIS_VERSION}/$tarball -O $DATADIR/$tarball
tar -xzf $DATADIR/$tarball -C $DATADIR
QDR=$(type -p qdrouterd) export PATH=$DATADIR/apache-artemis-${ARTEMIS_VERSION}/bin:$PATH
if [[ ! -x "$QDR" ]]; then
echo "FAILURE: Qpid Dispatch Router (qdrouterd) not installed"
exit 1
fi
# create a stand alone router
cat > ${DATADIR}/qdrouterd.conf <<EOF
router {
mode: standalone
id: Router.A
workerThreads: 4
saslConfigPath: ${DATADIR}/sasl2
saslConfigName: qdrouterd
}
EOF
# create a listener for incoming connect to the router
# ip address field name changed to 'host' at 1.0+
local field_name
field_name=$([[ $($QDR -v) == 0.*.* ]] && echo addr || echo host)
cat >> ${DATADIR}/qdrouterd.conf <<EOF
listener {
${field_name}: 0.0.0.0
port: 65123
role: normal
authenticatePeer: yes
}
EOF
# create fixed address prefixes
cat >> ${DATADIR}/qdrouterd.conf <<EOF
address {
prefix: unicast
distribution: closest
}
address {
prefix: exclusive
distribution: closest
}
address {
prefix: broadcast
distribution: multicast
}
address {
prefix: openstack.org/om/rpc/multicast
distribution: multicast
}
address {
prefix: openstack.org/om/rpc/unicast
distribution: closest
}
address {
prefix: openstack.org/om/rpc/anycast
distribution: balanced
}
address {
prefix: openstack.org/om/notify/multicast
distribution: multicast
}
address {
prefix: openstack.org/om/notify/unicast
distribution: closest
}
address {
prefix: openstack.org/om/notify/anycast
distribution: balanced
}
EOF
# create log file configuration
cat >> ${DATADIR}/qdrouterd.conf <<EOF
log {
module: DEFAULT
enable: trace+
output: ${DATADIR}/out
}
EOF
# sasl2 config
mkdir -p ${DATADIR}/sasl2
cat > ${DATADIR}/sasl2/qdrouterd.conf <<EOF
pwcheck_method: auxprop
auxprop_plugin: sasldb
sasldb_path: ${DATADIR}/qdrouterd.sasldb
mech_list: PLAIN ANONYMOUS
EOF
}
function _configure_qpidd {
QPIDD=$(which qpidd 2>/dev/null)
if [[ ! -x "$QPIDD" ]]; then
echo "FAILURE: qpidd broker not installed"
exit 1
fi
[ -f "/usr/lib/qpid/daemon/acl.so" ] && LIBACL="load-module=/usr/lib/qpid/daemon/acl.so"
cat > ${DATADIR}/qpidd.conf <<EOF
port=65123
sasl-config=${DATADIR}/sasl2
${LIBACL}
mgmt-enable=yes
log-to-stderr=no
data-dir=${DATADIR}/.qpidd
pid-dir=${DATADIR}/.qpidd
EOF
if ! `$QPIDD --help | grep -q "sasl-service-name"`; then
echo "This version of $QPIDD does not support SASL authentication with AMQP 1.0"
cat >> ${DATADIR}/qpidd.conf <<EOF
auth=no
EOF
else
cat >> ${DATADIR}/qpidd.conf <<EOF
auth=yes
acl-file=${DATADIR}/qpidd.acl
sasl-service-name=amqp
EOF
fi fi
cat >> ${DATADIR}/qpidd.conf <<EOF # TODO(ansmith) look to move this to pifpaf driver
queue-patterns=exclusive function _setup_global_site_package_path {
queue-patterns=unicast
topic-patterns=broadcast
EOF
cat > ${DATADIR}/qpidd.acl <<EOF
group admin stackqpid@QPID
acl allow admin all
acl deny all all
EOF
mkdir -p ${DATADIR}/sasl2
cat > ${DATADIR}/sasl2/qpidd.conf <<EOF
pwcheck_method: auxprop
auxprop_plugin: sasldb
sasldb_path: ${DATADIR}/qpidd.sasldb
mech_list: PLAIN ANONYMOUS
sql_select: dummy select
EOF
}
function _start_qdrouterd {
MAJOR=$(python -c 'import sys; print(sys.version_info.major)') MAJOR=$(python -c 'import sys; print(sys.version_info.major)')
MINOR=$(python -c 'import sys; print(sys.version_info.minor)') MINOR=$(python -c 'import sys; print(sys.version_info.minor)')
if [ -f "/etc/debian_version" ]; then
PRE="dist"
else
PRE="site"
fi
# qdrouterd needs access to global site packages # qdrouterd needs access to global site packages
# create path file and place in virtual env working directory # create path file and place in virtual env working directory
SITEDIR=${WORKDIR}/${ENVNAME}/lib/python${MAJOR}.${MINOR}/site-packages SITEDIR=${WORKDIR}/${ENVNAME}/lib/python${MAJOR}.${MINOR}/site-packages
cat > ${SITEDIR}/dispatch.pth <<EOF cat > ${SITEDIR}/dispatch.pth <<EOF
/usr/lib/python${MAJOR}.${MINOR}/site-packages /usr/lib/python${MAJOR}.${MINOR}/${PRE}-packages
EOF EOF
QDR=$(which qdrouterd 2>/dev/null)
mkfifo ${DATADIR}/out
$QDR --config ${DATADIR}/qdrouterd.conf &
wait_for_line "Router .*started" "error" ${DATADIR}/out
rm ${SITEDIR}/dispatch.pth
} }
function _start_qpidd { _setup_global_site_package_path
chmod -R a+r ${DATADIR} pifpaf --env-prefix ARTEMIS run artemis -- pifpaf --debug --env-prefix QDR run qdrouterd --username stackqpid --password secretqpid -- $*
QPIDD=$(which qpidd 2>/dev/null)
mkfifo ${DATADIR}/out
$QPIDD --log-enable trace+ --log-to-file ${DATADIR}/out --config ${DATADIR}/qpidd.conf &
wait_for_line "Broker .*running" "error" ${DATADIR}/out
}
_configure_${AMQP1_BACKEND}
_setup_${AMQP1_BACKEND}_user
_start_${AMQP1_BACKEND}
$*

View File

@ -67,8 +67,7 @@ commands = {toxinidir}/setup-test-env-kafka.sh stestr run --slowest {posargs:osl
basepython = python2.7 basepython = python2.7
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:65123// TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:5672//
AMQP1_BACKEND=qpidd
ENVNAME={envname} ENVNAME={envname}
WORKDIR={toxworkdir} WORKDIR={toxworkdir}
commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posargs:oslo_messaging.tests.functional} commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posargs:oslo_messaging.tests.functional}
@ -77,8 +76,7 @@ commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posar
basepython = python3.5 basepython = python3.5
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:65123// TRANSPORT_URL=amqp://stackqpid:secretqpid@127.0.0.1:5672//
AMQP1_BACKEND=qpidd
ENVNAME={envname} ENVNAME={envname}
WORKDIR={toxworkdir} WORKDIR={toxworkdir}
commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posargs:oslo_messaging.tests.functional} commands = {toxinidir}/tools/setup-test-env-amqp1.sh stestr run --slowest {posargs:oslo_messaging.tests.functional}