qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject qpid-dispatch git commit: DISPATCH-437 - WIP - Added code to transform body attribute map to use attribute ordinalities
Date Fri, 12 Aug 2016 19:18:26 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/DISPATCH-437-1 60eb82121 -> 187b55b2d


DISPATCH-437 - WIP - Added code to transform body attribute map to use attribute ordinalities


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

Branch: refs/heads/DISPATCH-437-1
Commit: 187b55b2d7df9dc6cc1550496942d9e07cc399c6
Parents: 60eb821
Author: Ganesh Murthy <gmurthy@redhat.com>
Authored: Fri Aug 12 15:17:37 2016 -0400
Committer: Ganesh Murthy <gmurthy@redhat.com>
Committed: Fri Aug 12 15:17:37 2016 -0400

----------------------------------------------------------------------
 include/qpid/dispatch/connection_manager.h      | 14 ++++-----
 .../management/agent/agent.py                   | 31 +++++++++++++-------
 src/connection_manager.c                        | 10 +++----
 src/router_core/agent_core.c                    |  6 ++--
 4 files changed, 36 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/187b55b2/include/qpid/dispatch/connection_manager.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/connection_manager.h b/include/qpid/dispatch/connection_manager.h
index baad127..feeb043 100644
--- a/include/qpid/dispatch/connection_manager.h
+++ b/include/qpid/dispatch/connection_manager.h
@@ -79,9 +79,9 @@ void qd_config_connector_free(qd_connection_manager_t *cm, qd_config_connector_t
  */
 void qd_connection_manager_start(qd_dispatch_t *qd);
 
-qd_amqp_error_t qd_connection_manager_create_ssl_profile(qd_dispatch_t *qd,
+qd_amqp_error_t qd_connection_manager_create_ssl_profile(qd_dispatch_t       *qd,
                                                          qd_field_iterator_t *name,
-                                                         qd_parsed_field_t *in_body,
+                                                         qd_parsed_field_t   *in_body,
                                                          qd_composed_field_t *out_body);
 
 qd_amqp_error_t qd_connection_manager_delete_ssl_profile(qd_dispatch_t *qd,
@@ -93,11 +93,11 @@ qd_amqp_error_t qd_connection_manager_read_ssl_profile(qd_dispatch_t *qd,
                                                        qd_field_iterator_t *identity,
                                                        qd_composed_field_t *out_body);
 
-qd_amqp_error_t qd_connection_manager_query_ssl_profile(qd_dispatch_t *qd,
-                                                        int offset,
-                                                        int count,
-                                                        qd_parsed_field_t     *in_body,
-                                                        qd_composed_field_t   *out_body);
+qd_amqp_error_t qd_connection_manager_query_ssl_profile(qd_dispatch_t       *qd,
+                                                        int                  offset,
+                                                        int                  count,
+                                                        qd_parsed_field_t   *in_body,
+                                                        qd_composed_field_t *out_body);
 /**
  * Get the connector's name.
  *

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/187b55b2/python/qpid_dispatch_internal/management/agent/agent.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/agent/agent.py b/python/qpid_dispatch_internal/management/agent/agent.py
index 5430e6e..3d131b3 100644
--- a/python/qpid_dispatch_internal/management/agent/agent.py
+++ b/python/qpid_dispatch_internal/management/agent/agent.py
@@ -761,6 +761,7 @@ class ManagementAgent:
         self.config_types = [et for et in schema.entity_types.itervalues()
                                      if schema.is_configuration(et)]
         self.policy = PolicyManager(self)
+        self.adapters = []
         if self.config_file:
             try:
                 self.load(self.config_file, raw_json)
@@ -769,7 +770,7 @@ class ManagementAgent:
         else:
             self.entities = []
         self.log_adapter = LogAdapter("AGENT")
-        self.adapters = []
+
         self.management = self.create_entity({"type": "management"})
         # self.add_entity(self.management)
         #self.io = IoAdapter(self.receive, address, 'L', '0', TREATMENT_ANYCAST_CLOSEST)
@@ -824,7 +825,6 @@ class ManagementAgent:
         """
         Calls the
         """
-        print 'body is *********** ', body
         self.agent_adapter.post_management_request(cid=cid,
                                                    reply_to=reply_to,
                                                    name=name,
@@ -835,14 +835,27 @@ class ManagementAgent:
                                                    count=count,
                                                    offset=offset)
 
+    def _transform_attributes(self, adapter):
+        transformed = {}
+        # adapter.attributes has something like this -
+        # {u'mobileAddrMaxAge': 60, u'raIntervalFlux': 4, u'workerThreads': 4, u'helloInterval':
1, u'area': '0',
+        # u'helloMaxAge': 3, u'saslConfigName': 'qdrouterd', u'remoteLsMaxAge': 60, u'raInterval':
30, u'mode': 0,
+        # 'type': 'org.apache.qpid.dispatch.router', u'id': 'Router.A'}
+        # We want to create a new dict with the keys as the ordinality of the respective
keys from the above dict
+        # like this - {0: 'Router.A', 1: 0, 2: '0', 3: 1, 4: 3, 5: 30, 6: 4, 7: 60, 11: 4,
14: 'qdrouterd', 16: 60}
+        #
+        for key in adapter.attributes.keys():
+            if key == 'type':
+                continue
+            transformed[adapter.entity_type.attributes.get(key).ordinality] = adapter.attributes.get(key)
+        return transformed
+
     def _create_config_entities(self):
-        print 'In _create_config_entities ******************** '
         for adapter in self.adapters:
-            print adapter.attributes
             self.post_request(cid=None, reply_to=None,
-                              operation_ordinality=self.all_operation_defs.get('CREATE').ordinality,
+                              operation_ordinality=self.schema.all_operation_defs.get('CREATE').ordinality,
                               entity_type_ordinality=adapter.entity_type.ordinality,
-                              body=adapter.attributes)
+                              body=self._transform_attributes(adapter))
 
     def get_config_types(self):
         return self.config_types
@@ -874,11 +887,9 @@ class ManagementAgent:
                 if et.singleton and not [s for s in sections if s[0] == et.short_name]:
                     sections.append((et.short_name, {}))
 
-            entities = [dict(type=self.schema.entity_type(self.schema.long_name(s[0])), **s[1])
for s in sections]
-            #self.schema.validate_all(entities)
-            self.entities = entities
+            self.entities = [dict(type=self.schema.entity_type(self.schema.long_name(s[0])),
**s[1]) for s in sections]
+            #self.schema.validate_all(self.entities)
             self.entity_adapters(self.entities)
-            print 'self.adapters ************** ', self.adapters
             self._create_config_entities()
 
     def log(self, level, text):

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/187b55b2/src/connection_manager.c
----------------------------------------------------------------------
diff --git a/src/connection_manager.c b/src/connection_manager.c
index 79e6935..bbf7e64 100644
--- a/src/connection_manager.c
+++ b/src/connection_manager.c
@@ -726,11 +726,11 @@ qd_amqp_error_t qd_connection_manager_read_ssl_profile(qd_dispatch_t
*qd,
     return status;
 }
 
-qd_amqp_error_t qd_connection_manager_query_ssl_profile(qd_dispatch_t *qd,
-                                                        int offset,
-                                                        int count,
-                                                        qd_parsed_field_t     *in_body,
-                                                        qd_composed_field_t     *out_body)
+qd_amqp_error_t qd_connection_manager_query_ssl_profile(qd_dispatch_t       *qd,
+                                                        int                  offset,
+                                                        int                  count,
+                                                        qd_parsed_field_t   *in_body,
+                                                        qd_composed_field_t *out_body)
 {
     return QD_AMQP_OK;
 }

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/187b55b2/src/router_core/agent_core.c
----------------------------------------------------------------------
diff --git a/src/router_core/agent_core.c b/src/router_core/agent_core.c
index fb82fea..f89d416 100644
--- a/src/router_core/agent_core.c
+++ b/src/router_core/agent_core.c
@@ -176,10 +176,10 @@ qdr_query_t *qdr_manage_query(qdr_core_t              *core,
                               void                    *context,
                               qd_router_entity_type_t  type,
                               qd_parsed_field_t       *attribute_names,
-                              qd_composed_field_t     *body)
+                              qd_composed_field_t     *out_body)
 {
 
-    qdr_query_t* query = qdr_query(core, context, type, body);
+    qdr_query_t* query = qdr_query(core, context, type, out_body);
 
     switch (query->entity_type) {
         case QD_SCHEMA_ENTITY_TYPE_ROUTER_CONFIG_ADDRESS:   qdr_agent_set_columns(query,
attribute_names, qdr_config_address_columns, QDR_CONFIG_ADDRESS_COLUMN_COUNT);  break;
@@ -355,7 +355,7 @@ static void qdr_manage_create_CT(qdr_core_t *core, qdr_action_t *action,
bool di
     qd_parsed_field_t       *in_body    = action->args.agent.in_body;
 
     switch (query->entity_type) {
-        case QD_SCHEMA_ENTITY_TYPE_ROUTER_CONFIG_ADDRESS:                      qdra_config_address_create_CT(core,
name, query, in_body); break;
+        case QD_SCHEMA_ENTITY_TYPE_ROUTER_CONFIG_ADDRESS:   qdra_config_address_create_CT(core,
name, query, in_body); break;
         case QD_SCHEMA_ENTITY_TYPE_ROUTER_CONFIG_LINKROUTE: qdra_config_link_route_create_CT(core,
name, query, in_body); break;
         case QD_SCHEMA_ENTITY_TYPE_ROUTER_CONFIG_AUTOLINK:  qdra_config_auto_link_create_CT(core,
name, query, in_body); break;
         case QD_SCHEMA_ENTITY_TYPE_CONNECTION:              break;


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


Mime
View raw message