def module_config(): result = rsyslog_server() if result is False: st.error( "Module config Failed - Unable to configure Sonic DUT as a rsyslog server" ) else: st.exec_all([[dut1_config], [dut2_config], [dut3_config]])
def module_unconfig(): st.exec_all( True, [[ ip_obj.delete_ip_interface, data.dut1_client, data.mgmt_intf, data.dut1_mgmt_ipv6[0], data.dut1_mgmt_ipv6_subnet, 'ipv6' ], [ ip_obj.delete_ip_interface, data.dut2_server, data.mgmt_intf, data.dut2_mgmt_ipv6[0], data.dut2_mgmt_ipv6_subnet, 'ipv6' ]]) st.exec_all([[dut1_unconfig], [dut2_unconfig]])
def setup_dut_config(): st.exec_all([[dut1_ip_addr_config], [dut2_ip_addr_config], [dut3_ip_addr_config]]) st.exec_all([[dut1_static_route_config], [dut2_static_route_config], [dut3_static_route_config]]) st.exec_all([[dut1_ipv6_addr_config], [dut2_ipv6_addr_config], [dut3_ipv6_addr_config]]) st.exec_all([[dut1_static_route_v6_config], [dut2_static_route_v6_config], [dut3_static_route_v6_config]])
def test_convergence_l3_scale(evpn_underlay_hooks): func_result = True err_list = [] data['table'] = list() tgen_emulate_bgp() data.config_tgen_bgp = True data.tc_list = ['scale'] for tc in data.tc_list: tc_result = True ############################################ st.banner('Testcase - {}'.format(tc)) ############################################ data['table_{}'.format(tc)] = list() for trigger in trigger_list: tech_support = True ########################################################## st.banner('Testcase -{} : Trigger - {}'.format(tc, trigger)) ########################################################### data[trigger] = {} data['table_{}'.format(trigger)] = [tc, trigger] if 'uplink' in trigger: st.log( "\n\n>>> Keep only one uplink port between Leaf and Spine nodes <<<<\n\n" ) st.exec_all([[ port_api.shutdown, evpn_dict['leaf_node_list'][0], [ evpn_dict["leaf1"]["intf_list_spine"][0], evpn_dict["leaf1"]["intf_list_spine"][3], evpn_dict["leaf1"]["intf_list_spine"][4], evpn_dict["leaf1"]["intf_list_spine"][7] ] ], [ port_api.shutdown, evpn_dict['leaf_node_list'][1], [ evpn_dict["leaf2"]["intf_list_spine"][0], evpn_dict["leaf2"]["intf_list_spine"][3], evpn_dict["leaf2"]["intf_list_spine"][4], evpn_dict["leaf2"]["intf_list_spine"][7] ] ]]) for iter in range(data.iteration_count): ################################################## st.banner('Testcase -{} : Trigger - {},Iteration -{}'.format( tc, trigger, (iter + 1))) ################################################### convergence_time = convergence_measure(tc, trigger=trigger, streams=stream_dict[tc], iteration=(iter + 1)) if type(convergence_time ) is bool and convergence_time is False: data[trigger]['convergence_{}'.format(iter)] = None else: data[trigger]['convergence_{}'.format(iter)] = float( convergence_time) if data[trigger]['convergence_{}'.format( iter)] > data.threshold or data[trigger][ 'convergence_{}'.format(iter)] is None: err = "Average Traffic convergence after {} : {} sec".format( trigger, data[trigger]['convergence_{}'.format(iter)]) st.error(err) st.report_tc_fail(tc, 'test_case_failure_message', err) if tech_support: st.generate_tech_support(dut=None, name='{}_{}_{}'.format( tc, trigger, iter)) tech_support = False tc_result = False err_list.append(err) func_result = False revert_trigger_change(trigger, iteration=(iter + 1)) table_append = data[trigger]['convergence_{}'.format(iter)] data['table_{}'.format(trigger)].append(table_append) get_average_convergence(data[trigger], trigger) if 'uplink' in trigger: st.log( ">>> \n\nBring back all uplink ports between Leaf and SPine nodes <<<<\n\n" ) st.exec_all([[ port_api.noshutdown, evpn_dict['leaf_node_list'][0], [ evpn_dict["leaf1"]["intf_list_spine"][0], evpn_dict["leaf1"]["intf_list_spine"][3], evpn_dict["leaf1"]["intf_list_spine"][4], evpn_dict["leaf1"]["intf_list_spine"][7] ] ], [ port_api.noshutdown, evpn_dict['leaf_node_list'][1], [ evpn_dict["leaf2"]["intf_list_spine"][0], evpn_dict["leaf2"]["intf_list_spine"][3], evpn_dict["leaf2"]["intf_list_spine"][4], evpn_dict["leaf2"]["intf_list_spine"][7] ] ]]) if 'link_down_uplink' not in trigger: st.log("verify BGP EVPN neighborship for all nodes ") st.exec_all([[leaf1_verify_evpn], [leaf2_verify_evpn]]) if tc_result: st.report_tc_pass(tc, 'test_case_passed') data['table_{}'.format(tc)].append( data['table_{}'.format(trigger)]) #Append each testcase along with all trigger result to data.table data['table'].append(data['table_{}'.format(tc)]) #Tabulate results tabulate_results(data['table']) if not func_result: st.report_fail('test_case_failure_message', err_list[0]) st.report_pass('test_case_passed')
def evpn_underlay_hooks(request): global vars create_glob_vars() vars = st.get_testbed_vars() if st.get_ui_type() == 'click': st.report_unsupported("test_execution_skipped", "Not supported for ui_type - click") api_list = [[create_evpn_5549_config]] parallel.exec_all(True, api_list, True) create_stream() st.log("verify MC LAG status in LVTEP nodes") mclag.verify_domain( evpn_dict["leaf_node_list"][0], domain_id=evpn_dict["l3_vni_sag"]['mlag_domain_id'], session_status='OK', local_ip=evpn_dict['leaf1']['iccpd_ip_list'][0], peer_ip=evpn_dict['leaf1']['iccpd_ip_list'][1], mclag_intfs=1, peer_link_inf=evpn_dict["leaf1"]["iccpd_pch_intf_list"][0], node_role='Active') mclag.verify_domain( evpn_dict["leaf_node_list"][1], domain_id=evpn_dict["l3_vni_sag"]['mlag_domain_id'], session_status='OK', local_ip=evpn_dict['leaf2']['iccpd_ip_list'][0], peer_ip=evpn_dict['leaf2']['iccpd_ip_list'][1], mclag_intfs=1, peer_link_inf=evpn_dict["leaf2"]["iccpd_pch_intf_list"][0], node_role='Standby') st.log("verify MC LAG interface status in LVTEP nodes") mclag.verify_interfaces( evpn_dict["leaf_node_list"][0], domain_id=evpn_dict["l3_vni_sag"]['mlag_domain_id'], mclag_intf=evpn_dict["leaf1"]["mlag_pch_intf_list"][0], mclag_intf_local_state="Up", mclag_intf_peer_state="Up", mclag_intf_l3_status='No', isolate_peer_link='Yes', traffic_disable='No') mclag.verify_interfaces( evpn_dict["leaf_node_list"][1], domain_id=evpn_dict["l3_vni_sag"]['mlag_domain_id'], mclag_intf=evpn_dict["leaf2"]["mlag_pch_intf_list"][0], mclag_intf_local_state="Up", mclag_intf_peer_state="Up", mclag_intf_l3_status='No', isolate_peer_link='Yes', traffic_disable='No') st.log("verify BGP EVPN neighborship for all nodes ") result = st.exec_all([[spine1_verify_evpn], [spine2_verify_evpn], [leaf1_verify_evpn], [leaf2_verify_evpn], [leaf3_verify_evpn]]) if result[0].count(False) > 0: st.error( "########## BGP EVPN neighborship is NOT UP on all spine and leaf nodes; Abort the suite ##########" ) st.report_fail("base_config_verification_failed") st.log("verify vxlan tunnel status on leaf nodes") result = st.exec_all([[leaf1_verify_vxlan], [leaf2_verify_vxlan], [leaf3_verify_vxlan]]) if result[0].count(False) > 0: st.error( "########## VxLAN tunnel status is NOT up on all leaf nodes; Abort the suite ##########" ) st.report_fail("base_config_verification_failed") get_mlag_active_stdby('Active') st.exec_all([[reboot_api.config_save, data['active']], [reboot_api.config_save, data['stdby']], [reboot_api.config_save, evpn_dict['spine_node_list'][0]]]) st.exec_all( [[reboot_api.config_save, data['active'], 'vtysh'], [reboot_api.config_save, data['stdby'], 'vtysh'], [reboot_api.config_save, evpn_dict['spine_node_list'][0], 'vtysh']]) data.config_tgen_bgp = False yield
def config_ip(config='yes'): if config == 'yes': api_name = ip_api.config_ip_addr_interface config_str = "Configure" else: api_name = ip_api.delete_ip_interface config_str = "Delete" hdrMsg("Bring-up the port on dut3 which is connected to dhcp server ") interface_api.interface_operation(data.dut3, data.dhcp_server_port, operation="startup") ########################################################################## hdrMsg( "IP-config: {} IP address between dut2 interface {} and dut3 interface {}" .format(config_str, data.d2d3_ports, data.d3d2_ports)) ########################################################################## utils.exec_all(True, [[ api_name, data.dut2, data.d2d3_ports[0], dut2_3_ip_list[0], mask_24 ], [api_name, data.dut3, data.d3d2_ports[0], dut3_2_ip_list[0], mask_24]]) if config == 'yes': st.banner('Install L2 DHCP rules on dhcp client device') copp_api.bind_class_action_copp_policy(data.dut4, classifier='copp-system-dhcpl2', action_group='copp-system-dhcp') ########################################################################## hdrMsg("Create loopback interfaces on dut1, dut2 and dut3") ########################################################################## parallel.exec_parallel(True, [data.dut1, data.dut2, data.dut3], ip_api.configure_loopback, [{ 'loopback_name': 'Loopback1' }] * 3) ########################################################################## hdrMsg("Loopback-config: {} IP address on Loopback interface".format( config_str)) ########################################################################## utils.exec_all(True, [[ api_name, data.dut1, "Loopback1", dut1_loopback_ip_list[0], '32' ], [ api_name, data.dut2, "Loopback1", dut2_loopback_ip_list[0], '32' ], [api_name, data.dut3, "Loopback1", dut3_loopback_ip_list[0], '32']]) ########################################## hdrMsg("config required vlan to test on dut2 and dut4") ########################################## utils.exec_all(True, [[vlan_api.create_vlan, data.dut2, ['100']], [vlan_api.create_vlan, data.dut4, ['100']]]) vlan_api.create_vlan(data.dut4, ['200', '300']) ########################################## hdrMsg("Add vlan members") ########################################## utils.exec_all(True, [[ vlan_api.add_vlan_member, data.dut2, '100', data.d2d4_ports[0], True ], [ vlan_api.add_vlan_member, data.dut4, '100', data.d4d2_ports[0], True ]]) ######################################################### hdrMsg("LAG-Config: Create portchannel on dut2 and dut4") ######################################################### utils.exec_all(True, [[pc.create_portchannel, data.dut2, ['PortChannel12']], [pc.create_portchannel, data.dut4, ['PortChannel12']]]) ######################################################### hdrMsg("LAG-Config: add member ports to portchannel") ######################################################### utils.exec_all(True, [[ pc.add_del_portchannel_member, data.dut2, 'PortChannel12', data.d2d4_ports[2], 'add' ], [ pc.add_del_portchannel_member, data.dut4, 'PortChannel12', data.d4d2_ports[2], 'add' ]]) ######################################################### hdrMsg("LAG-Config: Create portchannel on dut3 and dut1") ######################################################### utils.exec_all(True, [[pc.create_portchannel, data.dut3, ['PortChannel14']], [pc.create_portchannel, data.dut1, ['PortChannel14']]]) ######################################################### hdrMsg("LAG-Config: add member ports to portchannel") ######################################################### utils.exec_all(True, [[ pc.add_del_portchannel_member, data.dut3, 'PortChannel14', data.d3d1_ports[0], 'add' ], [ pc.add_del_portchannel_member, data.dut1, 'PortChannel14', data.d1d3_ports[0], 'add' ]]) ip_api.config_ip_addr_interface(data.dut2, 'Vlan100', dut2_4_ip_list[0], mask_24) ip_api.config_ip_addr_interface(data.dut2, data.d2d4_ports[1], dut2_4_ip_list[1], mask_24) ip_api.config_ip_addr_interface(data.dut2, 'PortChannel12', dut2_4_ip_list[2], mask_24) ip_api.config_ip_addr_interface(data.dut1, 'PortChannel14', data.dhcp_server_ipv6, mask_v6, family='ipv6') ######################################### hdrMsg("Add vlan members on DUT4") ######################################### vlan_api.add_vlan_member(data.dut4, '200', data.d4d2_ports[1]) vlan_api.add_vlan_member(data.dut4, '300', 'PortChannel12') st.exec_all([[create_static_route_dut2], [create_static_route_dut3]]) else: st.banner('Remove L2 DHCP rules on dhcp client device') copp_api.bind_class_action_copp_policy(data.dut4, classifier='copp-system-dhcpl2', action_group='copp-system-dhcp', config='no') ########################################################################## hdrMsg("Loopback-config: {} IP address on Loopback interface".format( config_str)) ########################################################################## utils.exec_all(True, [[ api_name, data.dut1, "Loopback1", dut1_loopback_ip_list[0], '32' ], [ api_name, data.dut2, "Loopback1", dut2_loopback_ip_list[0], '32' ], [api_name, data.dut3, "Loopback1", dut3_loopback_ip_list[0], '32']]) ########################################################################## hdrMsg("Delete loopback interfaces on dut1, dut2 and dut3") ########################################################################## parallel.exec_parallel(True, [data.dut1, data.dut2, data.dut3], ip_api.configure_loopback, [{ 'loopback_name': 'Loopback1', 'config': 'no' }] * 3) st.exec_all([[delete_static_route_dut2], [delete_static_route_dut3]]) hdrMsg(" Remove all ip configs on dut2") ip_api.delete_ip_interface(data.dut2, 'Vlan100', dut2_4_ip_list[0], mask_24) ip_api.delete_ip_interface(data.dut2, data.d2d4_ports[1], dut2_4_ip_list[1], mask_24) ip_api.delete_ip_interface(data.dut2, 'PortChannel12', dut2_4_ip_list[2], mask_24) ip_api.delete_ip_interface(data.dut1, 'PortChannel14', data.dhcp_server_ipv6, mask_v6, family='ipv6') ########################################################### hdrMsg("LAG-unConfig: delete member ports to portchannel") ########################################################### utils.exec_all(True, [[ pc.add_del_portchannel_member, data.dut2, 'PortChannel12', data.d2d4_ports[2], 'del' ], [ pc.add_del_portchannel_member, data.dut4, 'PortChannel12', data.d4d2_ports[2], 'del' ]]) utils.exec_all(True, [[ pc.add_del_portchannel_member, data.dut3, 'PortChannel14', data.d3d1_ports[0], 'del' ], [ pc.add_del_portchannel_member, data.dut1, 'PortChannel14', data.d1d3_ports[0], 'del' ]]) vlan_api.delete_vlan_member(data.dut4, '300', 'PortChannel12') ####################################################### hdrMsg("LAG-UnConfig: Delete portchannel on dut2 and dut4") ####################################################### utils.exec_all(True, [[pc.delete_portchannel, data.dut2, ['PortChannel12']], [pc.delete_portchannel, data.dut4, ['PortChannel12']]]) utils.exec_all(True, [[pc.delete_portchannel, data.dut3, ['PortChannel14']], [pc.delete_portchannel, data.dut1, ['PortChannel14']]]) ######################################## hdrMsg("Delete vlan member ports") ######################################## utils.exec_all(True, [[ vlan_api.delete_vlan_member, data.dut2, '100', data.d2d4_ports[0], True ], [ vlan_api.delete_vlan_member, data.dut4, '100', data.d4d2_ports[0], True ]]) vlan_api.delete_vlan_member(data.dut4, '200', data.d4d2_ports[1]) #################################### hdrMsg("Unconfig vlan fron dut2 and dut4") ################################### utils.exec_all(True, [[vlan_api.delete_vlan, data.dut2, ['100']], [vlan_api.delete_vlan, data.dut4, ['100']]]) vlan_api.delete_vlan(data.dut4, ['200', '300'])
def module_unconfig(): st.exec_all(True, [[dut1_unconfig], [dut2_unconfig]])