Exemplo n.º 1
0
def dut1_config(config=''):

    st.log('On DUT1 physical interface IPv4 and IPv6 addresses on it')
    ip_obj.config_ip_addr_interface(data.dut1_client, data.d1_d2_ports[0],
                                    data.dut1_dut2_ipv6[0],
                                    data.dut1_dut2_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut1_client, data.d1_d2_ports[0],
                                    data.dut1_dut2_ip[0],
                                    data.dut1_dut2_ip_subnet, 'ipv4')

    st.log('On DUT1 configure vlan and IPv4 and IPv6 addresses on it')
    vlan_obj.create_vlan(data.dut1_client, data.dut1_dut2_vlan[0])
    vlan_obj.add_vlan_member(data.dut1_client, data.dut1_dut2_vlan[0],
                             data.d1_d2_ports[1], True, True)
    ip_obj.config_ip_addr_interface(data.dut1_client,
                                    'Vlan' + data.dut1_dut2_vlan[0],
                                    data.dut1_dut2_ipv6[1],
                                    data.dut1_dut2_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut1_client,
                                    'Vlan' + data.dut1_dut2_vlan[0],
                                    data.dut1_dut2_ip[1],
                                    data.dut1_dut2_ip_subnet, 'ipv4')

    st.log('On DUT1 configure portchannel and IPv4 and IPv6 addresses on it')
    pc_obj.create_portchannel(data.dut1_client, data.portchannel)
    pc_obj.add_portchannel_member(data.dut1_client, data.portchannel,
                                  [data.d1_d2_ports[2], data.d1_d2_ports[3]])
    ip_obj.config_ip_addr_interface(data.dut1_client, data.portchannel,
                                    data.dut1_dut2_ipv6[2],
                                    data.dut1_dut2_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut1_client, data.portchannel,
                                    data.dut1_dut2_ip[2],
                                    data.dut1_dut2_ip_subnet, 'ipv4')

    st.log('On DUT1 configure loopback and IPv4 and IPv6 addresses on it')
    ip_obj.configure_loopback(data.dut1_client,
                              config='yes',
                              loopback_name=data.dut1_loopback[0])
    ip_obj.config_ip_addr_interface(data.dut1_client, data.dut1_loopback[0],
                                    data.dut1_loopback_ipv6[0],
                                    data.dut1_loopback_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut1_client, data.dut1_loopback[0],
                                    data.dut1_loopback_ip[0],
                                    data.dut1_loopback_ip_subnet, 'ipv4')

    st.log('IPv4 and IPv6 static routes for loopback reachability')
    ip_obj.create_static_route(data.dut1_client,
                               data.dut2_dut1_ip[0],
                               data.dut2_loopback_ip[0] + '/32',
                               family='ipv4')
    ip_obj.create_static_route(data.dut1_client,
                               data.dut2_dut1_ipv6[0],
                               data.dut2_loopback_ipv6[0] + '/128',
                               family='ipv6')

    return True
def test_ft_verify_max_static_portchannel():
    '''
    Author: Venkatesh Terli <*****@*****.**>
    Scenario - 3.4.1 Verify the max number of Static Port Channels configurable per system.
    '''
    portchannel_list = []
    for i in range(2, static_data.max_portchannels + 1, 1):
        portchannelobj.create_portchannel(vars.D1,
                                          "PortChannel" + str(i),
                                          static=True)
    for i in range(2, static_data.max_portchannels + 1, 1):
        temp = "PortChannel" + str(i)
        portchannel_list.append(temp)
    portchannelobj.delete_portchannels(vars.D1, portchannel_list)
    st.wait(10)
    portchannel_list1 = portchannelobj.get_portchannel_names(vars.D1)
    portchannel_list1 = list(dict.fromkeys(portchannel_list1))
    if len(portchannel_list1) != 1:
        st.report_fail('portchannel_config_clear_failed')
    elif static_data.portchannel_name not in portchannel_list1:
        st.report_fail('portchannel_not_found', static_data.portchannel_name)
    else:
        st.report_pass('max_portchannels_per_system')
