def test_l2_dynamic_lag_ping_case_1(topology, step):
    """
    Case 1:
        Verify a ping between 2 workstations connected by 2 switches configured
        with L2 dynamic LAGs works properly.
    """
    sw1 = topology.get('sw1')
    sw2 = topology.get('sw2')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    hs1_ip_address_with_mask = '10.0.10.1/24'
    hs2_ip_address_with_mask = '10.0.10.2/24'
    hs1_ip_address = '10.0.10.1'
    hs2_ip_address = '10.0.10.2'
    sw1_lag_id = '10'
    sw2_lag_id = '20'
    vlan_identifier = '8'
    number_pings = 5

    assert sw1 is not None
    assert sw2 is not None
    assert hs1 is not None
    assert hs2 is not None

    ports_sw1 = list()
    ports_sw2 = list()
    port_labels = ['1', '2', '3']

    step("Mapping interfaces")
    for port in port_labels:
        ports_sw1.append(sw1.ports[port])
        ports_sw2.append(sw2.ports[port])

    step("Sorting the port list")
    ports_sw1.sort()
    ports_sw2.sort()

    step("Turning on all interfaces used in this test")
    for port in ports_sw1:
        turn_on_interface(sw1, port)

    for port in ports_sw2:
        turn_on_interface(sw2, port)

    step("Validate interfaces are turn on")
    verify_turn_on_interfaces(sw1, ports_sw1)
    verify_turn_on_interfaces(sw1, ports_sw2)

    step("Assign an IP address on the same range to each workstation")
    hs1.libs.ip.interface('1', addr=hs1_ip_address_with_mask, up=True)
    hs2.libs.ip.interface('1', addr=hs2_ip_address_with_mask, up=True)

    step('Creating VLAN in both switches')
    create_vlan(sw1, vlan_identifier)
    create_vlan(sw2, vlan_identifier)

    step("Create LAG in both switches")
    create_lag(sw1, sw1_lag_id, 'active')
    create_lag(sw2, sw2_lag_id, 'active')

    step("Associate interfaces [2, 3] to LAG in both switches")
    for port in ports_sw1[1:3]:
        associate_interface_to_lag(sw1, port, sw1_lag_id)
    for port in ports_sw2[1:3]:
        associate_interface_to_lag(sw2, port, sw2_lag_id)

    step("Verify LAG configuration")
    verify_lag_config(sw1, sw1_lag_id, ports_sw1[1:3], mode='active')
    verify_lag_config(sw2, sw2_lag_id, ports_sw2[1:3], mode='active')

    step("Configure LAGs and workstations interfaces with same VLAN")
    associate_vlan_to_lag(sw1, vlan_identifier, sw1_lag_id)
    associate_vlan_to_lag(sw2, vlan_identifier, sw2_lag_id)
    associate_vlan_to_l2_interface(sw1, vlan_identifier, ports_sw1[0])
    associate_vlan_to_l2_interface(sw2, vlan_identifier, ports_sw2[0])

    step("Verify if LAG is synchronized")
    verify_state_sync_lag(sw1, ports_sw1[1:3], LOCAL_STATE, 'active')
    verify_state_sync_lag(sw1, ports_sw1[1:3], REMOTE_STATE, 'active')

    step("Get information for LAG in interface 2 with both switches")
    map_lacp_sw1 = sw1.libs.vtysh.show_lacp_interface(
        find_device_label(sw1, ports_sw1[1]))
    map_lacp_sw2 = sw2.libs.vtysh.show_lacp_interface(
        find_device_label(sw2, ports_sw2[1]))

    step("Validate the LAG was created in both switches")
    validate_lag_name(map_lacp_sw1, sw1_lag_id)
    validate_local_key(map_lacp_sw1, sw1_lag_id)
    validate_remote_key(map_lacp_sw1, sw2_lag_id)
    validate_lag_state_sync(map_lacp_sw1, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw1, REMOTE_STATE)

    validate_lag_name(map_lacp_sw2, sw2_lag_id)
    validate_local_key(map_lacp_sw2, sw2_lag_id)
    validate_remote_key(map_lacp_sw2, sw1_lag_id)
    validate_lag_state_sync(map_lacp_sw2, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw2, REMOTE_STATE)

    step("Ping workstation 2 from workstation 1 and viceversa")
    check_connectivity_between_hosts(hs1, hs1_ip_address, hs2, hs2_ip_address,
                                     number_pings, True)

    # ops-lacpd is stopped so that it produces the gcov coverage data
    #
    # Daemons from both switches will dump the coverage data to the
    # same file but the data write is done on daemon exit only.
    # The systemctl command waits until the process exits to return the
    # prompt and the shell function waits for the command to return,
    # therefore it is safe to stop the ops-lacpd daemons sequentially
    # This ensures that data from both processes is captured.
    sw1("systemctl stop ops-lacpd", shell="bash")
    sw2("systemctl stop ops-lacpd", shell="bash")
