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

[tests/vrf] Submit VRF testcases according to vrf test plan #1065

Merged
merged 6 commits into from
Dec 4, 2019

Conversation

dawnbeauty
Copy link
Contributor

@dawnbeauty dawnbeauty commented Aug 12, 2019

Signed-off-by: Zhiqian Wu zhiqian.wu@nephosinc.com

Description of PR

Summary:
Submit VRF testcases according to vrf test plan [sonic-net/SONiC/pull/409].

It works together with below PRs:

Type of change

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

Approach

How did you verify/test it?

  1. Feature tests:
root@sonic-mgmt:/var/root/sonic-mgmt-vrf/tests# py.test  -vvv --inventory veos --host-pattern all --user admin --testbed vms-t0 --testbed_file testbed.csv  --duration=0 --show-capture=stdout  test_vrf.py
======================= test session starts =================================
platform linux2 -- Python 2.7.12, pytest-4.6.3, py-1.8.0, pluggy-0.12.0 -- /usr/bin/python
cachedir: .pytest_cache
ansible: 2.0.0.2
rootdir: /var/root/sonic-mgmt-vrf/tests, inifile: setup.cfg
plugins: ansible-2.0.2
collected 40 items

test_vrf.py::TestVrfCreateAndBind::test_vrf_in_kernel PASSED                               [  2%]
test_vrf.py::TestVrfCreateAndBind::test_vrf_in_appl_db PASSED                              [  5%]
test_vrf.py::TestVrfCreateAndBind::test_vrf_in_asic_db PASSED                              [  7%]
test_vrf.py::TestVrfNeigh::test_ping_lag_neigh PASSED                                      [ 10%]
test_vrf.py::TestVrfNeigh::test_ping_vlan_neigh PASSED                                     [ 12%]
test_vrf.py::TestVrfNeigh::test_vrf1_neigh_ip_fwd PASSED                                   [ 15%]
test_vrf.py::TestVrfNeigh::test_vrf2_neigh_ip_fwd PASSED                                   [ 17%]
test_vrf.py::TestVrfFib::test_show_bgp_summary PASSED                                      [ 20%]
test_vrf.py::TestVrfFib::test_vrf1_fib PASSED                                              [ 22%]
test_vrf.py::TestVrfFib::test_vrf2_fib PASSED                                              [ 25%]
test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf1_from_vrf2 PASSED                    [ 27%]
test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf2_from_vrf1 PASSED                    [ 30%]
test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf1_from_vrf2 PASSED                      [ 32%]
test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf2_from_vrf1 PASSED                      [ 35%]
test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v4 PASSED                  [ 37%]
test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v6 PASSED                  [ 40%]
test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v4 PASSED                      [ 42%]
test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v6 PASSED                      [ 45%]
test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf1_loopback PASSED                           [ 47%]
test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf2_loopback PASSED                           [ 50%]
test_vrf.py::TestVrfLoopbackIntf::test_bgp_with_loopback PASSED                            [ 52%]
test_vrf.py::TestVrfWarmReboot::test_vrf_swss_warm_reboot PASSED                           [ 55%]
test_vrf.py::TestVrfWarmReboot::test_vrf_system_warm_reboot PASSED                         [ 57%]
test_vrf.py::TestVrfCapacity::test_ping SKIPPED                                            [ 60%]
test_vrf.py::TestVrfCapacity::test_ip_fwd SKIPPED                                          [ 62%]
test_vrf.py::TestVrfUnbindIntf::test_pc1_ip_addr_flushed PASSED                            [ 65%]
test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed PASSED                              [ 67%]
test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed_by_traffic PASSED                   [ 70%]
test_vrf.py::TestVrfUnbindIntf::test_pc1_routes_flushed PASSED                             [ 72%]
test_vrf.py::TestVrfUnbindIntf::test_pc2_neigh PASSED                                      [ 75%]
test_vrf.py::TestVrfUnbindIntf::test_pc2_fib PASSED                                        [ 77%]
test_vrf.py::TestVrfDeletion::test_pc1_ip_addr_flushed PASSED                              [ 80%]
test_vrf.py::TestVrfDeletion::test_pc2_ip_addr_flushed PASSED                              [ 82%]
test_vrf.py::TestVrfDeletion::test_vlan1000_ip_addr_flushed PASSED                         [ 85%]
test_vrf.py::TestVrfDeletion::test_loopback0_ip_addr_flushed PASSED                        [ 87%]
test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed PASSED                              [ 90%]
test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed_by_traffic PASSED                   [ 92%]
test_vrf.py::TestVrfDeletion::test_vrf1_routes_flushed PASSED                              [ 95%]
test_vrf.py::TestVrfDeletion::test_vrf2_neigh PASSED                                       [ 97%]
test_vrf.py::TestVrfDeletion::test_vrf2_fib PASSED                                         [100%]

