Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMP test rework #17306

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

pguibert6WIND
Copy link
Member

@pguibert6WIND pguibert6WIND commented Oct 30, 2024

See individual commits:

  • The BMP tests use a common library that is duplicate in bgp_bmp and bgp_bmp_vrf test.
    Gather the two tests in one, and benefit from the same code.

  • When testing with an iBGP peering, a fix has been found in current BMP collector implementation regarding the read of the BGP as path attribute. Fix it too.

  • Protection against killing of undesirable bmp collector when testing multiple bmp tests in parallel: BMPServer in topotests should not pkill -f bmpserver #17465

@frrbot frrbot bot added the bugfix label Oct 30, 2024
@pguibert6WIND pguibert6WIND changed the title Bmp test factorise plus fix BMP test factorise plus fix Oct 30, 2024
@pguibert6WIND pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch 2 times, most recently from 9c1b97b to 9c91da3 Compare October 31, 2024 22:18
tests/topotests/lib/bgp.py Outdated Show resolved Hide resolved
@pguibert6WIND pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch 2 times, most recently from 77e03e2 to fcdaf71 Compare November 5, 2024 08:31
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, waiting on ci

@pguibert6WIND
Copy link
Member Author

ci:rerun

@ton31337
Copy link
Member

ton31337 commented Nov 7, 2024

@pguibert6WIND
Copy link
Member Author

@pguibert6WIND pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch 2 times, most recently from 4a1c38d to f68a64e Compare November 16, 2024 10:08
@frrbot frrbot bot added the tests Topotests, make check, etc label Nov 20, 2024
@pguibert6WIND pguibert6WIND changed the title BMP test factorise plus fix BMP test rework Nov 20, 2024
tgen.start_topology()

if DEBUG_PCAP:
tgen.gears["r1"].run("rm /tmp/bmp.pcap")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this should be something more granular, because if you run this in parallel, it won't work... Same for tcpdump below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEBUG_PCAP is never enabled when running tests if this is what you fear.
Eventually, I can add a comment to say to not enable it while in CIP.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concern here is that you are writing to a arbitrary bit of the tmp directory when the FRR topotests already have a well established system in place where capturing log files exist in relation to what is going on. Let's try to keep this clean and consistent so that the next person doesn't add something to plain old /tmp and cause a real problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could commit 4118279 help ?

@ton31337
Copy link
Member

Can we fix this?

Pylint report for my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:
************* Module bmpserver
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:53: error (E0602, undefined-variable, check_pid) Undefined variable 'errno'
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:55: error (E0602, undefined-variable, check_pid) Undefined variable 'errno'
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:104: error (E0602, undefined-variable, removepid) Undefined variable 'errno'
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:181: error (E0602, undefined-variable, ) Undefined variable 'logging'

@pguibert6WIND
Copy link
Member Author

Can we fix this?

Pylint report for my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:
************* Module bmpserver
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:53: error (E0602, undefined-variable, check_pid) Undefined variable 'errno'
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:55: error (E0602, undefined-variable, check_pid) Undefined variable 'errno'
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:104: error (E0602, undefined-variable, removepid) Undefined variable 'errno'
 my_frr-216029/tests/topotests/lib/bmp_collector/bmpserver.py:181: error (E0602, undefined-variable, ) Undefined variable 'logging'

done

pguibert6WIND and others added 6 commits November 27, 2024 08:20
The bgp_bmp and bgp_bmp_vrf tests use similar routines
to test the bmp, but are duplicates. Gather the bgp_bmp
and the bgp_bmp_vrf tests in a single bgp_bmp folder.

- Create a bgpbmp.py library under the bgp_bmp test folder
- The bgp_bmp and bgp_bmp_vrf test are renamed to bgp_bmp_1
and bgp_bmp_2 test.
- Maintain separate folder for config and output results. Adapt
the bgp_bmp library accordingly.
- The json output for bgp_bmp_2 test has no referenc to hostame.

Signed-off-by: Philippe Guibert <[email protected]>
When configuring the bgp_bmp test with an additional
peer that sends empty AS-PATH, the bmp collector is stopping:

> [2024-10-28 17:41:51] Finished dissecting data from ('192.0.2.1', 33922)
> [2024-10-28 17:41:52] Data received from ('192.0.2.1', 33922): length 195
> [2024-10-28 17:41:52] Got message type: <class 'bmp.BMPRouteMonitoring'>
> [2024-10-28 17:41:52] unpack_from requires a buffer of at least 2 bytes for unpacking 2 bytes at offset 0 (actual buffer size is 0)
> [2024-10-28 17:41:52] TCP session closed with ('192.0.2.1', 33922)
> [2024-10-28 17:41:52] Server shutting down on 192.0.2.10:1789

The parser attempts to read an empty AS-path and considers the length
value as a length in bytes, whereas RFC mentions this value as
definining the number of AS-PAths. Fix this in the parser.

Signed-off-by: Philippe Guibert <[email protected]>
Use unified configuration procedure.

Signed-off-by: Philippe Guibert <[email protected]>
to help identify the file type. And apply black.

Signed-off-by: Louis Scalbert <[email protected]>
Multiple BMP tests can run in parallel but, when one instance ends,
it kills the BMP server process of all BMP tests.

Save the PID of a BMP server and only kill it at the end.

Link: FRRouting#17465
Fixes: 875511c ("topotests: add basic bmp collector")
Signed-off-by: Louis Scalbert <[email protected]>
DEBUG_PCAP can be set True to manually enable pcap debugging when
running bmp tests.

Save bmp pcap in logdir (ie. /tmp/topotests/bgp_bmp.bgp_bmp_X/ instead
of /tmp.

Signed-off-by: Louis Scalbert <[email protected]>
Signed-off-by: Philippe Guibert <[email protected]>
@pguibert6WIND
Copy link
Member Author

ci:rerun bfd test fail dont know why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix master size/XXL tests Topotests, make check, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants