Update app.py
This commit is contained in:
parent
bea2752ae0
commit
dee5ddd7ed
1 changed files with 21 additions and 2 deletions
23
app.py
23
app.py
|
|
@ -8,7 +8,7 @@ from flask import Flask, render_template_string, jsonify, url_for, redirect, ren
|
|||
|
||||
app = Flask(__name__)
|
||||
|
||||
from modules.parse import run_bgp_curl_command, run_arp_curl_command, run_neighbors_curl_command, run_interfaces_curl_command, run_bgp_route_curl_command, run_rpki_cache_connection_curl_command, run_rpki_lookup_curl_command, run_bgp_neighbor_detail_curl_command, run_bfd_peers_curl_command, run_bfd_peer_detail_curl_command, run_bgp_dampeningv4_curl_command, run_bgp_dampeningv6_curl_command
|
||||
from modules.parse import run_bgp_curl_command, run_arp_curl_command, run_neighbors_curl_command, run_interfaces_curl_command, run_bgp_route_curl_command, run_rpki_cache_connection_curl_command, run_rpki_lookup_curl_command, run_bgp_neighbor_detail_curl_command, run_bfd_peers_curl_command, run_bfd_peer_detail_curl_command, run_bgp_dampeningv4_curl_command, run_bgp_dampeningv6_curl_command,run_firewall_ipv4_curl_command, run_firewall_ipv6_curl_command
|
||||
|
||||
from modules.bgp import parse_bgp_data, generate_bgp_json
|
||||
|
||||
|
|
@ -28,6 +28,8 @@ from modules.bfd import parse_bfd_peers_data
|
|||
|
||||
from modules.bgp_dampening import parse_dampened_data, generate_dampened_json
|
||||
|
||||
from modules.firewall import parse_firewall_data
|
||||
|
||||
from modules.visual_route import generate_visual_route_graph
|
||||
|
||||
@app.context_processor
|
||||
|
|
@ -273,4 +275,21 @@ def visual_route_graph():
|
|||
if "error" in graph_data:
|
||||
return jsonify(graph_data), 400
|
||||
|
||||
return jsonify(graph_data)
|
||||
return jsonify(graph_data)
|
||||
|
||||
@app.route('/firewall')
|
||||
def firewall_page():
|
||||
return render_template("firewall.html")
|
||||
|
||||
@app.route('/firewall/json')
|
||||
def firewall_json():
|
||||
try:
|
||||
ipv4_raw = run_firewall_ipv4_curl_command()
|
||||
ipv6_raw = run_firewall_ipv6_curl_command()
|
||||
|
||||
ipv4_rulesets = parse_firewall_data(ipv4_raw)
|
||||
ipv6_rulesets = parse_firewall_data(ipv6_raw)
|
||||
|
||||
return jsonify({"ipv4": ipv4_rulesets, "ipv6": ipv6_rulesets})
|
||||
except Exception as e:
|
||||
return jsonify({"error": "Failed to retrieve firewall data.", "details": str(e)}), 500
|
||||
Loading…
Add table
Add a link
Reference in a new issue