Skip to content

[pytest] Add new test to check BGP update time#2594

Merged
lolyu merged 5 commits intosonic-net:masterfrom
lolyu:bgp_update_timer
Nov 30, 2020
Merged

[pytest] Add new test to check BGP update time#2594
lolyu merged 5 commits intosonic-net:masterfrom
lolyu:bgp_update_timer

Conversation

@lolyu
Copy link
Collaborator

@lolyu lolyu commented Nov 26, 2020

Description of PR

Summary:
Fixes # (issue)

Add a testcase test_bgp_update_timer to cover the following testing scenario:

  1. For FRRrouting, ensure SONiC sends BGP updates to neighbors after receiving within 1s.
  2. For Quagga, ensure the time interval is within 20s.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

How did you do it?

  1. Start two new BGP sessions.
  2. Send BGP update to announce route from the first neighbor to DUT.
  3. Ensure DUT sends a BGP update to the second neighbor to announce the received route.
  4. Time the interval between Step 2 and Step 3.
  5. Send BGP update to withdraw the route announced in Step 2 from the first neighbor to DUT.
  6. Ensure DUT sends a BGP update to the second neighbor to withdraw the route.
  7. Time the interval between Step 5 and Step 6.
  8. Repeat Step 2 to Step 7 for 5 times.
  9. Ensure the medians of announce update intervals and withdraw updates intervals are within threshold.

How did you verify/test it?

  1. Test it against t0
bgp/test_bgp_update_timer.py::test_bgp_update_timer PASSED                                                                                                                  [100%]
  1. Test it against t1
bgp/test_bgp_update_timer.py::test_bgp_update_timer PASSED                                                                                                                  [100%]
  1. Test it over 201811
bgp/test_bgp_update_timer.py::test_bgp_update_timer PASSED                                                                                                                  [100%]

Any platform specific information?

Supported testbed topology if it's a new test case?

t0 and t1

Documentation

Add variable `db_table_name` to `bgpmon.j2` so that it could be used in
add peers to tables like `BGP_NEIGHBOR`.
Rename it to `bgp_template.j2` to reflect this change.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
Use neighbor ip to name BGP dump file instead of using DUT's IP in case
of there might be multiple BGP sessions connected to the same DUT IP
address.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
@lolyu lolyu force-pushed the bgp_update_timer branch 3 times, most recently from d80f888 to b976899 Compare November 26, 2020 15:19
Add new testcase `test_bgp_update_timer` to ensure BGP updates are
propagated within certain time threshold.
For FRRouting, time interval for the update in and update out for the
same route must be within 1s.
For Quagga, the time interval must be within 20s.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
@lolyu lolyu changed the title Bgp update timer [pytest] Add new test to check BGP update time Nov 27, 2020
@lolyu lolyu marked this pull request as ready for review November 27, 2020 04:42
@lolyu lolyu requested review from a team, bingwang-ms and wangxin November 27, 2020 04:42
@lolyu
Copy link
Collaborator Author

lolyu commented Nov 27, 2020

Retest this please

@lolyu
Copy link
Collaborator Author

lolyu commented Nov 27, 2020

updated and retest passed, @wangxin, please help to review again, thanks.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
line = stdin.readline()
obj = json.loads(line)
f = open("/tmp/exabgp-" + obj["neighbor"]["ip"], "a")
f = open("/tmp/exabgp-" + obj["neighbor"]["address"]["local"], "a")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why make this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because DUT uses loopback address as router ID for both sessions, those two exabgp will dump to the same file.

Change BGP update match conditions:
1. Check withdrawn routes length first to decide if withdrawn routes
exists.
2. Check total path attributes length first to decide if nlri is
included in this update message.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
@lolyu lolyu merged commit 840b457 into sonic-net:master Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants