From 939b35d9d7df23b40458ef85745e8856eb3b0e29 Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 5 May 2021 10:28:11 +0000 Subject: [PATCH] Improve the rde evaluate all test case by doing a withdraw of a prefix that is hidden (but sent to one system because of rde evaluate all). --- .../bgpd/integrationtests/eval_all.sh | 55 +++++++++++++++++-- .../{eval_all.ok => eval_all.test1.ok} | 18 +----- .../bgpd/integrationtests/eval_all.test2.ok | 10 ++++ .../bgpd/integrationtests/exabgp.eval_all.in | 14 ++--- 4 files changed, 69 insertions(+), 28 deletions(-) rename regress/usr.sbin/bgpd/integrationtests/{eval_all.ok => eval_all.test1.ok} (53%) create mode 100644 regress/usr.sbin/bgpd/integrationtests/eval_all.test2.ok diff --git a/regress/usr.sbin/bgpd/integrationtests/eval_all.sh b/regress/usr.sbin/bgpd/integrationtests/eval_all.sh index ec1b631cc89..c9dc7814c5d 100644 --- a/regress/usr.sbin/bgpd/integrationtests/eval_all.sh +++ b/regress/usr.sbin/bgpd/integrationtests/eval_all.sh @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: eval_all.sh,v 1.1 2021/04/13 07:39:17 claudio Exp $ +# $OpenBSD: eval_all.sh,v 1.2 2021/05/05 10:28:11 claudio Exp $ set -e @@ -107,12 +107,57 @@ sleep 2 echo test 1 -sleep 5 -route -T ${RDOMAIN1} exec bgpctl sh rib detail -route -T ${RDOMAIN1} exec bgpctl sh rib out detail | \ +# no filtering +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.2 announce route 10.12.1.0/24 next-hop self' +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 announce route 10.12.1.0/24 next-hop self' +# filter from 64501 +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.2 announce route 10.12.2.0/24 next-hop self community [ 64500:64503 64500:64504 ]' +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 announce route 10.12.2.0/24 next-hop self' +# filter from both +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.2 announce route 10.12.3.0/24 next-hop self community [ 64500:64503 64500:64504 ]' +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 announce route 10.12.3.0/24 next-hop self community [ 64500:64503 64500:64504 ]' +# similar with aspath and prepends +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.2 announce route 10.0.1.0/24 next-hop self as-path [ 64501 101 ] community [ 64500:64503 64500:64504 ]' +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 announce route 10.0.1.0/24 next-hop self as-path [ 64502 101 101 101 ]' + +sleep 3 +route -T ${RDOMAIN1} exec bgpctl sh rib +(route -T ${RDOMAIN1} exec bgpctl sh rib out nei 10.12.57.4 detail; +route -T ${RDOMAIN1} exec bgpctl sh rib out nei 10.12.57.5 detail ) | \ grep -v 'Last update:' | tee eval_all.out sleep .2 -diff -u ${BGPDCONFIGDIR}/eval_all.ok eval_all.out +diff -u ${BGPDCONFIGDIR}/eval_all.test1.ok eval_all.out +echo OK + +echo test 2 + +# withdraw hidden route +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 withdraw route 10.12.2.0/24' +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 withdraw route 10.0.1.0/24' + +sleep 3 +route -T ${RDOMAIN1} exec bgpctl sh rib +(route -T ${RDOMAIN1} exec bgpctl sh rib out nei 10.12.57.4 detail; +route -T ${RDOMAIN1} exec bgpctl sh rib out nei 10.12.57.5 detail ) | \ + grep -v 'Last update:' | tee eval_all.out +sleep .2 +diff -u ${BGPDCONFIGDIR}/eval_all.test2.ok eval_all.out +echo OK + +# same result as test 1 +echo test 3 + +# readd route +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 announce route 10.12.2.0/24 next-hop self' +exacmd 'neighbor 10.12.57.1 router-id 10.12.57.3 announce route 10.0.1.0/24 next-hop self as-path [ 64502 101 101 101 ]' + +sleep 3 +route -T ${RDOMAIN1} exec bgpctl sh rib +(route -T ${RDOMAIN1} exec bgpctl sh rib out nei 10.12.57.4 detail; +route -T ${RDOMAIN1} exec bgpctl sh rib out nei 10.12.57.5 detail ) | \ + grep -v 'Last update:' | tee eval_all.out +sleep .2 +diff -u ${BGPDCONFIGDIR}/eval_all.test1.ok eval_all.out echo OK exacmd 'shutdown' diff --git a/regress/usr.sbin/bgpd/integrationtests/eval_all.ok b/regress/usr.sbin/bgpd/integrationtests/eval_all.test1.ok similarity index 53% rename from regress/usr.sbin/bgpd/integrationtests/eval_all.ok rename to regress/usr.sbin/bgpd/integrationtests/eval_all.test1.ok index 8b3891ef259..f8841474fe8 100644 --- a/regress/usr.sbin/bgpd/integrationtests/eval_all.ok +++ b/regress/usr.sbin/bgpd/integrationtests/eval_all.test1.ok @@ -1,20 +1,8 @@ -BGP routing table entry for 10.12.1.0/24 - 64501 - Nexthop 10.12.57.2 (via 10.12.57.2) Neighbor 10.12.57.3 (10.12.57.3) - Origin IGP, metric 0, localpref 100, weight 0, ovs not-found, external, valid - -BGP routing table entry for 10.12.2.0/24 - 64501 - Nexthop 10.12.57.2 (via 10.12.57.2) Neighbor 10.12.57.3 (10.12.57.3) - Origin IGP, metric 0, localpref 100, weight 0, ovs not-found, external, valid - Communities: 64500:64503 64500:64504 - -BGP routing table entry for 10.12.3.0/24 - 64501 - Nexthop 10.12.57.2 (via 10.12.57.2) Neighbor 10.12.57.3 (10.12.57.3) +BGP routing table entry for 10.0.1.0/24 + 64502 101 101 101 + Nexthop 10.12.57.3 (via 10.12.57.3) Neighbor 10.12.57.4 (10.12.57.4) Origin IGP, metric 0, localpref 100, weight 0, ovs not-found, external, valid - Communities: 64500:64503 64500:64504 BGP routing table entry for 10.12.1.0/24 64501 diff --git a/regress/usr.sbin/bgpd/integrationtests/eval_all.test2.ok b/regress/usr.sbin/bgpd/integrationtests/eval_all.test2.ok new file mode 100644 index 00000000000..810bd0b94a4 --- /dev/null +++ b/regress/usr.sbin/bgpd/integrationtests/eval_all.test2.ok @@ -0,0 +1,10 @@ + +BGP routing table entry for 10.12.1.0/24 + 64501 + Nexthop 10.12.57.2 (via 10.12.57.2) Neighbor 10.12.57.4 (10.12.57.4) + Origin IGP, metric 0, localpref 100, weight 0, ovs not-found, external, valid + +BGP routing table entry for 10.12.1.0/24 + 64501 + Nexthop 10.12.57.2 (via 10.12.57.2) Neighbor 10.12.57.5 (10.12.57.5) + Origin IGP, metric 0, localpref 100, weight 0, ovs not-found, external, valid diff --git a/regress/usr.sbin/bgpd/integrationtests/exabgp.eval_all.in b/regress/usr.sbin/bgpd/integrationtests/exabgp.eval_all.in index 348c44fff1f..08a4add1868 100644 --- a/regress/usr.sbin/bgpd/integrationtests/exabgp.eval_all.in +++ b/regress/usr.sbin/bgpd/integrationtests/exabgp.eval_all.in @@ -16,10 +16,9 @@ neighbor 10.12.57.1 { ipv4 unicast; } - static { - route 10.12.1.0/24 next-hop self; - route 10.12.2.0/24 next-hop self community [ 64500:64503 64500:64504 ]; - route 10.12.3.0/24 next-hop self community [ 64500:64503 64500:64504 ]; + api { + processes [ reader ]; + neighbor-changes; } } @@ -36,10 +35,9 @@ neighbor 10.12.57.1 { ipv4 unicast; } - static { - route 10.12.1.0/24 next-hop self; - route 10.12.2.0/24 next-hop self; - route 10.12.3.0/24 next-hop self community [ 64500:64503 64500:64504 ]; + api { + processes [ reader ]; + neighbor-changes; } } -- 2.20.1