示例#1
0
def test_change_mux_state(
        require_mocked_dualtor,
        apply_mock_dual_tor_tables,
        apply_mock_dual_tor_kernel_configs,
        rand_selected_dut,
        request):

    dut = rand_selected_dut

    # Apply mux active state
    load_swss_config(dut, _swss_path(SWSS_MUX_STATE_ACTIVE_CONFIG_FILE))
    load_swss_config(dut, _swss_path(SWSS_MUX_STATE_STANDBY_CONFIG_FILE))
    load_swss_config(dut, _swss_path(SWSS_MUX_STATE_ACTIVE_CONFIG_FILE))

    wait(10, 'extra wait for initial CRMs to be updated')

    crm_facts1 = dut.get_crm_facts()
    logger.info(json.dumps(crm_facts1, indent=4))

    # Set all mux state to 'standby'/'active' N times.
    for _ in range(request.config.getoption('--mux-stress-count')):
        load_swss_config(dut, _swss_path(SWSS_MUX_STATE_STANDBY_CONFIG_FILE))
        load_swss_config(dut, _swss_path(SWSS_MUX_STATE_ACTIVE_CONFIG_FILE))

    wait(10, 'extra wait for CRMs to be updated')

    crm_facts2 = dut.get_crm_facts()
    logger.info(json.dumps(crm_facts2, indent=4))

    # Check CRM values for leak
    unmatched_crm_facts = compare_crm_facts(crm_facts1, crm_facts2)
    pytest_assert(len(unmatched_crm_facts)==0, 'Unmatched CRM facts: {}'.format(json.dumps(unmatched_crm_facts, indent=4)))
示例#2
0
def test_flap_neighbor_entry_standby(
        require_mocked_dualtor,
        apply_mock_dual_tor_tables,
        apply_mock_dual_tor_kernel_configs,
        rand_selected_dut,
        tbinfo,
        request,
        mock_server_ip_mac_map):

    dut = rand_selected_dut

    vlan_interface_name = dut.get_extended_minigraph_facts(tbinfo)['minigraph_vlans'].keys()[0]

    # Apply mux standby state
    load_swss_config(dut, _swss_path(SWSS_MUX_STATE_STANDBY_CONFIG_FILE))

    wait(3, 'extra wait for initial CRMs to be updated')

    crm_facts1 = dut.get_crm_facts()
    logger.info(json.dumps(crm_facts1, indent=4))

    for _ in range(request.config.getoption('--mux-stress-count')):
        remove_neighbors(dut, mock_server_ip_mac_map, vlan_interface_name)
        add_neighbors(dut, mock_server_ip_mac_map, vlan_interface_name)

    wait(3, 'extra wait for CRMs to be updated')

    crm_facts2 = dut.get_crm_facts()
    logger.info(json.dumps(crm_facts2, indent=4))

    unmatched_crm_facts = compare_crm_facts(crm_facts1, crm_facts2)
    pytest_assert(len(unmatched_crm_facts)==0, 'Unmatched CRM facts: {}'.format(json.dumps(unmatched_crm_facts, indent=4)))
示例#3
0
def test_standby_tor_upstream_mux_toggle(rand_selected_dut, tbinfo, ptfadapter,
                                         rand_selected_interface,
                                         require_mocked_dualtor,
                                         toggle_all_simulator_ports,
                                         set_crm_polling_interval):
    itfs, ip = rand_selected_interface
    PKT_NUM = 100
    # Step 1. Set mux state to standby and verify traffic is dropped by ACL rule and drop counters incremented
    set_mux_state(rand_selected_dut, tbinfo, 'standby', [itfs],
                  toggle_all_simulator_ports)
    # Wait sometime for mux toggle
    time.sleep(PAUSE_TIME)
    crm_facts0 = rand_selected_dut.get_crm_facts()
    # Verify packets are not go up
    verify_upstream_traffic(host=rand_selected_dut,
                            ptfadapter=ptfadapter,
                            tbinfo=tbinfo,
                            itfs=itfs,
                            server_ip=ip['server_ipv4'].split('/')[0],
                            pkt_num=PKT_NUM,
                            drop=True)

    time.sleep(5)
    # Step 2. Toggle mux state to active, and verify traffic is not dropped by ACL and fwd-ed to uplinks; verify CRM show and no nexthop objects are stale
    set_mux_state(rand_selected_dut, tbinfo, 'active', [itfs],
                  toggle_all_simulator_ports)
    # Wait sometime for mux toggle
    time.sleep(PAUSE_TIME)
    # Verify packets are not go up
    verify_upstream_traffic(host=rand_selected_dut,
                            ptfadapter=ptfadapter,
                            tbinfo=tbinfo,
                            itfs=itfs,
                            server_ip=ip['server_ipv4'].split('/')[0],
                            pkt_num=PKT_NUM,
                            drop=False)

    # Step 3. Toggle mux state to standby, and verify traffic is dropped by ACL; verify CRM show and no nexthop objects are stale
    set_mux_state(rand_selected_dut, tbinfo, 'standby', [itfs],
                  toggle_all_simulator_ports)
    # Wait sometime for mux toggle
    time.sleep(PAUSE_TIME)
    # Verify packets are not go up again
    verify_upstream_traffic(host=rand_selected_dut,
                            ptfadapter=ptfadapter,
                            tbinfo=tbinfo,
                            itfs=itfs,
                            server_ip=ip['server_ipv4'].split('/')[0],
                            pkt_num=PKT_NUM,
                            drop=True)
    crm_facts1 = rand_selected_dut.get_crm_facts()
    unmatched_crm_facts = compare_crm_facts(crm_facts0, crm_facts1)
    pt_assert(
        len(unmatched_crm_facts) == 0, 'Unmatched CRM facts: {}'.format(
            json.dumps(unmatched_crm_facts, indent=4)))