summaryrefslogtreecommitdiff
path: root/7/main.pl
diff options
context:
space:
mode:
Diffstat (limited to '7/main.pl')
-rw-r--r--7/main.pl26
1 files changed, 26 insertions, 0 deletions
diff --git a/7/main.pl b/7/main.pl
new file mode 100644
index 0000000..579f74f
--- /dev/null
+++ b/7/main.pl
@@ -0,0 +1,26 @@
+:- use_module(library(format)).
+:- use_module(library(lists)).
+
+:- use_module(bgp, [
+ create_firewall/0]).
+
+print_warnings([]).
+print_warnings([W|Ws]) :-
+ format("Warning: ~s~n", [W]), print_warnings(Ws).
+
+print_warnings :-
+ findall(W, bgp:warning(W), BgpWs),
+ findall(W, firewall:warning(W), FwWs),
+ append(BgpWs, FwWs, Ws),
+ length(Ws, L),
+ ( L > 0 ->
+ format("Found ~w warning(s):~n", [L]),
+ print_warnings(Ws)
+ ; format("No warnings!~n", [])
+ ).
+
+main :-
+ bgp:create_firewall,
+ print_warnings,
+ bgp:bird_config(BirdDict),
+ yaml_write(current_output, BirdDict).