Skip to content

[BGP] Implement new testcase test_traffic_shift#2553

Merged
bingwang-ms merged 5 commits intosonic-net:masterfrom
bingwang-ms:add_test_traffic_shift
Nov 23, 2020
Merged

[BGP] Implement new testcase test_traffic_shift#2553
bingwang-ms merged 5 commits intosonic-net:masterfrom
bingwang-ms:add_test_traffic_shift

Conversation

@bingwang-ms
Copy link
Collaborator

@bingwang-ms bingwang-ms commented Nov 19, 2020

Description of PR

Summary:
Fixes # (issue)
Implement a new testcase test_traffic_shift.

  • case 1 test_TSA
    Verify all routes are announced to bgp monitor, and only loopback routes are announced to neighs.
  1. Start exabgp on ptf, and establise BGP session with DUT
  2. Setup BGPMON over the BGP session in step 1
  3. Issue TSA on DUT, and wait some time (say 30 secs)
  4. Verify all routes are announced to BGPMON on ptf
  5. Verify only loopback routes with certain community are announced to bgp neighbors
  • case 2 test_TSB
    Verify all routes are announced to bgp monitor and all routes are announced to neighbors.
  1. Start exabgp on ptf, and establise BGP session with DUT
  2. Setup BGPMON over the BGP session in step 1
  3. Issue TSB on DUT, and wait some time (say 30 secs)
  4. Verify all routes are announced to BGPMON on ptf
  5. Verify all routes are announced to bgp neighbors

Please merge after sonic-net/sonic-buildimage#5906 and sonic-net/sonic-buildimage#5968 are merged.

Type of change

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

Approach

What is the motivation for this PR?

This PR is to implement new testcase test_traffic_shift.

How did you do it?

  1. Use exabgp to dump all received routes on BGPMON, and parsed into a set;
  2. Retrieve all routes from ceos and parsed into a dict;
  3. Retrieve all routes from dut and parsed into a dict;
  4. Compare routes retrieved in step 3 with that retrieved in step 1 and step 2.

How did you verify/test it?

Verified on vtestbed t1

py.test --inventory veos_vtb --host-pattern vlab-01 --module-path ../ansible/library/ --testbed vms-kvm-t1 --testbed_file vtestbed.csv --junit-xml=tr.xml --log-cli-level warn -k 'not test_restart_syncd' --topology=t1,t0,any,util bgp/test_traffic_shift.py
========================================================================================= test session starts =========================================================================================
collected 2 items                                                                                                                                                                                     

bgp/test_traffic_shift.py::test_TSA ^@PASSED                                                                                                                                                      [ 50%]
bgp/test_traffic_shift.py::test_TSB ^@PASSED                                                                                                                                                      [100%]

-------------------------------------------------------------------------- generated xml file: /data/sonic-mgmt/tests/tr.xml --------------------------------------------------------------------------
===================================================================================== 2 passed in 822.05 seconds ======================================================================================

Any platform specific information?

No.

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

Only run on T1 topo.

Documentation

@bingwang-ms bingwang-ms requested review from a team and pavel-shirshov November 19, 2020 03:49
@lgtm-com
Copy link

lgtm-com bot commented Nov 19, 2020

This pull request introduces 1 alert when merging c3f2fba into 7c5d15a - view on LGTM.com

new alerts:

  • 1 for Should use a 'with' statement

Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

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

Please check my comments

dump_script = module.params['dump_script']

setup_exabgp_processor()
setup_exabgp_processor(dump_script==DEFAULT_DUMP_SCRIPT)
Copy link
Contributor

Choose a reason for hiding this comment

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

duthost.command("sonic-cfggen -j {} -w".format(BGPMON_CONFIG_FILE))
time.sleep(BGP_ANNOUNCE_TIME)
bgpmon_routes = parse_exabgp_dump(ptfhost)
rib_v4 = parse_rib(duthost, 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we start bgpmon before TSA?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think bgpmon should be started after TSA. That is because if we start bgpmon, and then set TSA, there will be a short TSB (normal) state between two operations, during which routes are possible to be announced. We might get a failure then.

1. Rename 'default_dump_script' to 'use_default_dump_script'
2. Rename 'TS_ERROR' to 'TS_INCONSISTENT'
3. Raise exception for unexpected state of 'TSC'

Signed-off-by: bingwang <[email protected]>
Copy link
Contributor

@pavel-shirshov pavel-shirshov left a comment

Choose a reason for hiding this comment

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

LGTM

@bingwang-ms bingwang-ms merged commit 2c9642e into sonic-net:master Nov 23, 2020
bingwang-ms added a commit that referenced this pull request Nov 23, 2020
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…3075)

