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

Merged
merged 7 commits into from
Dec 3, 2024
Merged

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
@pguibert6WIND pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch from 2ee8f99 to c8381ce Compare November 20, 2024 10:31
@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 ?

@pguibert6WIND pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch from 4118279 to ea42a86 Compare November 21, 2024 15:36
@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 pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch from ea42a86 to 634ea31 Compare November 25, 2024 17:13
@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 pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch from 634ea31 to c01ffee Compare November 27, 2024 07:22
@pguibert6WIND
Copy link
Member Author

ci:rerun bfd test fail dont know why

filtered_out["routes"][pfx] = None

# ls /tmp/show*json | while read file; do egrep -v 'prefix|network|metric|ocPrf|version|weight|peerId|vrf|Version|valid|Reason|fe80' $file >$(basename $file); echo >> $(basename $file); done
with open(f"/tmp/show-bgp-ipv4-{bmp_log_type}-step{step}.json", "w") as json_file:
Copy link
Member

Choose a reason for hiding this comment

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

These need to be in the relevant test directory for the exact same reason as outlined before

Copy link
Member Author

Choose a reason for hiding this comment

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

This is done, Donald. I think we matched all necessary changes.

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]>
@pguibert6WIND pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch 2 times, most recently from f8a629a to 165e66e Compare December 2, 2024 17:39
pguibert6WIND and others added 5 commits December 2, 2024 18:44
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]>
…/tmp

Some temporary files are hardwritten in /tmp folder. Use the bmp log
folder instead. Replace the bmp log file argument with bmp log folder.

Signed-off-by: Philippe Guibert <[email protected]>
@pguibert6WIND pguibert6WIND force-pushed the bmp_test_factorise_plus_fix branch from 165e66e to d1301f1 Compare December 2, 2024 17:47
@riw777 riw777 merged commit 6e1eeed into FRRouting:master Dec 3, 2024
11 checks passed
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