def test_ft_verify_fallback_is_configure_or_not_on_static_portchannel():
    '''
    Author: Venkatesh Terli <*****@*****.**>
    Scenario - 3.2.6 Verify that "fallback" cannot be configured on a static Port Channel.
    '''
    st.log(
        'Scenario - 3.2.6 Verify that "fallback" cannot be configured on a static Port Channel.'
    )
    if portchannelobj.create_portchannel(vars.D1,
                                         static_data.portchannel_name2,
                                         fallback=True,
                                         static=True):
        st.report_fail('portchannel_fallback_configuration_fail')
    else:
        st.report_pass('portchannel_fallback_configuration')
def test_ft_verify_static_portchannel_add_member_to_other_portchannel():
    '''
    Author: Venkatesh Terli <*****@*****.**>
    Scenario - 3.2.5 A member port already part of a port-channel shouldn't be allowed to add it to another port-channel.
    '''
    st.log(
        "Scenario - 3.2.5 A member port already part of a port-channel shouldn't be allowed to add it to another port-channel."
    )
    if not portchannelobj.create_portchannel(
            vars.D1, static_data.portchannel_name2, static=True):
        st.report_fail('portchannel_create_failed',
                       static_data.portchannel_name2, vars.D1)
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name2,
                                              static_data.members_dut1[0],
                                              skip_verify=False,
                                              skip_err_check=True)
    portchannelobj.delete_portchannel(vars.D1, static_data.portchannel_name2)
    st.report_pass('add_member_ports_to_other_portchannel')
Exemplo n.º 5
0
def dut3_config(config=''):
    st.log('On DUT3 physical interface IPv4 and IPv6 addresses on it')
    vrf_obj.config_vrf(dut=data.dut3_client,
                       vrf_name=data.dut3_vrf_phy,
                       config='yes')
    vrf_obj.bind_vrf_interface(dut=data.dut3_client,
                               vrf_name=data.dut3_vrf_phy,
                               intf_name=data.d3_d2_ports[0],
                               config='yes')
    ip_obj.config_ip_addr_interface(data.dut3_client, data.d3_d2_ports[0],
                                    data.dut3_dut2_ipv6[0],
                                    data.dut3_dut2_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut3_client, data.d3_d2_ports[0],
                                    data.dut3_dut2_ip[0],
                                    data.dut3_dut2_ip_subnet, 'ipv4')
    vlan_obj.create_vlan(data.dut3_client, data.dut2_dut3_vlan[0])
    vlan_obj.add_vlan_member(data.dut3_client, data.dut2_dut3_vlan[0],
                             data.d3_d2_ports[1], True, True)
    st.log('On DUT3 configure vlan and IPv4 and IPv6 addresses on it')
    vrf_obj.config_vrf(dut=data.dut3_client,
                       vrf_name=data.dut3_vrf_vlan,
                       config='yes')
    vrf_obj.bind_vrf_interface(dut=data.dut3_client,
                               vrf_name=data.dut3_vrf_vlan,
                               intf_name='Vlan' + data.dut2_dut3_vlan[0],
                               config='yes')
    ip_obj.config_ip_addr_interface(data.dut3_client,
                                    'Vlan' + data.dut2_dut3_vlan[0],
                                    data.dut3_dut2_ipv6[1],
                                    data.dut3_dut2_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut3_client,
                                    'Vlan' + data.dut2_dut3_vlan[0],
                                    data.dut3_dut2_ip[1],
                                    data.dut3_dut2_ip_subnet, 'ipv4')
    st.log('On DUT3 configure portchannel and IPv4 and IPv6 addresses on it')
    pc_obj.create_portchannel(data.dut3_client, data.portchannel_2)
    pc_obj.add_portchannel_member(data.dut3_client, data.portchannel_2,
                                  [data.d3_d2_ports[2], data.d3_d2_ports[3]])
    vrf_obj.config_vrf(dut=data.dut3_client,
                       vrf_name=data.dut3_vrf_pc,
                       config='yes')
    vrf_obj.bind_vrf_interface(dut=data.dut3_client,
                               vrf_name=data.dut3_vrf_pc,
                               intf_name=data.portchannel_2,
                               config='yes')
    ip_obj.config_ip_addr_interface(data.dut3_client, data.portchannel_2,
                                    data.dut3_dut2_ipv6[2],
                                    data.dut3_dut2_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut3_client, data.portchannel_2,
                                    data.dut3_dut2_ip[2],
                                    data.dut3_dut2_ip_subnet, 'ipv4')

    st.log('On DUT3 configure loopback and IPv4 and IPv6 addresses on it')
    ip_obj.configure_loopback(data.dut3_client,
                              config='yes',
                              loopback_name=data.dut3_loopback[1])
    vrf_obj.config_vrf(dut=data.dut3_client,
                       vrf_name=data.dut3_vrf_phy,
                       config='yes')
    vrf_obj.bind_vrf_interface(dut=data.dut3_client,
                               vrf_name=data.dut3_vrf_phy,
                               intf_name=data.dut3_loopback[1],
                               config='yes')
    ip_obj.config_ip_addr_interface(data.dut3_client, data.dut3_loopback[1],
                                    data.dut3_loopback_ipv6[1],
                                    data.dut3_loopback_ipv6_subnet, 'ipv6')
    ip_obj.config_ip_addr_interface(data.dut3_client, data.dut3_loopback[1],
                                    data.dut3_loopback_ip[1],
                                    data.dut3_loopback_ip_subnet, 'ipv4')

    st.log('IPv4 and IPv6 static routes for loopback reachability')
    ip_obj.create_static_route(data.dut3_client,
                               data.dut2_dut3_ip[0],
                               data.dut2_loopback_ip[1] + '/32',
                               family='ipv4',
                               interface=data.d3_d2_ports[0],
                               vrf=data.dut3_vrf_phy)
    ip_obj.create_static_route(data.dut3_client,
                               data.dut2_dut3_ipv6[0],
                               data.dut2_loopback_ipv6[1] + '/128',
                               family='ipv6',
                               interface=data.d3_d2_ports[0],
                               vrf=data.dut3_vrf_phy)
    return True
