def test_ft_arp_static_route_config_mgmt_verifying_config_with_warm_reboot(): ''' Author: Surendra Kumar Vella([email protected]) Verify static ARP route config after warm-reboot ''' st.log("Checking whether the platform supports warm-reboot") if not data.platform.lower( ) in data.constants['WARM_REBOOT_SUPPORTED_PLATFORMS']: st.report_unsupported('test_case_unsupported') st.log("Performing warm-reboot on DUT") st.reboot(vars.D1, "warm") st.log("Verifying static route entries after save and warm-reboot") st.wait(5) static_route_verify() st.log("Verifying dynamic ARP entries after save and warm-reboot") if not arp_obj.verify_arp(vars.D1, data.ipv4_address_tgen, data.src_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.ipv4_address_tgen, vars.D1) else: st.log("Verified that dynamic ARP entry is present in arp table") if st.get_ui_type(vars.D1) != "click": st.log("Verifying static ARP entries after save and warm-reboot") if not arp_obj.verify_arp(vars.D1, data.static_arp_ip, data.static_arp_mac, ""): st.report_fail("static_arp_create_fail", vars.D1) else: st.log("Verified that static ARP entry is present in arp table") st.report_pass("test_case_passed")
def arp_static_route_reboot_module_hooks(request): # add things at the start of this module init_vars() initialize_variables() get_parms() global tg_handler tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2") global tg tg = tg_handler["tg"] tg_ph_list = [tg_handler["tg_ph_1"], tg_handler["tg_ph_2"]] st.log("configuring static route") adding_static_route() st.log("Getting ARP entry dynamically") adding_dynamic_arp() ip_obj.config_ip_addr_interface(vars.D1, vars.D1T1P2, data.ipv4_address_1, data.mask, family="ipv4", config='add') st.log("Configuring static ARP") arp_obj.add_static_arp(vars.D1, data.static_arp_ip, data.static_arp_mac, vars.D1T1P2) st.log( "Verifying static route entries before save and reboot/fast-reboot/warm-reboot" ) static_route_verify() st.log( "Verifying dynamic ARP entries before save and reboot/fast-reboot/warm-reboot" ) if not arp_obj.verify_arp(vars.D1, data.ipv4_address_ixia, data.src_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.ipv4_address_ixia, vars.D1) else: st.log("Verified that dynamic ARP entry is present in arp table") st.log( "Verifying static ARP entries before save and reboot/fast-reboot/warm-reboot" ) if not arp_obj.verify_arp(vars.D1, data.static_arp_ip, data.static_arp_mac, ""): st.report_fail("static_arp_create_fail", vars.D1) else: st.log("Verified that static ARP entry is present in arp table") st.log("Save the config on the DUT") rb_obj.config_save(vars.D1) st.log("saving config in vtysh mode to save static route") rb_obj.config_save(vars.D1, shell="vtysh") yield # Below step will clear IP adresses configured on different interfaces in the device ip_obj.clear_ip_configuration(st.get_dut_names()) #Below step will clear static route configured in the device ip_obj.delete_static_route(vars.D1, data.ipv4_address_ixia, data.ipv4_address_network, family='ipv4', shell="vtysh") #Below step will delete static arp entries configured in the device arp_obj.delete_static_arp(vars.D1, data.static_arp_ip, vars.D1T1P2)
def test_ft_arp_static_route_config_mgmt_verifying_config_with_save_reboot(): ''' Author: Surendra Kumar Vella([email protected]) Verify static ARP route config after save cold-reboot ''' st.log("Performing reboot on DUT") st.reboot(vars.D1) st.log("Verifying static route entries after save and reboot") st.wait(5) static_route_verify() adding_dynamic_arp() st.log("Verifying dynamic ARP entries after save and reboot") if not arp_obj.verify_arp(vars.D1, data.ipv4_address_tgen, data.src_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.ipv4_address_tgen, vars.D1) else: st.log("Verified that dynamic ARP entry is present in arp table") st.report_pass("test_case_passed")
def test_scale_ip_unnumbered(): ########################################################################################################################################## result = 0 st.banner('FtOpSoRoIPunScl001 - Verify maximum IPv4 unnumbered interfaces') st.log( 'Configure IP unnumbered on Physical interfaces between DUT1 and DUT3') for d1port, d2port in zip(data.d1_d2_ports, data.d2_d1_ports): dict1 = { 'family': 'ipv4', 'action': 'add', 'interface': d1port, 'loop_back': dut1_loopback[0] } dict2 = { 'family': 'ipv4', 'action': 'add', 'interface': d2port, 'loop_back': dut2_loopback[0] } parallel.exec_parallel(True, [data.dut1, data.dut2], ip_obj.config_unnumbered_interface, [dict1, dict2]) st.log( 'Configure IP unnumbered on Physical interfaces between DUT2 and DUT3') for d2port, d3port in zip(data.d2_d3_ports, data.d3_d2_ports): dict2 = { 'family': 'ipv4', 'action': 'add', 'interface': d2port, 'loop_back': dut2_loopback[0] } dict3 = { 'family': 'ipv4', 'action': 'add', 'interface': d3port, 'loop_back': dut3_loopback[0] } parallel.exec_parallel(True, [data.dut2, data.dut3], ip_obj.config_unnumbered_interface, [dict2, dict3]) if not ip_obj.verify_interface_ip_address( data.dut2, data.d2_d3_ports[0], dut2_loopback_ip[0] + '/' + ip_loopback_prefix, 'ipv4', '', 'U'): st.error( 'IP Unnumbered configuration on DUT2-Physical Interface failed') result += 1 if not loc_lib.retry_api(ip_obj.ping, data.dut1, addresses=dut3_loopback_ip[0], retry_count=5, delay=10): st.error('IPv4 Ping from DUT1 to DUT3 failed') result += 1 if not arp_obj.verify_arp(dut=data.dut2, ipaddress=dut3_loopback_ip[0]): st.error( "Failed to resolve ARP for link local address over physical interface" ) result += 1 aggrResult = loc_lib.send_verify_traffic(type='ipv4') if not aggrResult: st.error('IPv4 traffic with IPv4 unnumbered failed') result += 1 port_obj.shutdown(data.dut2, [ data.d2_d1_ports[0], data.d2_d1_ports[1], data.d2_d1_ports[2], data.d2_d1_ports[3], data.d2_d3_ports[0], data.d2_d3_ports[1], data.d2_d3_ports[2], data.d2_d3_ports[3] ]) st.log('Wait for OSFP to go down') st.wait(10) port_obj.noshutdown(data.dut2, [ data.d2_d1_ports[0], data.d2_d1_ports[1], data.d2_d1_ports[2], data.d2_d1_ports[3], data.d2_d3_ports[0], data.d2_d3_ports[1], data.d2_d3_ports[2], data.d2_d3_ports[3] ]) st.log('Wait for OSFP to come up') st.wait(10) if not loc_lib.retry_api(ip_obj.ping, data.dut1, addresses=dut3_loopback_ip[0], retry_count=5, delay=10): st.error('IPv4 Ping from DUT1 to DUT2 failed') result += 1 aggrResult = loc_lib.send_verify_traffic(type='ipv4') if not aggrResult: st.error('IPv4 traffic with IPv4 unnumbered failed') result += 1 if result == 0: st.report_tc_pass('FtOpSoRoIPunScl001', 'test_case_passed') else: st.report_tc_fail('FtOpSoRoIPunScl001', 'test_case_failed') if result == 0: st.report_pass('test_case_passed') else: st.report_fail('test_case_failed')
def test_ft_arp_entry_link_failure(): ################# Author Details ################ # Name: Rakesh Kumar Vooturi # Email: [email protected] ################################################# # # Objective - Verify an ARP table entry learned on port based routing interface is # removed from ARP table after link failure on which that entry is learned. # Objective - Verify an ARP table entry learned on vlan based routing interface is # removed from ARP table after link failure on which that entry is learned # ############### Test bed details ################ # DUT-----TG ################################################# # Ping from tgen to DUT. res = tgapi.verify_ping(src_obj=tg, port_handle=tg_handler["tg_ph_1"], dev_handle=h1['handle'], dst_ip=data.d1t1_ip_addr, ping_count='1', exp_count='1') if res: st.log("Ping succeeded.") else: st.warn("Ping failed.") res = tgapi.verify_ping(src_obj=tg, port_handle=tg_handler["tg_ph_2"], dev_handle=h2['handle'], dst_ip=data.d1t2_ip_addr, ping_count='1', exp_count='1') st.log("PING_RES: " + str(res)) if res: st.log("Ping succeeded.") else: st.warn("Ping failed.") # Verify dynamic arp entries st.log("Verifying the arp entries on the DUT.") if not arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t1d1_ip_addr, dut1) st.log("Verifying the arp entries on the DUT") if not arp_obj.verify_arp(dut1, data.t2d1_ip_addr, data.t2d1_mac_addr, vars.D1T1P2, data.vlan_1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t2d1_ip_addr, dut1) # Shutdown the routing interface link. st.log("Shutdown the routing interface links.") if not interface_obj.interface_operation(dut1, [vars.D1T1P1, vars.D1T1P2], "shutdown"): st.report_fail('interface_admin_shut_down_fail', [vars.D1T1P1, vars.D1T1P2]) # Verify dynamic arp entries st.log("Verifying the arp entries on the DUT.") if arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr, vars.D1T1P1): st.report_fail("ARP_dynamic_entry_removal_fail", data.t1d1_ip_addr, vars.D1T1P1) st.log("Verifying the arp entries on the DUT") if arp_obj.verify_arp(dut1, data.t2d1_ip_addr): st.report_fail("ARP_dynamic_entry_removal_fail", data.t2d1_ip_addr, vars.D1T1P2) # Startup the routing interface link. st.log("Startup the routing interface link.") if not interface_obj.interface_operation(dut1, [vars.D1T1P1, vars.D1T1P2], "startup"): st.report_fail('interface_admin_startup_fail', [vars.D1T1P1, vars.D1T1P2]) st.wait(5) # Verify dynamic arp entries st.log("Verifying the arp entries on the DUT.") if not arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t1d1_ip_addr, dut1) st.log("Verifying the arp entries on the DUT") if not arp_obj.verify_arp(dut1, data.t2d1_ip_addr, data.t2d1_mac_addr, vars.D1T1P2, data.vlan_1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t2d1_ip_addr, dut1) st.report_pass("test_case_passed")
def test_ft_arp_clear_cache_static_and_dynamic_entries( fixture_ft_arp_clear_cache_static_and_dynamic_entries): ################## Author Details ############### # Name: Rakesh Kumar Vooturi # Email: [email protected] ################################################# # # Objective - Verify that the clearing the ARP cache, # all dynamic entries are removed and static entries are not cleared. # ############### Test bed details ################ # TG-----DUT-----TG ################################################# # Adding static arp entries arp_obj.add_static_arp(dut1, data.static_arp_ip_1, data.static_arp_mac_1, vars.D1T1P1) arp_obj.add_static_arp(dut1, data.static_arp_ip, data.static_arp_mac, data.vlan_int_1) res = tgapi.verify_ping(src_obj=tg, port_handle=tg_handler["tg_ph_1"], dev_handle=h1['handle'], dst_ip=data.d1t1_ip_addr, ping_count='1', exp_count='1') if res: st.log("Ping succeeded.") else: st.warn("Ping failed.") res = tgapi.verify_ping(src_obj=tg, port_handle=tg_handler["tg_ph_2"], dev_handle=h2['handle'], dst_ip=data.d1t2_ip_addr, ping_count='1', exp_count='1') if res: st.log("Ping succeeded.") else: st.warn("Ping failed.") # Verify static and dynamic arp entries st.log("Verifying the arp entries on the DUT") if not arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t1d1_ip_addr, dut1) if not arp_obj.verify_arp(dut1, data.t2d1_ip_addr, data.t2d1_mac_addr, vars.D1T1P2, data.vlan_1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t2d1_ip_addr, dut1) if not arp_obj.verify_arp(dut1, data.static_arp_ip_1, data.static_arp_mac_1, vars.D1T1P1): st.report_fail("static_arp_create_fail", dut1) if not arp_obj.verify_arp(dut1, data.static_arp_ip, data.static_arp_mac, "", data.vlan_1): st.report_fail("static_arp_create_fail", dut1) st.banner( "Start - Verifying dynamic and static arp entries behavior on issuing sonic-clear arp command *WITH* traffic flowing" ) # TG ports reset st.log("Resetting the TG ports") tg.tg_traffic_control(action="clear_stats", port_handle=tg_handler["tg_ph_list"]) #TG stream formation s1 = tg.tg_traffic_config(port_handle=tg_handler["tg_ph_2"], mode='create', rate_pps=10, mac_src=data.t2d1_mac_addr, transmit_mode="continuous", mac_dst=d1_mac_addr, l2_encap='ethernet_ii_vlan', l3_protocol="ipv4", ip_dst_addr=data.t1d1_ip_addr, ip_src_addr=data.t2d1_ip_addr, vlan_id=data.vlan_1, vlan="enable") s2 = tg.tg_traffic_config(port_handle=tg_handler["tg_ph_1"], mode='create', rate_pps=10, mac_src=data.t1d1_mac_addr, transmit_mode="continuous", mac_dst=d1_mac_addr, l2_encap='ethernet_ii_vlan', l3_protocol="ipv4", ip_dst_addr=data.t2d1_ip_addr, ip_src_addr=data.t1d1_ip_addr) tg.tg_traffic_control(action="run", stream_handle=[s1['stream_id'], s2['stream_id']]) # Adding wait for traffic to flow. st.wait(5) # Issuing sonic-clear arp command and veryfying the entries behavior. arp_obj.clear_arp_table(dut1) # Adding wait for traffic to flow. st.wait(5) # Verify static and dynamic arp entries after clear arp st.log( "Verifying the arp entries on the DUT after issuing sonic-clear arp command with traffic flowing." ) if not arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t1d1_ip_addr, dut1) if not arp_obj.verify_arp(dut1, data.t2d1_ip_addr, data.t2d1_mac_addr, vars.D1T1P2, data.vlan_1): st.report_fail("ARP_entry_dynamic_entry_fail", data.t2d1_ip_addr, dut1) if not arp_obj.verify_arp(dut1, data.static_arp_ip_1, data.static_arp_mac_1, vars.D1T1P1): st.report_fail("static_arp_delete_fail", dut1) if not arp_obj.verify_arp(dut1, data.static_arp_ip, data.static_arp_mac, "", data.vlan_1): st.report_fail("static_arp_delete_fail", dut1) # Stop the traffic tg.tg_traffic_control(action="stop", stream_handle=[s1['stream_id'], s2['stream_id']]) st.log("Verifying the TG stats") traffic_details = { '1': { 'tx_ports': [vars.T1D1P2], 'tx_obj': [tg], 'exp_ratio': [1], 'rx_ports': [vars.T1D1P1], 'rx_obj': [tg], } } if not tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count'): st.report_fail("traffic_verification_failed") else: st.log("traffic verification passed") st.banner( "End - Verified dynamic and static arp entries behavior on issuing sonic-clear arp command *WITH* traffic flowing" ) st.banner( "Start - Verifying dynamic and static arp entries behavior on issuing sonic-clear arp command *WITHOUT* traffic flowing" ) # Issuing sonic-clear arp command and veryfying the entries behavior. arp_obj.clear_arp_table(dut1) # Verify static and dynamic arp entries after clear arp st.log( "Verifying the arp entries on the DUT after issuing sonic-clear arp command" ) if arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr, vars.D1T1P1): st.report_fail("ARP_dynamic_entry_clear_arp_fail", data.t1d1_ip_addr, dut1) if arp_obj.verify_arp(dut1, data.t2d1_ip_addr, data.t2d1_mac_addr, vars.D1T1P2, data.vlan_1): st.report_fail("ARP_dynamic_entry_clear_arp_fail", data.t2d1_ip_addr, dut1) if not arp_obj.verify_arp(dut1, data.static_arp_ip_1, data.static_arp_mac_1, vars.D1T1P1): st.report_fail("static_arp_delete_fail", dut1) if not arp_obj.verify_arp(dut1, data.static_arp_ip, data.static_arp_mac, "", data.vlan_1): st.report_fail("static_arp_delete_fail", dut1) st.banner( "End - Verified dynamic and static arp entries behavior on issuing sonic-clear arp command *WITHOUT* traffic flowing" ) st.report_pass("test_case_passed")