Esempio n. 2
0
def verify_lacp_state(
    sw1,
    sw2,
    sw1_lacp_mode='active',
    sw2_lacp_mode='active',
    ports=list()
):
    lacp_def_value = '1'
    lacp_def_priority = '65534'
    sw1_lacp_config = sw1.libs.vtysh.show_lacp_configuration()
    sw2_lacp_config = sw2.libs.vtysh.show_lacp_configuration()
    print('Verify LACP state on LAG members')
    for port in ports[sw1][0:2]:
        sw1_lacp_state = sw1.libs.vtysh.show_lacp_interface(port)
        sw2_lacp_state = sw2.libs.vtysh.show_lacp_interface(port)
        sw_lacp_states = [sw1_lacp_state, sw2_lacp_state]
        sw_lacp_configs = [sw1_lacp_config, sw2_lacp_config]
        sw_lacp_modes = [sw1_lacp_mode, sw2_lacp_mode]
        for (
            sw_lacp_state,
            sw_lacp_config,
            sw_lacp_mode,
            rev_sw_lacp_state
        ) in zip(
            sw_lacp_states,
            sw_lacp_configs,
            sw_lacp_modes,
            reversed(sw_lacp_states)
        ):
            verify_lag_interface_lag_id(sw_lacp_state)
            verify_lag_interface_key(
                sw_lacp_state,
                rev_sw_lacp_state,
                key=lacp_def_value,
                value_check=True,
                cross_check=True
            )
            verify_lag_interface_priority(
                sw_lacp_state,
                rev_sw_lacp_state,
                priority=lacp_def_value,
                value_check=True,
                cross_check=True
            )
            verify_lag_interface_system_priority(
                sw_lacp_state,
                sw2_int_map_lacp=rev_sw_lacp_state,
                system_priority=lacp_def_priority,
                value_check=True,
                cross_check=True
            )
            sys_id = sw_lacp_config['id']
            verify_lag_interface_system_id(
                sw_lacp_state,
                sw2_int_map_lacp=rev_sw_lacp_state,
                system_id=sys_id,
                value_check=True,
                cross_check=True
            )
            verify_lag_interface_id(
                sw_lacp_state,
                rev_sw_lacp_state,
                value_check=False,
                cross_check=True
            )
            validate_lag_state_sync(
                sw_lacp_state,
                LOCAL_STATE,
                lacp_mode=sw_lacp_mode
            )
            validate_lag_state_sync(
                rev_sw_lacp_state,
                REMOTE_STATE,
                lacp_mode=sw_lacp_mode
            )
