0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Flock tests and CLI: now we're saving and checking show route output

This commit is contained in:
Maria Matejka 2024-07-19 16:47:29 +02:00
parent fce146cb61
commit 48dccde2ab
18 changed files with 1784 additions and 21 deletions

View File

@ -61,6 +61,11 @@ protocol static p170 {
disabled; disabled;
} }
protocol static STARTUP {
ipv6;
route 2001:db8:cc00::/40 unreachable;
}
# We need to CHECK this: # We need to CHECK this:
# - adding worst to best # - adding worst to best
# - adding best to worst # - adding best to worst
@ -68,6 +73,8 @@ protocol static p170 {
# - reconf # - reconf
function CHECK() -> bool { function CHECK() -> bool {
if net = 2001:db8:cc00::/40 then return true;
bgp_path.prepend(preference); bgp_path.prepend(preference);
case epoch { case epoch {
1: case preference { 1: case preference {

View File

@ -0,0 +1,26 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,80 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (170)'
dest: unreachable
proto: p170
when: true
2001:db8:eee2::/48:
routes:
- args: '* (170)'
dest: unreachable
proto: p170
when: true
2001:db8:eee3::/48:
routes:
- args: '* (170)'
dest: unreachable
proto: p170
when: true
2001:db8:eee4::/48:
routes:
- args: '* (170)'
dest: unreachable
proto: p170
when: true
2001:db8:eee5::/48:
routes:
- args: '* (170)'
dest: unreachable
proto: p170
when: true
2001:db8:eee6::/48:
routes:
- args: '* (170)'
dest: unreachable
proto: p170
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee5::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,113 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (180)'
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee2::/48:
routes:
- args: '* (180)'
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee3::/48:
routes:
- args: '* (180)'
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee4::/48:
routes:
- args: '* (180)'
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee5::/48:
routes:
- args: '* (180)'
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee6::/48:
routes:
- args: '* (180)'
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS180i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee5::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,146 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (190)'
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee2::/48:
routes:
- args: '* (190)'
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee3::/48:
routes:
- args: '* (190)'
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee4::/48:
routes:
- args: '* (190)'
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee5::/48:
routes:
- args: '* (190)'
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee6::/48:
routes:
- args: '* (190)'
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS180i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee5::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,179 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee5::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,146 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,122 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,80 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,26 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,80 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,122 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,146 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,179 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee5::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -0,0 +1,179 @@
tables:
master4:
networks: {}
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (200)'
dest: unreachable
proto: STARTUP
when: true
2001:db8:eee1::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee2::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee3::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee4::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee5::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
2001:db8:eee6::/48:
routes:
- args: '* (200)'
dest: unreachable
proto: p200
when: true
- args: (190)
dest: unreachable
proto: p190
when: true
- args: (180)
dest: unreachable
proto: p180
when: true
- args: (170)
dest: unreachable
proto: p170
when: true
version: v3.0-alpha2-660-g62145d08-x
---
tables:
master6:
networks:
2001:db8:cc00::/40:
routes:
- args: '* (100) [AS1i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee1::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee2::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee3::/48:
routes:
- args: '* (100) [AS200i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee4::/48:
routes:
- args: '* (100) [AS190i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
2001:db8:eee5::/48:
routes:
- args: '* (100) [AS170i]'
dest: unicast
nexthop:
- iface: L
nexthop: 2001:db8::1
proto: LINK
when: true
version: v3.0-alpha2-660-g62145d08-x

View File

@ -17,11 +17,34 @@ class ThisTest(Test):
# Start machines and links # Start machines and links
await self.start() await self.start()
# Partial test # Startup check
await self.route_dump(5) await self.route_dump(10, "startup")
for p in ("p170", "p180", "p190", "p200"): wtb = ("p170", "p180", "p190", "p200")
btw = reversed(wtb)
# Enable worst to best
for p in wtb:
await self.src.enable(p) await self.src.enable(p)
await self.route_dump(1) await self.route_dump(1, f"enable-{p}")
# Disable worst to best
for p in wtb:
await self.src.disable(p)
await self.route_dump(1, f"disable-{p}")
# Enable best to worst
for p in btw:
await self.src.enable(p)
await self.route_dump(1, f"enable-{p}")
# Disable worst to best
for p in btw:
await self.src.disable(p)
await self.route_dump(1, f"disable-{p}")
# Re-enable all at once
await asyncio.gather(*[ self.src.enable(p) for p in wtb ])
await self.route_dump(5, f"add-all")
await self.cleanup() await self.cleanup()

View File

@ -21,25 +21,20 @@ class CLIParser:
return return
self.enter(groups) self.enter(groups)
print("subparser inited", self, self.result)
def parse(self, line: str): def parse(self, line: str):
print(f"in {self} parsing line {line}")
assert(self.cur == None) assert(self.cur == None)
if line is not None: if line is not None:
for k,v in self.subparsers.items(): for k,v in self.subparsers.items():
print(f"trying to match {k} for {v}")
if m := k.match(line): if m := k.match(line):
self.cur = (c := v(groups=m.groups(), parent=self)) self.cur = (c := v(groups=m.groups(), parent=self))
while c.cur is not None: while c.cur is not None:
c = c.cur c = c.cur
return c return c
elif self.parent is None: elif self.parent is None:
print("overall exit", self, self.result)
return self return self
try: try:
print(f"exiting {self} with result {self.result}")
self.exit() self.exit()
self.parent.cur = None self.parent.cur = None
return self.parent.parse(line) return self.parent.parse(line)
@ -67,7 +62,6 @@ class ShowRouteParser(CLIParser):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.result["tables"] = {} self.result["tables"] = {}
print("parser init", self, self.result)
@subparser(ShowRouteParser) @subparser(ShowRouteParser)
class NothingParser(CLIParser): class NothingParser(CLIParser):
@ -119,7 +113,7 @@ class RouteParser(CLIParser):
class NextHopParser(CLIParser): class NextHopParser(CLIParser):
entryRegex = re.compile("\\s+via ([0-9a-f:.]+) on (.*)") entryRegex = re.compile("\\s+via ([0-9a-f:.]+) on (.*)")
def enter(self, groups): def enter(self, groups):
self.result = { self.result = {
k: v for k,v in zip(("nexthop", "iface"), groups) k: v for k,v in zip(("nexthop", "iface"), groups)
} }
@ -128,11 +122,9 @@ class NextHopParser(CLIParser):
def parse(data: str): def parse(data: str):
parser = ShowRouteParser() parser = ShowRouteParser()
print("created parser", parser)
for line in data.split("\n"): for line in data.split("\n"):
parser = parser.parse(line) parser = parser.parse(line)
parser = parser.parse(None) parser = parser.parse(None)
print("returning result", parser.result)
return parser.result return parser.result

View File

@ -4,6 +4,7 @@ import jinja2
import os import os
import pathlib import pathlib
import sys import sys
import yaml
sys.path.insert(0, "/home/maria/flock") sys.path.insert(0, "/home/maria/flock")
@ -11,6 +12,58 @@ from flock.Hypervisor import Hypervisor
from flock.Machine import Machine from flock.Machine import Machine
from .CLI import CLI, Transport from .CLI import CLI, Transport
# TODO: move this to some aux file
class Differs(Exception):
def __init__(self, a, b, tree):
self.a = a
self.b = b
self.tree = tree
@classmethod
def false(cls, a, b, deep, tree):
if deep:
raise cls(a, b, tree)
else:
return False
def deep_eq(a, b, deep=False):
if a == b:
return True
# Do not iterate over strings
if type(a) is str and type(b) is str:
return Differs.false(a, b, deep, tree=[])
try:
for k,v in a.items():
try:
deep_eq(v, b[k], True)
except Differs as d:
d.tree.append(k)
raise d
except KeyError:
return Differs.false(v, None, deep, tree=[k])
for k in b:
if not k in a:
return Differs.false(None, b[k], deep, tree=[k])
except AttributeError:
try:
if len(a) != len(b):
return Differs.false(len(a), len(b), deep, tree=[len])
for i in range(len(a)):
try:
deep_eq(a[i], b[i])
except Differs as d:
d.tree.append(i)
raise d
except TypeError:
return Differs.false(a, b, deep, [])
return True
class MinimalistTransport(Transport): class MinimalistTransport(Transport):
def __init__(self, socket, machine): def __init__(self, socket, machine):
self.sock = socket self.sock = socket
@ -106,18 +159,26 @@ class Test:
ipv6_link_pxlen = 64 ipv6_link_pxlen = 64
ipv4_link_pxlen = 28 ipv4_link_pxlen = 28
SAVE = 1
CHECK = 2
show_difs = False
# 198.51.100.0/24, 203.0.113.0/24 # 198.51.100.0/24, 203.0.113.0/24
def __init__(self, name): def __init__(self, name, mode: int):
self.name = name self.name = name
self.hypervisor = Hypervisor(name) self.hypervisor = Hypervisor(name)
self.machine_index = {} self.machine_index = {}
self.mode = mode
self._started = None self._started = None
self._starting = False self._starting = False
self.ipv6_pxgen = self.ipv6_prefix.subnets(new_prefix=self.ipv6_link_pxlen) self.ipv6_pxgen = self.ipv6_prefix.subnets(new_prefix=self.ipv6_link_pxlen)
self.ipv4_pxgen = self.ipv4_prefix.subnets(new_prefix=self.ipv4_link_pxlen) self.ipv4_pxgen = self.ipv4_prefix.subnets(new_prefix=self.ipv4_link_pxlen)
self.route_dump_id = 0
async def hcom(self, *args): async def hcom(self, *args):
if self._started is None: if self._started is None:
self._started = asyncio.Future() self._started = asyncio.Future()
@ -190,10 +251,15 @@ class Test:
await asyncio.gather(*[ v.cleanup() for v in self.machine_index.values() ]) await asyncio.gather(*[ v.cleanup() for v in self.machine_index.values() ])
await self.hcom("stop", True) await self.hcom("stop", True)
async def route_dump(self, timeout=None, machines=None): async def route_dump(self, timeout, name, machines=None, check_timeout=10, check_retry_timeout=0.5):
if timeout is not None: # Compile dump ID
await asyncio.sleep(timeout) self.route_dump_id += 1
if name is None:
name = f"dump-{self.route_dump_id:04d}.yaml"
else:
name = f"dump-{self.route_dump_id:04d}-{name}.yaml"
# Collect machines to dump
if machines is None: if machines is None:
machines = self.machine_index.values() machines = self.machine_index.values()
else: else:
@ -202,16 +268,67 @@ class Test:
for m in machines for m in machines
] ]
print(*[ # Define the obtainer function
await asyncio.gather(*[ async def obtain():
dump = await asyncio.gather(*[
where.show_route() where.show_route()
for where in machines for where in machines
]) ])
]) for d in dump:
for t in d["tables"].values():
for n in t["networks"].values():
for r in n["routes"]:
assert("when" in r)
r["when"] = True
return dump
match self.mode:
case Test.SAVE:
await asyncio.sleep(timeout)
dump = await obtain()
with open(name, "w") as y:
yaml.dump_all(dump, y)
print(f"{name}\t{self.route_dump_id}\t[ SAVED ]")
case Test.CHECK:
with open(name, "r") as y:
c = [*yaml.safe_load_all(y)]
seen = []
try:
async with asyncio.timeout(check_timeout) as to:
while True:
dump = await obtain()
try:
deep_eq(c, dump, True)
# if deep_eq(c, dump):
spent = asyncio.get_running_loop().time() - to.when() + check_timeout
print(f"{name}\t{self.route_dump_id}\t[ OOK ]\t{spent:.6f}s")
return True
except Differs as d:
if self.show_difs:
print(f"Differs at {' -> '.join([str(s) for s in reversed(d.tree)])}: {d.a} != {d.b}")
seen.append(dump)
await asyncio.sleep(check_retry_timeout)
except TimeoutError as e:
print(f"{name}\t{self.route_dump_id}\t[ BAD ]")
for q in range(len(seen)):
with open(f"__result_bad_{q}__{name}", "w") as y:
yaml.dump_all(seen[q], y)
return False
case _:
raise Exception("Invalid test mode")
if __name__ == "__main__": if __name__ == "__main__":
name = sys.argv[1] name = sys.argv[1]
mode = Test.CHECK
if name == "-s":
name = sys.argv[2]
mode = Test.SAVE
p = (pathlib.Path(__file__).parent.parent.parent / "flock" / name).absolute() p = (pathlib.Path(__file__).parent.parent.parent / "flock" / name).absolute()
sys.path.insert(0, str(p)) sys.path.insert(0, str(p))
@ -222,4 +339,4 @@ if __name__ == "__main__":
import test import test
os.chdir(p) os.chdir(p)
asyncio.run(test.ThisTest(name).run()) asyncio.run(test.ThisTest(name, mode).run())