diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-11-01 13:17:54 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-11-01 13:17:54 +0100 |
commit | f9e4736863371770bbbd03cf1762d8d44153b7a7 (patch) | |
tree | 9154cd2cc90913873c4299547db28a5fc7e494b4 /3.sql | |
parent | 14fb889f021c50763d21c77ff0f25e8bdbabd3a9 (diff) | |
download | prolog-firewall-f9e4736863371770bbbd03cf1762d8d44153b7a7.tar.gz prolog-firewall-f9e4736863371770bbbd03cf1762d8d44153b7a7.tar.bz2 prolog-firewall-f9e4736863371770bbbd03cf1762d8d44153b7a7.tar.xz prolog-firewall-f9e4736863371770bbbd03cf1762d8d44153b7a7.zip |
wip
Diffstat (limited to '3.sql')
-rw-r--r-- | 3.sql | 56 |
1 files changed, 56 insertions, 0 deletions
@@ -0,0 +1,56 @@ +pragma foreign_keys = true; + +create table host( + id int not null primary key, + name text not null unique +); + +insert into host(id, name) values +(1, 'knot'), +(2, 'lhn2ix'), +(3, 'conflatorio'), +(4, 'hash'); + +select * from host; + +create table router_link( + router text references host(name) not null, + remote text references host(name) not null, + addr text, + primary key(router, remote) +); + +create table network( + router text references host(name), + addr text, + range int); +insert into router_link(router, remote, addr) VALUES + ("knot", "lhn2ix", "1:1::1"), + ("lhn2ix", "knot", "1:2::1"), + ("lhn2ix", "hash", "1:2::2"), + ("hash", "lhn2ix", "1:3::1"); + +insert into network(router, addr, range) VALUES + ("knot", "1::f11b::", 64), + ("lhn2ix", "1::dbea::", 64), + ("hash", "1::e5b0::", 64); + +#create table bgp_connection(router, remote, addr); +#insert into bgp_connection +create view bgp_connection as +select + router.router as router, + remote.router as remote, + remote.addr as remote_addr +from router_link router +inner join router_link remote on router.remote = remote.router; + +.mode column +.print +.print HOST +select * from host; + +.print +.print BGP CONNECTION +select * from bgp_connection +order by router, remote; |