def verify_lacp_state(sw1,
                      sw2,
                      sw_real_ports,
                      sw1_lacp_mode='off',
                      sw2_lacp_mode='active'):
    sw1_lacp_config = sw1.libs.vtysh.show_lacp_configuration()
    sw2_lacp_config = sw2.libs.vtysh.show_lacp_configuration()
    print('Verify LACP state on LAG members')
    for port in sw_real_ports[sw1][0:2]:
        sw1_lacp_state = sw1.libs.vtysh.show_lacp_interface(port)
    for port in sw_real_ports[sw2][0:2]:
        sw2_lacp_state = sw2.libs.vtysh.show_lacp_interface(port)
    for i in range(0, len(SW_LBL_PORTS)):
        sw_lacp_states = [sw1_lacp_state, sw2_lacp_state]
        sw_lacp_configs = [sw1_lacp_config, sw2_lacp_config]
        sw_lacp_modes = [sw1_lacp_mode, sw2_lacp_mode]
        if sw1_lacp_mode == 'off':
            lacp_def_value = ''
            lacp_def_priority = ''
        else:
            lacp_def_value = '1'
            lacp_def_priority = '65534'
        for (
                sw_lacp_state,
                sw_lacp_config,
                sw_lacp_mode,
                rev_sw_lacp_state,
        ) in zip(sw_lacp_states, sw_lacp_configs, sw_lacp_modes,
                 reversed(sw_lacp_states)):
            verify_lag_interface_lag_id(sw_lacp_state)
            verify_lag_interface_key(sw_lacp_state,
                                     rev_sw_lacp_state,
                                     key=lacp_def_value,
                                     value_check=True,
                                     cross_check=True)
            verify_lag_interface_priority(sw_lacp_state,
                                          rev_sw_lacp_state,
                                          priority=lacp_def_value,
                                          value_check=True,
                                          cross_check=True)
            verify_lag_interface_system_priority(
                sw_lacp_state,
                sw2_int_map_lacp=rev_sw_lacp_state,
                system_priority=lacp_def_priority,
                value_check=True,
                cross_check=True)
            if sw_lacp_mode != 'off':
                sys_id = sw_lacp_config['id']
            else:
                sys_id = ''
            verify_lag_interface_system_id(sw_lacp_state,
                                           sw2_int_map_lacp=rev_sw_lacp_state,
                                           system_id=sys_id,
                                           value_check=True,
                                           cross_check=True)
            if sw_lacp_mode != 'off':
                verify_lag_interface_id(sw_lacp_state,
                                        rev_sw_lacp_state,
                                        value_check=False,
                                        cross_check=True)
                validate_lag_state_sync(sw_lacp_state,
                                        LOCAL_STATE,
                                        lacp_mode=sw_lacp_mode)
                validate_lag_state_sync(rev_sw_lacp_state,
                                        REMOTE_STATE,
                                        lacp_mode=sw_lacp_mode)
            else:
                verify_lag_interface_id(sw_lacp_state,
                                        rev_sw_lacp_state,
                                        id='',
                                        value_check=True,
                                        cross_check=True)
                validate_lag_state_static(sw_lacp_state, LOCAL_STATE)
                validate_lag_state_static(sw_lacp_state, REMOTE_STATE)