====================================== slowest test durations ====================================
165.08s call     test_vrf.py::TestVrfWarmReboot::test_vrf_system_warm_reboot
147.31s call     test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf1_from_vrf2
146.83s call     test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf2_from_vrf1
146.70s call     test_vrf.py::TestVrfDeletion::test_vrf1_routes_flushed
76.84s call     test_vrf.py::TestVrfUnbindIntf::test_pc1_routes_flushed
56.91s call     test_vrf.py::TestVrfWarmReboot::test_vrf_swss_warm_reboot
16.11s teardown test_vrf.py::TestVrfDeletion::test_vrf2_fib
14.87s setup    test_vrf.py::TestVrfLoopbackIntf::test_bgp_with_loopback
14.07s setup    test_vrf.py::TestVrfCreateAndBind::test_vrf_in_kernel
11.25s teardown test_vrf.py::TestVrfUnbindIntf::test_pc2_fib
8.66s call     test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v6
8.54s call     test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v4
6.71s call     test_vrf.py::TestVrfUnbindIntf::test_pc2_fib
6.68s call     test_vrf.py::TestVrfFib::test_vrf1_fib
6.44s call     test_vrf.py::TestVrfDeletion::test_vrf2_fib
6.33s call     test_vrf.py::TestVrfFib::test_vrf2_fib
5.50s setup    test_vrf.py::TestVrfUnbindIntf::test_pc1_ip_addr_flushed
3.55s call     test_vrf.py::TestVrfCreateAndBind::test_vrf_in_appl_db
2.63s teardown test_vrf.py::TestVrfLoopbackIntf::test_bgp_with_loopback
2.53s call     test_vrf.py::TestVrfNeigh::test_vrf1_neigh_ip_fwd
2.45s call     test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf1_from_vrf2
2.26s call     test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed_by_traffic
2.25s call     test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf2_from_vrf1
2.03s call     test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed_by_traffic
1.95s call     test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v4
1.83s call     test_vrf.py::TestVrfUnbindIntf::test_pc2_neigh
1.83s call     test_vrf.py::TestVrfLoopbackIntf::test_bgp_with_loopback
1.81s call     test_vrf.py::TestVrfNeigh::test_vrf2_neigh_ip_fwd
1.74s setup    test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf1_loopback
1.65s call     test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v6
1.60s call     test_vrf.py::TestVrfCreateAndBind::test_vrf_in_kernel
1.56s call     test_vrf.py::TestVrfNeigh::test_ping_lag_neigh
1.55s call     test_vrf.py::TestVrfDeletion::test_vrf2_neigh
1.45s call     test_vrf.py::TestVrfFib::test_show_bgp_summary
1.40s setup    test_vrf.py::TestVrfDeletion::test_pc1_ip_addr_flushed
1.38s teardown test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v6
1.29s setup    test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v4
1.06s setup    test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf1_from_vrf2
0.89s call     test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed
0.73s call     test_vrf.py::TestVrfNeigh::test_ping_vlan_neigh
0.66s call     test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf1_loopback
0.64s call     test_vrf.py::TestVrfDeletion::test_pc1_ip_addr_flushed
0.59s call     test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf2_loopback
0.55s call     test_vrf.py::TestVrfDeletion::test_pc2_ip_addr_flushed
0.50s call     test_vrf.py::TestVrfDeletion::test_loopback0_ip_addr_flushed
0.48s call     test_vrf.py::TestVrfDeletion::test_vlan1000_ip_addr_flushed
0.45s setup    test_vrf.py::TestVrfFib::test_show_bgp_summary
0.40s setup    test_vrf.py::TestVrfWarmReboot::test_vrf_swss_warm_reboot
0.38s call     test_vrf.py::TestVrfCreateAndBind::test_vrf_in_asic_db
0.16s call     test_vrf.py::TestVrfUnbindIntf::test_pc1_ip_addr_flushed
0.15s call     test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed
0.00s teardown test_vrf.py::TestVrfCreateAndBind::test_vrf_in_kernel
0.00s teardown test_vrf.py::TestVrfWarmReboot::test_vrf_system_warm_reboot
0.00s setup    test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v6
0.00s setup    test_vrf.py::TestVrfFib::test_vrf1_fib
0.00s setup    test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed_by_traffic
0.00s setup    test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed_by_traffic
0.00s setup    test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf2_loopback
0.00s setup    test_vrf.py::TestVrfNeigh::test_vrf1_neigh_ip_fwd
0.00s setup    test_vrf.py::TestVrfNeigh::test_ping_vlan_neigh
0.00s teardown test_vrf.py::TestVrfNeigh::test_ping_lag_neigh
0.00s teardown test_vrf.py::TestVrfFib::test_vrf2_fib
0.00s setup    test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf1_from_vrf2
0.00s setup    test_vrf.py::TestVrfNeigh::test_ping_lag_neigh
0.00s setup    test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf2_from_vrf1
0.00s teardown test_vrf.py::TestVrfFib::test_show_bgp_summary
0.00s setup    test_vrf.py::TestVrfWarmReboot::test_vrf_system_warm_reboot
0.00s setup    test_vrf.py::TestVrfDeletion::test_loopback0_ip_addr_flushed
0.00s setup    test_vrf.py::TestVrfUnbindIntf::test_pc2_neigh
0.00s teardown test_vrf.py::TestVrfWarmReboot::test_vrf_swss_warm_reboot
0.00s setup    test_vrf.py::TestVrfDeletion::test_vrf2_neigh
0.00s teardown test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf1_loopback
0.00s setup    test_vrf.py::TestVrfFib::test_vrf2_fib
0.00s setup    test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed
0.00s setup    test_vrf.py::TestVrfNeigh::test_vrf2_neigh_ip_fwd
0.00s setup    test_vrf.py::TestVrfDeletion::test_vlan1000_ip_addr_flushed
0.00s teardown test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v4
0.00s setup    test_vrf.py::TestVrfUnbindIntf::test_pc2_fib
0.00s teardown test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf2_from_vrf1
0.00s setup    test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v6
0.00s setup    test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed
0.00s setup    test_vrf.py::TestVrfCreateAndBind::test_vrf_in_appl_db
0.00s setup    test_vrf.py::TestVrfCreateAndBind::test_vrf_in_asic_db
0.00s teardown test_vrf.py::TestVrfNeigh::test_ping_vlan_neigh
0.00s setup    test_vrf.py::TestVrfDeletion::test_pc2_ip_addr_flushed
0.00s setup    test_vrf.py::TestVrfDeletion::test_vrf2_fib
0.00s setup    test_vrf.py::TestVrfAclRedirect::test_redirect_to_new_ports_v4
0.00s setup    test_vrf.py::TestVrfUnbindIntf::test_pc1_routes_flushed
0.00s teardown test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed
0.00s setup    test_vrf.py::TestVrfDeletion::test_vrf1_routes_flushed
0.00s setup    test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf2_from_vrf1
0.00s teardown test_vrf.py::TestVrfUnbindIntf::test_pc2_neigh
0.00s teardown test_vrf.py::TestVrfCreateAndBind::test_vrf_in_appl_db
0.00s teardown test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf1_from_vrf2
0.00s teardown test_vrf.py::TestVrfUnbindIntf::test_pc1_ip_addr_flushed
0.00s teardown test_vrf.py::TestVrfDeletion::test_pc1_ip_addr_flushed
0.00s teardown test_vrf.py::TestVrfUnbindIntf::test_pc1_routes_flushed
0.00s teardown test_vrf.py::TestVrfIsolation::test_fib_isolate_vrf1_from_vrf2
0.00s teardown test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed
0.00s teardown test_vrf.py::TestVrfDeletion::test_vlan1000_ip_addr_flushed
0.00s teardown test_vrf.py::TestVrfCreateAndBind::test_vrf_in_asic_db
0.00s teardown test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v4
0.00s teardown test_vrf.py::TestVrfDeletion::test_vrf1_routes_flushed
0.00s setup    test_vrf.py::TestVrfCapacity::test_ping
0.00s teardown test_vrf.py::TestVrfLoopbackIntf::test_ping_vrf2_loopback
0.00s teardown test_vrf.py::TestVrfNeigh::test_vrf2_neigh_ip_fwd
0.00s teardown test_vrf.py::TestVrfCapacity::test_ping
0.00s teardown test_vrf.py::TestVrfDeletion::test_loopback0_ip_addr_flushed
0.00s teardown test_vrf.py::TestVrfDeletion::test_pc2_ip_addr_flushed
0.00s teardown test_vrf.py::TestVrfFib::test_vrf1_fib
0.00s teardown test_vrf.py::TestVrfNeigh::test_vrf1_neigh_ip_fwd
0.00s teardown test_vrf.py::TestVrfIsolation::test_neigh_isolate_vrf2_from_vrf1
0.00s setup    test_vrf.py::TestVrfCapacity::test_ip_fwd
0.00s teardown test_vrf.py::TestVrfCapacity::test_ip_fwd
0.00s teardown test_vrf.py::TestVrfDeletion::test_vrf1_neighs_flushed_by_traffic
0.00s teardown test_vrf.py::TestVrfDeletion::test_vrf2_neigh
0.00s teardown test_vrf.py::TestVrfUnbindIntf::test_pc1_neigh_flushed_by_traffic
0.00s teardown test_vrf.py::TestVrfAclRedirect::test_origin_ports_recv_no_pkts_v6
============================ 38 passed, 2 skipped in 891.46 seconds ===========================
  1. Capacity(Scale) tests

Support options:

  • vrf_capacity -- the number of VRFs to be setup on dut.
  • vrf_test_count -- the number of VRFs to be verified. Verify all configured vrf could take about half an hour, setup/cleanup stage take most of the time. So, limit the number of vrfs to be covered to limit script execution time.
root@sonic-mgmt:/var/root/sonic-mgmt-vrf/tests# py.test  -vvv --inventory veos --host-pattern all --user admin --testbed vms-t0 --testbed_file testbed.csv  --duration=0 --log-cli-level INFO --setup-show --show-capture=stdout  --vrf_capacity 1000 --vrf_test_count 100 test_vrf.py::TestVrfCapacity
============================ test session starts ==========================================
platform linux2 -- Python 2.7.12, pytest-4.6.3, py-1.8.0, pluggy-0.12.0 -- /usr/bin/python                  
cachedir: .pytest_cache                                                                                     
ansible: 2.0.0.2                                                                                            
rootdir: /var/root/sonic-mgmt-vrf/tests, inifile: setup.cfg                                                 
plugins: ansible-2.0.2                                                                                      
collected 2 tems 
                                                                                                            
test_vrf.py::TestVrfCapacity::test_ping 
SETUP    S localhost
------------------------------ live log setup -----------------------------------------------
INFO     root:conftest.py:102 <SubRequest 'localhost' for <Function test_ping>> used time: 0.09s

