From: claudio Date: Sat, 8 Sep 2018 13:10:55 +0000 (+0000) Subject: Regress tests for as-set and prefix-set blocks X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b0960b808cfce728b6650d222464fdfc3a8c9b44;p=openbsd Regress tests for as-set and prefix-set blocks --- diff --git a/regress/usr.sbin/bgpd/config/Makefile b/regress/usr.sbin/bgpd/config/Makefile index 2938a36dc9b..3d57b5a6d6c 100644 --- a/regress/usr.sbin/bgpd/config/Makefile +++ b/regress/usr.sbin/bgpd/config/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.3 2018/09/08 12:32:01 claudio Exp $ +# $OpenBSD: Makefile,v 1.4 2018/09/08 13:10:55 claudio Exp $ -BGPDTESTS=1 2 3 4 5 +BGPDTESTS=1 2 3 4 5 6 7 REGRESS_TARGETS = config diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.6.in b/regress/usr.sbin/bgpd/config/bgpd.conf.6.in new file mode 100644 index 00000000000..9eba5d45651 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.6.in @@ -0,0 +1,42 @@ +# $OpenBSD: bgpd.conf.6.in,v 1.1 2018/09/08 13:10:55 claudio Exp $ +# test as-set blocks + +AS 1 + +as-set "test1" { 1 2 3 4 } +#notyet as-set "test2" { 1, 2, 3, 4 } + +as-set "test3" { + 1 # with comment + 2 + 3 + 4 +# 5 # commented entry +} +#notyet as-set "test4" { +# 1, +# 2, +# 3, +# 4 +#} + +# concatenation test +as-set "test5" { \ + 1 2 \ + 3 4 \ +} + +as-set "AS_SET_AS_PCH1" { + 27 42 187 297 715 3856 10886 11893 13202 + 16327 16668 19281 20539 21312 21556 24999 25505 27678 32978 32979 35160 + 38052 42530 44876 45170 45494 48892 50843 51874 51972 52234 52304 52306 + 54145 54390 60313 197058 +} + +#notyet as-set "AS_SET_AS_PCH2" { +# 27, 42, 187, 297, 715, 3856, 10886, 11893, 13202, +# 6327, 16668, 19281, 20539, 21312, 21556, 24999, 25505, +# 27678, 32978, 32979, 35160, 38052, 42530, 44876, 45170, +# 45494, 48892, 50843, 51874, 51972, 52234, 52304, 52306, +# 54145, 54390, 60313, 197058 +#} diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.6.ok b/regress/usr.sbin/bgpd/config/bgpd.conf.6.ok new file mode 100644 index 00000000000..9336b919a63 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.6.ok @@ -0,0 +1,32 @@ +AS 1 +router-id 127.0.0.1 +socket "/var/run/bgpd.sock.0" +holdtime min 3 +fib-priority 48 + + +rde rib Adj-RIB-In no evaluate +rde rib Adj-RIB-Out no evaluate +rde rib Loc-RIB rtable 0 fib-update yes + +as-set "test1" { + 1 2 3 4 +} + +as-set "test3" { + 1 2 3 4 +} + +as-set "test5" { + 1 2 3 4 +} + +as-set "AS_SET_AS_PCH1" { + 27 42 187 297 715 3856 10886 11893 13202 16327 16668 19281 20539 + 21312 21556 24999 25505 27678 32978 32979 35160 38052 42530 44876 + 45170 45494 48892 50843 51874 51972 52234 52304 52306 54145 54390 + 60313 197058 +} + + + diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.7.in b/regress/usr.sbin/bgpd/config/bgpd.conf.7.in new file mode 100644 index 00000000000..30402cdf96a --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.7.in @@ -0,0 +1,50 @@ +# $OpenBSD: bgpd.conf.7.in,v 1.1 2018/09/08 13:10:55 claudio Exp $ +# test prefix-set blocks + +AS 1 + +prefix-set test1 { 1.2.3/24 } +prefix-set test2 { 1.2.3/24 1.2.8.0/22 prefixlen = 24 } + +prefix-set "test3_prefixes" { \ + 192.0.211.0/24 prefixlen 24 - 32 \ + 2222:69:c000::/48 prefixlen 48 - 64 \ + 0.0.0.0/0 or-longer \ + 192.0.160.0/19 prefixlen >= 22 \ +} + +prefix-set "test4_prefixes" { + 192.0.211.0/24 prefixlen 24 - 32 + 2222:69:c000::/48 prefixlen 48 - 64 + 0.0.0.0/0 or-longer + 192.0.160.0/19 prefixlen >= 22 +} + +#notyet prefix-set "test5_prefixes" { +# 192.0.211.0/24 prefixlen 24 - 32, +# 2222:69:c000::/48 prefixlen 48 - 64, +# 0.0.0.0/0 or-longer, +# 192.0.160.0/19 prefixlen >= 22 +#} + +# from the example bgpd.conf +# list of networks that may be originated by our ASN +prefix-set mynetworks { \ + 192.0.2.0/24 \ + 2001:db8:abcd::/48 \ +} +prefix-set bogons { \ + 0.0.0.0/8 or-longer 10.0.0.0/8 or-longer \ + 100.64.0.0/10 or-longer 127.0.0.0/8 or-longer \ + 169.254.0.0/16 or-longer 172.16.0.0/12 or-longer \ + 192.0.2.0/24 or-longer 192.88.99.0/24 or-longer \ + 192.168.0.0/16 or-longer 198.18.0.0/15 or-longer \ + 198.51.100.0/24 or-longer 203.0.113.0/24 or-longer \ + 224.0.0.0/4 or-longer 240.0.0.0/4 or-longer \ + ::/8 or-longer 0100::/64 or-longer \ + 2001:2::/48 or-longer 2001:10::/28 or-longer \ + 2001:db8::/32 or-longer 2002::/16 or-longer \ + 3ffe::/16 or-longer fc00::/7 or-longer \ + fe80::/10 or-longer fec0::/10 or-longer \ + ff00::/8 or-longer \ +} diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.7.ok b/regress/usr.sbin/bgpd/config/bgpd.conf.7.ok new file mode 100644 index 00000000000..bdc229dc1c4 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.7.ok @@ -0,0 +1,55 @@ +AS 1 +router-id 127.0.0.1 +socket "/var/run/bgpd.sock.0" +holdtime min 3 +fib-priority 48 + + +rde rib Adj-RIB-In no evaluate +rde rib Adj-RIB-Out no evaluate +rde rib Loc-RIB rtable 0 fib-update yes + +prefix-set "test1" { + 1.2.3.0/24 +} + +prefix-set "test2" { + 1.2.3.0/24 1.2.8.0/22 prefixlen = 24 + +} + +prefix-set "test3_prefixes" { + 192.0.211.0/24 or-longer 2222:69:c000::/48 prefixlen 48 - 64 + 0.0.0.0/0 or-longer 192.0.160.0/19 prefixlen >= 22 + +} + +prefix-set "test4_prefixes" { + 192.0.211.0/24 or-longer 2222:69:c000::/48 prefixlen 48 - 64 + 0.0.0.0/0 or-longer 192.0.160.0/19 prefixlen >= 22 + +} + +prefix-set "mynetworks" { + 192.0.2.0/24 2001:db8:abcd::/48 + +} + +prefix-set "bogons" { + 0.0.0.0/8 or-longer 10.0.0.0/8 or-longer + 100.64.0.0/10 or-longer 127.0.0.0/8 or-longer + 169.254.0.0/16 or-longer 172.16.0.0/12 or-longer + 192.0.2.0/24 or-longer 192.88.99.0/24 or-longer + 192.168.0.0/16 or-longer 198.18.0.0/15 or-longer + 198.51.100.0/24 or-longer 203.0.113.0/24 or-longer + 224.0.0.0/4 or-longer 240.0.0.0/4 or-longer + ::/8 or-longer 100::/64 or-longer + 2001:2::/48 or-longer 2001:10::/28 or-longer + 2001:db8::/32 or-longer 2002::/16 or-longer + 3ffe::/16 or-longer fc00::/7 or-longer + fe80::/10 or-longer fec0::/10 or-longer + ff00::/8 or-longer +} + + +