From f9e4736863371770bbbd03cf1762d8d44153b7a7 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 1 Nov 2023 13:17:54 +0100 Subject: wip --- 3.sql | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 3.sql (limited to '3.sql') diff --git a/3.sql b/3.sql new file mode 100644 index 0000000..e49391e --- /dev/null +++ b/3.sql @@ -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; -- cgit v1.2.3