Update app.py
This commit is contained in:
parent
2555f2d23c
commit
9e65fbf94e
1 changed files with 16 additions and 2 deletions
18
app.py
18
app.py
|
|
@ -9,7 +9,7 @@ from datetime import datetime, timedelta
|
||||||
|
|
||||||
app = Flask(__name__)
|
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,run_firewall_ipv4_curl_command, run_firewall_ipv6_curl_command, run_bgp_reset_command, run_bgp_shutdown_command, run_bgp_enable_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, run_bgp_reset_command, run_bgp_shutdown_command, run_bgp_enable_command, run_firewall_log_curl_command
|
||||||
from modules.bgp import parse_bgp_data, generate_bgp_json
|
from modules.bgp import parse_bgp_data, generate_bgp_json
|
||||||
from modules.arp import parse_arp_data, generate_arp_json
|
from modules.arp import parse_arp_data, generate_arp_json
|
||||||
from modules.neighbors import parse_neighbors_data, generate_neighbors_json
|
from modules.neighbors import parse_neighbors_data, generate_neighbors_json
|
||||||
|
|
@ -19,7 +19,7 @@ from modules.librenms import get_port_id, fetch_graph_base64
|
||||||
from modules.rpki import parse_rpki_cache_data, parse_rpki_lookup_data
|
from modules.rpki import parse_rpki_cache_data, parse_rpki_lookup_data
|
||||||
from modules.bfd import parse_bfd_peers_data
|
from modules.bfd import parse_bfd_peers_data
|
||||||
from modules.bgp_dampening import parse_dampened_data, generate_dampened_json
|
from modules.bgp_dampening import parse_dampened_data, generate_dampened_json
|
||||||
from modules.firewall import parse_firewall_data
|
from modules.firewall import parse_firewall_data, parse_firewall_log_data
|
||||||
from modules.visual_route import generate_visual_route_graph
|
from modules.visual_route import generate_visual_route_graph
|
||||||
from modules.database import get_peer_history, get_total_routes_history, get_unique_peers
|
from modules.database import get_peer_history, get_total_routes_history, get_unique_peers
|
||||||
|
|
||||||
|
|
@ -314,6 +314,20 @@ def firewall_json():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify({"error": "Failed to retrieve firewall data.", "details": str(e)}), 500
|
return jsonify({"error": "Failed to retrieve firewall data.", "details": str(e)}), 500
|
||||||
|
|
||||||
|
@app.route('/firewall/log/<string:ip_version>/<string:ruleset_name>/<string:rule_number>')
|
||||||
|
def firewall_log_page(ip_version, ruleset_name, rule_number):
|
||||||
|
try:
|
||||||
|
raw_data = run_firewall_log_curl_command(ip_version, ruleset_name, rule_number)
|
||||||
|
log_data = parse_firewall_log_data(raw_data)
|
||||||
|
except Exception as e:
|
||||||
|
log_data = f"Could not retrieve the logs: {e}"
|
||||||
|
|
||||||
|
return render_template('firewall_log.html',
|
||||||
|
ip_version=ip_version,
|
||||||
|
ruleset_name=ruleset_name,
|
||||||
|
rule_number=rule_number,
|
||||||
|
log_data=log_data)
|
||||||
|
|
||||||
@app.route('/bgp/peer/<string:ip_version>/<path:neighbor_ip>/graph')
|
@app.route('/bgp/peer/<string:ip_version>/<path:neighbor_ip>/graph')
|
||||||
def bgp_peer_graph_page(ip_version, neighbor_ip):
|
def bgp_peer_graph_page(ip_version, neighbor_ip):
|
||||||
if ip_version not in ['ipv4', 'ipv6']:
|
if ip_version not in ['ipv4', 'ipv6']:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue