summaryrefslogtreecommitdiff
path: root/6/bgp.py
diff options
context:
space:
mode:
Diffstat (limited to '6/bgp.py')
-rwxr-xr-x6/bgp.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/6/bgp.py b/6/bgp.py
index 2bd756a..d508762 100755
--- a/6/bgp.py
+++ b/6/bgp.py
@@ -13,10 +13,22 @@ def to_ansible(kind, hosts):
with PrologMQI() as mqi:
with mqi.create_thread() as p:
- result = p.query("consult(main)")
+ result = p.query("consult(main), main.")
print(result)
result = p.query("bgp:bird_config(BirdDict)")
r = result[0]["BirdDict"]
print(yaml.dump(r))
to_ansible("bgp", r)
+
+ hosts = {}
+ result = p.query("firewall:fw_rule(Host, Attrs).")
+# print(yaml.dump(result))
+ for r in result:
+ host = r["Host"]
+ if host not in hosts:
+ hosts[host] = h = {}
+ h["firewall_rules"] = rules = []
+ rules.append(r["Attrs"])
+
+ to_ansible("firewall", hosts)