def test_lacp_agg_key_move_interface(topology):
    """
    Case 1:
        Verify aggregation key functionality when
        interface is moved to another LAG in one of
        the switches from the topology
        Initial Topology:
            SW1>
                LAG100 -> Interfaces: 1,2
            SW2>
                LAG100 -> Interfaces: 1,2
        Final Topology:
            SW1>
                LAG200 -> Interfaces: 1,3
                LAG100 -> Interfaces: 2,4
            SW2>
                LAG100 -> Interfaces: 1,2
        Expected behaviour:
            Interface 1 should not be in Collecting/Distributing
            state in neither switch.
    """
    sw1 = topology.get('sw1')
    sw2 = topology.get('sw2')
    sw1_lag_id = '100'
    sw1_lag_id_2 = '200'
    sw2_lag_id = '100'

    assert sw1 is not None
    assert sw2 is not None

    p11 = sw1.ports['1']
    p12 = sw1.ports['2']
    p13 = sw1.ports['3']
    p14 = sw1.ports['4']
    p21 = sw2.ports['1']
    p22 = sw2.ports['2']
    p23 = sw2.ports['3']
    p24 = sw2.ports['4']

    print("Turning on all interfaces used in this test")
    ports_sw1 = [p11, p12, p13, p14]
    for port in ports_sw1:
        turn_on_interface(sw1, port)

    ports_sw2 = [p21, p22, p23, p24]
    for port in ports_sw2:
        turn_on_interface(sw2, port)

    print("Waiting for interfaces to turn on")
    time.sleep(60)

    print("Validate interfaces are turn on")
    validate_turn_on_interfaces(sw1, ports_sw1)
    validate_turn_on_interfaces(sw2, ports_sw2)

    print("Create LAG in both switches")
    create_lag_active(sw1, sw1_lag_id)
    create_lag_active(sw2, sw2_lag_id)

    set_lacp_rate_fast(sw1, sw1_lag_id)
    set_lacp_rate_fast(sw2, sw2_lag_id)

    print("Associate interfaces [1,2] to lag in both switches")
    associate_interface_to_lag(sw1, p11, sw1_lag_id)
    associate_interface_to_lag(sw1, p12, sw1_lag_id)
    associate_interface_to_lag(sw2, p21, sw2_lag_id)
    associate_interface_to_lag(sw2, p22, sw2_lag_id)

    # Without this sleep time, we are validating temporary
    # states in state machines
    print("Waiting for LAG negotations between switches")
    time.sleep(80)

    print("Get information for LAG in interface 1 with both switches")
    map_lacp_sw1 = sw1.libs.vtysh.show_lacp_interface(p11)
    map_lacp_sw2 = sw2.libs.vtysh.show_lacp_interface(p21)

    print("Get the state of LAGs using diag-dump lacp basic in both switches")
    sw1_lacp_state = get_diagdump_lacp_state(sw1)
    sw2_lacp_state = get_diagdump_lacp_state(sw2)
    map_diagdump_lacp_sw1_p11 = sw1_lacp_state[str(sw1_lag_id)][int(p11)]
    map_diagdump_lacp_sw2_p21 = sw2_lacp_state[str(sw2_lag_id)][int(p21)]

    print("Get the configured interfaces for each LAG using diag-dump " +
          "lacp basic in both switches")
    sw1_lacp_interfaces = get_diagdump_lacp_interfaces(sw1)
    sw2_lacp_interfaces = get_diagdump_lacp_interfaces(sw2)
    validate_diagdump_lacp_interfaces(sw1_lacp_interfaces, sw1_lag_id,
                                      [p11, p12], [p11, p12], [p11, p12])
    validate_diagdump_lacp_interfaces(sw2_lacp_interfaces, sw2_lag_id,
                                      [p21, p22], [p21, p22], [p21, p22])

    print("Validate the LAG was created in both switches")
    validate_lag_name(map_lacp_sw1, sw1_lag_id)
    validate_local_key(map_lacp_sw1, sw1_lag_id)
    validate_remote_key(map_lacp_sw1, sw2_lag_id)
    validate_lag_state_sync(map_lacp_sw1, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw1, REMOTE_STATE)
    # Validate diag-dump results
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw1_p11,
                                     DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw1_p11,
                                     DIAG_DUMP_REMOTE_STATE)

    validate_lag_name(map_lacp_sw2, sw2_lag_id)
    validate_local_key(map_lacp_sw2, sw2_lag_id)
    validate_remote_key(map_lacp_sw2, sw1_lag_id)
    validate_lag_state_sync(map_lacp_sw2, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw2, REMOTE_STATE)
    # Validate diag-dump results
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw2_p21,
                                     DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw2_p21,
                                     DIAG_DUMP_REMOTE_STATE)

    print("Changing interface 1 to lag 200 in switch 1")
    create_lag_active(sw1, sw1_lag_id_2)
    set_lacp_rate_fast(sw1, sw1_lag_id_2)
    associate_interface_to_lag(sw1, p11, sw1_lag_id_2)
    associate_interface_to_lag(sw1, p13, sw1_lag_id_2)
    associate_interface_to_lag(sw1, p14, sw1_lag_id)

    # Waiting for switch 1 to update LAG status with newest configuration
    print("Waiting for LAG update withe new configuration")
    time.sleep(30)

    print("Get information from LAG in interface 1 with both switches")
    map_lacp_sw1_p11 = sw1.libs.vtysh.show_lacp_interface(p11)
    map_lacp_sw1_p12 = sw1.libs.vtysh.show_lacp_interface(p12)
    map_lacp_sw1_p13 = sw1.libs.vtysh.show_lacp_interface(p13)
    map_lacp_sw1_p14 = sw1.libs.vtysh.show_lacp_interface(p14)
    map_lacp_sw2_p21 = sw2.libs.vtysh.show_lacp_interface(p21)
    map_lacp_sw2_p22 = sw2.libs.vtysh.show_lacp_interface(p22)

    print("Get the state of LAGs using diag-dump lacp basic in both switches")
    sw1_lacp_state = get_diagdump_lacp_state(sw1)
    sw2_lacp_state = get_diagdump_lacp_state(sw2)
    map_diagdump_lacp_sw1_p11 = sw1_lacp_state[str(sw1_lag_id_2)][int(p11)]
    map_diagdump_lacp_sw1_p12 = sw1_lacp_state[str(sw1_lag_id)][int(p12)]
    map_diagdump_lacp_sw2_p21 = sw2_lacp_state[str(sw2_lag_id)][int(p21)]
    map_diagdump_lacp_sw2_p22 = sw2_lacp_state[str(sw2_lag_id)][int(p22)]

    print("Get the configured interfaces for each LAG using diagdump " +
          "getlacpinterfaces in both switches")
    sw1_lacp_interfaces = get_diagdump_lacp_interfaces(sw1)
    sw2_lacp_interfaces = get_diagdump_lacp_interfaces(sw2)
    validate_diagdump_lacp_interfaces(sw1_lacp_interfaces, sw1_lag_id,
                                      [p12, p24], [p12, p24], [p12])
    validate_diagdump_lacp_interfaces(sw1_lacp_interfaces, sw1_lag_id_2,
                                      [p11, p13], [p11, p13], [])
    validate_diagdump_lacp_interfaces(sw2_lacp_interfaces, sw2_lag_id,
                                      [p21, p22], [p21, p22], [p22])

    print("Validate lag is out of sync in interface 1 in both switches")
    validate_lag_name(map_lacp_sw1_p11, sw1_lag_id_2)
    validate_local_key(map_lacp_sw1_p11, sw1_lag_id_2)
    validate_remote_key(map_lacp_sw1_p11, sw2_lag_id)
    validate_lag_state_afn(map_lacp_sw1_p11, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw1_p12, LOCAL_STATE)
    validate_lag_state_default_neighbor(map_lacp_sw1_p13, LOCAL_STATE)
    validate_lag_state_default_neighbor(map_lacp_sw1_p14, LOCAL_STATE)
    # Validate diag-dump results
    validate_diagdump_lag_state_afn(map_diagdump_lacp_sw1_p11,
                                    DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw1_p12,
                                     DIAG_DUMP_LOCAL_STATE)

    validate_lag_name(map_lacp_sw2_p21, sw2_lag_id)
    validate_local_key(map_lacp_sw2_p21, sw2_lag_id)
    validate_remote_key(map_lacp_sw2_p21, sw1_lag_id_2)
    validate_lag_state_out_of_sync(map_lacp_sw2_p21, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw2_p22, LOCAL_STATE)
    # Validate diag-dump results
    validate_diagdump_lag_state_out_sync(map_diagdump_lacp_sw2_p21,
                                         DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw2_p22,
                                     DIAG_DUMP_LOCAL_STATE)
