Skip to content

Commit

Permalink
config-perf: prelim staged commit for adding filter to list api.
Browse files Browse the repository at this point in the history
This diff is needed for a follow-up commit in generateDS

add filters parameter in client-library list api

(cherry picked from commit 047539b)

Change-Id: I987218043568a1b69e6b54a5a1ecc1e35d49ad44
Partial-Bug: #1462156
(cherry picked from commit 1d5ea2e)
  • Loading branch information
Hampapur Ajay committed Jun 14, 2015
1 parent f59670e commit 5749183
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/api-lib/vnc_api.py
Expand Up @@ -596,7 +596,7 @@ def get_auth_token(self):

def resource_list(self, obj_type, parent_id=None, parent_fq_name=None,
back_ref_id=None, obj_uuids=None, fields=None,
detail=False, count=False):
detail=False, count=False, filters=None):
if not obj_type:
raise ResourceTypeUnknownError(obj_type)

Expand Down Expand Up @@ -641,6 +641,13 @@ def resource_list(self, obj_type, parent_id=None, parent_fq_name=None,

query_params['count'] = count

if filters:
ffield_names = ','.join([f['field_name'] for f in filters])
ffield_values = ','.join(
[json.dumps(f['field_value']) for f in filters])
query_params['filter_field_names'] = ffield_names
query_params['filter_field_values'] = ffield_values

if do_post_for_list:
uri = self._action_uri.get('list-bulk-collection')
if not uri:
Expand Down
6 changes: 3 additions & 3 deletions src/config/api-server/vnc_cfg_ifmap.py
Expand Up @@ -1407,13 +1407,13 @@ def dbe_update(self, obj_type, obj_ids, new_obj_dict):
# end dbe_update

def dbe_list(self, obj_type, parent_uuids=None, back_ref_uuids=None,
obj_uuids=None, count=False, paginate_start=None,
paginate_count=None):
obj_uuids=None, count=False, filters=None,
paginate_start=None, paginate_count=None):
method_name = obj_type.replace('-', '_')
(ok, cassandra_result) = self._cassandra_db.list(
method_name, parent_uuids=parent_uuids,
back_ref_uuids=back_ref_uuids, obj_uuids=obj_uuids,
count=count)
count=count, filters=filters)
return (ok, cassandra_result)
# end dbe_list

Expand Down

0 comments on commit 5749183

Please sign in to comment.