def api_cnode_detail(cid, no): cnode = CellNode.select().where((CellNode.no == no) & (CellNode.cell == cid)).dicts().first() if cnode is not None: node = Node.select().where(Node.id == cnode['node']).dicts().first() cnode['node'] = node return jsonify(cell_node=cnode) else: abort(404)
def api_cnode_detail(cid, no): cnode = CellNode.select().where( (CellNode.no == no) & (CellNode.cell == cid)).dicts().first() if cnode is not None: node = Node.select().where(Node.id == cnode['node']).dicts().first() cnode['node'] = node return jsonify(cell_node=cnode) else: abort(404)
def api_cnode_state(cid, no): cnode = CellNode.select().where((CellNode.no == no) & (CellNode.cell == cid)).first() if cnode is None: abort(404) if request.method == 'GET': return jsonify(cell_node=cnode.get_current_status()) if request.method == 'PUT': params = request.get_json() op = params['operation'] if op == 'start': cnode.start(params) return jsonify(cell_node=cnode.get_current_status()) elif op == 'stop': cnode.stop(params) return jsonify(cell_node=cnode.get_current_status()) else: abort(400)
def api_cnode_state(cid, no): cnode = CellNode.select().where( (CellNode.no == no) & (CellNode.cell == cid)).first() if cnode is None: abort(404) if request.method == 'GET': return jsonify(cell_node=cnode.get_current_status()) if request.method == 'PUT': params = request.get_json() op = params['operation'] if op == 'start': cnode.start(params) return jsonify(cell_node=cnode.get_current_status()) elif op == 'stop': cnode.stop(params) return jsonify(cell_node=cnode.get_current_status()) else: abort(400)