qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgoul...@apache.org
Subject svn commit: r1075452 - in /qpid/trunk/qpid: cpp/src/tests/ tools/src/py/
Date Mon, 28 Feb 2011 18:00:11 GMT
Author: mgoulish
Date: Mon Feb 28 18:00:10 2011
New Revision: 1075452

URL: http://svn.apache.org/viewvc?rev=1075452&view=rev
Log:
What was a single test -- sasl_fed_ex -- is now
4 tests with a common core.  They are:

  sasl_fed_ex_dynamic
  sasl_fed_ex_link
  sasl_fed_ex_queue
  sasl_fed_ex_route 

( and the common core is sasl_fed_ex )

These tests correspond to the 4 different ways that the 
qpid-route command has of making links, or links+routes.
All those pathways have to be modified so that the new
"mechanism" argument information can be passed down and
used -- so that you can specify a SASL mechnism to be
used on the interbroker link that you create.

( So -- the qpid-route command also had to be modified
to propagate the mechanism info with all 4 subcommands. )

Since the SASL mechanism is owned by the link, these 
tests check that the link comes up and becomes operational.

Finally, I modified the sasl-mechanism flag in qpid-route
to call it "client-sasl-mechanism" to better distinguish 
between the SASL mechanism used in the created route -- and
the SASL mechanism (if any) that is used when the qpid-route 
client itself connects to the broker that it is talking to.


Added:
    qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic
    qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link
    qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue
    qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route
Modified:
    qpid/trunk/qpid/cpp/src/tests/cli_tests.py
    qpid/trunk/qpid/cpp/src/tests/sasl.mk
    qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex
    qpid/trunk/qpid/tools/src/py/qpid-route

Modified: qpid/trunk/qpid/cpp/src/tests/cli_tests.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/cli_tests.py?rev=1075452&r1=1075451&r2=1075452&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/cli_tests.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/cli_tests.py Mon Feb 28 18:00:10 2011
@@ -425,7 +425,7 @@ class CliTests(TestBase010):
         qmf = self.qmf
 
         ret = self.qpid_route_api("dynamic add "
-                                  + " --sasl-mechanism PLAIN "
+                                  + " --client-sasl-mechanism PLAIN "
                                   + "guest/guest@localhost:"+str(self.broker.port) + " "
                                   + str(self.remote_host())+":"+str(self.remote_port()) +
" "
                                   +"amq.direct")
@@ -444,7 +444,7 @@ class CliTests(TestBase010):
         qmf = self.qmf
 
         ret = self.qpid_route_api("dynamic add "
-                                  + " --sasl-mechanism PLAIN "
+                                  + " --client-sasl-mechanism PLAIN "
                                   + "localhost:"+str(self.broker.port) + " "
                                   + str(self.remote_host())+":"+str(self.remote_port()) +
" "
                                   +"amq.direct")

Modified: qpid/trunk/qpid/cpp/src/tests/sasl.mk
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl.mk?rev=1075452&r1=1075451&r2=1075452&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/sasl.mk (original)
+++ qpid/trunk/qpid/cpp/src/tests/sasl.mk Mon Feb 28 18:00:10 2011
@@ -30,9 +30,9 @@ check_PROGRAMS+=sasl_version
 sasl_version_SOURCES=sasl_version.cpp
 sasl_version_LDADD=$(lib_client)
 
-TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex
+TESTS += run_cluster_authentication_test sasl_fed sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue
sasl_fed_ex_route
 LONG_TESTS += run_cluster_authentication_soak
-EXTRA_DIST += run_cluster_authentication_test sasl_fed sasl_fed_ex run_cluster_authentication_soak
+EXTRA_DIST += run_cluster_authentication_test sasl_fed sasl_fed_ex run_cluster_authentication_soak
sasl_fed_ex_dynamic sasl_fed_ex_link sasl_fed_ex_queue sasl_fed_ex_route
 
 
 endif # HAVE_SASL

Modified: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex?rev=1075452&r1=1075451&r2=1075452&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex (original)
+++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex Mon Feb 28 18:00:10 2011
@@ -21,20 +21,43 @@
 
 
 #===============================================================================
-# This test creates a federated link between two brokers using SASL security.
+# These tests create federated links between two brokers using SASL security.
 # The SASL mechanism used is EXTERNAL, which is satisfied by SSL
 # transport-layer security.
 #===============================================================================
 
 source ./test_env.sh
 
+script_name=`basename $0`
+
+if [ $# -ne 1 ]
+then
+  echo
+  # These are the four different ways of creating links ( or routes+links ) 
+  # that the qpid-route command provides.
+  echo "Usage: ${script_name} dynamic|link|queue|route"
+  echo
+  exit 1
+fi
+
+qpid_route_method=$1
+
+debug=
+
+function print {
+  if [ "$debug" ]; then
+    echo "${script_name}: $1"
+  fi
+}
+
+
 
 # This minimum value corresponds to sasl version 2.1.22
 minimum_sasl_version=131350
 
 sasl_version=`$QPID_TEST_EXEC_DIR/sasl_version`
 
-# This test is necessary becasue this sasl version is the first one that permits 
+# This test is necessary because this sasl version is the first one that permits 
 # redirection of the sasl config file path.
 if [ "$sasl_version" -lt  "$minimum_sasl_version" ]; then
   echo "sasl_fed: must have sasl version 2.1.22 or greater.  ( Integer value: $minimum_sasl_version
)  Version is: $sasl_version"
@@ -118,9 +141,7 @@ export QPID_SSL_CERT_NAME=${TEST_HOSTNAM
 
 
 
-#echo "-----------------------"
-#echo "Starting SRC broker"
-#echo "-----------------------"
+print "Starting SRC broker"
 $QPIDD_EXEC                                  \
   --port=${SRC_TCP_PORT}                     \
   --ssl-port ${SRC_SSL_PORT}                 \
@@ -141,9 +162,7 @@ $QPIDD_EXEC                             
   --log-to-file $tmp_root/qpidd_src.log 2> /dev/null
 
 
-#echo "-----------------------"
-#echo "Starting DST broker"
-#echo "-----------------------"
+print "Starting DST broker"
 $QPIDD_EXEC                                  \
   --port=${DST_TCP_PORT}                     \
   --ssl-port ${DST_SSL_PORT}                 \
@@ -170,76 +189,75 @@ ROUTING_KEY=sasl_fed_queue
 EXCHANGE_NAME=sasl_fedex
 
 
-#echo "-----------------------"
-#echo "add exchanges"
-#echo "-----------------------"
+print "add exchanges"
 $QPID_CONFIG_EXEC -a localhost:${SRC_TCP_PORT} add exchange direct $EXCHANGE_NAME
 $QPID_CONFIG_EXEC -a localhost:${DST_TCP_PORT} add exchange direct $EXCHANGE_NAME
 
 
-#echo "-----------------------"
-#echo "add queues"
-#echo "-----------------------"
+print "add queues"
 $QPID_CONFIG_EXEC -a localhost:${SRC_TCP_PORT} add queue $QUEUE_NAME
 $QPID_CONFIG_EXEC -a localhost:${DST_TCP_PORT} add queue $QUEUE_NAME
 
 
-#echo "-----------------------"
-#echo "create bindings"
-#echo "-----------------------"
+print "create bindings"
 $QPID_CONFIG_EXEC -a localhost:${SRC_TCP_PORT} bind $EXCHANGE_NAME $QUEUE_NAME $ROUTING_KEY
 $QPID_CONFIG_EXEC -a localhost:${DST_TCP_PORT} bind $EXCHANGE_NAME $QUEUE_NAME $ROUTING_KEY
 
 
-#echo "-----------------------"
-#echo "qpid-route route add"
-#echo "-----------------------"
+#
 # NOTE: The SRC broker *must* be referred to as $TEST_HOSTNAME, and not as "localhost".
 #       It must be referred to by the exact string given as the Common Name (CN) in the cert,
 #       which was created in the function create_certs, above.
-$QPID_ROUTE_EXEC route add localhost:${DST_TCP_PORT}   $TEST_HOSTNAME:${SRC_SSL_PORT} -t
ssl $EXCHANGE_NAME $ROUTING_KEY "" "" EXTERNAL
 
-#echo "-----------------------"
-#echo "view the route :"
-#echo "-----------------------"
-#$PYTHON_COMMANDS/qpid-route route list localhost:${DST_TCP_PORT} 
 
-# I don't know how to avoid this sleep yet.  It has to come after route-creation.
-sleep 5
-
-n_messages=100
 
-./datagen --count ${n_messages} | ./sender --broker localhost --port ${SRC_TCP_PORT} --exchange
${EXCHANGE_NAME} --routing-key ${ROUTING_KEY} --mechanism ANONYMOUS
+if   [ ${qpid_route_method} == "dynamic" ]; then
+  print "dynamic add"
+  $QPID_ROUTE_EXEC -t ssl dynamic add localhost:${DST_TCP_PORT} $TEST_HOSTNAME:${SRC_SSL_PORT}
$EXCHANGE_NAME "" "" EXTERNAL
+elif [ ${qpid_route_method} == "link"   ];  then
+  print "link add"
+  $QPID_ROUTE_EXEC -t ssl link add localhost:${DST_TCP_PORT} $TEST_HOSTNAME:${SRC_SSL_PORT}
 EXTERNAL
+elif [ ${qpid_route_method} == "queue" ];   then
+  print "queue add"
+  $QPID_ROUTE_EXEC -t ssl queue add localhost:${DST_TCP_PORT}   $TEST_HOSTNAME:${SRC_SSL_PORT}
$EXCHANGE_NAME $ROUTING_KEY EXTERNAL
+elif [ ${qpid_route_method} == "route" ];   then
+  print "route add"
+  $QPID_ROUTE_EXEC -t ssl route add localhost:${DST_TCP_PORT}   $TEST_HOSTNAME:${SRC_SSL_PORT}
$EXCHANGE_NAME $ROUTING_KEY "" "" EXTERNAL
+else
+  echo "unknown method: |${qpid_route_method}|"
+  echo " choices are: dynamic|link|queue|route "
+  print "Asking brokers to quit."
+  $QPIDD_EXEC --port ${SRC_TCP_PORT} --quit
+  $QPIDD_EXEC --port ${DST_TCP_PORT} --quit
+  exit 2
+fi
 
+# I don't know how to avoid this sleep yet.  It has to come after route-creation 
+# to avoid false negatives.
+sleep 5
 
-#echo "-----------------------"
-#echo "Examine DST Broker"
-#echo "-----------------------"
-dst_message_count=`qpid-stat -q localhost:${DST_TCP_PORT} | grep sasl_fed_queue | awk '{print
$2}'`
+print "check the link"
+link_status=$($QPID_ROUTE_EXEC link list localhost:${DST_TCP_PORT} | tail -1 | awk '{print
$5}')
+print "link_status == ${link_status}"
 
 
-#echo "-----------------------"
-#echo "Asking brokers to quit."
-#echo "-----------------------"
+print "Asking brokers to quit."
 $QPIDD_EXEC --port ${SRC_TCP_PORT} --quit
 $QPIDD_EXEC --port ${DST_TCP_PORT} --quit
 
+sleep 1
 
-#echo "-----------------------"
-#echo   "Removing temporary directory $tmp_root"
-#echo "-----------------------"
+print "Removing temporary directory $tmp_root"
 rm -rf $tmp_root
 
-if [ "$dst_message_count" -eq  "$n_messages" ]; then
-  #echo "good: |$dst_message_count| == |$n_messages|"
+
+if [ ${link_status} == "Operational" ]; then
+  print "result: good"
   exit 0
-else
-   #echo "not ideal: |$dst_message_count| != |$n_messages|"
-  exit 1
 fi
 
-
-
+print "result: fail"
+exit 3
 
 
 

Added: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic?rev=1075452&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic (added)
+++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_dynamic Mon Feb 28 18:00:10 2011
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+source ./test_env.sh
+
+${srcdir}/sasl_fed_ex dynamic
+
+

Added: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link?rev=1075452&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link (added)
+++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_link Mon Feb 28 18:00:10 2011
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+source ./test_env.sh
+
+${srcdir}/sasl_fed_ex link
+
+

Added: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue?rev=1075452&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue (added)
+++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_queue Mon Feb 28 18:00:10 2011
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+source ./test_env.sh
+
+${srcdir}/sasl_fed_ex queue
+
+

Added: qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route?rev=1075452&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route (added)
+++ qpid/trunk/qpid/cpp/src/tests/sasl_fed_ex_route Mon Feb 28 18:00:10 2011
@@ -0,0 +1,27 @@
+#! /bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
+source ./test_env.sh
+
+${srcdir}/sasl_fed_ex route
+
+

Modified: qpid/trunk/qpid/tools/src/py/qpid-route
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-route?rev=1075452&r1=1075451&r2=1075452&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-route (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-route Mon Feb 28 18:00:10 2011
@@ -27,18 +27,18 @@ import locale
 from qmf.console import Session, BrokerURL
 
 usage = """
-Usage:  qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker> <exchange>
[tag] [exclude-list]
+Usage:  qpid-route [OPTIONS] dynamic add <dest-broker> <src-broker> <exchange>
[tag] [exclude-list] [mechanism]
         qpid-route [OPTIONS] dynamic del <dest-broker> <src-broker> <exchange>
 
         qpid-route [OPTIONS] route add   <dest-broker> <src-broker> <exchange>
<routing-key> [tag] [exclude-list] [mechanism]
         qpid-route [OPTIONS] route del   <dest-broker> <src-broker> <exchange>
<routing-key>
-        qpid-route [OPTIONS] queue add   <dest-broker> <src-broker> <exchange>
<queue>
+        qpid-route [OPTIONS] queue add   <dest-broker> <src-broker> <exchange>
<queue> [mechanism]
         qpid-route [OPTIONS] queue del   <dest-broker> <src-broker> <exchange>
<queue>
         qpid-route [OPTIONS] route list  [<dest-broker>]
         qpid-route [OPTIONS] route flush [<dest-broker>]
         qpid-route [OPTIONS] route map   [<broker>]
 
-        qpid-route [OPTIONS] link add  <dest-broker> <src-broker>
+        qpid-route [OPTIONS] link add  <dest-broker> <src-broker> [mechanism]
         qpid-route [OPTIONS] link del  <dest-broker> <src-broker>
         qpid-route [OPTIONS] link list [<dest-broker>]"""
 
@@ -61,7 +61,7 @@ class Config:
         self._transport = "tcp"
         self._ack       = 0
         self._connTimeout = 10
-        self._sasl_mechanism = None
+        self._client_sasl_mechanism = None
 
 config = Config()
 
@@ -95,7 +95,7 @@ def OptionsAndArguments(argv):
     parser.add_option("--ack", action="store", type="int", metavar="<n>", help="Acknowledge
transfers over the bridge in batches of N")
     parser.add_option("-t", "--transport", action="store", type="string", default="tcp",
metavar="<transport>", help="Transport to use for links, defaults to tcp")
 
-    parser.add_option("--sasl-mechanism", action="store", type="string", metavar="<mech>",
help="SASL mechanism for authentication (e.g. EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5,
GSSAPI). Used when the client connects to the destination broker (not for authentication between
the source and destination brokers - that is specified using the [mechanisms] argument to
'add route'). SASL automatically picks the most secure available mechanism - use this option
to override.")
+    parser.add_option("--client-sasl-mechanism", action="store", type="string", metavar="<mech>",
help="SASL mechanism for authentication (e.g. EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5,
GSSAPI). Used when the client connects to the destination broker (not for authentication between
the source and destination brokers - that is specified using the [mechanisms] argument to
'add route'). SASL automatically picks the most secure available mechanism - use this option
to override.")
 
     opts, encArgs = parser.parse_args(args=argv)
 
@@ -131,8 +131,8 @@ def OptionsAndArguments(argv):
     if opts.ack:
         config._ack = opts.ack
 
-    if opts.sasl_mechanism:
-        config._sasl_mechanism = opts.sasl_mechanism
+    if opts.client_sasl_mechanism:
+        config._client_sasl_mechanism = opts.client_sasl_mechanism
 
     return args
 
@@ -143,7 +143,7 @@ class RouteManager:
         self.local = BrokerURL(localBroker)
         self.remote  = None
         self.qmf = Session()
-        self.broker = self.qmf.addBroker(localBroker, config._connTimeout, config._sasl_mechanism)
+        self.broker = self.qmf.addBroker(localBroker, config._connTimeout, config._client_sasl_mechanism)
         self.broker._waitForStable()
         self.agent = self.broker.getBrokerAgent()
 
@@ -166,7 +166,7 @@ class RouteManager:
                 return link
         return None
 
-    def addLink(self, remoteBroker, mech="PLAIN"):
+    def addLink(self, remoteBroker, interbroker_mechanism=""):
         self.remote = BrokerURL(remoteBroker)
         if self.local.match(self.remote.host, self.remote.port):
             raise Exception("Linking broker to itself is not permitted")
@@ -176,7 +176,7 @@ class RouteManager:
         link = self.getLink()
         if link == None:
             res = broker.connect(self.remote.host, self.remote.port, config._durable,
-                                 mech, self.remote.authName or "", self.remote.authPass or
"",
+                                 interbroker_mechanism, self.remote.authName or "", self.remote.authPass
or "",
                                  config._transport)
             if config._verbose:
                 print "Connect method returned:", res.status, res.text
@@ -295,11 +295,11 @@ class RouteManager:
             if b[0] != self.local.name():
                 self.qmf.delBroker(b[1])
 
-    def addRoute(self, remoteBroker, exchange, routingKey, tag, excludes, mech="PLAIN", dynamic=False):
+    def addRoute(self, remoteBroker, exchange, routingKey, tag, excludes, interbroker_mechanism="",
dynamic=False):
         if dynamic and config._srclocal:
             raise Exception("--src-local is not permitted on dynamic routes")
 
-        self.addLink(remoteBroker, mech)
+        self.addLink(remoteBroker, interbroker_mechanism)
         link = self.getLink()
         if link == None:
             raise Exception("Link failed to create")
@@ -320,8 +320,8 @@ class RouteManager:
         if config._verbose:
             print "Bridge method returned:", res.status, res.text
 
-    def addQueueRoute(self, remoteBroker, exchange, queue):
-        self.addLink(remoteBroker)
+    def addQueueRoute(self, remoteBroker, interbroker_mechanism, exchange, queue ):
+        self.addLink(remoteBroker, interbroker_mechanism)
         link = self.getLink()
         if link == None:
             raise Exception("Link failed to create")
@@ -504,10 +504,12 @@ def main(argv=None):
         rm = RouteManager(localBroker)
         if group == "link":
             if cmd == "add":
-                if nargs != 4:
+                if nargs < 3 or nargs > 5:
                     Usage()
                     return(-1)
-                rm.addLink(remoteBroker)
+                interbroker_mechanism = ""
+                if nargs > 4: interbroker_mechanism = args[4]
+                rm.addLink(remoteBroker, interbroker_mechanism)
             elif cmd == "del":
                 if nargs != 4:
                     Usage()
@@ -518,16 +520,17 @@ def main(argv=None):
 
         elif group == "dynamic":
             if cmd == "add":
-                if nargs < 5 or nargs > 7:
+                if nargs < 5 or nargs > 8:
                     Usage()
                     return(-1)
 
                 tag = ""
                 excludes = ""
-                mech = "PLAIN"
+                interbroker_mechanism = ""
                 if nargs > 5: tag = args[5]
                 if nargs > 6: excludes = args[6]
-                rm.addRoute(remoteBroker, args[4], "", tag, excludes, mech, dynamic=True)
+                if nargs > 7: interbroker_mechanism = args[7]
+                rm.addRoute(remoteBroker, args[4], "", tag, excludes, interbroker_mechanism,
dynamic=True)
             elif cmd == "del":
                 if nargs != 5:
                     Usage()
@@ -543,11 +546,11 @@ def main(argv=None):
 
                 tag = ""
                 excludes = ""
-                mech = "PLAIN"
+                interbroker_mechanism = ""
                 if nargs > 6: tag = args[6]
                 if nargs > 7: excludes = args[7]
-                if nargs > 8: mech = args[8]
-                rm.addRoute(remoteBroker, args[4], args[5], tag, excludes, mech, dynamic=False)
+                if nargs > 8: interbroker_mechanism = args[8]
+                rm.addRoute(remoteBroker, args[4], args[5], tag, excludes, interbroker_mechanism,
dynamic=False)
             elif cmd == "del":
                 if nargs != 6:
                     Usage()
@@ -565,11 +568,13 @@ def main(argv=None):
                     return(-1)
 
         elif group == "queue":
-            if nargs != 6:
+            if nargs < 6 or nargs > 7:
                 Usage()
                 return(-1)
             if cmd == "add":
-                rm.addQueueRoute(remoteBroker, exchange=args[4], queue=args[5])
+                interbroker_mechanism = ""
+                if nargs > 6: interbroker_mechanism = args[6]
+                rm.addQueueRoute(remoteBroker, interbroker_mechanism, exchange=args[4], queue=args[5]
)
             elif cmd == "del":
                 rm.delQueueRoute(remoteBroker, exchange=args[4], queue=args[5])
             else:



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message