diff options
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) |