You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2016/03/19 00:07:00 UTC

[42/50] [abbrv] qpid-dispatch git commit: Merge branch 'tross-DISPATCH-179-1'

Merge branch 'tross-DISPATCH-179-1'

Conflicts:
	include/qpid/dispatch/container.h
	include/qpid/dispatch/ctools.h
	include/qpid/dispatch/server.h
	python/qpid_dispatch_internal/management/agent.py
	src/connection_manager.c
	src/container.c
	src/router_config.c
	src/router_node.c
	src/router_pynode.c
	tests/system_tests_qdmanage.py


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/215b5864
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/215b5864
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/215b5864

Branch: refs/heads/master
Commit: 215b5864b778e9c1817bc05e62a7e00985fee286
Parents: c6ccf1e 620d779
Author: Ted Ross <tr...@redhat.com>
Authored: Fri Mar 18 09:43:14 2016 -0400
Committer: Ted Ross <tr...@redhat.com>
Committed: Fri Mar 18 09:43:14 2016 -0400

----------------------------------------------------------------------
 CMakeLists.txt                                  |    2 +-
 etc/qdrouterd.conf                              |    7 +
 include/qpid/dispatch.h                         |    1 +
 include/qpid/dispatch/amqp.h                    |    5 +-
 include/qpid/dispatch/bitmask.h                 |   10 +-
 include/qpid/dispatch/connection_manager.h      |   11 +
 include/qpid/dispatch/container.h               |   10 +-
 include/qpid/dispatch/ctools.h                  |    1 +
 include/qpid/dispatch/iterator.h                |    9 +
 include/qpid/dispatch/message.h                 |    2 +-
 include/qpid/dispatch/parse.h                   |    8 +
 include/qpid/dispatch/router.h                  |   78 +-
 include/qpid/dispatch/router_core.h             |  645 ++++++
 include/qpid/dispatch/server.h                  |    5 +
 include/qpid/dispatch/trace_mask.h              |   97 +
 python/qpid_dispatch/management/qdrouter.json   |  266 ++-
 python/qpid_dispatch_internal/dispatch.py       |   15 +-
 .../qpid_dispatch_internal/management/agent.py  |  105 +-
 .../qpid_dispatch_internal/management/config.py |    7 +-
 python/qpid_dispatch_internal/router/engine.py  |   11 +-
 python/qpid_dispatch_internal/router/node.py    |    5 +-
 src/CMakeLists.txt                              |   21 +-
 src/amqp.c                                      |    5 +-
 src/bitmask.c                                   |   75 +-
 src/connection_manager.c                        |  101 +-
 src/container.c                                 |   79 +-
 src/dispatch.c                                  |   22 +-
 src/dispatch_private.h                          |    5 +
 src/iterator.c                                  |   33 +-
 src/lrp.c                                       |   22 +-
 src/message.c                                   |    4 +-
 src/parse.c                                     |   21 +
 src/python_embedded.c                           |   61 +-
 src/router_agent.c                              |   76 +-
 src/router_config.c                             |  536 +++--
 src/router_core/DESIGN                          |  264 +++
 src/router_core/agent.c                         |  437 ++++
 src/router_core/agent_address.c                 |  295 +++
 src/router_core/agent_address.h                 |   38 +
 src/router_core/agent_config_address.c          |  415 ++++
 src/router_core/agent_config_address.h          |   35 +
 src/router_core/agent_config_auto_link.c        |  425 ++++
 src/router_core/agent_config_auto_link.h        |   35 +
 src/router_core/agent_config_link_route.c       |  408 ++++
 src/router_core/agent_config_link_route.h       |   35 +
 src/router_core/agent_link.c                    |  366 +++
 src/router_core/agent_link.h                    |   36 +
 src/router_core/connections.c                   | 1207 ++++++++++
 src/router_core/error.c                         |   97 +
 src/router_core/forwarder.c                     |  505 +++++
 src/router_core/management_agent.c              |  490 ++++
 src/router_core/route_control.c                 |  333 +++
 src/router_core/route_control.h                 |   51 +
 src/router_core/route_tables.c                  |  676 ++++++
 src/router_core/router_core.c                   |  380 ++++
 src/router_core/router_core_private.h           |  583 +++++
 src/router_core/router_core_thread.c            |   79 +
 src/router_core/terminus.c                      |  180 ++
 src/router_core/transfer.c                      |  507 +++++
 src/router_forwarders.c                         |   16 +-
 src/router_node.c                               | 2134 ++++--------------
 src/router_private.h                            |  277 +--
 src/router_pynode.c                             |  469 +---
 src/server.c                                    |    5 +-
 src/trace_mask.c                                |  147 ++
 src/waypoint.c                                  |    6 +-
 tests/config-2/A.conf                           |    5 +
 tests/config-2/B.conf                           |   13 +-
 tests/field_test.c                              |   46 +-
 tests/mock/dispatch.py                          |    7 +
 tests/parse_test.c                              |   82 +
 tests/system_tests_link_routes.py               |   17 +-
 tests/system_tests_management.py                |    2 +-
 tests/system_tests_qdmanage.py                  |  131 +-
 tests/system_tests_qdstat.py                    |    4 +-
 tests/tool_test.c                               |   46 +-
 tools/qdmanage                                  |    5 +-
 tools/qdstat                                    |   76 +-
 78 files changed, 10753 insertions(+), 2973 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/CMakeLists.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/include/qpid/dispatch/server.h
----------------------------------------------------------------------
diff --cc include/qpid/dispatch/server.h
index 4f39fc5,e8d92b8..e6c42ca
--- a/include/qpid/dispatch/server.h
+++ b/include/qpid/dispatch/server.h
@@@ -248,12 -248,11 +248,17 @@@ typedef struct qd_server_config_t 
      char *port;
  
      /**
 +     * Protocol family that the socket will use when binding listener or connector.
 +     * Possible values are IPv4 or IPv6. If not specified, the protocol family will be automatically determined from the address
 +     */
 +    char *protocol_family;
 +
 +    /**
+      * Connection name, used as a reference from other parts of the configuration.
+      */
+     char *name;
+ 
+     /**
       * Space-separated list of SASL mechanisms to be accepted for the connection.
       */
      char *sasl_mechanisms;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --cc python/qpid_dispatch/management/qdrouter.json
index 3c342ad,6f70fe9..e7d59d3
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@@ -645,9 -641,9 +646,9 @@@
          },
  
          "connector": {
 -            "description": "Establishes an outgoing connections from the router.",
 +            "description": "Establishes an outgoing connection from the router.",
              "extends": "configurationEntity",
-             "operations": ["CREATE"],
+             "operations": ["CREATE", "DELETE"],
              "annotations": [
                  "addrPort",
                  "connectionRole",

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/python/qpid_dispatch_internal/management/agent.py
----------------------------------------------------------------------
diff --cc python/qpid_dispatch_internal/management/agent.py
index 1c1b876,a7dc4c5..1a77129
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py
@@@ -250,10 -243,49 +250,52 @@@ class RouterEntity(EntityAdapter)
      def create(self):
          self._qd.qd_dispatch_configure_router(self._dispatch, self)
  
 +    def __str__(self):
 +        return super(RouterEntity, self).__str__().replace("Entity(", "RouterEntity(")
 +
  
+ class AddressEntity(EntityAdapter):
+     def __init__(self, agent, entity_type, attributes=None):
+         super(AddressEntity, self).__init__(agent, entity_type, attributes, validate=False)
+         # Router is a mix of configuration and operational entity.
+         # The statistics attributes are operational not configured.
+         self._add_implementation(
+             CImplementation(agent.qd, entity_type, self._dispatch))
+ 
+     def _identifier(self): return self.attributes.get('identity')
+ 
+     def create(self):
+         self._qd.qd_dispatch_configure_address(self._dispatch, self)
+ 
+ 
+ class LinkRouteEntity(EntityAdapter):
+     def __init__(self, agent, entity_type, attributes=None):
+         super(LinkRouteEntity, self).__init__(agent, entity_type, attributes, validate=False)
+         # Router is a mix of configuration and operational entity.
+         # The statistics attributes are operational not configured.
+         self._add_implementation(
+             CImplementation(agent.qd, entity_type, self._dispatch))
+ 
+     def _identifier(self): return self.attributes.get('identity')
+ 
+     def create(self):
+         self._qd.qd_dispatch_configure_link_route(self._dispatch, self)
+ 
+ 
+ class AutoLinkEntity(EntityAdapter):
+     def __init__(self, agent, entity_type, attributes=None):
+         super(AutoLinkEntity, self).__init__(agent, entity_type, attributes, validate=False)
+         # Router is a mix of configuration and operational entity.
+         # The statistics attributes are operational not configured.
+         self._add_implementation(
+             CImplementation(agent.qd, entity_type, self._dispatch))
+ 
+     def _identifier(self): return self.attributes.get('identity')
+ 
+     def create(self):
+         self._qd.qd_dispatch_configure_auto_link(self._dispatch, self)
+ 
+ 
  class LogEntity(EntityAdapter):
  
      def __init__(self, agent, entity_type, attributes=None, validate=True):
@@@ -287,54 -316,53 +329,84 @@@ def _addr_port_identifier(entity)
  
  class ListenerEntity(EntityAdapter):
      def create(self):
-         self._qd.qd_dispatch_configure_listener(self._dispatch, self)
+         config_listener = self._qd.qd_dispatch_configure_listener(self._dispatch, self)
          self._qd.qd_connection_manager_start(self._dispatch)
+         return config_listener
  
 +    def _identifier(self):
 +        return _addr_port_identifier(self)
 +
 +    def __str__(self):
 +        return super(ListenerEntity, self).__str__().replace("Entity(", "ListenerEntity(")
 +
+     def _delete(self):
+         self._qd.qd_connection_manager_delete_listener(self._dispatch, self._implementations[0].key)
+ 
+     def _identifier(self): return _addr_port_identifier(self)
  
  class ConnectorEntity(EntityAdapter):
      def create(self):
-         self._qd.qd_dispatch_configure_connector(self._dispatch, self)
+         config_connector = self._qd.qd_dispatch_configure_connector(self._dispatch, self)
          self._qd.qd_connection_manager_start(self._dispatch)
+         return config_connector
+ 
+     def _delete(self):
+         self._qd.qd_connection_manager_delete_connector(self._dispatch, self._implementations[0].key)
  
 -    def _identifier(self): return _addr_port_identifier(self)
 +    def _identifier(self):
 +        return _addr_port_identifier(self)
 +
 +    def __str__(self):
 +        return super(ConnectorEntity, self).__str__().replace("Entity(", "ConnectorEntity(")
  
  class FixedAddressEntity(EntityAdapter):
      def create(self):
-         self._qd.qd_dispatch_configure_address(self._dispatch, self)
+         self._qd.qd_dispatch_configure_fixed_address(self._dispatch, self)
  
 +    def __str__(self):
 +        return super(FixedAddressEntity, self).__str__().replace("Entity(", "FixedAddressEntity(")
 +
  
  class WaypointEntity(EntityAdapter):
      def create(self):
          self._qd.qd_dispatch_configure_waypoint(self._dispatch, self)
-         self._qd.qd_waypoint_activate_all(self._dispatch)
+         #self._qd.qd_waypoint_activate_all(self._dispatch)
  
 +    def __str__(self):
 +        return super(WaypointEntity, self).__str__().replace("Entity(", "WaypointEntity(")
 +
  class LinkRoutePatternEntity(EntityAdapter):
      def create(self):
          self._qd.qd_dispatch_configure_lrp(self._dispatch, self)
  
 +    def __str__(self):
 +        return super(LinkRoutePatternEntity, self).__str__().replace("Entity(", "LinkRoutePatternEntity(")
 +
+ class AddressEntity(EntityAdapter):
+     def create(self):
+         self._qd.qd_dispatch_configure_address(self._dispatch, self)
+ 
++    def __str__(self):
++        return super(AddressEntity, self).__str__().replace("Entity(", "AddressEntity(")
++
+ class LinkRouteEntity(EntityAdapter):
+     def create(self):
+         self._qd.qd_dispatch_configure_link_route(self._dispatch, self)
+ 
++    def __str__(self):
++        return super(LinkRouteEntity, self).__str__().replace("Entity(", "LinkRouteEntity(")
++
+ class AutoLinkEntity(EntityAdapter):
+     def create(self):
+         self._qd.qd_dispatch_configure_auto_link(self._dispatch, self)
+ 
++    def __str__(self):
++        return super(AutoLinkEntity, self).__str__().replace("Entity(", "AutoLinkEntity(")
++
  class ConsoleEntity(EntityAdapter):
 +    def __str__(self):
 +        return super(ConsoleEntity, self).__str__().replace("Entity(", "ConsoleEntity(")
 +
      def create(self):
          # if a named listener is present, use its addr:port 
          name = self.attributes.get('listener')

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/src/connection_manager.c
----------------------------------------------------------------------
diff --cc src/connection_manager.c
index 038ac63,07c7d1e..34c833d
--- a/src/connection_manager.c
+++ b/src/connection_manager.c
@@@ -139,16 -139,14 +139,17 @@@ static qd_error_t load_server_config(qd
      bool depAllowUnsecured  = qd_entity_opt_bool(entity, "allowUnsecured", !requireSsl); CHECK();
  
      memset(config, 0, sizeof(*config));
 -    config->host            = qd_entity_get_string(entity, "addr"); CHECK();
 -    config->port            = qd_entity_get_string(entity, "port"); CHECK();
 -    config->name            = qd_entity_opt_string(entity, "name", 0); CHECK();
 -    config->role            = qd_entity_get_string(entity, "role"); CHECK();
 -    config->max_frame_size  = qd_entity_get_long(entity, "maxFrameSize"); CHECK();
 +    config->host                 = qd_entity_get_string(entity, "addr"); CHECK();
 +    config->port                 = qd_entity_get_string(entity, "port"); CHECK();
++    config->name                 = qd_entity_opt_string(entity, "name", 0); CHECK();
 +    config->role                 = qd_entity_get_string(entity, "role"); CHECK();
 +    config->protocol_family      = qd_entity_opt_string(entity, "protocolFamily", 0); CHECK();
 +    config->max_frame_size       = qd_entity_get_long(entity, "maxFrameSize"); CHECK();
      config->idle_timeout_seconds = qd_entity_get_long(entity, "idleTimeoutSeconds"); CHECK();
 -    config->sasl_mechanisms = qd_entity_opt_string(entity, "saslMechanisms", 0); CHECK();
 -    config->ssl_enabled = has_attrs(entity, ssl_attributes, ssl_attributes_count);
 +    config->sasl_username        = qd_entity_opt_string(entity, "saslUsername", 0); CHECK();
 +    config->sasl_password        = qd_entity_opt_string(entity, "saslPassword", 0); CHECK();
 +    config->sasl_mechanisms      = qd_entity_opt_string(entity, "saslMechanisms", 0); CHECK();
 +    config->ssl_enabled          = has_attrs(entity, ssl_attributes, ssl_attributes_count);
  
      //
      // For now we are hardwiring this attribute to true.  If there's an outcry from the
@@@ -191,13 -190,23 +193,25 @@@ qd_config_listener_t *qd_dispatch_confi
      qd_config_listener_t *cl = NEW(qd_config_listener_t);
      cl->is_connector = false;
      cl->listener = 0;
-     load_server_config(qd, &cl->configuration, entity);
+     if (load_server_config(qd, &cl->configuration, entity) != QD_ERROR_NONE) {
+         qd_log(cm->log_source, QD_LOG_ERROR, "Unable to create config listener: %s", qd_error_message());
+         qd_config_listener_free(cl);
+         return 0;
+     }
      DEQ_ITEM_INIT(cl);
      DEQ_INSERT_TAIL(cm->config_listeners, cl);
 -    qd_log(cm->log_source, QD_LOG_INFO, "Configured Listener: %s:%s role=%s",
 -           cl->configuration.host, cl->configuration.port, cl->configuration.role);
 +    qd_log(cm->log_source, QD_LOG_INFO, "Configured Listener: %s:%s proto=%s role=%s",
 +           cl->configuration.host, cl->configuration.port,
 +           cl->configuration.protocol_family ? cl->configuration.protocol_family : "any",
 +           cl->configuration.role);
+ 
+     return cl;
+ }
+ 
+ 
+ qd_error_t qd_entity_refresh_listener(qd_entity_t* entity, void *impl)
+ {
+     return QD_ERROR_NONE;
  }
  
  
@@@ -206,24 -221,21 +226,22 @@@ qd_config_connector_t *qd_dispatch_conf
      qd_error_clear();
      qd_connection_manager_t *cm = qd->connection_manager;
      qd_config_connector_t *cc = NEW(qd_config_connector_t);
--    memset(cc, 0, sizeof(*cc));
++    ZERO(cc);
++
      cc->is_connector = true;
-     if (load_server_config(qd, &cc->configuration, entity))
-         return qd_error_code();
+     if (load_server_config(qd, &cc->configuration, entity) != QD_ERROR_NONE) {
+         qd_log(cm->log_source, QD_LOG_ERROR, "Unable to create config connector: %s", qd_error_message());
+         qd_config_connector_free(cc);
+         return 0;
 -    }
      DEQ_ITEM_INIT(cc);
-     if (strcmp(cc->configuration.role, "on-demand") == 0) {
-         cc->connector_name = qd_entity_get_string(entity, "name"); QD_ERROR_RET();
-         DEQ_INSERT_TAIL(cm->on_demand_connectors, cc);
-         qd_log(cm->log_source, QD_LOG_INFO, "Configured on-demand connector: %s:%s name=%s",
-                cc->configuration.host, cc->configuration.port, cc->connector_name);
-     } else {
-         DEQ_INSERT_TAIL(cm->config_connectors, cc);
-         qd_log(cm->log_source, QD_LOG_INFO, "Configured Connector: %s:%s proto=%s role=%s",
-                cc->configuration.host, cc->configuration.port,
-                cc->configuration.protocol_family ? cc->configuration.protocol_family : "any",
-                cc->configuration.role);
 -
+     DEQ_INSERT_TAIL(cm->config_connectors, cc);
 -    qd_log(cm->log_source, QD_LOG_INFO, "Configured Connector: %s:%s role=%s, name=%s",
 -           cc->configuration.host, cc->configuration.port, cc->configuration.role,
 -           cc->configuration.name ? cc->configuration.name : "<none>");
++    qd_log(cm->log_source, QD_LOG_INFO, "Configured Connector: %s:%s proto=%s role=%s",
++           cc->configuration.host, cc->configuration.port,
++           cc->configuration.protocol_family ? cc->configuration.protocol_family : "any",
++           cc->configuration.role);
 +    }
-     return QD_ERROR_NONE;
+ 
+     return cc;
  }
  
  

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/src/message.c
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/src/router_forwarders.c
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/src/router_node.c
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/src/server.c
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/tests/system_tests_qdmanage.py
----------------------------------------------------------------------
diff --cc tests/system_tests_qdmanage.py
index 041a325,f11bec4..96d5821
--- a/tests/system_tests_qdmanage.py
+++ b/tests/system_tests_qdmanage.py
@@@ -163,23 -179,31 +179,47 @@@ class QdmanageTest(TestCase)
          actual = self.run_qdmanage("GET-JSON-SCHEMA")
          self.assertEquals(schema, dictify(json.loads(actual)))
  
 +    def test_update(self):
 +        exception = False
 +        try:
 +            # Try to not set 'output'
 +            json.loads(self.run_qdmanage("UPDATE --type org.apache.qpid.dispatch.log --name log/DEFAULT output="))
 +        except Exception as e:
 +            exception = True
 +            self.assertTrue("InternalServerErrorStatus: CError: Configuration: Failed to open log file ''" in e.message)
 +        self.assertTrue(exception)
 +
 +        # Set a valid 'output'
 +        output = json.loads(self.run_qdmanage("UPDATE --type org.apache.qpid.dispatch.log --name log/DEFAULT "
 +                                              "enable=trace+ output=A.log"))
 +        self.assertEqual("A.log", output['output'])
 +        self.assertEqual("trace+", output['enable'])
 +
-     def test_add_connector(self):
+     def create(self, type, name, port):
+         create_command = 'CREATE --type=' + type + ' --name=' + name + ' addr=0.0.0.0 port=' + port
+         connector = json.loads(self.run_qdmanage(create_command))
+         return connector
+ 
+     def test_create_delete_connector(self):
+         long_type = 'org.apache.qpid.dispatch.connector'
+         query_command = 'QUERY --type=' + long_type
+         output = json.loads(self.run_qdmanage(query_command))
+         name = output[0]['name']
+ 
+         # Delete an existing connector
+         delete_command = 'DELETE --type=' + long_type + ' --name=' + name
+         self.run_qdmanage(delete_command)
+         output = json.loads(self.run_qdmanage(query_command))
+         self.assertEqual(output, [])
+ 
+         # Re-create the connector and then try wait_connectors
+         self.create(long_type, name, str(QdmanageTest.inter_router_port))
+         full_name = 'connection/0.0.0.0:' + str(QdmanageTest.inter_router_port)
+         output = json.loads(self.run_qdmanage('READ --type=org.apache.qpid.dispatch.connection --name ' + full_name))
+ 
+         self.assertEquals(full_name, output['name'])
+ 
+     def test_zzz_add_connector(self):
          port = self.get_port()
          # dont provide role and make sure that role is defaulted to 'normal'
          command = "CREATE --type=connector --name=eaconn1 port=" + str(port) + " addr=0.0.0.0"

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/215b5864/tests/system_tests_qdstat.py
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org