コード例 #1
0
def test_nf_false_flag_toggle_lacp_active(topology, step, main_setup):
    """Toggle 'lacp' flag to 'active' with 'false' flag.

    The source code must handle also the possibility to retrieve from OVSDB the
    'lacp-fallback-ab' flag with 'false' even when by default the flag is not
    present.

    To disable LAG 1 on both switches, 'lacp' flag will be toggled between
    '[]' and 'active'.
    """

    sw1 = topology.get('sw1')
    sw2 = topology.get('sw2')

    assert sw1 is not None
    assert sw2 is not None

    print_header('Fallback disabled with false flag, toggle "lacp" flag to '
                 'active')

    ##########################################################################
    # Add 'fallback' flag as 'false'
    ##########################################################################
    print('Setting "lacp-fallback-ab" flag into OVSDB')
    set_port_parameter(sw1, test_lag, disable_fallback)
    set_port_parameter(sw2, test_lag, disable_fallback)

    ##########################################################################
    # LAG 1 disabled on sw1
    ##########################################################################
    print('Shutting down LAG1 on sw1')
    set_port_parameter(sw1, test_lag, disable_lag)
    print('Verify that all sw2 SMs are in "Defaulted and Expired"')
    sw_wait_until_all_sm_ready([sw2], intf_labels, active_no_fallback)

    print('Enabling LAG1 on sw1')
    set_port_parameter(sw1, test_lag, active_lag)
    print('Verify all interface SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)

    ##########################################################################
    # LAG 1 disabled on sw2
    ##########################################################################
    print('Shutting down LAG1 on sw2')
    set_port_parameter(sw2, test_lag, disable_lag)
    print('Verify that all sw1 SMs are in "Defaulted and Expired"')
    sw_wait_until_all_sm_ready([sw1], intf_labels, active_no_fallback)

    print('Enabling LAG1 on sw2')
    set_port_parameter(sw2, test_lag, active_lag)

    ##########################################################################
    # Remove added flag
    ##########################################################################
    print('Clearing "lacp-fallback-ab" flag from OVSDB')
    remove_port_parameter(sw1, test_lag, other_config_key, [fallback_key])
    remove_port_parameter(sw2, test_lag, other_config_key, [fallback_key])

    print('Verify all interface SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)
コード例 #2
0
def test_nf_toggle_lacp_flag_active(topology, step, main_setup):
    """Toggle 'lacp' flag to 'active'.

    To disable LAG 1 on both switches, 'lacp' flag will be toggled between
    '[]' and 'active'.
    """

    sw1 = topology.get('sw1')
    sw2 = topology.get('sw2')

    assert sw1 is not None
    assert sw2 is not None

    print_header('Fallback disabled, toggle "lacp" flag to active')

    ##########################################################################
    # LAG 1 disabled on sw1
    ##########################################################################
    print('Shutting down LAG1 on sw1')
    set_port_parameter(sw1, test_lag, disable_lag)
    print('Verify that all sw2 SMs are in "Defaulted and Expired"')
    sw_wait_until_all_sm_ready([sw2], intf_labels, active_no_fallback)

    print('Enabling LAG1 on sw1')
    set_port_parameter(sw1, test_lag, active_lag)
    print('Verify all interface SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)

    ##########################################################################
    # LAG 1 disabled on sw2
    ##########################################################################
    print('Shutting down LAG1 on sw2')
    set_port_parameter(sw2, test_lag, disable_lag)
    print('Verify that all sw1 SMs are in "Defaulted and Expired"')
    sw_wait_until_all_sm_ready([sw1], intf_labels, active_no_fallback)

    print('Enabling LAG1 on sw2')
    set_port_parameter(sw2, test_lag, active_lag)
    print('Verify all interface SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)
コード例 #3
0
def test_fb_toggle_lacp_flag_passive(topology, step, main_setup):
    """Toggle 'lacp' flag to 'passive'.

    To disable LAG 1 on both switches, 'lacp' flag will be toggled between
    '[]' and 'passive'.

    Note: Both switches cannot be in the same state of 'passive' or
    connectivity will be lost.
    """

    sw1 = topology.get('sw1')
    sw2 = topology.get('sw2')

    assert sw1 is not None
    assert sw2 is not None

    print_header('Fallback enabled, toggle "lacp" flag to passive')

    ##########################################################################
    # Add 'fallback' flag
    ##########################################################################
    print('Enabling Fallback on both switches')
    set_port_parameter(sw1, test_lag, enable_fallback)
    set_port_parameter(sw2, test_lag, enable_fallback)

    ##########################################################################
    # LAG 1 disabled on sw1
    ##########################################################################
    print('Setting sw2 LAG to "passive"')
    set_port_parameter(sw2, test_lag, passive_lag)
    print('Shutting down LAG1 on sw1')
    set_port_parameter(sw1, test_lag, disable_lag)

    print('Verify that one interface is "Collecting, Distributing and '
          'Defaulted" on sw2')
    intf_fallback_enabled = sw_wait_until_one_sm_ready([sw2], intf_labels,
                                                       passive_fallback)

    print('Found interface: %s' % intf_fallback_enabled)

    print('Verify that other interfaces are "Defaulted" on sw2')
    tmp = list(intf_labels)
    tmp.remove(intf_fallback_enabled)
    sw_wait_until_all_sm_ready([sw2], tmp, passive_other_intf)

    print('Enabling LAG1 on sw1')
    set_port_parameter(sw1, test_lag, active_lag)
    print('Verify all interface SM from sw1 are "active"')
    sw_wait_until_all_sm_ready([sw1], intf_labels, active_ready)
    print('Verify all interface SM from sw2 are "passive"')
    sw_wait_until_all_sm_ready([sw2], intf_labels, passive_ready)

    print('Setting sw2 LAG to "active"')
    set_port_parameter(sw2, test_lag, active_lag)
    print('Verify all interface SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)

    ##########################################################################
    # LAG 1 disabled on sw2
    ##########################################################################
    print('Setting sw1 LAG to "passive"')
    set_port_parameter(sw1, test_lag, passive_lag)
    print('Shutting down LAG1 on sw2')
    set_port_parameter(sw2, test_lag, disable_lag)

    print('Verify that one interface is "Collecting, Distributing and '
          'Defaulted" on sw1')
    intf_fallback_enabled = sw_wait_until_one_sm_ready([sw1], intf_labels,
                                                       passive_fallback)

    print('Found interface: %s' % intf_fallback_enabled)

    print('Verify that other interfaces are "Defaulted" on sw1')
    tmp = list(intf_labels)
    tmp.remove(intf_fallback_enabled)
    sw_wait_until_all_sm_ready([sw1], tmp, passive_other_intf)

    print('Enabling LAG1 on sw2')
    set_port_parameter(sw2, test_lag, active_lag)
    print('Verify all interface SM from sw1 are "passive"')
    sw_wait_until_all_sm_ready([sw1], intf_labels, passive_ready)
    print('Verify all interface SM from sw2 are "active"')
    sw_wait_until_all_sm_ready([sw2], intf_labels, active_ready)

    print('Setting sw1 LAG to "active"')
    set_port_parameter(sw1, test_lag, active_lag)

    ##########################################################################
    # Remove added flag
    ##########################################################################
    print('Clearing "lacp-fallback-ab" flag from OVSDB')
    remove_port_parameter(sw1, test_lag, other_config_key, [fallback_key])
    remove_port_parameter(sw2, test_lag, other_config_key, [fallback_key])

    print('Verify all interface SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)
コード例 #4
0
def test_fb_toggle_admin_flag(topology, step, main_setup):
    """Toggle 'admin' flag.

    To disable LAG 1 on both switches, 'admin' flag will be toggled between
    'up' and 'down'.
    """

    sw1 = topology.get('sw1')
    sw2 = topology.get('sw2')

    assert sw1 is not None
    assert sw2 is not None

    print_header('Fallback enabled, toggle "admin" flag')

    ##########################################################################
    # Add 'fallback' flag
    ##########################################################################
    print('Enabling Fallback on both switches')
    set_port_parameter(sw1, test_lag, enable_fallback)
    set_port_parameter(sw2, test_lag, enable_fallback)

    ##########################################################################
    # LAG 1 disabled on sw1
    ##########################################################################
    print('Shutting down LAG1 on sw1')
    set_port_parameter(sw1, test_lag, disable_admin)
    print('Verify that one interface is "Collecting, Distributing and '
          'Defaulted" on sw2')
    intf_fallback_enabled = sw_wait_until_one_sm_ready([sw2], intf_labels,
                                                       active_fallback)

    print('Found interface: %s' % intf_fallback_enabled)

    print('Verify that other interfaces are "Defaulted" on sw2')
    tmp = list(intf_labels)
    tmp.remove(intf_fallback_enabled)
    sw_wait_until_all_sm_ready([sw2], tmp, active_other_intf)

    print('Enabling LAG1 on sw1')
    set_port_parameter(sw1, test_lag, enable_admin)
    print('Verify all interfaces SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)

    ##########################################################################
    # LAG 1 disabled on sw2
    ##########################################################################
    print('Shutting down LAG1 on sw2')
    set_port_parameter(sw2, test_lag, disable_admin)
    print('Verify that one interface is "Collecting, Distributing and '
          'Defaulted" on sw1')
    intf_fallback_enabled = sw_wait_until_one_sm_ready([sw1], intf_labels,
                                                       active_fallback)

    print('Found interface: %s' % intf_fallback_enabled)

    print('Verify that other interfaces are "Defaulted" on sw1')
    tmp = list(intf_labels)
    tmp.remove(intf_fallback_enabled)
    sw_wait_until_all_sm_ready([sw1], tmp, active_other_intf)

    print('Enabling LAG1 on sw2')
    set_port_parameter(sw2, test_lag, enable_admin)

    ##########################################################################
    # Remove added flag
    ##########################################################################
    print('Clearing "lacp-fallback-ab" flag from OVSDB')
    remove_port_parameter(sw1, test_lag, other_config_key, [fallback_key])
    remove_port_parameter(sw2, test_lag, other_config_key, [fallback_key])

    print('Verify all interfaces SM from both switches are working')
    sw_wait_until_all_sm_ready([sw1, sw2], intf_labels, active_ready)