Exemplo n.º 6
0
def ip_module_hooks(request):
    global vars, tg_handler, tg
    # Min topology verification
    st.log("Ensuring minimum topology")
    vars = st.ensure_min_topology("D1T1:4", "D2T1:2", "D1D2:4")
    # Initialize TG and TG port handlers
    tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2", "T1D2P1",
                                          "T1D2P2")
    tg = tg_handler["tg"]
    # IP module configuration
    st.log("Vlan routing configuration on D1D2P1,D2D1P1")
    vlan_obj.create_vlan(vars.D1, data.vlan_1)
    vlan_obj.add_vlan_member(vars.D1,
                             data.vlan_1, [vars.D1D2P1],
                             tagging_mode=True)
    vlan_obj.create_vlan(vars.D2, data.vlan_1)
    vlan_obj.add_vlan_member(vars.D2,
                             data.vlan_1, [vars.D2D1P1],
                             tagging_mode=True)
    ipfeature.config_ip_addr_interface(vars.D1,
                                       data.vlan_int_1,
                                       data.ip4_addr[2],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D1,
                                       data.vlan_int_1,
                                       data.ip6_addr[2],
                                       96,
                                       family=data.af_ipv6)
    ipfeature.config_ip_addr_interface(vars.D2,
                                       data.vlan_int_1,
                                       data.ip4_addr[3],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D2,
                                       data.vlan_int_1,
                                       data.ip6_addr[3],
                                       96,
                                       family=data.af_ipv6)
    st.log("Port routing configuration on port-channel")
    data.dut1_pc_members = [vars.D1D2P2, vars.D1D2P3]
    data.dut2_pc_members = [vars.D2D1P2, vars.D2D1P3]
    pc_obj.create_portchannel(vars.D1, data.port_channel)
    pc_obj.add_portchannel_member(vars.D1, data.port_channel,
                                  data.dut1_pc_members)
    pc_obj.create_portchannel(vars.D2, data.port_channel)
    pc_obj.add_portchannel_member(vars.D2, data.port_channel,
                                  data.dut2_pc_members)
    ipfeature.config_ip_addr_interface(vars.D1,
                                       data.port_channel,
                                       data.ip4_addr[4],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D2,
                                       data.port_channel,
                                       data.ip4_addr[5],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D1,
                                       data.port_channel,
                                       data.ip6_addr[4],
                                       96,
                                       family=data.af_ipv6)
    ipfeature.config_ip_addr_interface(vars.D2,
                                       data.port_channel,
                                       data.ip6_addr[5],
                                       96,
                                       family=data.af_ipv6)
    st.log("port routing configuration on  D1D2P4,D2D1P4")
    ipfeature.config_ip_addr_interface(vars.D1,
                                       vars.D1D2P4,
                                       data.ip4_addr[6],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D2,
                                       vars.D2D1P4,
                                       data.ip4_addr[7],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D1,
                                       vars.D1D2P4,
                                       data.ip6_addr[6],
                                       96,
                                       family=data.af_ipv6)
    ipfeature.config_ip_addr_interface(vars.D2,
                                       vars.D2D1P4,
                                       data.ip6_addr[7],
                                       96,
                                       family=data.af_ipv6)
    st.log("configuring the dut1 ports connected to TGen with ip addresses")
    ipfeature.config_ip_addr_interface(vars.D1,
                                       vars.D1T1P1,
                                       data.ip4_addr[1],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D1,
                                       vars.D1T1P2,
                                       data.ip6_addr[1],
                                       96,
                                       family=data.af_ipv6)
    ipfeature.create_static_route(vars.D1,
                                  data.ip6_addr[7],
                                  data.static_ip6_rt,
                                  shell=data.shell_vtysh,
                                  family=data.af_ipv6)
    ipfeature.create_static_route(vars.D1,
                                  data.ip4_addr[7],
                                  data.static_ip_rt,
                                  shell=data.shell_vtysh,
                                  family=data.af_ipv4)
    st.log("configuring the dut2 ports connected to TGen with ip addresses")
    ipfeature.config_ip_addr_interface(vars.D2,
                                       vars.D2T1P1,
                                       data.ip4_addr[8],
                                       24,
                                       family=data.af_ipv4)
    ipfeature.config_ip_addr_interface(vars.D2,
                                       vars.D2T1P2,
                                       data.ip6_addr[8],
                                       96,
                                       family=data.af_ipv6)

    yield
    ipfeature.clear_ip_configuration(st.get_dut_names())
    ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6')
    vlan_obj.clear_vlan_configuration(st.get_dut_names())
    pc_obj.clear_portchannel_configuration(st.get_dut_names())
    ipfeature.delete_static_route(vars.D1,
                                  data.ip4_addr[7],
                                  data.static_ip_rt,
                                  shell=data.shell_vtysh,
                                  family=data.af_ipv4)
    ipfeature.delete_static_route(vars.D1,
                                  data.static_ip6_rt_drop,
                                  data.static_ip6_rt,
                                  shell=data.shell_vtysh,
                                  family=data.af_ipv6)
def portchannel_func_hooks(request):
    yield
    if st.get_func_name(
            request
    ) == 'test_ft_verify_static_portchannel_is_up_or_not_with_one_active_member':
        portchannelobj.add_del_portchannel_member(vars.D1,
                                                  static_data.portchannel_name,
                                                  static_data.members_dut1[1:])
    if st.get_func_name(
            request
    ) == 'test_ft_verify_static_portchannel_is_up_with_active_members_when_no_lag_in_partner':
        portchannelobj.create_portchannel(vars.D2,
                                          static_data.portchannel_name,
                                          static=True)
        portchannelobj.add_del_portchannel_member(vars.D2,
                                                  static_data.portchannel_name,
                                                  static_data.members_dut2)
        add_vlan_member(vars.D2,
                        static_data.vid,
                        static_data.portchannel_name,
                        tagging_mode=True)
    if st.get_func_name(
            request
    ) == 'test_ft_verify_fallback_is_configure_or_not_on_static_portchannel':
        if portchannelobj.get_portchannel(vars.D1,
                                          static_data.portchannel_name2):
            portchannelobj.delete_portchannel(vars.D1,
                                              static_data.portchannel_name2)
    if st.get_func_name(
            request
    ) == 'test_ft_verify_static_portchannel_del_from_ip_assigned_vlan':
        st.wait(2)
        ipobj.config_ip_addr_interface(vars.D1,
                                       'Vlan{}'.format(static_data.vid),
                                       static_data.ip41,
                                       static_data.ip_mask,
                                       config='remove')
        portchannelobj.add_del_portchannel_member(vars.D1,
                                                  static_data.portchannel_name,
                                                  static_data.members_dut1)
    if st.get_func_name(request) == 'test_ft_del_ip_assigned_portchannel':
        if not portchannelobj.get_portchannel(vars.D1,
                                              static_data.portchannel_name):
            portchannelobj.create_portchannel(vars.D1,
                                              static_data.portchannel_name,
                                              static=True)
        ipobj.delete_ip_interface(vars.D1,
                                  static_data.portchannel_name,
                                  static_data.ip41,
                                  static_data.ip_mask,
                                  skip_error=True)
        portchannelobj.add_del_portchannel_member(vars.D1,
                                                  static_data.portchannel_name,
                                                  static_data.members_dut1)
        exceptions = exec_all(True,
                              [[
                                  add_vlan_member, vars.D1, static_data.vid,
                                  static_data.portchannel_name, True
                              ],
                               [
                                   add_vlan_member, vars.D2, static_data.vid,
                                   static_data.portchannel_name, True
                               ]])[1]
        ensure_no_exception(exceptions)
    if st.get_func_name(
            request
    ) == 'test_ft_verify_static_portchannel_l3_hash_sip_dip_l4port':
        arpobj.delete_static_arp(vars.D2,
                                 static_data.ip42,
                                 interface=vars.D2T1P1,
                                 mac=static_data.remote_mac2)
        ipobj.clear_ip_configuration([vars.D1, vars.D2],
                                     family='ipv4',
                                     thread=True)
        exceptions = exec_all(
            True, [[
                add_vlan_member, vars.D1, static_data.vid,
                [static_data.portchannel_name, vars.D1T1P1], True
            ],
                   [
                       add_vlan_member, vars.D2, static_data.vid,
                       [static_data.portchannel_name, vars.D2T1P1], True
                   ]])[1]
        ensure_no_exception(exceptions)
    if st.get_func_name(
            request
    ) == 'test_ft_verify_static_portchannel_vlan_routing_l3_traffic':
        arpobj.delete_static_arp(vars.D2,
                                 static_data.ip42,
                                 interface=vars.D2T1P1,
                                 mac=static_data.remote_mac2)
        ipobj.clear_ip_configuration([vars.D1, vars.D2],
                                     family='ipv4',
                                     thread=True)
        exceptions = exec_all(True, [[
            add_vlan_member, vars.D1, static_data.vid, vars.D1T1P1, True
        ], [add_vlan_member, vars.D2, static_data.vid, vars.D2T1P1, True]])[1]
        ensure_no_exception(exceptions)
def dut1_config():

    result = True
    st.log('On DUT1 configure vrfs and loopbacks')
    result = vrf_obj.config_vrf(dut=data.dut1,
                                vrf_name=data.dut1_vrf[0],
                                config='yes')
    result = ip_obj.configure_loopback(data.dut1,
                                       config='yes',
                                       loopback_name=[
                                           data.dut1_loopback[0],
                                           data.dut1_loopback[1],
                                           data.dut1_loopback[2]
                                       ])

    st.log('On DUT1 configure vlan')
    result = vlan_obj.create_vlan(data.dut1, data.dut1_dut2_vlan[0])
    result = vlan_obj.add_vlan_member(data.dut1, data.dut1_dut2_vlan[0],
                                      data.d1_d2_ports[1], True, True)

    st.log('On DUT1 configure portchannel')
    result = pc_obj.create_portchannel(data.dut1, data.portchannel)
    result = pc_obj.add_portchannel_member(
        data.dut1, data.portchannel,
        [data.d1_d2_ports[2], data.d1_d2_ports[3]])

    st.log(
        'On DUT1 bind all the loopbacks, physical, vlan and portchannel interfaces between the DUTs to the VRF'
    )
    result = vrf_obj.bind_vrf_interface(
        dut=data.dut1,
        vrf_name=[
            data.dut1_vrf[0], data.dut1_vrf[0], data.dut1_vrf[0],
            data.dut1_vrf[0], data.dut1_vrf[0], data.dut1_vrf[0],
            data.dut1_vrf[0], data.dut1_vrf[0]
        ],
        intf_name=[
            data.dut1_tg_ports[0], data.dut1_loopback[0],
            data.dut1_loopback[1], data.dut1_loopback[2], data.d1_d2_ports[0],
            'Vlan' + data.dut1_dut2_vlan[0], data.portchannel
        ],
        config='yes')

    st.banner('On DUT1 verify vrf bindings for all the interfaces')
    output = vrf_obj.get_vrf_verbose(dut=data.dut1, vrfname=data.dut1_vrf[0])
    if data.dut1_vrf[0] in output['vrfname']:
        st.log('VRF configured on DUT1 is as expected', data.dut1_vrf[0])
    else:
        st.error('VRF name configured on DUT1 is as not expected',
                 data.dut1_vrf[0])
        result = False
    for value in output['interfaces']:
        if data.dut1_tg_ports[0] or data.dut1_loopback[
                0] or data.dut1_loopback[1] or data.dut1_loopback[
                    2] or data.d1_d2_ports[0] or 'Vlan' + data.dut1_dut2_vlan[
                        0] or data.portchannel == value:
            st.log('Bind to VRF is as expected', value)
        else:
            st.error('Bind to VRF is not as expected', value)
            result = False

    st.log(
        'On DUT1 configure OSPF router ID, ospf networks and add all the ospf interfaces'
    )
    result = ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[0],
                                             data.dut1_loopback_ipv6[0],
                                             data.ipv6_loopback_prefix, 'ipv6')
    result = ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[0],
                                             data.dut1_loopback_ip[0],
                                             data.ip_loopback_prefix, 'ipv4')
    result = ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[1],
                                             data.dut1_loopback_ipv6[1],
                                             data.ipv6_loopback_prefix, 'ipv6')
    result = ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[1],
                                             data.dut1_loopback_ip[1],
                                             data.ip_loopback_prefix, 'ipv4')
    result = ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[2],
                                             data.dut1_loopback_ipv6[2],
                                             data.ipv6_loopback_prefix, 'ipv6')
    result = ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[2],
                                             data.dut1_loopback_ip[2],
                                             data.ip_loopback_prefix, 'ipv4')

    st.log(
        'On DUT1 configure OSPF router ID, ospf networks and add all the ospf interfaces'
    )
    result = ospf_obj.config_ospf_router_id(data.dut1,
                                            data.dut1_ospf_router_id,
                                            data.dut1_vrf[0], '', 'yes')
    result = ospf_obj.config_ospf_network(
        data.dut1, data.dut1_loopback_ip[0] + '/' + data.ip_loopback_prefix, 0,
        data.dut1_vrf[0], '', 'yes')
    result = ospf_obj.config_ospf_network(
        data.dut1, data.dut1_loopback_ip[1] + '/' + data.ip_loopback_prefix, 0,
        data.dut1_vrf[0], '', 'yes')
    result = ospf_obj.config_ospf_network(
        data.dut1, data.dut1_loopback_ip[2] + '/' + data.ip_loopback_prefix, 0,
        data.dut1_vrf[0], '', 'yes')
    result = ospf_obj.config_ospf_network(data.dut1, data.dut1_tg1_network_v4,
                                          0, data.dut1_vrf[0], '', 'yes')
    result = ospf_obj.config_interface_ip_ospf_network_type(
        data.dut1, data.d1_d2_ports[0], 'point-to-point', data.dut1_vrf[0],
        'yes')
    result = ospf_obj.config_interface_ip_ospf_network_type(
        data.dut1, 'Vlan' + data.dut1_dut2_vlan[0], 'point-to-point',
        data.dut1_vrf[0], 'yes')
    result = ospf_obj.config_interface_ip_ospf_network_type(
        data.dut1, data.portchannel, 'point-to-point', data.dut1_vrf[0], 'yes')

    st.log('On DUT1 configure IP addresses on DUT - TG interfaces')
    ip_obj.config_ip_addr_interface(data.dut1, data.dut1_tg_ports[0],
                                    data.dut1_tg_ipv6[0], data.tg_ipv6_subnet,
                                    'ipv6')
    ip_obj.config_ip_addr_interface(data.dut1, data.dut1_tg_ports[0],
                                    data.dut1_tg_ip[0], data.tg_ip_subnet,
                                    'ipv4')
    return result
def dut2_config():

    result = True
    st.log('On DUT2 configure loopback')
    result = ip_obj.configure_loopback(data.dut2,
                                       config='yes',
                                       loopback_name=[
                                           data.dut2_loopback[0],
                                           data.dut2_loopback[1],
                                           data.dut2_loopback[2]
                                       ])

    st.log('On DUT2 configure vlan')
    result = vlan_obj.create_vlan(data.dut2, data.dut1_dut2_vlan[0])
    result = vlan_obj.add_vlan_member(data.dut2, data.dut1_dut2_vlan[0],
                                      data.d2_d1_ports[1], True, True)

    st.log('On DUT2 configure portchannel')
    result = pc_obj.create_portchannel(data.dut2, data.portchannel)
    result = pc_obj.add_portchannel_member(
        data.dut2, data.portchannel,
        [data.d2_d1_ports[2], data.d2_d1_ports[3]])

    st.log(
        'On DUT2 configure OSPF router ID, ospf networks and add all the ospf interfaces'
    )
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_loopback[0],
                                             data.dut2_loopback_ipv6[0],
                                             data.ipv6_loopback_prefix, 'ipv6')
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_loopback[0],
                                             data.dut2_loopback_ip[0],
                                             data.ip_loopback_prefix, 'ipv4')
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_loopback[1],
                                             data.dut2_loopback_ipv6[1],
                                             data.ipv6_loopback_prefix, 'ipv6')
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_loopback[1],
                                             data.dut2_loopback_ip[1],
                                             data.ip_loopback_prefix, 'ipv4')
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_loopback[2],
                                             data.dut2_loopback_ipv6[2],
                                             data.ipv6_loopback_prefix, 'ipv6')
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_loopback[2],
                                             data.dut2_loopback_ip[2],
                                             data.ip_loopback_prefix, 'ipv4')

    st.log(
        'On DUT2 configure OSPF router ID, ospf networks and add all the ospf interfaces'
    )
    result = ospf_obj.config_ospf_router_id(data.dut2,
                                            data.dut2_ospf_router_id,
                                            'default', '', 'yes')
    result = ospf_obj.config_ospf_network(
        data.dut2, data.dut2_loopback_ip[0] + '/' + data.ip_loopback_prefix, 0,
        'default', '', 'yes')
    result = ospf_obj.config_ospf_network(
        data.dut2, data.dut2_loopback_ip[1] + '/' + data.ip_loopback_prefix, 0,
        'default', '', 'yes')
    result = ospf_obj.config_ospf_network(
        data.dut2, data.dut2_loopback_ip[2] + '/' + data.ip_loopback_prefix, 0,
        'default', '', 'yes')
    result = ospf_obj.config_ospf_network(data.dut2, data.dut2_tg1_network_v4,
                                          0, 'default', '', 'yes')
    result = ospf_obj.config_interface_ip_ospf_network_type(
        data.dut2, data.d2_d1_ports[0], 'point-to-point', 'default', 'yes')
    result = ospf_obj.config_interface_ip_ospf_network_type(
        data.dut2, 'Vlan' + data.dut1_dut2_vlan[0], 'point-to-point',
        'default', 'yes')
    result = ospf_obj.config_interface_ip_ospf_network_type(
        data.dut2, data.portchannel, 'point-to-point', 'default', 'yes')

    st.log('On DUT2 configure IP addresses on DUT2 - TG interfaces')
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_tg_ports[0],
                                             data.dut2_tg_ipv6[0],
                                             data.tg_ipv6_subnet, 'ipv6')
    result = ip_obj.config_ip_addr_interface(data.dut2, data.dut2_tg_ports[0],
                                             data.dut2_tg_ip[0],
                                             data.tg_ip_subnet, 'ipv4')
    result = arp_obj.add_static_arp(data.dut2, data.tg_dut2_ip[0],
                                    '00:00:33:33:33:01', data.dut2_tg_ports[0])

    return result