utilities:
* efd2ab8 2022-12-14 | [muxcable][show] update `show mux tunnel-route` to separate ASIC and kernel into two columns (sonic-net#2553) (HEAD -> 202205) [Jing Zhang]

kernel:
* 085d8cb 2022-12-14 | Merge pull request sonic-net#303 from madhava28/cisco/kernel_config (HEAD -> 202205) [Saikrishna Arcot]

swss:
* d8e46b9 2022-12-16 | [muxorch] Skip programming ACL for standby `active-active` ports (sonic-net#2569) (HEAD -> 202205) [Longxiang Lyu]

Signed-off-by: Ying Xie <[email protected]>

Signed-off-by: Ying Xie <[email protected]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…le head (sonic-net#13353)

utilties:
* 7fc3fb7 2023-01-06 | [storyteller] add link prober state change to story teller (sonic-net#2585) (HEAD -> 202205, github/202205) [Jing Zhang]
* d8202e8 2023-01-12 | [202205] Added a new option in show queue counters command to display voq statistics (sonic-net#2591) [Sambath Kumar Balasubramanian]
* 98dde31 2023-01-11 | resolved conflicts (sonic-net#2589) [kannankvs]

swss:
* 268c3f3 2023-01-11 | Added new attributes for Vnet and Vxlan ecmp configurations. (sonic-net#2584) (HEAD -> 202205, github/202205) [siqbal1986]
* 50235b6 2023-01-12 | [routesync] Fix for stale dynamic neighbor (sonic-net#2553) [vganesan-nokia]
* ad9d826 2023-01-12 | [202205][voq] Add voq counters. (sonic-net#2606) [Sambath Kumar Balasubramanian]
* 34995f1 2023-01-10 | Revert "[voq][chassis]Add show fabric counters port/queue commands (sonic-net#2522)" (sonic-net#2612) [Arvindsrinivasan Lakshmi Narasimhan]

sairedis:
* 92e6442 2023-01-05 | enable cisco8000 SAI bulk API feature (sonic-net#1153) (sonic-net#1164) (github/202205) [Keith Lu]

platform-daemons:
* 10eb2e6 2023-01-06 | Fix bug where transceiver info is missing after port breakout change (sonic-net#329) (HEAD -> 202205) [Tal Berlowitz]

Signed-off-by: Ying Xie <[email protected]>

Signed-off-by: Ying Xie <[email protected]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
sonic-net#13202

advance sonic-utilities submodule for 202211 branch

34428157 - (HEAD, origin/202211) Revert "Optimize the execution time of the 'show techsupport' script to 5-10%, (Qos config change sonic-net#2504)" (6 days ago) [stormliang]
c3bd01f6 - Revert "[generate_dump] Optimize the execution time of 'show techsupport' CLI by parallel function execution ([201811][Devices] Add new device CIG CS6436-56P sonic-net#2512)" (6 days ago) [stormliang]
5a326d8b - [Mellanox] Change severity to NOTICE in Mellanox buffer migrator when unable to fetch DEVICE_METADATA due to empty CONFIG_DB during initialization ([warm boot] cherry-pick PR sonic-net#2538 and advance related sub-modules in 201811 branch sonic-net#2569) (2 weeks ago) [Stephen Sun]
50b36ef3 - Fix issue: unconfigured PGs are displayed in watermarkstat ([docker-lldp]: fix several issues in lldpd docker sonic-net#2556) (2 weeks ago) [Stephen Sun]
a9fd2a79 - [Command Ref] Add doc for syslog rate limit ([sub module] move sairedis and swss to 201811 branch sonic-net#2508) (2 weeks ago) [Junchao-Mellanox]
80546ff3 - [generate_dump] Optimize the execution time of 'show techsupport' CLI by parallel function execution ([201811][Devices] Add new device CIG CS6436-56P sonic-net#2512) (2 weeks ago) [Vadym Hlushko]
6649ca8a - [timer.unit.j2] use wanted-by in timer unit ([201803] [services] Restart SwSS service upon unexpected critical process exit sonic-net#2546) (2 weeks ago) [Stepan Blyshchak]
dd23d0ef - Fixes [Sub-If|VRF] Unbind sub-interface from VRF is failed sonic-net#12170: Delete subinterface and recreate the subinterface in ([VLAN] "show mac" doesn't work when interface added to vlan as tagged member sonic-net#2513) (2 weeks ago) [Preetham]
236749d3 - [db_migrator] Fix migration of Loopback data: handle all Loopback interfaces (DellEMC S6000 xcvrd support sonic-net#2560) (2 weeks ago) [Vaibhav Hemant Dixit]
5762d814 - Optimize the execution time of the 'show techsupport' script to 5-10%, (Qos config change sonic-net#2504) (2 weeks ago) [Vadym Hlushko]
d3c3e368 - [muxcable][show] update show mux tunnel-route to separate ASIC and kernel into two columns (build errors on branch 201811 for centec platform sonic-net#2553) (2 weeks ago) [Jing Zhang]
c98648a1 - [show]Fix show route return code on error (Dell SMF driver hwmon number reorder fix for Dell S6100/Z9100 sonic-net#2542) (2 weeks ago) [Sudharsan Dhamal Gopalarathnam]
01374673 - [route_check]: Ignore ASIC only SOC IPs (Added new SN3700/SN3700C Mellanox platforms sonic-net#2548) (2 weeks ago) [Lawrence Lee]
d2967805 - YANG Validation for ConfigDB Updates: WARM_RESTART, SFLOW_SESSION, SFLOW, VXLAN_TUNNEL, VXLAN_EVPN_NVO, VXLAN_TUNNEL_MAP, MGMT_VRF_CONFIG, CABLE_LENGTH, VRF tables ([submodule 201811] advance sairedis and swss submodule for 201811 branch sonic-net#2526) (2 weeks ago) [isabelmsft]
88b01ffd - [db_migrator] Remove import of swsssdk as it is not supported in master ([build]: apply proxy setting to curl. sonic-net#2544) (2 weeks ago) [Vaibhav Hemant Dixit]
4ae970c6 - Support syslog rate limit configuration for containers and host (Move FRR from 4.0 to 6.0.2 and make new frr version and pkg compile sonic-net#2454) (2 weeks ago) [Junchao-Mellanox]
608ed147 - [generate_dump] [Mellanox] Fix the duplicate dfw dump collection problem by adding symlinks ('show vlan config' is not displaying the VLAN members, after the clear config and reload with default l2 configuration. sonic-net#2536) (2 weeks ago) [Vivek]
bdc2599f - [config] Add check in config interface ip command to block if the interface is portchannel member ([sub module] advance sonic-swss sub module sonic-net#2539) (2 weeks ago) [Sudharsan Dhamal Gopalarathnam]
cff4fed5 - [system-health] Improve code structure of system health CLIs ([sub-module] advance sonic-swss sub-module sonic-net#2453) (2 weeks ago) [Junchao-Mellanox]
488e5714 - Transceiver eeprom dom CLI modification to show output from TRANSCEIVER_DOM_THRESHOLD table (Fix for KeyError: 'DEVICE_NEIGHBOR' when executing 'show interfaces neighbor expected' command sonic-net#2535) (2 weeks ago) [mihirpat1]
07ca5def - sonic-utilities: Update config reload() to verify formatting of an input file ([ntp]: Do not disable reader for error ENOBUFS sonic-net#2529) (2 weeks ago) [Caitlin Choate]
f0f083a2 - [GCU] Add RemoveCreateOnlyDependency Validator/Generator (Enabling Fast-reboot command in s6100 loaded with T0 topo getting Failed unmounting /host error sonic-net#2500) (2 weeks ago) [jingwenxie]
eca0253c - [QoS] Introduce delay to the qos reload flow (Config reload/load_minigraph not clearing State DB sonic-net#2503) (2 weeks ago) [DavidZagury]
35158ee0 - Use github code scanning instead of LGTM ([sub module] sub module sonic-swss-common tracking 201811 branch sonic-net#2530) (2 weeks ago) [Liu Shilong]
682b5cee - Change show kube command default value of insecure key to True ([submodule] update sonic-snmpagent sonic-net#2517) (2 weeks ago) [lixiaoyuner]
ce19e631 - Add db_migrator_constants.py script to setup.py (Add device data for Arista 7060PX/DX4-32 sonic-net#2534) (2 weeks ago) [Vaibhav Hemant Dixit]
0d0c2693 - [drop counters] Fix CLI script for unconfigured PGs ([config] Do not fail for minigraphs which do not have neighbors listed in <Devices> section sonic-net#2518) (2 weeks ago) [Lior Avramov]
2c69d0fd - Update vrf add, del commands for duplicate/non-existing VRFs (solve package build dependency issue sonic-net#2467) (2 weeks ago) [Muhammad Danish]
efc09280 - Port 202012 DB migration changes to newer branches ([vs]: Force10-S6000 buffer settings for virtual switch sonic-net#2515) (2 weeks ago) [Vaibhav Hemant Dixit]
70a15aaa - [VXLAN]Fixing traceback in show remotemac when mac moves during command execution ([build] When generating image version, handle case where current commit has no reachable tags sonic-net#2506) (2 weeks ago) [Sudharsan Dhamal Gopalarathnam]
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.

2 participants