diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-11-14 19:50:21 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-11-14 19:50:21 +0100 |
commit | 2c76aa98d5fe49f57c94bde4cbe2ba5ca1ff338a (patch) | |
tree | 91ea002c66a77de393fa9a334eaa97f4d6b3dc27 /6/bgp.py | |
parent | 2caac53749dece14825991ffcc267e913091e842 (diff) | |
download | prolog-firewall-2c76aa98d5fe49f57c94bde4cbe2ba5ca1ff338a.tar.gz prolog-firewall-2c76aa98d5fe49f57c94bde4cbe2ba5ca1ff338a.tar.bz2 prolog-firewall-2c76aa98d5fe49f57c94bde4cbe2ba5ca1ff338a.tar.xz prolog-firewall-2c76aa98d5fe49f57c94bde4cbe2ba5ca1ff338a.zip |
wip
Diffstat (limited to '6/bgp.py')
-rwxr-xr-x | 6/bgp.py | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) |