From ad3a9dbc669d50f5cc11b70d946dfef55f13692e Mon Sep 17 00:00:00 2001 From: claudio Date: Sat, 8 Sep 2018 12:32:01 +0000 Subject: [PATCH] Add some additional config regress tests. Testing neighbor, group and rdomain. --- regress/usr.sbin/bgpd/config/Makefile | 4 +- regress/usr.sbin/bgpd/config/bgpd.conf.4.in | 41 +++++++++++++++ regress/usr.sbin/bgpd/config/bgpd.conf.4.ok | 57 +++++++++++++++++++++ regress/usr.sbin/bgpd/config/bgpd.conf.5.in | 37 +++++++++++++ regress/usr.sbin/bgpd/config/bgpd.conf.5.ok | 48 +++++++++++++++++ 5 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 regress/usr.sbin/bgpd/config/bgpd.conf.4.in create mode 100644 regress/usr.sbin/bgpd/config/bgpd.conf.4.ok create mode 100644 regress/usr.sbin/bgpd/config/bgpd.conf.5.in create mode 100644 regress/usr.sbin/bgpd/config/bgpd.conf.5.ok diff --git a/regress/usr.sbin/bgpd/config/Makefile b/regress/usr.sbin/bgpd/config/Makefile index 4181cbbf9c4..2938a36dc9b 100644 --- a/regress/usr.sbin/bgpd/config/Makefile +++ b/regress/usr.sbin/bgpd/config/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.2 2018/09/08 09:18:34 benno Exp $ +# $OpenBSD: Makefile,v 1.3 2018/09/08 12:32:01 claudio Exp $ -BGPDTESTS=1 2 3 +BGPDTESTS=1 2 3 4 5 REGRESS_TARGETS = config diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.4.in b/regress/usr.sbin/bgpd/config/bgpd.conf.4.in new file mode 100644 index 00000000000..0fc9d607cc7 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.4.in @@ -0,0 +1,41 @@ +# $OpenBSD: bgpd.conf.4.in,v 1.1 2018/09/08 12:32:01 claudio Exp $ +# test neighbor and group statements + +AS 1 + +neighbor 192.0.2.1 { + remote-as 64496 +} +#notyet neighbor 192.0.2.2 { remote-as 64496 } + +neighbor 192.0.2.3 { + # test comment + remote-as 64496 + descr "test-peer" +} + +group testing { + remote-as 64496 + + neighbor 192.0.2.4 + #notyet neighbor 192.0.2.5 { descr "test2-peer" } + neighbor 192.0.2.6 { + remote-as 64497 + descr "test2-peer" + + + } + #notyet neighbor 192.0.2.7 { + # comment + + # another comment + #notyet } + neighbor 192.0.2.8 +} + +group test2 { + remote-as 64497 + + neighbor 192.0.2.10 + #notyet neighbor 192.0.2.11 { descr "test3-peer" } +} diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.4.ok b/regress/usr.sbin/bgpd/config/bgpd.conf.4.ok new file mode 100644 index 00000000000..872b5bf3f29 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.4.ok @@ -0,0 +1,57 @@ +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 + + +neighbor 192.0.2.3 { + descr "test-peer" + remote-as 64496 + enforce neighbor-as yes + enforce local-as yes + announce IPv4 unicast +} +neighbor 192.0.2.1 { + remote-as 64496 + enforce neighbor-as yes + enforce local-as yes + announce IPv4 unicast +} +group "testing" { + neighbor 192.0.2.8 { + remote-as 64496 + enforce neighbor-as yes + enforce local-as yes + announce IPv4 unicast + } + neighbor 192.0.2.6 { + descr "test2-peer" + remote-as 64497 + enforce neighbor-as yes + enforce local-as yes + announce IPv4 unicast + } + neighbor 192.0.2.4 { + remote-as 64496 + enforce neighbor-as yes + enforce local-as yes + announce IPv4 unicast + } +} + +group "test2" { + neighbor 192.0.2.10 { + remote-as 64497 + enforce neighbor-as yes + enforce local-as yes + announce IPv4 unicast + } +} + + diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.5.in b/regress/usr.sbin/bgpd/config/bgpd.conf.5.in new file mode 100644 index 00000000000..f08e5c33472 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.5.in @@ -0,0 +1,37 @@ +# $OpenBSD: bgpd.conf.5.in,v 1.1 2018/09/08 12:32:01 claudio Exp $ +# test rdomain statement + +AS 1 + +# example from the man page +rdomain 1 { + descr "a rdomain" + rd 65002:1 + import-target rt 65002:42 + export-target rt 65002:42 + network 192.0.2/24 + depend on mpe0 +} + +rdomain 2 { + rd 1:2 +} + +rdomain 3 { + rd 1:3 + + # some comment + descr "test-rdomain" +} + +rdomain 4 { + depend on mpe1 + descr "test-full" + export-target rt 65002:42 + export-target rt 192.0.2.3:42 + fib-update no + import-target rt 65002:21 + import-target rt 192.0.2.3:21 + network 192.0.2.32/27 + rd 192.0.2.4:1 +} diff --git a/regress/usr.sbin/bgpd/config/bgpd.conf.5.ok b/regress/usr.sbin/bgpd/config/bgpd.conf.5.ok new file mode 100644 index 00000000000..bbeba06e585 --- /dev/null +++ b/regress/usr.sbin/bgpd/config/bgpd.conf.5.ok @@ -0,0 +1,48 @@ +AS 1 +router-id 127.0.0.1 +socket "/var/run/bgpd.sock.0" +holdtime min 3 +fib-priority 48 + +rdomain 1 { + descr "a rdomain" + fib-update yes + depend on mpe0 + network 192.0.2.0/24 + + rd 65002:1 + export-target rt 65002:42 + import-target rt 65002:42 +} +rdomain 2 { + fib-update yes + depend on + + rd 1:2 +} +rdomain 3 { + descr "test-rdomain" + fib-update yes + depend on + + rd 1:3 +} +rdomain 4 { + descr "test-full" + fib-update no + depend on mpe1 + network 192.0.2.32/27 + + rd 192.0.2.4:1 + export-target rt 65002:42 + export-target rt 192.0.2.3:42 + import-target rt 65002:21 + import-target rt 192.0.2.3:21 +} + +rde rib Adj-RIB-In no evaluate +rde rib Adj-RIB-Out no evaluate +rde rib Loc-RIB rtable 0 fib-update yes + + + -- 2.20.1