SETUP    S testbedINFO     root:conftest.py:102 <SubRequest 'testbed' for <Function test_ping>> used time: 0.00s
    SETUP    M ansible_adhocINFO     root:conftest.py:102 <SubRequest 'ansible_adhoc' for <Function test_ping>> used time: 0.00s
    SETUP    M duthost (fixtures used: ansible_adhoc, testbed)INFO     root:conftest.py:102 <SubRequest 'duthost' for <Function test_ping>> used time: 0.01s
    SETUP    M ptfhost (fixtures used: ansible_adhoc, testbed)INFO     root:conftest.py:102 <SubRequest 'ptfhost' for <Function test_ping>> used time: 0.01s
    SETUP    M host_facts (fixtures used: duthost)INFO     root:conftest.py:102 <SubRequest 'host_facts' for <Function test_ping>> used time: 0.93s
    SETUP    M setup_vrf (fixtures used: duthost, host_facts, ptfhost, testbed)INFO     root:conftest.py:102 <SubRequest 'setup_vrf' for <Function test_ping>> used time: 12.25s
    SETUP    M cfg_facts (fixtures used: duthost)INFO     root:conftest.py:102 <SubRequest 'cfg_facts' for <Function test_ping>> used time: 0.50s
      SETUP    C vrf_countINFO     root:conftest.py:102 <SubRequest 'vrf_count' for <Function test_ping>> used time: 0.00s
      SETUP    C random_vrf_list (fixtures used: vrf_count)INFO     root:conftest.py:102 <SubRequest 'random_vrf_list' for <Function test_ping>> used time: 0.00s
      SETUP    C setup_vrf_capacity (fixtures used: cfg_facts, duthost, ptfhost, random_vrf_list, vrf_count)INFO     root:conftest.py:102 <SubRequest 'setup_vrf_capacity' for <Function test_ping>> used time: 382.70s
        test_vrf.py::TestVrfCapacity::test_ping (fixtures used: ansible_adhoc, cfg_facts, duthost, host_facts, localhost, ptfhost, random_vrf_list, setup_vrf, setup_vrf_capacity, testbed, vrf_count)PASSED
        test_vrf.py::TestVrfCapacity::test_ip_fwd (fixtures used: ansible_adhoc, cfg_facts, duthost, host_facts, localhost, ptfhost, random_vrf_list, setup_vrf, setup_vrf_capacity, testbed, vrf_count)PASSED
      TEARDOWN C setup_vrf_capacity
      TEARDOWN C random_vrf_list
      TEARDOWN C vrf_count
    TEARDOWN M cfg_facts
    TEARDOWN M setup_vrf
    TEARDOWN M host_facts
    TEARDOWN M ptfhost
    TEARDOWN M duthost
    TEARDOWN M ansible_adhoc
