From f2ebe24292cbb6b914a492c7e6ccf0c369d5f06c Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Sat, 8 Feb 2020 10:36:49 -0500 Subject: topotest: bgp_l3vpn_to_bgp_vrf - report unexpected BGP notifications Signed-off-by: Lou Berger --- .../scripts/notification_check.py | 9 ++++++ .../test_bgp_l3vpn_to_bgp_vrf.py | 36 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py (limited to 'tests') diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py new file mode 100644 index 000000000..d44754878 --- /dev/null +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py @@ -0,0 +1,9 @@ +from lutil import luCommand +rtrs = ['ce1', 'ce2', 'ce3', 'r1', 'r2', 'r3', 'r4'] +for rtr in rtrs: + ret = luCommand(rtr, 'vtysh -c "show bgp neigh"', 'Notification received .([A-Za-z0-9/ ]*)', 'none', 'collect neighbor stats') + found = luLast() + if ret != False and found != None: + val = found.group(1) + ret = luCommand(rtr, 'vtysh -c "show bgp neigh"', 'Notification received', 'fail', 'Notify RXed! {}'.format(val)) +#done diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py index 2dad5e768..7e3639829 100755 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/test_bgp_l3vpn_to_bgp_vrf.py @@ -47,6 +47,15 @@ def test_adjacencies(): #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True)' ltemplateTest('scripts/adjacencies.py', False, CliOnFail, CheckFunc) +def test_notification_check(): + CliOnFail = None + # For debugging, uncomment the next line + #CliOnFail = 'tgen.mininet_cli' + CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')' + #uncomment next line to start cli *before* script is run + #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')' + ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc) + def SKIP_test_add_routes(): CliOnFail = None # For debugging, uncomment the next line @@ -75,6 +84,15 @@ def test_check_linux_mpls(): #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')' ltemplateTest('scripts/check_linux_mpls.py', False, CliOnFail, CheckFunc) +def test_notification_check(): + CliOnFail = None + # For debugging, uncomment the next line + #CliOnFail = 'tgen.mininet_cli' + CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')' + #uncomment next line to start cli *before* script is run + #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')' + ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc) + def test_check_scale_up(): CliOnFail = None # For debugging, uncomment the next line @@ -84,6 +102,15 @@ def test_check_scale_up(): #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')' ltemplateTest('scripts/scale_up.py', False, CliOnFail, CheckFunc) +def test_notification_check(): + CliOnFail = None + # For debugging, uncomment the next line + #CliOnFail = 'tgen.mininet_cli' + CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')' + #uncomment next line to start cli *before* script is run + #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')' + ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc) + def test_check_scale_down(): CliOnFail = None # For debugging, uncomment the next line @@ -93,6 +120,15 @@ def test_check_scale_down(): #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')' ltemplateTest('scripts/scale_down.py', False, CliOnFail, CheckFunc) +def test_notification_check(): + CliOnFail = None + # For debugging, uncomment the next line + #CliOnFail = 'tgen.mininet_cli' + CheckFunc = 'ltemplateVersionCheck(\'4.1\', iproute2=\'4.9\')' + #uncomment next line to start cli *before* script is run + #CheckFunc = 'ltemplateVersionCheck(\'4.1\', cli=True, iproute2=\'4.9\')' + ltemplateTest('scripts/notification_check.py', False, CliOnFail, CheckFunc) + def SKIP_test_cleanup_all(): CliOnFail = None # For debugging, uncomment the next line -- cgit v1.2.3