Esempio n. 5
0
def test_lacp_agg_key_more_than_one_lag_connected(topology):
    """
    Case 2:
        Verify only interfaces associated with the same
        aggregation key get to Collecting/Distributing state
        Initial Topology:
            SW1>
                LAG150 -> Interfaces: 1,2,3,4
            SW2>
                LAG150 -> Interfaces: 1,2
                LAG400 -> Interfaces: 3,4
        Expected behaviour:
            Interfaces 1 and 2 in both switches get state Active, InSync,
            Collecting and Distributing. Interfaces 3 and 4 should get state
            Active, OutOfSync, Collecting and Distributing
    """
    sw1 = topology.get('sw1')
    sw2 = topology.get('sw2')
    sw1_lag_id = '150'
    sw2_lag_id = '150'
    sw2_lag_id_2 = '400'

    assert sw1 is not None
    assert sw2 is not None

    ports_sw1 = list()
    ports_sw2 = list()
    port_labels = ['1', '2', '3', '4']

    step("Mapping interfaces")
    for port in port_labels:
        ports_sw1.append(sw1.ports[port])
        ports_sw2.append(sw2.ports[port])

    step("Sorting the port list")
    ports_sw1.sort()
    ports_sw2.sort()

    step("Turning on all interfaces used in this test")
    for port in ports_sw1:
        turn_on_interface(sw1, port)

    for port in ports_sw2:
        turn_on_interface(sw2, port)

    step("Verify interfaces to turn on")
    verify_turn_on_interfaces(sw1, ports_sw1)
    verify_turn_on_interfaces(sw2, ports_sw2)

    mac_addr_sw1 = sw1.libs.vtysh.show_interface('1')['mac_address']
    mac_addr_sw2 = sw2.libs.vtysh.show_interface('1')['mac_address']
    assert mac_addr_sw1 != mac_addr_sw2, \
        'Mac address of interfaces in sw1 is equal to mac address of ' + \
        'interfaces in sw2. This is a test framework problem. Dynamic ' + \
        'LAGs cannot work properly under this condition. Refer to Taiga ' + \
        'issue #1251.'

    step("Create LAG in both switches")
    create_lag_active(sw1, sw1_lag_id)
    create_lag_active(sw2, sw2_lag_id)
    create_lag_active(sw2, sw2_lag_id_2)
    set_lacp_rate_fast(sw1, sw1_lag_id)
    set_lacp_rate_fast(sw2, sw2_lag_id)
    set_lacp_rate_fast(sw2, sw2_lag_id_2)

    step("Associate interfaces to lag in both switches")
    for interface in ports_sw1:
        associate_interface_to_lag(sw1, interface, sw1_lag_id)

    for interface in ports_sw2[0:2]:
        associate_interface_to_lag(sw2, interface, sw2_lag_id)

    for interface in ports_sw2[2:4]:
        associate_interface_to_lag(sw2, interface, sw2_lag_id_2)

    step("#### Verify LAG configuration ####")
    verify_lag_config(sw1, sw1_lag_id, ports_sw1, 'fast', mode='active')
    verify_lag_config(sw2, sw2_lag_id, ports_sw2[0:2], 'fast', mode='active')
    verify_lag_config(sw2, sw2_lag_id_2, ports_sw2[2:4], 'fast', mode='active')

    step("Get the configured interfaces for each LAG using diag-dump " +
         "lacp basic in both switches")
    time.sleep(60)
    sw1_lacp_interfaces = get_diagdump_lacp_interfaces(sw1)
    sw2_lacp_interfaces = get_diagdump_lacp_interfaces(sw2)
    validate_diagdump_lacp_interfaces(sw1_lacp_interfaces, sw1_lag_id,
                                      ports_sw1, ports_sw1,
                                      [ports_sw1[0], ports_sw1[1]])
    validate_diagdump_lacp_interfaces(sw2_lacp_interfaces, sw2_lag_id,
                                      [ports_sw2[0], ports_sw2[1]],
                                      [ports_sw2[0], ports_sw2[1]],
                                      [ports_sw2[0], ports_sw2[1]])
    validate_diagdump_lacp_interfaces(sw2_lacp_interfaces, sw2_lag_id_2,
                                      [ports_sw2[2], ports_sw2[3]],
                                      [ports_sw2[2], ports_sw2[3]], [])

    step("Get information for LAG in interface 1 with both switches")
    map_lacp_sw1_p11 = sw1.libs.vtysh.show_lacp_interface(ports_sw1[0])
    map_lacp_sw1_p12 = sw1.libs.vtysh.show_lacp_interface(ports_sw1[1])
    map_lacp_sw1_p13 = sw1.libs.vtysh.show_lacp_interface(ports_sw1[2])
    map_lacp_sw1_p14 = sw1.libs.vtysh.show_lacp_interface(ports_sw1[3])
    map_lacp_sw2_p21 = sw2.libs.vtysh.show_lacp_interface(ports_sw2[0])
    map_lacp_sw2_p22 = sw2.libs.vtysh.show_lacp_interface(ports_sw2[1])
    map_lacp_sw2_p23 = sw2.libs.vtysh.show_lacp_interface(ports_sw2[2])
    map_lacp_sw2_p24 = sw2.libs.vtysh.show_lacp_interface(ports_sw2[3])

    step("Get the state of LAGs using diag-dump lacp basic in both switches")
    sw1_lacp_state = get_diagdump_lacp_state(sw1)
    sw2_lacp_state = get_diagdump_lacp_state(sw2)

    # Recast labels to work with the library output
    ports_sw1[:] = [int(x) if x.isdigit() else x for x in ports_sw1]
    ports_sw2[:] = [int(x) if x.isdigit() else x for x in ports_sw2]

    map_diagdump_lacp_sw1_p11 = sw1_lacp_state[str(sw1_lag_id)][ports_sw1[0]]
    map_diagdump_lacp_sw1_p12 = sw1_lacp_state[str(sw1_lag_id)][ports_sw1[1]]
    map_diagdump_lacp_sw1_p13 = sw1_lacp_state[str(sw1_lag_id)][ports_sw1[2]]
    map_diagdump_lacp_sw1_p14 = sw1_lacp_state[str(sw1_lag_id)][ports_sw1[3]]
    map_diagdump_lacp_sw2_p21 = sw2_lacp_state[str(sw2_lag_id)][ports_sw2[0]]
    map_diagdump_lacp_sw2_p22 = sw2_lacp_state[str(sw2_lag_id)][ports_sw2[1]]
    map_diagdump_lacp_sw2_p23 = sw2_lacp_state[str(sw2_lag_id_2)][ports_sw2[2]]
    map_diagdump_lacp_sw2_p24 = sw2_lacp_state[str(sw2_lag_id_2)][ports_sw2[3]]

    step("Validate the LAG was created in both switches")
    validate_lag_state_sync(map_lacp_sw1_p11, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw1_p12, LOCAL_STATE)
    validate_lag_state_out_of_sync(map_lacp_sw1_p13, LOCAL_STATE)
    validate_lag_state_out_of_sync(map_lacp_sw1_p14, LOCAL_STATE)

    validate_lag_state_sync(map_lacp_sw2_p21, LOCAL_STATE)
    validate_lag_state_sync(map_lacp_sw2_p22, LOCAL_STATE)
    validate_lag_state_afn(map_lacp_sw2_p23, LOCAL_STATE)
    validate_lag_state_afn(map_lacp_sw2_p24, LOCAL_STATE)

    # Validate diag-dump results
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw1_p11,
                                     DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw1_p12,
                                     DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_out_sync(map_diagdump_lacp_sw1_p13,
                                         DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_out_sync(map_diagdump_lacp_sw1_p14,
                                         DIAG_DUMP_LOCAL_STATE)

    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw2_p21,
                                     DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_sync(map_diagdump_lacp_sw2_p22,
                                     DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_afn(map_diagdump_lacp_sw2_p23,
                                    DIAG_DUMP_LOCAL_STATE)
    validate_diagdump_lag_state_afn(map_diagdump_lacp_sw2_p24,
                                    DIAG_DUMP_LOCAL_STATE)