def test_mgmt_cli_mode_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") # 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") # 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") st.show(vars.D1, "show interfaces status") st.report_pass("operation_successful")
def test_mgmt_cli_mode_check_2(): vars = st.get_testbed_vars() # from sonic to mgmt-cli interface mode and commands after mode change st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet4") st.cli_config(vars.D1, "shutdown") st.cli_config(vars.D1, "no shutdown") # from sonic to mgmt-cli interface mode and commands along with mode change st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet40") st.cli_config(vars.D1, "shutdown") st.cli_config(vars.D1, "no shutdown") # 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") st.cli_config(vars.D1, "seq 2 permit udp any any") st.cli_config(vars.D1, "no seq 2") # from sonic to mgmt-cli interface mode with different interface st.change_prompt(vars.D1, "mgmt-intf-config", interface="Ethernet40") st.cli_config(vars.D1, "shutdown") st.cli_config(vars.D1, "no shutdown") st.show(vars.D1, "show interfaces status") st.report_pass("operation_successful")
def ntp_module_hooks(request): global vars vars = dict() vars = st.get_testbed_vars() global_vars() yield ntp_obj.delete_ntp_servers(vars.D1)
def test_l3_perf_tc_14_2(): vars = st.get_testbed_vars() dut2 = vars.D2 if (data.l3_intf is False): output = bcm_show(dut2, 'bcmcmd "l3 intf show" | wc -l') st.log(output) default_intf_count = parse_route_output(output) create_l3_interface(dut2, 1000, 1, default_intf_count) data.l3_intf = True st.log(data.result) #data.oct1 = 10 #data.oct2 = 0 #data.oct3 = 1 #data.oct4 = 1 #create_l3_interface(dut1, 1000, 0, default_intf_count) #clean-up using range command #cmd = "config vlan range del 1 1000" st.report_pass("test_case_passed") else: if (data.result[4] == 1): st.report_pass("test_case_passed") else: st.report_pass("test_case_failed")
def test_ft_system_uptime(): """ Author: Sreenivasula Reddy V <*****@*****.**> Validate 'show uptime' command """ vars = st.get_testbed_vars() st.log("About to get system uptime in seconds") intial_uptime = int(boxserv_obj.get_system_uptime_in_seconds(vars.D1)) st.log("initial_uptime: {}".format(intial_uptime)) st.log("About to wait for 1 min") st.wait(60) uptime_after_1min = intial_uptime + int(60) st.log("uptime_after_1min: {}".format(uptime_after_1min)) st.log("About to check system uptime after 60 sec") sys_uptime = int(boxserv_obj.get_system_uptime_in_seconds(vars.D1)) st.log("sys_uptime: {}".format(sys_uptime)) st.log( "About to validate system uptime which should be greater than or equal to system uptime after 1 min" ) st.log("uptime_after_1min+60: {}".format(uptime_after_1min + 60)) st.log("Verifying {}<={}<={}".format(uptime_after_1min, sys_uptime, uptime_after_1min + 60)) if uptime_after_1min <= sys_uptime <= uptime_after_1min + 60: st.log("System Uptime is getting updated with correct value") else: st.report_fail("sytem_uptime_fail", vars.D1) st.report_pass("test_case_passed")
def test_klish_tam(): vars = st.get_testbed_vars() st.config(vars.D1, "tam", type="klish") st.config(vars.D1, "int-ifa-ts", type="klish") st.show(vars.D1, "show interface status", type="click") st.config(vars.D1, "tam", type="klish") st.config(vars.D1, "int-ifa-ts", type="klish") st.show(vars.D1, "show interface brief", type="vtysh", skip_tmpl=True) st.config(vars.D1, "tam", type="klish") st.config(vars.D1, "int-ifa-ts", type="klish") st.show(vars.D1, "show neighbors", type="lldp", skip_tmpl=True) st.config(vars.D1, "tam", type="klish") st.config(vars.D1, "int-ifa-ts", type="klish") st.config(vars.D1, "configure med policy application voice", type="lldp") st.config(vars.D1, "tam", type="klish") st.config(vars.D1, "int-ifa-ts", type="klish") st.config(vars.D1, "pseudowire dummy", type="vtysh") st.config(vars.D1, "tam", type="klish") st.config(vars.D1, "int-ifa-ts", type="klish") st.show(vars.D1, "show interface status", type="click") st.report_pass("operation_successful")
def test_vtysh_prompt_modes_check_4(): vars = st.get_testbed_vars() st.change_prompt(vars.D1, "normal-user") st.cli_config(vars.D1, "no shutdown", "vtysh-intf-config", interface="Ethernet40") st.cli_config(vars.D1, "receive-interval 10", "vtysh-bfd-peer-config", peer_ip="1.2.3.4") st.cli_config(vars.D1, "list", "vtysh-key-chain-config", key_chain="testkeychain") st.cli_config(vars.D1, "key-string teststring", "vtysh-key-chain-Identifier-config", key_id="1") st.cli_config(vars.D1, "vc type ethernet", "vtysh-l2vpn-config", l2vpn_name="testl2vpn") st.cli_config(vars.D1, "nexthop 1.2.3.4", "vtysh-nhgroup-config", group_name="testnhgroup") st.cli_config(vars.D1, "set nexthop 1.2.3.4", "vtysh-pbr-map-config", map_name="testpbrmap", seq_id="1") st.cli_config(vars.D1, "neighbor 1.2.3.4", "vtysh-pseudowire-config", interface="Ethernet4") st.cli_config(vars.D1, "set community none", "vtysh-route-map-config", tag_name="testroutemap", action="deny", seq_num="1") st.cli_config(vars.D1, "aggregate-address 1.2.3.4/24", "vtysh-router-config", router="bgp", instance="1") st.cli_config(vars.D1, "allow-ecmp", "vtysh-router-config", router="rip") st.cli_config(vars.D1, "aggregate-address 1.2.3.4/24", "vtysh-router-config", router="bgp", instance="1") st.cli_config(vars.D1, "bgp dampening", "vtysh-router-af-config", addr_family="ipv4", modifier="unicast") st.cli_config(vars.D1, "allow-ecmp", "vtysh-router-config", router="rip") st.cli_config(vars.D1, "bgp dampening", "vtysh-router-af-config", router="bgp", instance="1", addr_family="ipv4", modifier="unicast") st.cli_config(vars.D1, "aggregate-address 1.2.3.4/24", "vtysh-router-config", router="bgp", instance="1") st.cli_config(vars.D1, "ip protocol any route-map test", "vtysh-vrf-config", vrf_name="testvrfname") st.show(vars.D1, "show vlan config") st.report_pass("operation_successful")
def flap_interface(intf_name): vars = st.get_testbed_vars() ifapi.interface_operation(vars.D1, intf_name, operation="shutdown") st.wait(5) ifapi.interface_operation(vars.D1, intf_name, operation="startup")
def check_intf_traffic_counters(dut1): papi.clear_interface_counters(dut1) st.wait(10) vars = st.get_testbed_vars() DUT_rx_value = papi.get_interface_counters(dut1, vars.D1T1P1, "rx_bps") DUT_tx_value = papi.get_interface_counters(dut1, vars.D1T1P2, "tx_bps") for i in DUT_rx_value: p1_rcvd = i['rx_bps'] p1_rcvd = p1_rcvd.replace(" MB/s", "") p1_rcvd = p1_rcvd.replace(" B/s", "") for i in DUT_tx_value: p2_txmt = i['tx_bps'] p2_txmt = p2_txmt.replace(" MB/s", "") p2_txmt = p2_txmt.replace(" B/s", "") st.log( "rx_ok counter value on DUT Ingress port: {} and tx_ok xounter value on DUT Egress port : {}" .format(p1_rcvd, p2_txmt)) if (p1_rcvd and p2_txmt): return True else: return False
def test_l3_host_scaling_tc5_8(): vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles_1() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) papi.get_status(dut1) ret = fast_reboot_node(dut1) pre_test_l3_fwding() if (ret): tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1) tr1 = create_l3_host(tg1, tg_ph_1, data.max_host_1, 20) st.wait(15) total = get_arp_count(dut1) st.log("Total ARP entries: {}".format(total)) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1) post_test_l3_fwding() if (total >= data.max_host_1): st.report_pass("test_case_passed") else: st.report_fail("test_case_failed") else: post_test_l3_fwding() st.report_fail("test_case_failed")
def test_l3_perf_tc_12_5(): pre_test_l3_fwding_v6() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) interface_status_show(dut1) tr1 = create_l3_host_v6(tg1, tg_ph_1, 16000) # Verified ARP and counters at the DUT. default_nd = arpapi.get_ndp_count(dut1) st.log("Total NDP entries are: {}".format(default_nd)) measure_nd_learn_time(dut1, default_nd, 16000) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'], max_wait_timer=10) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding_v6() st.report_pass("test_case_passed")
def test_l3_host_scaling_tc5_5(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) ifapi.interface_status_show(dut1) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tr1 = create_l3_host(tg1, tg_ph_1, 8000, 120) st.wait(15) # Verified ARP and counters at the DUT. total = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total)) if (total): arpfeature.clear_arp_table(vars.D1) st.wait(30) total = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total)) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding() if (total >= data.max_host_1): st.report_pass("test_case_passed") else: st.report_fail("test_case_failed")
def post_test_l3_fwding(): vars = st.get_testbed_vars() data.my_dut_list = st.get_dut_names() ipfeature.delete_ip_interface(vars.D1, vars.D1T1P1, data.d1t1_5_x_ip_addr, data.mask) ipfeature.delete_ip_interface(vars.D1, vars.D1T1P2, data.d1t2_5_x_ip_addr, data.mask)
def test_l3_perf_tc_14_1(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.show_ip_route(dut1) interface_status_show(dut1) tr1 = create_l3_host(tg1, tg_ph_1, 10000) st.wait(15) # Verified ARP and counters at the DUT. output = bcm_show(dut1, "time show arp") st.log(output) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'], max_wait_timer=10) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding() st.report_pass("test_case_passed")
def initialize_variables(): global data, vars data = SpyTestDict() vars = st.get_testbed_vars() data.vlan = 10 data.vlan_int = "Vlan{}".format(data.vlan) data.dhcp_service_name = "isc-dhcp-server" data.RA_ipaddress_1 = '176.16.40.1' data.RA_ipaddress_2 = '192.168.0.2' data.RA_ipaddress_21 = '192.168.0.2/24' data.subnet = '24' data.family = 'ipv4' data.pool_ip_address = "192.168.2" data.wait_time_to_no_shut = 10 data.dhcp_relay_params = vars.D2D1P1 data.dhcp_server_ip = '176.16.40.210' data.dhcp_files = ['isc-dhcp-server', 'dhcpd.conf', 'dhcpd6.conf'] data.dhcp_files_path = [ os.path.join(os.path.dirname(__file__), data.dhcp_files[0]), os.path.join(os.path.dirname(__file__), data.dhcp_files[1]), os.path.join(os.path.dirname(__file__), data.dhcp_files[2]) ] data.dhcp_files_path = [] for file in data.dhcp_files: data.dhcp_files_path.append( os.path.join(os.path.dirname(__file__), file)) data.username = '******' data.route_list = [ '192.168.0.0/24', '100.100.100.0/24', '200.200.200.0/24', '11.11.11.0/24', '110.110.110.0/24' ]
def test_l3_host_scaling_tc5_1(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) ifapi.interface_status_show(dut1) tr1 = create_l3_host(tg1, tg_ph_1, 8000, 5) st.wait(15) # Verified ARP and counters at the DUT. total_in_sw = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total_in_sw)) #We expect all 8k host entries should be programmed in hw within 32secs st.wait(20) output = bcm_show(dut1, 'bcmcmd "l3 l3table show" | wc -l') total_in_hw = parse_route_output(output) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding() if (total_in_sw >= data.max_host_1 and total_in_hw >= data.max_host_1): st.report_pass("test_case_passed") else: st.report_fail("test_case_failed")
def test_vtysh_prompt_modes_check_1(): vars = st.get_testbed_vars() st.change_prompt(vars.D1, "normal-user") # from vtysh mode to normal user and back to normal user st.change_prompt(vars.D1, "vtysh-user") st.change_prompt(vars.D1, "normal-user") # from sonic to vtysh config mode and back to normal user st.change_prompt(vars.D1, "vtysh-config") st.change_prompt(vars.D1, "normal-user") st.change_prompt(vars.D1, "vtysh-intf-config", interface="Ethernet40") st.change_prompt(vars.D1, "vtysh-intf-config", interface="Ethernet4") st.change_prompt(vars.D1, "vtysh-intf-config", interface="Ethernet40") st.change_prompt(vars.D1, "vtysh-user") # from sonic to vtysh router config mode and back to normal user st.change_prompt(vars.D1, "vtysh-router-config", router="bgp", instance="1") st.change_prompt(vars.D1, "vtysh-router-af-config", addr_family="ipv4", modifier="unicast") st.change_prompt(vars.D1, "vtysh-router-config", router="rip") st.change_prompt(vars.D1, "vtysh-user") st.change_prompt(vars.D1, "vtysh-router-config", router="bgp", instance="1") st.change_prompt(vars.D1, "vtysh-router-af-config", addr_family="ipv4", modifier="unicast") st.change_prompt(vars.D1, "vtysh-router-config", router="rip") # using vtysh_show and back to normal user st.vtysh_show(vars.D1, "show ip prefix-list", skip_tmpl=True) st.change_prompt(vars.D1, "normal-user") st.show(vars.D1, "show interfaces status") st.report_pass("operation_successful")
def test_ft_ipv6_neighbor_entry(): ################# Author Details ################ # Name: Raja Sekhar Uppara # Email: [email protected] ################################################# # Objective - 1.Verify that IPv6 neighbor entries are created successfully. # 2.Verify that Ipv6 Static neighbor entries are created successfully. # 3.'sudo sonic-clear ndp' flushes the existing dymanic entries ############### Test bed details ################ # TG1-----DUT-----TG2 ################################################# vars = st.get_testbed_vars() arp_obj.show_ndp(vars.D1) ndp_dut_count_initial = arp_obj.get_ndp_count(vars.D1) if ndp_dut_count_initial < 2 * data.count: st.report_fail("ndp_dynamic_entry_fail") arp_obj.clear_ndp_table(vars.D1) ndp_dut_count_post_clear = int(arp_obj.get_ndp_count(vars.D1)) if ndp_dut_count_post_clear > 2: out = arp_obj.show_ndp(vars.D1) entries = filter_and_select(out, [None], {'status': 'NOARP'}) if not len(out) == len(entries): st.report_fail("ndp_entries_clearing_failed") arp_obj.config_static_ndp(vars.D1, data.neigh_ip6_addr_gw[2], data.tg_mac3, vars.D1T1P1) ndp_dut_count_static = int(arp_obj.get_ndp_count(vars.D1)) if not ndp_dut_count_static: st.report_fail("static_ndp_create_fail") arp_obj.config_static_ndp(vars.D1, data.neigh_ip6_addr_gw[2], data.tg_mac3, vars.D1T1P1, 'del') st.report_pass("test_case_passed")
def get_interface_breakout_mode(dut, interface, *fields): """ Author: Naveen Nag email : [email protected] :param dut: :param interface: :param fields: :return: port,interface,supported_modes,default mode Usage: port.get_interface_breakout_mode(dut1, 'Ethernet4', 'port','supported_modes') :return - [{'supported_modes': '1x100G[40G], 4x25G[10G]', 'port': '1/2'}] """ if '/' not in interface: temp_vars = st.get_testbed_vars() if temp_vars.config.ifname_type == 'alias': interface = st.get_other_names(dut,[interface])[0] if '/' in interface: interface = '/'.join([interface.split('/')[0], interface.split('/')[1]]) output = st.show(dut, "show interface breakout modes | grep \"{} \"".format(interface), type='klish') entries = filter_and_select(output, fields, {'iface': interface}) if entries: return entries else: st.error("{} is not part of the output".format(interface)) return False
def test_wrong_vtysh_cmd_2(): vars = st.get_testbed_vars() st.config(vars.D1, "router bgp\nexit\nexit", type="vtysh", skip_error_check=True) st.show(vars.D1, "testetst\nexit", skip_error_check=True, skip_tmpl=True) st.report_pass("operation_successful")
def test_l3_intf_scaling_tc_6_1(): vars = st.get_testbed_vars() dut = vars.D2 verify_traffic_results(dut) if data.tc6_xresult[0]: st.report_pass("test_case_passed") else: st.report_fail("test_case_failed")
def test_stop_mgmt_and_enter(): vars = st.get_testbed_vars() st.config(vars.D1, "sudo systemctl stop mgmt-framework") st.show(vars.D1, "show interface status", type="klish", skip_tmpl=True) st.show(vars.D1, "show vlan config", type="click", skip_tmpl=True) st.report_pass("operation_successful")
def test_stop_bgp_and_enter(): vars = st.get_testbed_vars() st.config(vars.D1, "sudo systemctl stop bgp") st.show(vars.D1, "show interface brief", type="vtysh", skip_tmpl=True) st.show(vars.D1, "show vlan config", type="click", skip_tmpl=True) st.report_pass("operation_successful")
def test_vtysh_intf_pim(): vars = st.get_testbed_vars() st.config(vars.D1, "interface Vlan101\nip pim hello 20\nexit", type="vtysh") st.config(vars.D1, "interface Vlan101\nip pim hello 15\nexit", type="vtysh") st.show(vars.D1, "show interface brief", type="vtysh", skip_tmpl=True) st.report_pass("operation_successful")
def nat_post_config(): vars = st.get_testbed_vars() util_nat_zone_config(vars.D2, [vars.D2D1P1, vars.D2D3P1], [data.zone_1, data.zone_2], config=data.config_del) nat_obj.clear_nat_config(vars.D2) nat_obj.config_nat_feature(vars.D2, 'disable') ip_obj.delete_static_route(vars.D1, data.d2d1_ip_addr,"{}/{}".format(data.d1_static_nw, data.ip_addr_mask)) ip_obj.delete_static_route(vars.D3, data.d2d3_ip_addr,"{}/{}".format(data.d3_static_nw, data.ip_addr_mask)) ip_obj.clear_ip_configuration(st.get_dut_names())
def get_handles(): vars = st.get_testbed_vars() tg = tgapi.get_chassis(vars) tg1, tg2 = tg, tg tg_ph_1 = tg1.get_port_handle(vars.T1D1P1) tg_ph_2 = tg2.get_port_handle(vars.T1D1P2) return (tg1, tg2, tg_ph_1, tg_ph_2)
def make_global_vars(): global vars vars = st.get_testbed_vars() data.spine1_port_list1 = [vars.D1D3P1, vars.D1D4P1, vars.D1D5P1, vars.D1D6P1] data.spine2_port_list1 = [vars.D2D3P1, vars.D2D4P1, vars.D2D5P1, vars.D2D6P1] data.leafs_spine1_port_lst1 = [vars.D3D1P1, vars.D4D1P1, vars.D5D1P1, vars.D6D1P1] data.leafs_spine2_port_lst1 = [vars.D3D2P1, vars.D4D2P1, vars.D5D2P1, vars.D6D2P1] data.spine1_port_list2 = [vars.D1D3P2, vars.D1D4P2, vars.D1D5P2, vars.D1D6P2] data.spine2_port_list2 = [vars.D2D3P2, vars.D2D4P2, vars.D2D5P2, vars.D2D6P2] data.leafs_spine1_port_lst2 = [vars.D3D1P2, vars.D4D1P2, vars.D5D1P2, vars.D6D1P2] data.leafs_spine2_port_lst2 = [vars.D3D2P2, vars.D4D2P2, vars.D5D2P2, vars.D6D2P2] data.spine1_port_list3 = [vars.D1D3P3, vars.D1D4P3, vars.D1D5P3, vars.D1D6P3] data.spine2_port_list3 = [vars.D2D3P3, vars.D2D4P3, vars.D2D5P3, vars.D2D6P3] data.leafs_spine1_port_lst3 = [vars.D3D1P3, vars.D4D1P3, vars.D5D1P3, vars.D6D1P3] data.leafs_spine2_port_lst3 = [vars.D3D2P3, vars.D4D2P3, vars.D5D2P3, vars.D6D2P3] data.spine1_port_list4 = [vars.D1D3P4, vars.D1D4P4, vars.D1D5P4, vars.D1D6P4] data.spine2_port_list4 = [vars.D2D3P4, vars.D2D4P4, vars.D2D5P4, vars.D2D6P4] data.leafs_spine1_port_lst4 = [vars.D3D1P4, vars.D4D1P4, vars.D5D1P4, vars.D6D1P4] data.leafs_spine2_port_lst4 = [vars.D3D2P4, vars.D4D2P4, vars.D5D2P4, vars.D6D2P4] data.spine1_leaf1_po_intf_list = [vars.D1D3P2, vars.D1D3P3] data.spine1_leaf2_po_intf_list = [vars.D1D4P2, vars.D1D4P3] data.spine1_leaf3_po_intf_list = [vars.D1D5P2, vars.D1D5P3] data.spine1_leaf4_po_intf_list = [vars.D1D6P2, vars.D1D6P3] data.spine1_all_lfs_po_intf_list = [data.spine1_leaf1_po_intf_list, data.spine1_leaf2_po_intf_list, data.spine1_leaf3_po_intf_list, data.spine1_leaf4_po_intf_list] data.leaf1_spine1_po_intf_list = [vars.D3D1P2, vars.D3D1P3] data.leaf2_spine1_po_intf_list = [vars.D4D1P2, vars.D4D1P3] data.leaf3_spine1_po_intf_list = [vars.D5D1P2, vars.D5D1P3] data.leaf4_spine1_po_intf_list = [vars.D6D1P2, vars.D6D1P3] data.spine2_leaf1_po_intf_list = [vars.D2D3P2, vars.D2D3P3] data.spine2_leaf2_po_intf_list = [vars.D2D4P2, vars.D2D4P3] data.spine2_leaf3_po_intf_list = [vars.D2D5P2, vars.D2D5P3] data.spine2_leaf4_po_intf_list = [vars.D2D6P2, vars.D2D6P3] data.spine2_all_lfs_po_intf_list = [data.spine2_leaf1_po_intf_list, data.spine2_leaf2_po_intf_list, data.spine2_leaf3_po_intf_list, data.spine2_leaf4_po_intf_list] data.leaf1_spine2_po_intf_list = [vars.D3D2P2, vars.D3D2P3] data.leaf2_spine2_po_intf_list = [vars.D4D2P2, vars.D4D2P3] data.leaf3_spine2_po_intf_list = [vars.D5D2P2, vars.D5D2P3] data.leaf4_spine2_po_intf_list = [vars.D6D2P2, vars.D6D2P3] data.leaf1_po_list = ["PortChannel13","PortChannel23"] data.leaf2_po_list = ["PortChannel14","PortChannel24"] data.leaf3_po_list = ["PortChannel15","PortChannel25"] data.leaf4_po_list = ["PortChannel16","PortChannel26"] data.spine1_po_list = ["PortChannel13","PortChannel14","PortChannel15","PortChannel16"] data.spine2_po_list = ["PortChannel23","PortChannel24","PortChannel25","PortChannel26"] data.leafs_spine1_po_lst1 = ["PortChannel13", "PortChannel14", "PortChannel15", "PortChannel16"] data.leafs_spine2_po_lst1 = ["PortChannel23", "PortChannel24", "PortChannel25", "PortChannel26"] data.leaf_nodes_list = [vars.D3, vars.D4, vars.D5, vars.D6] data.spine_nodes_list = [vars.D1, vars.D2] globals().update(data)
def config_mgmt_func_hooks(request): # add things at the start every test case # use 'st.get_func_name(request)' to compare # if any thing specific a particular test case global vars vars = st.get_testbed_vars() st.log("Ensuring minimum topology") vars = st.ensure_min_topology("D1") data.gmin = "100" data.gmax = "1000" data.rmin = "100" data.rmax = "1000" data.ymin = "100" data.ymax = "1000" data.ECN_profile_name = "ECN" data.cos_name = "COS" data.acl_ipv4_table_name = 'acl_table_v4' data.acl_ipv6_table_name = 'acl_table_v6' data.src_ip = '192.168.11.1' data.src_ipv6 = '2001::10' data.mask = '24' data.mask_ipv6 = '128' data.description = 'INGRESS_drop' data.acl_rule = 'ipv4_acl_rule' data.acl_rule_v6 = 'ipv6_acl_rule' data.priority = '55' data.type = 'L3' data.type_ipv6 = 'L3V6' data.packet_action = 'drop' data.stage = 'INGRESS' data.mode_high = 'high' data.mode_low = 'low' data.polling_interval = '1' data.threshold_percentage_type = 'percentage' data.threshold_used_type = 'used' data.threshold_free_type = 'free' data.ipv4_route_family = "ipv4_route" data.ipv6_route_family = "ipv6_route" data.fdb_family = "fdb" data.ipv4_neighbor_family = "ipv4_neighbor" data.ipv6_neighbor_family = "ipv6_neighbor" data.acl_group_entry_family = 'acl_group_entry' data.acl_group_counter_family = 'acl_group_counter' data.ipv6_nexthop_family = 'ipv6_nexthop' data.ipv4_nexthop_family = 'ipv4_nexthop' data.acl_table_family = "acl_table" data.mode_high_percentage = 50 data.mode_low_percentage = 20 data.mode_high_used = 1000 data.mode_low_used = 10 data.mode_high_free = 1000 data.mode_low_free = 10 data.mtu = "9216" data.eth = "Ethernet4" data.property = "mtu" data.mtu_default = "9100" yield
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")
def bgp_module_hooks(request): global bgp_cli_type st.ensure_min_topology('D1D2:1', 'D1T1:1', 'D2T1:1') bgp_cli_type = st.get_ui_type() if bgp_cli_type == 'click': bgp_cli_type = 'vtysh' bgplib.init_resource_data(st.get_testbed_vars()) bgp_pre_config() yield bgp_pre_config_cleanup()