Advertisement
niammuddin

vyos API ConfigTreeQuery

Mar 20th, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. # # ConfigTreeQuery
  2. # @app.route('/api/test_config', methods=['GET'])
  3. # def test_config():
  4. # if 'user_id' not in session:
  5. # return jsonify(error="Not authenticated"), 401
  6.  
  7. # try:
  8. # config = ConfigTreeQuery()
  9. # response = config.get_config_dict(["interfaces", "ethernet"])
  10. # return jsonify({
  11. # "success": True,
  12. # "data": response,
  13. # "message": "load config success"
  14. # })
  15.  
  16. # except Exception as e:
  17. # return jsonify({
  18. # "success": False,
  19. # "data": None,
  20. # "message": str(e)
  21. # })
  22.  
  23. # # VbashOpRun
  24. # @app.route('/api/test_config1', methods=['GET'])
  25. # def test_config1():
  26. # if 'user_id' not in session:
  27. # return jsonify(error="Not authenticated"), 401
  28.  
  29. # try:
  30. # config = VbashOpRun()
  31. # response = config.run(["show interfaces"])
  32. # return jsonify({
  33. # "success": True,
  34. # "data": response,
  35. # "message": "load config success"
  36. # })
  37.  
  38. # except Exception as e:
  39. # return jsonify({
  40. # "success": False,
  41. # "data": None,
  42. # "message": str(e)
  43. # })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement