Example #1
0
def test_vtysh_modes_check_6():
    vars = st.get_testbed_vars()
    cmd = "\n".join("""
    router bgp 101
    no neighbor 2001::1:23:1:2 remote-as 101
    address-family ipv6 unicast
    no neighbor 2001::1:23:1:2 activate
    router bgp 101
    """.strip().splitlines())
    st.vtysh_config(vars.D1, cmd)
    st.report_pass("operation_successful")
def create_bgp_neighbor_route_map_config(dut, local_asn, neighbor_ip,
                                         routemap):
    command = "route-map {} permit 10".format(routemap)
    st.vtysh_config(dut, command)
    command = "set ipv6 next-hop prefer-global"
    st.vtysh_config(dut, command)
    command = "router bgp {}".format(local_asn)
    st.vtysh_config(dut, command)
    command = "address-family ipv6 unicast"
    st.vtysh_config(dut, command)
    command = "neighbor {} route-map {} in".format(neighbor_ip, routemap)
    st.vtysh_config(dut, command)
    #command = "neighbor {} route-map {} out".format(neighbor_ip, routemap)
    return
Example #3
0
def delete_bgp_router(dut, router_id, as_num):
    """
    :param router_id:
    :type router_id:
    :param as_num:
    :type as_num:
    :param dut:
    :type dut:
    :return:
    :rtype:
    """
    st.log("delete bgp router info")
    my_cmd = "router bgp {}".format(as_num)
    st.vtysh_config(dut, my_cmd)
    my_cmd = "no bgp router-id {}".format(router_id)
Example #4
0
def bgp_router_cli_validation(dut, type="vtysh"):
    cmd = ['router bgp 100']
    for each in range(101, 121):
        if type == 'vtysh':
            cmd.append('neighbor 192.168.{}.2 remote-as 300'.format(each))
        else:
            cmd.extend([
                'neighbor 192.168.{}.2'.format(each), 'remote-as 300', 'exit'
            ])
    cmd.append('exit')
    cmd.append('no router bgp')
    if type == "vtysh":
        for each in cmd:
            st.vtysh_config(dut, each)
    else:
        st.config(dut, cmd, type=type, skip_error_check=True)
Example #5
0
def test_lldp_mode_check_1():
    vars = st.get_testbed_vars()
    # from sonic to lldp mode
    st.show(vars.D1, "show platform summary")
    st.config(vars.D1, "configure lldp status tx-only", type="lldp", conf=True)
    st.show(vars.D1, "show neighbors", type="lldp")
    # from lldp to sonic mode
    st.show(vars.D1, "show platform summary")

    # from lldp to vtysh mode
    st.config(vars.D1, "configure lldp status tx-only", type="lldp", conf=True)
    st.vtysh_config(vars.D1, "router bgp 65100")

    # from vtysh to lldp mode
    st.config(vars.D1, "configure lldp status tx-only", type="lldp", conf=True)

    st.report_pass("operation_successful")
Example #6
0
def test_vtysh():
    vars = st.get_testbed_vars()
    st.vtysh_config(vars.D1, "ip prefix-list test permit 5.5.5.0/24")
    st.vtysh_config(vars.D1, "route-map test permit 1")
    # st.vtysh_config("end")
    st.vtysh_config(vars.D1, "exit")
    st.vtysh_config(vars.D1, "router bgp 1")
    # st.vtysh_show("show running-config")
    # st.vtysh_show("show ip prefix-list")
    st.report_pass("operation_successful")
Example #7
0
def test_vtysh_modes_check_2():
    vars = st.get_testbed_vars()
    # Command in Config level - with mode change - with end and exit
    st.vtysh_config(vars.D1, "route-map test permit 1")
    st.vtysh_show(vars.D1, "show route-map test")
    st.vtysh_config(vars.D1, "exit")

    st.vtysh_config(vars.D1, "route-map test permit 1")
    st.vtysh_show(vars.D1, "show route-map test")
    st.vtysh_config(vars.D1, "end")

    st.report_pass("operation_successful")
Example #8
0
def vrf_static_route(dut, **kwargs):
    if 'config' in kwargs:
        config = kwargs['config']
    else:
        config = ''
    if 'next_hop_list' in kwargs:
        next_hop_list = kwargs['next_hop_list']
    if 'vrf_list' in kwargs:
        vrf_list = kwargs['vrf_list']
    if 'dest_list' in kwargs:
        dest_list = kwargs['dest_list']
    my_cmd = ''
    if dut == data.dut1:
        for dest, vrf, next_hop in zip(dest_list, vrf_list, next_hop_list):
            my_cmd += '{} ip route {}/32 {} nexthop-vrf {} \n'.format(
                config, dest, next_hop, vrf)
    if dut == data.dut2:
        for dest, vrf in zip(dest_list, vrf_list):
            my_cmd += '{} ip route {}/32 7.0.0.2 nexthop-vrf default vrf {} \n'.format(
                config, dest, vrf)
    st.vtysh_config(dut, my_cmd)
    return True
def l3_max_route_max_path_scaling_tc(max_paths, max_routes, use_config_file, family="ipv4"):
    (dut) = (data.dut)
    #count = 0
    data.my_dut_list = st.get_dut_names()
    dut1 = data.my_dut_list[0]
    dut2 = data.my_dut_list[1]
    #intf_ip_addr = data.dut1_start_ip_addr
    #intf_ip_addr2 = data.start_ip_addr2
    #nexthop = data.nexthop_start_ip_addr
    vrf_flag = False
    member_dut1 = vars.D1T1P1
    member_dut2 = vars.D2T1P1
    # L3 INTF SCALING TEST CASE 1.1 START
    #json_path = os.getcwd()
    apply_file = False

    if apply_file is False:
        ipfeature.clear_ip_configuration(st.get_dut_names())
        vapi.clear_vlan_configuration(st.get_dut_names())
        st.banner("Started doing the needed config.")
        cmd = "config vlan range add 2 129"
        st.config(dut, cmd)
        st.config(dut2, cmd)
        command = "config vlan member add 2 {}".format(member_dut1)
        st.config(dut, command)
        command = "config vlan member add 2 {}".format(member_dut2)
        st.config(dut2, command)
        max_vlan = max_paths/4
        base_vlan = 3
        max_vlan = max_vlan - base_vlan
        v_range_t = str(base_vlan) + " " + str(base_vlan + max_vlan )
        vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[0])
        vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[0])
        base_range = 1
        max_range = 4
        max_vlan = max_paths/4
        incr_vlan = max_paths/4
        for index in range(base_range, max_range):
            base_vlan = max_vlan + 1
            max_vlan = max_vlan + incr_vlan
            #max_vlan = max_vlan + 32
            v_range_t = str(base_vlan) + " " + str(max_vlan)
            vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[index])
            vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[index])

        ip_addr = data.dut1_start_ip_addr
        ip_addr2 = data.dut2_start_ip_addr
        v6_ip_addr = data.v6_start_ip_addr
        v6_ip_addr2 = data.v6_new_dut2_start_ip_addr
        ix_vlan_val = 2
        #command = "config interface ip add "+ "Vlan" + str(data.vlan_val) + " " + ip_addr+'/24'
        if family == "ipv4":
            command1 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + ip_addr
            command2 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + ip_addr2
        else:
            command1 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + v6_ip_addr
            command2 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + v6_ip_addr2
        st.config(dut1, command1)
        st.config(dut2, command2)
        ip_addr2 = data.dut2_start_ip_addr
        base_vlan = 3
        max_vlan = max_paths + 1
        #max_vlan = 130
        for index in range(base_vlan, max_vlan):
            if family == "ipv4":
                (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network")
                (_, ip_addr2) = ipfeature.increment_ip_addr(ip_addr2, "network")
                command = "config interface ip add "+ "Vlan" + str(index) + " " + ip_addr
                command_dut2 = "config interface ip add "+ "Vlan" + str(index) + " " + ip_addr2
            else:
                v6_tok = str(hex(index)[2:])
                v6_ip_addr = "2100:0:" + v6_tok + "::1/64"
                v6_ip_addr2 = "2100:0:" + v6_tok + "::2/64"
                command = "config interface ip add "+ "Vlan" + str(index) + " " + v6_ip_addr
                command_dut2 = "config interface ip add "+ "Vlan" + str(index) + " " + v6_ip_addr2
            st.config(dut, command)
            st.config(dut2, command_dut2)

    (tg1, tg_ph_1, tg2, tg_ph_2) = get_handles_2()

    tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1)
    tg2.tg_traffic_control(action='reset',port_handle=tg_ph_2)

    #h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.2.2', gateway='10.2.2.1', arp_send_req='1')
    #h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.2.2',  gateway='10.2.2.1', src_mac_addr='00:0a:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0', vlan_id_step='1')
    if family == "ipv4":
        h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.2.3',
                  gateway='10.2.2.1', src_mac_addr='00:0a:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1')
        arp_obj.show_arp(dut)
        h2=tg1.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr='10.2.2.4',
                  gateway='10.2.2.2', src_mac_addr='00:0b:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1')
        arp_obj.show_arp(dut2)
    else:
        h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', ipv6_intf_addr='2100:0:2::3',
                  ipv6_gateway='2100:0:2::1', src_mac_addr='00:0a:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1')
        st.show(dut, "show ndp")
        arp_obj.show_arp(dut)
        h2=tg1.tg_interface_config(port_handle=tg_ph_2, mode='config', ipv6_intf_addr='2200:0:2::4',
                  ipv6_gateway='2200:0:2::2', src_mac_addr='00:0b:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1')
        st.show(dut2, "show ndp")
        arp_obj.show_arp(dut2)

    if family == "ipv4":
        bgpfeature.create_bgp_router(dut, data.as_num, '')
        bgpfeature.create_bgp_router(dut2, data.new_as_num, '')
        dut1_neigh_ip_addr = data.neigh_ip_addr
        dut2_neigh_ip_addr = data.dut1_start_ip_addr
        #formatted_dut1_neigh_ip_addr = dut1_neigh_ip_addr.replace("/24","")
        #formatted_dut2_neigh_ip_addr = dut2_neigh_ip_addr.replace("/24","")
        formatted_dut1_neigh_ip_addr = "10.2.2.3"
        bgpfeature.create_bgp_neighbor(dut, data.as_num, formatted_dut1_neigh_ip_addr, data.remote_as_num)

        (_, dut1_neigh_ip_addr) = ipfeature.increment_ip_addr(dut1_neigh_ip_addr, "network")
        (_, dut2_neigh_ip_addr) = ipfeature.increment_ip_addr(dut2_neigh_ip_addr, "network")
        base_vlan = 3
        max_vlan = max_paths + 1
        #max_vlan = 130
        # The below neighbor config is for inter dut links ibgp
        for index in range(base_vlan, max_vlan):
            formatted_dut1_neigh_ip_addr = dut1_neigh_ip_addr.replace("/24","")
            bgpfeature.create_bgp_neighbor(dut, data.as_num, formatted_dut1_neigh_ip_addr, data.new_as_num)
            (_, dut1_neigh_ip_addr) = ipfeature.increment_ip_addr(dut1_neigh_ip_addr, "network")
            formatted_dut2_neigh_ip_addr = dut2_neigh_ip_addr.replace("/24","")
            bgpfeature.create_bgp_neighbor(dut2, data.new_as_num, formatted_dut2_neigh_ip_addr, data.as_num)
            (_, dut2_neigh_ip_addr) = ipfeature.increment_ip_addr(dut2_neigh_ip_addr, "network")

        conf_var = { 'mode'                  : 'enable',
                     'active_connect_enable' : '1',
                     'local_as'              : '200',
                     'remote_as'             : '100',
                     'remote_ip_addr'        : '10.2.2.1'
                   }
        max_route_str = str(max_routes)
        route_var = { 'mode'       : 'add',
                      'num_routes' : max_route_str,
                      'prefix'     : '121.1.1.0',
                      'as_path'    : 'as_seq:1'
                    }
                    #'num_routes' : '30000',
        ctrl_start = { 'mode' : 'start'}
        ctrl_stop = { 'mode' : 'stop'}


        # Configuring the BGP router.
        bgp_rtr1 = tgapi.tg_bgp_config(tg = tg1,
            handle    = h1['handle'],
            conf_var  = conf_var,
            route_var = route_var,
            ctrl_var  = ctrl_start)

        st.log("BGP_HANDLE: "+str(bgp_rtr1))
        # Verified at neighbor.
        st.log("BGP neighborship established.")
        st.wait(10)

        def f1(d):
            st.show(d, "show bgp ipv4 summary", type='vtysh')
            st.show(d, "show interface status")
            st.show(d, "show ip route | head -1000")
            arp_obj.show_arp(d)

        st.banner("ARP entries before traffic is initiated on Dut1 and Dut2")
        st.exec_each([dut, dut2], f1)

        #Port Counters

        tr1=tg2.tg_traffic_config(port_handle=tg_ph_2, emulation_src_handle=h2['handle'], emulation_dst_handle=bgp_rtr1['route'][0]['handle'], circuit_endpoint_type='ipv4', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='0')
    else:
        v6_dut1_neigh_ip_addr = "2100:0:2::3"
        create_bgp_neighbor_route_map_config(dut, data.as_num, v6_dut1_neigh_ip_addr, data.routemap, vrf_flag)
        create_bgp_neighbor_route_map_config(dut2, data.new_as_num, v6_dut1_neigh_ip_addr, data.routemap, vrf_flag)
        bgpfeature.create_bgp_router(dut, data.as_num, '')
        create_bgp_neighbor_config(dut, data.as_num, v6_dut1_neigh_ip_addr, data.remote_as_num, data.routemap)
        #link_bgp_neighbor_to_routemap(dut, data.as_num, v6_dut1_neigh_ip_addr, data.routemap, vrf_flag)
        bgpfeature.create_bgp_router(dut2, data.new_as_num, '')
        base_vlan = 3
        max_vlan = max_paths + 1
        for index in range(base_vlan, max_vlan):
            v6_tok = str(hex(index)[2:])
            v6_dut1_neigh_ip_addr = "2100:0:" + v6_tok + "::2"
            v6_dut2_neigh_ip_addr2 = "2100:0:" + v6_tok + "::1"
            create_bgp_neighbor_config(dut, data.as_num, v6_dut1_neigh_ip_addr, data.new_as_num, data.routemap)
            create_bgp_neighbor_config(dut2, data.new_as_num, v6_dut2_neigh_ip_addr2, data.as_num, data.routemap)
            #bgpfeature.create_bgp_neighbor(dut, data.as_num, v6_dut1_neigh_ip_addr, data.new_as_num, family="ipv6")
            #bgpfeature.create_bgp_neighbor(dut2, data.new_as_num, v6_dut2_neigh_ip_addr2, data.as_num, family="ipv6")

        bgp_conf=tg2.tg_emulation_bgp_config(handle=h1['handle'], mode='enable', ip_version='6',
            active_connect_enable='1', local_as='200', remote_as='100', remote_ipv6_addr='2100:0:2::1')
        max_route_str = str(max_routes)

        bgp_route=tg2.tg_emulation_bgp_route_config(handle=bgp_conf['handle'], mode='add', ip_version='6',
            num_routes=max_route_str, prefix='3300:0:0:2::1', as_path='as_seq:1')
        tg2.tg_emulation_bgp_control(handle=bgp_conf['handle'], mode='start')

        def f1(d):
            st.show(d, "show run bgp")
            st.show(d, "show ndp")
            st.show(d, "show bgp ipv6 summary", type='vtysh')
            st.show(d, "show ipv6 route | head -1000")
            arp_obj.show_arp(d)
        st.banner("ARP entries before traffic is initiated on Dut1 and Dut2")
        st.exec_each([dut, dut2], f1)

        tr1=tg2.tg_traffic_config(port_handle=tg_ph_2, emulation_src_handle=h2['handle'],
            emulation_dst_handle=bgp_route['handle'], circuit_endpoint_type='ipv6', mode='create',
            transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='0')

        #tr1=tg1.tg_traffic_config(port_handle=tg_ph_2, mac_src='00:11:01:00:00:01', mac_dst='80:a2:35:97:eb:c1',
        # ipv6_dst_mode='increment', ipv6_dst_count=200, ipv6_dst_step='::1',ipv6_src_addr='2200:0:2::5',
        # ipv6_dst_addr='3300:0:0:2::1',  l3_protocol='ipv6', l2_encap='ethernet_ii_vlan', vlan_id='2',
        # vlan='enable', mode='create', transmit_mode='continuous', length_mode='fixed',
        # rate_pps=512000, enable_stream_only_gen='1')

    tg2.tg_traffic_control(action='run', handle=tr1['stream_id'])
    ret1 = check_inter_dut_intf_traffic_counters()
    ret2 = check_end_to_end_intf_traffic_counters()
    tg2.tg_traffic_control(action='stop', handle=tr1['stream_id'])

    st.banner("ARP entries in both DUT's after traffic is stopped")
    st.exec_each([dut, dut2], arp_obj.show_arp)

    tg1.tg_traffic_control(action='reset',port_handle=tg_ph_2)
    if family == "ipv4":
        tgapi.tg_bgp_config(tg = tg1, handle = bgp_rtr1['conf']['handle'], ctrl_var=ctrl_stop)
    else:
        tg1.tg_emulation_bgp_control(handle=bgp_conf['handle'], mode='stop')
    tg1.tg_interface_config(port_handle=tg_ph_1, handle=h1['handle'], mode='destroy')
    tg1.tg_interface_config(port_handle=tg_ph_2, handle=h2['handle'], mode='destroy')

    #import pdb;pdb.set_trace()
    if apply_file is False:
        ip_addr = data.dut1_start_ip_addr
        ip_addr2 = data.dut2_start_ip_addr
        st.log("Un-Config previously config")
        base_range = 2
        max_range = max_paths + 1
        for index in range(base_range, max_range):
            if family == "ipv4":
                command1 = "config interface ip remove "+ "Vlan" + str(index) + " " + ip_addr
                command2 = "config interface ip remove "+ "Vlan" + str(index) + " " + ip_addr2
                (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network")
                (_, ip_addr2) = ipfeature.increment_ip_addr(ip_addr2, "network")
            else:
                v6_tok = str(hex(index)[2:])
                if index == 2:
                    v6_ip_addr2 = "2200:0:" + v6_tok + "::2/64"
                else:
                    v6_ip_addr2 = "2100:0:" + v6_tok + "::2/64"
                v6_ip_addr = "2100:0:" + v6_tok + "::1/64"
                command1 = "config interface ip remove "+ "Vlan" + str(index) + " " + v6_ip_addr
                command2 = "config interface ip remove "+ "Vlan" + str(index) + " " + v6_ip_addr2
            st.config(dut, command1)
            st.config(dut2, command2)
        max_vlan = max_paths/4
        base_vlan = 3
        max_vlan = max_vlan - base_vlan

        v_range_t = str(base_vlan) + " " + str(base_vlan + max_vlan )
        vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[0], config='del')
        vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[0], config='del')
        base_range = 1
        max_range = 4
        max_vlan = max_paths/4
        incr_vlan = max_paths/4
        for index in range(base_range, max_range):
            base_vlan = max_vlan + 1
            #max_vlan = max_vlan + 32
            max_vlan = max_vlan + incr_vlan
            v_range_t = str(base_vlan) + " " + str(max_vlan)
            vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[index], config='del')
            vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[index], config='del')
        cmd = "config vlan range del 2 129"
        st.config(dut, cmd)
        my_cmd = "no router bgp {}".format(data.as_num)
        st.vtysh_config(dut, my_cmd)
        my_cmd = "no router bgp {}".format(data.new_as_num)
        st.vtysh_config(dut2, my_cmd)

    st.debug("ret1: {} , ret2: {}".format(ret1, ret2))
    if ret1 is True and ret2 is True:
        ret = True
        st.log("Test Case PASSED")
    else:
        ret = False
        st.log("Test Case FAILED")
    st.log("operation_successful")
    return ret
def create_bgp_neighbor_config(dut, local_asn, neighbor_ip, remote_asn, routemap, keep_alive=60, hold=180, password=None, family="ipv6"):
    """

    :param dut:
    :param local_asn:
    :param neighbor_ip:
    :param remote_asn:
    :param keep_alive:
    :param hold:
    :param password:
    :param family:
    :return:
    """
    st.log("Creating BGP neighbor ..")
    # Add validation for IPV4 / IPV6 address
    # config_router_bgp_mode(dut, local_asn)

    command = "neighbor {} remote-as {}".format(neighbor_ip, remote_asn)
    st.vtysh_config(dut, command)
    command = "neighbor {} timers {} {}".format(neighbor_ip, keep_alive, hold)
    st.vtysh_config(dut, command)
    if password:
        command = " neighbor {} password {}".format(neighbor_ip, password)
        st.vtysh_config(dut, command)
    # Gather the IP type using the validation result
    # ipv6 = False
    if family == "ipv6":
        command = "address-family ipv6 unicast"
        st.vtysh_config(dut, command)
        command = "neighbor {} activate".format(neighbor_ip)
        st.vtysh_config(dut, command)
        command = "neighbor {} route-map {} in".format(neighbor_ip, routemap)
        st.vtysh_config(dut, command)
        #command = "neighbor {} route-map {} out".format(neighbor_ip, routemap)
    return True
def create_bgp_neighbor_route_map_config(dut, local_asn, neighbor_ip, routemap, vrf_flag):
    command = "route-map {} permit 10".format(routemap)
    st.vtysh_config(dut, command)
    command = "set ipv6 next-hop prefer-global"
    st.vtysh_config(dut, command)
def delete_bgp_router(dut, router_id, as_num):
    st.log("delete bgp router info")
    my_cmd = "router bgp {}".format(as_num)
    st.vtysh_config(dut, my_cmd)
Example #13
0
def test_vtysh_modes_check_4():
    vars = st.get_testbed_vars()
    # Multiple commands in Config level - with multiple mode change - with end and exit
    st.vtysh_config(vars.D1, "router bgp 65100")
    st.vtysh_show(vars.D1, "show ip bgp")
    st.vtysh_config(vars.D1, "end")

    st.vtysh_config(vars.D1, "router bgp 65100")
    st.vtysh_show(vars.D1, "show ip bgp")
    st.vtysh_config(vars.D1, "end")

    st.vtysh_config(vars.D1, "router bgp 65100")
    st.vtysh_config(vars.D1, "address-family ipv4 unicast")
    st.vtysh_config(vars.D1, "bgp dampening")
    st.vtysh_show(vars.D1, "show ip bgp")
    st.vtysh_config(vars.D1, "end")

    st.vtysh_config(vars.D1, "router bgp 65100")
    st.vtysh_config(vars.D1, "address-family ipv4 unicast")
    st.vtysh_config(vars.D1, "bgp dampening")
    st.vtysh_show(vars.D1, "show ip bgp")
    st.vtysh_config(vars.D1, "exit")

    st.report_pass("operation_successful")
Example #14
0
def test_vtysh_modes_check_3():
    vars = st.get_testbed_vars()
    # Multiple commands in Config level - with one mode change - with end and exit
    st.vtysh_config(vars.D1, "ip prefix-list test permit 5.5.5.0/24")
    st.vtysh_config(vars.D1, "route-map test permit 1")
    st.vtysh_show(vars.D1, "show ip prefix-list")
    st.vtysh_config(vars.D1, "end")

    st.vtysh_config(vars.D1, "ip prefix-list test permit 5.5.5.0/24")
    st.vtysh_config(vars.D1, "route-map test permit 1")
    st.vtysh_show(vars.D1, "show ip prefix-list")
    st.vtysh_config(vars.D1, "exit")

    st.report_pass("operation_successful")
Example #15
0
def test_all_modes_check_1():
    vars = st.get_testbed_vars()

    # from sonic to mgmt-cli mode
    st.show(vars.D1, "show ip interfaces")
    st.change_prompt(vars.D1, "mgmt-user")
    st.cli_show(vars.D1, "show interface status", skip_tmpl=True)

    # from mgmt-cli to sonic mode
    st.change_prompt(vars.D1, "normal-user")

    # from sonic to mgmt-cli interface mode
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")

    # from sonic to mgmt-cli interface mode with different interface
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet40")
    st.cli_show(vars.D1, "show interface status", skip_tmpl=True)
    st.cli_show(vars.D1, "show interface status | no-more ", skip_tmpl=True)

    # from mgmt-cli interface to sonic mode
    st.change_prompt(vars.D1, "normal-user")

    # from mgmt-cli interface mode to mgmt-cli acl mode and commands after mode change
    st.change_prompt(vars.D1, "mgmt-ipv4-acl-config", aclname="MyACL")

    # from sonic to mgmt-cli interface mode with different interface
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet40")

    # from mgmt-cli Config to various different modes and vice versa
    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.show(vars.D1, "show neighbors", type="lldp")

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.vtysh_show(vars.D1, "show ip bgp")

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.vtysh_config(vars.D1, "do show ip bgp")

    st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4")
    st.show(vars.D1, "show interfaces status")

    # from mgmt-cli normal mode to various different modes and vice versa
    st.change_prompt(vars.D1, "mgmt-user")
    st.show(vars.D1, "show neighbors", type="lldp")

    st.change_prompt(vars.D1, "mgmt-user")
    st.vtysh_show(vars.D1, "show ip bgp")

    st.change_prompt(vars.D1, "mgmt-user")
    st.vtysh_config(vars.D1, "do show ip bgp")

    st.change_prompt(vars.D1, "mgmt-user")
    st.show(vars.D1, "show interfaces status")

    # from lldp mode to remaining modes and vice versa
    st.show(vars.D1, "show neighbors", type="lldp")
    st.vtysh_show(vars.D1, "show ip bgp")

    st.show(vars.D1, "show neighbors", type="lldp")
    st.vtysh_config(vars.D1, "do show ip bgp")

    st.show(vars.D1, "show neighbors", type="lldp")
    st.show(vars.D1, "show interfaces status")

    # from vtysh config mode to remaining modes and vice versa
    st.vtysh_config(vars.D1, "do show ip bgp")
    st.vtysh_show(vars.D1, "show ip route")

    st.vtysh_config(vars.D1, "do show ip bgp")
    st.show(vars.D1, "show interfaces status")

    # from vtysh mode to remaining modes and vice versa
    st.vtysh_show(vars.D1, "show ip bgp")
    st.show(vars.D1, "show interfaces status")

    st.report_pass("operation_successful")
Example #16
0
def test_vtysh_modes_check_5():
    vars = st.get_testbed_vars()
    # Multiple ends
    st.vtysh_config(vars.D1, "end")
    st.vtysh_config(vars.D1, "end")
    st.vtysh_config(vars.D1, "end")

    # Multiple exists
    st.vtysh_config(vars.D1, "exit")
    st.vtysh_config(vars.D1, "exit")
    st.vtysh_config(vars.D1, "exit")

    st.report_pass("operation_successful")
Example #17
0
def test_vtysh_modes_check_1():
    vars = st.get_testbed_vars()
    # Command in Config level - no mode change - with end and exit
    st.vtysh_config(vars.D1, "ip prefix-list test permit 5.5.5.0/24")
    st.vtysh_show(vars.D1, "show ip prefix-list")
    st.vtysh_config(vars.D1, "end")

    st.vtysh_config(vars.D1, "ip prefix-list test permit 5.5.5.0/24")
    st.vtysh_show(vars.D1, "show ip prefix-list")
    st.vtysh_config(vars.D1, "exit")

    st.vtysh_config(vars.D1, "line vty")
    st.vtysh_config(vars.D1, "end")

    st.vtysh_config(vars.D1, "line vty")
    st.vtysh_config(vars.D1, "exit")

    st.report_pass("operation_successful")