diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-03-30 19:07:54 +0300 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-04-01 22:25:53 +0300 |
| commit | bfc2265eb2efdf8201edb4dae25c1f75fff2ec70 (patch) | |
| tree | d764cfde77742580d7316cebffd3c4e8973fad82 /src/server/rz_api.py | |
| parent | 407f888ba155f5bce9e2370d12a8c68dffd14fd9 (diff) | |
rz_api: refactoring REST api calls to rz_api_rest
Diffstat (limited to 'src/server/rz_api.py')
| -rw-r--r-- | src/server/rz_api.py | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/server/rz_api.py b/src/server/rz_api.py index f2fb9936..2217e4e2 100644 --- a/src/server/rz_api.py +++ b/src/server/rz_api.py @@ -41,81 +41,6 @@ def __common_exec(op, on_success=common_resp_handle, on_error=common_resp_handle log.error(traceback.print_exc()) return on_error(error='error occurred') -def load_node_set_by_id_attr(): - """ - load node-set by ID attribute - - @param id_set: list of node ids to match id attribute against - @return: a list of nodes whose id attribute matches 'id' or - an empty list if the requested node is not found - @raise exception: on error - """ - req_json = request.get_json() - id_set = req_json['id_set'] - - __sanitize_input(id_set) - - return __load_node_set_by_id_attr_common(id_set) - -def __load_node_set_by_id_attr_common(id_set): - """ - @param f_k: optional attribute filter key - @param f_vset: possible key values to match against - """ - op = DBO_match_node_set_by_id_attribute(id_set=id_set) - try: - n_set = db_ctl.exec_op(op) - return common_resp_handle(data=n_set) - except Exception as e: - log.exception(e) - return common_resp_handle(error='unable to load node with ids: {0}'.format(id_set)) - -def match_node_set_by_attr_filter_map(attr_filter_map): - """ - @param attr_filter_map - - @return: a set of node DB id's - """ - op = DBO_match_node_id_set(attr_filter_map) - return __common_exec(op) - -def load_link_set_by_link_ptr_set(): - - def deserialize_param_set(param_json): - l_ptr_set_raw = param_json['link_ptr_set'] - - __sanitize_input(l_ptr_set_raw) - - l_ptr_set = [] - for lptr_dict in l_ptr_set_raw: - src_id = lptr_dict.get('__src_id') - dst_id = lptr_dict.get('__dst_id') - l_ptr_set += [Link.Link_Ptr(src_id=src_id, dst_id=dst_id) ] - - return l_ptr_set - - l_ptr_set = deserialize_param_set(request.get_json()) - - op = DBO_load_link_set.init_from_link_ptr_set(l_ptr_set) - return __common_exec(op) - -def diff_commit__set(): - """ - commit a diff set - """ - def sanitize_input(req): - diff_set_dict = req.get_json()['diff_set'] - topo_diff_dict = diff_set_dict['__diff_set_topo'][0] - topo_diff = Topo_Diff.from_json_dict(topo_diff_dict) - - sanitize_input__topo_diff(topo_diff) - return topo_diff; - - topo_diff = sanitize_input(request) - - op = DBO_diff_commit__topo(topo_diff) - return __common_exec(op) - def index(): # fetch rz_username for welcome message |