TEARDOWN S testbed
TEARDOWN S localhost

============================== slowest test durations =====================================
396.51s setup    test_vrf.py::TestVrfCapacity::test_ping
80.27s teardown test_vrf.py::TestVrfCapacity::test_ip_fwd
11.10s call     test_vrf.py::TestVrfCapacity::test_ping
10.36s call     test_vrf.py::TestVrfCapacity::test_ip_fwd
0.00s teardown test_vrf.py::TestVrfCapacity::test_ping
0.00s setup    test_vrf.py::TestVrfCapacity::test_ip_fwd
============================== 2 passed in 498.30 seconds =================================
  1. vrf attribute tests
    Currently, some vendors do not support change attributes of vrf. So just leave it to a separate test file vrf_test_attr.py.

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

create a new topo t0-vrf base on t0 according to vrf test plan.

Documentation

https://github.com/Azure/SONiC/blob/master/doc/vrf/vrf-ansible-test-plan.md

Zhiqian.Wu added 2 commits August 12, 2019 16:58
Signed-off-by: Zhiqian Wu <zhiqian.wu@nephosinc.com>
 - change the reboot sleep time to a global variable

Signed-off-by: Zhiqian Wu <zhiqian.wu@nephosinc.com>
duthost.shell("rm /etc/sonic/config_db.json.bak")

# FIXME use a better way to load config
duthost.shell("reboot")
Copy link
Contributor

Choose a reason for hiding this comment

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

If you have to use this way I think "config reload" should work, a reboot is too heavy and will cause the test too long.

Copy link
Contributor Author

@dawnbeauty dawnbeauty Oct 28, 2019

Choose a reason for hiding this comment

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

Maybe "config reload" is ok here, but I don't think it's a proper way to do that. Since "config reload" does not cleanup kernel devs (Vlans/PortChannels/VRFs) and ips on interfaces, i.e., when _stop_services() not all of services cleanup themselves. It will lead to many garbage in kernel.

For example, consider the situation where there are two cfgs:

  • old_cfg(before reload): Vrf1 - Lag1 - IP100
  • new_cfg(reload new_cfg): Vrf2 - Lag1 -IP200

