From 91d4463c86b31fb41dfba511f448fceac4e6deba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Hrdina?= Date: Tue, 21 Jan 2025 14:20:56 +0100 Subject: [PATCH] Add test for RHEL-68432 /Regression/gracefull-restart --- Regression/gracefull-restart/daemons | 81 +++++++++++++++++++++++++++ Regression/gracefull-restart/frr.conf | 25 +++++++++ Regression/gracefull-restart/main.fmf | 24 ++++++++ Regression/gracefull-restart/test.sh | 44 +++++++++++++++ 4 files changed, 174 insertions(+) create mode 100644 Regression/gracefull-restart/daemons create mode 100644 Regression/gracefull-restart/frr.conf create mode 100644 Regression/gracefull-restart/main.fmf create mode 100755 Regression/gracefull-restart/test.sh diff --git a/Regression/gracefull-restart/daemons b/Regression/gracefull-restart/daemons new file mode 100644 index 0000000..ed4961f --- /dev/null +++ b/Regression/gracefull-restart/daemons @@ -0,0 +1,81 @@ +# This file tells the frr package which daemons to start. +# +# Sample configurations for these daemons can be found in +# /usr/share/doc/frr/examples/. +# +# ATTENTION: +# +# When activating a daemon for the first time, a config file, even if it is +# empty, has to be present *and* be owned by the user and group "frr", else +# the daemon will not be started by /etc/init.d/frr. The permissions should +# be u=rw,g=r,o=. +# When using "vtysh" such a config file is also needed. It should be owned by +# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too. +# +# The watchfrr, zebra and staticd daemons are always started. +# +bgpd=yes +ospfd=no +ospf6d=no +ripd=no +ripngd=no +isisd=no +pimd=no +nhrpd=no +eigrpd=no +sharpd=no +pbrd=no +bfdd=no +fabricd=no +vrrpd=no + +# +# If this option is set the /etc/init.d/frr script automatically loads +# the config via "vtysh -b" when the servers are started. +# Check /etc/pam.d/frr if you intend to use "vtysh"! +# +vtysh_enable=yes +zebra_options=" -A 127.0.0.1 -s 90000000" +bgpd_options=" -A 127.0.0.1" +ospfd_options=" -A 127.0.0.1" +ospf6d_options=" -A ::1" +ripd_options=" -A 127.0.0.1" +ripngd_options=" -A ::1" +isisd_options=" -A 127.0.0.1" +pimd_options=" -A 127.0.0.1" +nhrpd_options=" -A 127.0.0.1" +eigrpd_options=" -A 127.0.0.1" +sharpd_options=" -A 127.0.0.1" +pbrd_options=" -A 127.0.0.1" +staticd_options="-A 127.0.0.1" +bfdd_options=" -A 127.0.0.1" +fabricd_options="-A 127.0.0.1" +vrrpd_options=" -A 127.0.0.1" + +# configuration profile +# +#frr_profile="traditional" +#frr_profile="datacenter" + +# +# This is the maximum number of FD's that will be available. +# Upon startup this is read by the control files and ulimit +# is called. Uncomment and use a reasonable value for your +# setup if you are expecting a large number of peers in +# say BGP. +#MAX_FDS=1024 + +# The list of daemons to watch is automatically generated by the init script. +#watchfrr_options="" + +# To make watchfrr create/join the specified netns, use the following option: +#watchfrr_options="--netns" +# This only has an effect in /etc/frr//daemons, and you need to +# start FRR with "/usr/lib/frr/frrinit.sh start ". + +# for debugging purposes, you can specify a "wrap" command to start instead +# of starting the daemon directly, e.g. to use valgrind on ospfd: +# ospfd_wrap="/usr/bin/valgrind" +# or you can use "all_wrap" for all daemons, e.g. to use perf record: +# all_wrap="/usr/bin/perf record --call-graph -" +# the normal daemon command is added to this at the end. \ No newline at end of file diff --git a/Regression/gracefull-restart/frr.conf b/Regression/gracefull-restart/frr.conf new file mode 100644 index 0000000..4c983fc --- /dev/null +++ b/Regression/gracefull-restart/frr.conf @@ -0,0 +1,25 @@ +hostname Router-CLIENT +! +log file debugging +! +router bgp 50000 + bgp router-id + no bgp ebgp-requires-policy + no bgp default ipv4-unicast + no bgp network import-check + neighbor 10.0.0.1 remote-as 500001 + ! + address-family ipv4 unicast + neighbor 10.0.0.1 activate + neighbor 10.0.0.1 next-hop-self + exit-address-family +exit +! +route-map RMAP permit 10 + set ipv6 next-hop prefer-global +exit +! +line vty +! +! +end \ No newline at end of file diff --git a/Regression/gracefull-restart/main.fmf b/Regression/gracefull-restart/main.fmf new file mode 100644 index 0000000..de58885 --- /dev/null +++ b/Regression/gracefull-restart/main.fmf @@ -0,0 +1,24 @@ +summary: FRR gives false warning when Graceful Restart enabled +description: 'When doing a BGP Peering with GR, there is a false warning. There is feature (Graceful Restart) which should work but logs will be polluted with false negative.' +contact: Frantisek Hrdina +component: + - frr +test: ./test.sh +framework: beakerlib +recommend: + - frr +duration: 5m +enabled: true +tag: + - Tier1 +tier: '1' +link: + - verifies: https://issues.redhat.com/browse/RHEL-68432 +adjust: + - environment+: + AVC_ERROR: +no_avc_check + when: distro ~< rhel-8.7 + because: 'BZ 1941765 (AVCs while running frr tests) fixed in RHEL 8.7' + - enabled: false + when: distro < rhel-7 + continue: false diff --git a/Regression/gracefull-restart/test.sh b/Regression/gracefull-restart/test.sh new file mode 100755 index 0000000..484508e --- /dev/null +++ b/Regression/gracefull-restart/test.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +CLIENT_FRR_LOG="/var/log/frr/frr-r2.log" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm "frr" + TestDir=$(pwd) + rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" + rlRun "pushd $tmp" + + rlRun "rlFileBackup --clean /etc/frr/" + rlRun "rlFileBackup --clean /etc/systemd/system/" + rlRun "rlFileBackup --clean /var/log/frr/" + rlRun "rlFileBackup --clean /var/log/audit/audit.log" + rlRun "rlFileBackup --clean /var/run/frr" + rlRun "rlFileBackup --clean /run/frr" + rlRun "rlFileBackup --clean /root/.history_frr" + + rlRun "cp -f $TestDir/frr.conf /etc/frr/frr.conf" + rlRun "cp -f $TestDir/daemons /etc/frr/daemons" + rlRun "echo \"service integrated-vtysh-config\" > /etc/frr/vtysh.conf" + + rlRun "sed -i 's||${CLIENT_IF_ADDR}|g' /etc/frr/frr.conf" + rlRun "sed -i 's||${CLIENT_FRR_LOG}|g' /etc/frr/frr.conf" + rlPhaseEnd + + rlPhaseStartTest + rlServiceStart "frr" + sleep 30s + rlRun "vtysh -c configure -c 'router bgp 50000' -c 'neighbor 10.0.0.1 graceful-restart' &> graceful-restart.log" + rlRun "vtysh -c configure -c 'router bgp 50000' -c 'neighbor 10.0.0.1 graceful-restart' &> graceful-restart.log" + rlAssertNotGrep "% The Graceful Restart command used is not valid at this moment." graceful-restart.log + rlPhaseEnd + + rlPhaseStartCleanup + rlServiceRestore "frr" + rlRun "rlFileRestore" 0 "Restoring original config files" + rlRun "popd" + rlRun "rm -r $tmp" 0 "Remove tmp directory" + rlPhaseEnd +rlJournalEnd