% vim set ft=prolog

:- module(hosts, [
    host/1,
    host_config/2,
    attached_network/2,
    router_link/3]).

host(conflatorio).
host(hash).
host(knot).
host(kv24ix).
host(lhn2ix).

host_config(knot, Config) :- Config = _{
    ip: "fdf3:aad9:a885:0b3a::1"
  }.

host_config(hash, Config) :- Config = _{
    ip: "fdf3:aad9:a885:0b3a::13"
  }.

host_config(lhn2ix, Config) :- Config = _{
    ip: "fdf3:aad9:a885:0b3a::15"
  }.

host_config(kv24ix, Config) :- Config = _{
    ip: "fdf3:aad9:a885:0b3a::16"
  }.

% (router, router_ip, remote)
router_link(knot,        "1::1",  hash).
router_link(knot,        "1::8",  lhn2ix).
router_link(knot,        "1::7",  kv24ix).
router_link(hash,        "1::2",  knot).
router_link(hash,        "1::10", kv24ix).
router_link(hash,        "1::3",  lhn2ix).
router_link(kv24ix,      "1::6",  knot).
router_link(kv24ix,      "1::5",  hash).
router_link(lhn2ix,      "1::9",  hash).
router_link(lhn2ix,      "1::4",  knot).
router_link(conflatorio, "1::11", lhn2ix).
%router_link(lhn2ix,      "1::12", conflatorio).

% network(R, address, range)
attached_network(conflatorio, ipv6_net("1:78e1::", 64)).
attached_network(hash,        ipv6_net("1:e5b0::", 64)).
attached_network(knot,        ipv6_net("1:f11b::", 64)).
attached_network(lhn2ix,      ipv6_net("1:dbe1::", 64)).
attached_network(lhn2ix,      ipv6_net("1:ab69::", 64)).
attached_network(kv42ix,      ipv6_net("1:cd02::", 64)).