After config reload, the result will be "Vrf1-(bind no devs), Vrf2-lag1-IP100+IP200". It is not
what we want.

That's why i choose "reboot". Please let me know what do you think about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds like some bug here? Or this is some SONiC common limitation?

Copy link
Contributor Author

@dawnbeauty dawnbeauty Nov 8, 2019

Choose a reason for hiding this comment

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

Most managers(e.g. intfmgr, vlanmgr, vrfmgr) have similar behaviors. They are designed to consume add/del msgs from db, but not cleanup when they are shut down. Kernel have no knowledge about the termination. So, I think it's a common limitation. Maybe we need improve config reload , or "config reload" might not design to be used for this purpose.

Anyway, cold, fast and warm reboot are ok here. Not config reload. Since there has a separate test for warm, so here cold reboot is choosen.


# FIXME use a better way to load config
duthost.shell("reboot")
time.sleep(REBOOT_SLEEP_TIME)
Copy link
Contributor

Choose a reason for hiding this comment

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

There are some utilities to handle this case more nice, you can take a look https://github.com/Azure/sonic-mgmt/blob/master/tests/platform/test_reboot.py#L107

Copy link
Contributor Author

@dawnbeauty dawnbeauty Nov 11, 2019

Choose a reason for hiding this comment

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

Add a new reboot function for better handling this.

verify_no_packet_any(test, masked_exp_pkt, dst_port_list)


class FibTest(BaseTest):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to reuse existing ptftest(https://github.com/Azure/sonic-mgmt/tree/master/ansible/roles/test/files/ptftests)? Seems some functions already implemented there, idea is to avoid redundant code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Improved fib_test.FibTest and vrf_test.FwdTest


def get_cfg_facts(duthost):
## use config db contents(running-config) instead of json file(startup-config)
#tmp_facts = json.loads(duthost.shell("sonic-cfggen -j /etc/sonic/config_db.json --print-data")['stdout'])
Copy link
Contributor

Choose a reason for hiding this comment

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

remove comment out code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


# basic check after warm reboot
duthost.shell("docker exec -i syncd ps aux | grep /usr/bin/syncd")
duthost.shell("docker exec -i swss ps aux | grep orchagent")
Copy link
Contributor

@keboliu keboliu Oct 28, 2019

Choose a reason for hiding this comment

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

maybe you can reuse critical service check function: https://github.com/Azure/sonic-mgmt/blob/master/tests/common/devices.py#L154 same suggestion for below warm reboot test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use wait_until + critical_service_check for better handling this.

for ver, ips in g_vars['vrf_intfs']['Vrf1']['PortChannel0001'].iteritems():
for ip in ips:
duthost.shell("config interface ip add PortChannel0001 {}".format(ip))
time.sleep(10) # wait for bgp session re-established.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think should check the BGP session status here, since it is critical to the below test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Check bgp session status after rebind intf(in TestVrfUnbindIntf) and restore vrf(in TestVrfDeletion). In addition, neigh/fib tests are added after rebind/restore.

Zhiqian.Wu added 2 commits November 8, 2019 16:57
…tion

* use fixture testbed_devices instead of duthost/ptfhost
for reuse critical service check function from SonicHost.

* extract a function for reboot
  use `wait_for` instead of sleeping a specified time slot
  after reboot
  reuse critical service check function

* extract a function for check interface status, use `wait_until`
  for continue polling interfaces status

* remove comment out codes

* add a fib/neigh test after rebind intf

* add a bgp/fib/neigh test after restore vrf

* refactor vrf_test.py
@prsunny
Copy link
Contributor

prsunny commented Nov 26, 2019

@dawnbeauty , can you resolve the conflict?, @keboliu , please approve if comments are addressed

@dawnbeauty
Copy link
Contributor Author

@prsunny, Done.

@prsunny
Copy link
Contributor

prsunny commented Dec 3, 2019

@keboliu , can you please approve

@prsunny prsunny merged commit 7208106 into sonic-net:master Dec 4, 2019
@dawnbeauty dawnbeauty deleted the vrf branch December 17, 2019 02:12
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