def verify_ipv6_address_config(dut): if dut == vars.D1: st.log("Verify ipv6 address on routing interface {}".format( vars.D1D2P1), dut=dut) if not ip_obj.verify_interface_ip_address( vars.D1, vars.D1D2P1, "{}/96".format(data.local_ip6_addr), data.af_ipv6): st.report_fail('ip6_routing_int_create_fail', vars.D1D2P1) else: st.log("Verify ipv6 address on routing interface {}".format( vars.D2D1P1), dut=dut) if not ip_obj.verify_interface_ip_address( vars.D2, vars.D2D1P1, "{}/96".format(data.neigh_ip6_addr), data.af_ipv6): st.report_fail('ip6_routing_int_create_fail', vars.D2D1P1) if dut == vars.D1: st.log("Verify ipv6 address on routing interface {}".format( vars.D1T1P2), dut=dut) if not ip_obj.verify_interface_ip_address( vars.D1, vars.D1T1P2, "{}/{}".format(data.d1t1_ip6_addr, data.d1t1_ip6_addr_mask), data.af_ipv6): st.report_fail('ipv6_routing_int_create_fail', vars.D1T1P2)
def verify_ipv6_address_config(): st.log("Verify ipv6 address on routing interface {} in D1".format( vars.D1D2P1)) if not ip_obj.verify_interface_ip_address( vars.D1, vars.D1D2P1, "{}/96".format(data.local_ip6_addr), data.af_ipv6): st.report_fail('ip6_routing_int_create_fail', vars.D1D2P1) else: st.log(" IPV6 Addres Config is successful") st.log("Verify ipv6 address on routing interface {} in D2".format( vars.D2D1P1)) if not ip_obj.verify_interface_ip_address( vars.D2, vars.D2D1P1, "{}/96".format(data.neigh_ip6_addr), data.af_ipv6): st.report_fail('ip6_routing_int_create_fail', vars.D2D1P1) else: st.log(" IPV6 Addres Config is successful") st.log("Verify ipv6 address on routing interface {} in D1".format( vars.D1T1P2)) if not ip_obj.verify_interface_ip_address( vars.D1, vars.D1T1P2, "{}/{}".format( data.d1t1_ip6_addr, data.d1t1_ip6_addr_mask), data.af_ipv6): st.report_fail('ipv6_routing_int_create_fail', vars.D1T1P2) else: st.log(" IPV6 Addres Config is successful")
def test_dhcp_relay_warm_reboot(): ################################################# # # Objective - Configure DHCP relay and verify if the configuration is retained after warm reboot. # ################################################# data.platform = basic_obj.get_hwsku(vars.D2) data.constants = st.get_datastore(vars.D2, "constants", 'default') st.log("OUTPUT:{}".format(data.constants)) if not data.platform.lower( ) in data.constants['WARM_REBOOT_SUPPORTED_PLATFORMS']: st.report_fail('test_case_unsupported') st.log("Performing Config save") rb_obj.config_save(vars.D2) st.log("Performing warm Reboot") st.reboot(vars.D2, "warm") if not basic_obj.poll_for_system_status(vars.D2, 'dhcp_relay.service', 120, 1): st.report_fail("service_not_running", "dhcp-relay") if not st.poll_wait(basic_obj.verify_service_status, 60, vars.D2, "dhcp_relay"): st.log("DHCP relay service not running") st.log("Verifying DHCP Helper configuration post reboot") check_dhcp_relay_config() dhcp_relay_obj.dhcp_client_start(vars.D3, vars.D3D2P1) if ip_obj.verify_interface_ip_address(vars.D3, vars.D3D2P1, data.pool_ip_address, family="ipv4", vrfname=''): st.report_fail("IP_address_assignment_failed", vars.D3) st.log( "Successfully verified DHCP Helper configuration is retained after warm reboot" ) st.report_pass("test_case_passed")
def dut2_verify_unnumbered(type): result = True if type == 'phy': st.log('On DUT2 verify IP unnumbered for Physical interface') if not ip_obj.verify_interface_ip_address( data.dut2, data.d2_d1_ports[0], data.dut2_loopback_ip[0] + '/' + data.ip_loopback_prefix, 'ipv4', '', 'U'): result = False if type == 'vlan': st.log('On DUT2 verify IP unnumbered for vlan') if not ip_obj.verify_interface_ip_address( data.dut2, 'Vlan' + data.dut1_dut2_vlan[0], data.dut2_loopback_ip[1] + '/' + data.ip_loopback_prefix, 'ipv4', '', 'U'): result = False if type == 'pc': st.log('On DUT2 verify IP unnumbered for portchannel') if not ip_obj.verify_interface_ip_address( data.dut2, data.portchannel, data.dut2_loopback_ip[2] + '/' + data.ip_loopback_prefix, 'ipv4', '', 'U'): result = False return result
def dut_bgpv6(local_asn, remote_asn, data=[]): st.log("Creating the ipv6 routing interfaces in {}".format(vars.D1)) ipfeature.config_ip_addr_interface(data.D1, data.dut_p2_interface, data.dut_p2_ipaddr, data.dut_p2_ipaddr_subnet, family="ipv6") if not ipfeature.verify_interface_ip_address( data.D1, data.dut_p2_interface, data.dut_p2_ipaddr + '/' + str(data.dut_p2_ipaddr_subnet), family="ipv6"): st.report_fail('ip6_routing_int_create_fail', data.dut_p2_ipaddr) bgp_obj.create_bgp_router(data.D1, data.local_asn, data.router_id_1) bgp_obj.create_bgp_neighbor(dut=data.D1, local_asn=data.local_asn, neighbor_ip=data.dut_p2_ipaddr_peer, remote_asn=data.remote_asn, family="ipv6") st.log("Waiting for the ecrm_bgp_config_v6 neighbors to get Established") st.wait(10)
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_unnumvrf_donar(fixture_unnumvrf_test_donar): tc_list = [ 'FtOpSoRoIPnumvrfFun007', 'FtOpSoRoIPnumvrfFun008', 'FtOpSoRoIPnumvrfFun009' ] final_result = 0 result = True error_list = [] st.banner('FtOpSoRoIPnumvrfFun007 -- to -- FtOpSoRoIPnumvrfFun009') st.banner( 'Verify unnumbered interface for non default vrf after unbind and rebind vrf' ) tc_result = True st.log('Remove the unnumbered configuration on DUT1') loc_lib.dut1_config_unnumbered('phy', 'no') loc_lib.dut1_config_unnumbered('vlan', 'no') loc_lib.dut1_config_unnumbered('pc', 'no') st.log( 'Remove the OSPF configuration for the unnumbered interfaces on DUT1') ospf_obj.config_interface_ip_ospf_network_type(data.dut1, data.d1_d2_ports[0], 'point-to-point', data.dut1_vrf[0], 'no') ospf_obj.config_interface_ip_ospf_network_type( data.dut1, 'Vlan' + data.dut1_dut2_vlan[0], 'point-to-point', data.dut1_vrf[0], 'no') ospf_obj.config_interface_ip_ospf_network_type(data.dut1, data.portchannel, 'point-to-point', data.dut1_vrf[0], 'no') st.log('Remove the IP addresses for the unnumbered interfaces on DUT1') ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[2], data.dut1_loopback_ip[2], data.ip_loopback_prefix, "ipv4") ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[1], data.dut1_loopback_ip[1], data.ip_loopback_prefix, "ipv4") ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[0], data.dut1_loopback_ip[0], data.ip_loopback_prefix, "ipv4") st.log('Remove the VRF binding for the unnumbered interfaces on DUT1') vrf_obj.bind_vrf_interface( dut=data.dut1, vrf_name=[data.dut1_vrf[0], data.dut1_vrf[0], data.dut1_vrf[0]], intf_name=[ data.d1_d2_ports[0], 'Vlan' + data.dut1_dut2_vlan[0], data.portchannel ], config='no') st.log('Bind the back to the unnumbered interfaces on DUT1') vrf_obj.bind_vrf_interface( dut=data.dut1, vrf_name=[data.dut1_vrf[0], data.dut1_vrf[0], data.dut1_vrf[0]], intf_name=[ 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 if result is False: error = "Unbind/Rebind of unnumbered interfaces failed" tc_result = False error_list.append(error) if tc_result: st.report_tc_pass(tc_list[0], 'tc_passed') else: final_result += 1 st.report_tc_fail(tc_list[0], 'test_case_failure_message', error) st.banner( 'Verify unnumbered interface for non default vrf after adding and removing donar IP' ) tc_result = True st.log('On DUT1 configure back the ip addresses on the loopbacks') ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[1], data.dut1_loopback_ip[1], data.ip_loopback_prefix, 'ipv4') 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 add the interfaces back in the ospf network') ospf_obj.config_interface_ip_ospf_network_type( data.dut1, 'Vlan' + data.dut1_dut2_vlan[0], 'point-to-point', data.dut1_vrf[0], 'yes') 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 and verify portchannel and vlan as unnumbered interfaces' ) loc_lib.dut1_config_unnumbered('vlan', '') result = loc_lib.dut1_verify_unnumbered('vlan') if result is False: error = "Verification of unnumbered interfaces over vrf on a vlan failed after adding/removing the donar interface" tc_result = False error_list.append(error) loc_lib.dut1_config_unnumbered('pc', '') result = loc_lib.dut1_verify_unnumbered('pc') if result is False: error = "Verification of unnumbered interfaces over vrf on a portchannel failed after adding/removing the donar interface" tc_result = False error_list.append(error) if tc_result: st.report_tc_pass(tc_list[1], 'tc_passed') else: final_result += 1 st.report_tc_fail(tc_list[1], 'test_case_failure_message', error) st.banner( 'Verify unnumbered interface for non default vrf after modifying the donar IP' ) tc_result = True st.log( 'On DUT1 modify the donar interface address, add them to the ospf network and configure the physical interface as unnumbered for the new donar IP' ) ip_obj.config_ip_addr_interface(data.dut1, data.dut1_loopback[0], data.dut1_loopback_ip[3], data.ip_loopback_prefix, 'ipv4') ospf_obj.config_interface_ip_ospf_network_type(data.dut1, data.d1_d2_ports[0], 'point-to-point', data.dut1_vrf[0], 'yes') ospf_obj.config_ospf_network( data.dut1, data.dut1_loopback_ip[3] + '/' + data.ip_loopback_prefix, 0, data.dut1_vrf[0], '', 'yes') ip_obj.config_unnumbered_interface(data.dut1, family='ipv4', action='add', interface=data.d1_d2_ports[0], loop_back=data.dut1_loopback[0]) st.log('Verify OSPF is up for all interfaces') result = loc_lib.verify_ospf() if result is False: error = "OSPF neighbors are not up for all/some of the unnumbered interfaces" tc_result = False error_list.append(error) result = ip_obj.verify_interface_ip_address( data.dut1, data.d1_d2_ports[0], data.dut1_loopback_ip[3] + '/' + data.ip_loopback_prefix, 'ipv4', data.dut1_vrf[0], 'U') if result is False: error = "Verification of unnumbered interfaces over vrf on a physical interface failed after modifying the donar IP" tc_result = False error_list.append(error) st.log( 'Shutting the other ports for traffic to take new configured donar address' ) port_obj.shutdown( data.dut1, [data.d1_d2_ports[1], data.d1_d2_ports[2], data.d1_d2_ports[3]]) result = retry_api(ip_obj.verify_ip_route, data.dut2, type='O', nexthop=data.dut1_loopback_ip[3], interface=data.d2_d1_ports[0], ip_address=data.dut1_loopback_ip[3] + '/' + data.ip_loopback_prefix, family="ipv4", retry_count=7, delay=5) if result is False: error = "IP routes on non-default vrf with new IP failed" tc_result = False error_list.append(error) result = loc_lib.send_verify_traffic() if result is False: error = "Traffic over vrf on a physical interface failed after modifying the donar IP" tc_result = False error_list.append(error) if tc_result: st.report_tc_pass(tc_list[2], 'tc_passed') else: final_result += 1 st.report_tc_fail(tc_list[2], 'test_case_failure_message', error) if final_result != 0: st.report_fail('test_case_failure_message', error_list) else: st.report_pass('test_case_passed')
def test_ft_verify_static_portchannel_vlan_routing_l3_traffic(): """ Author: Venkatesh Terli <*****@*****.**> 3.1.6 Verify that LAG can forward traffic when participating in VLAN Routing. """ st.log( "verify that scenario - 3.1.6 Verify that LAG can forward traffic when participating in VLAN Routing." ) exceptions = exec_all( True, [[ ipobj.config_ip_addr_interface, vars.D1, 'Vlan{}'.format( static_data.vid), static_data.ip_addr_pc1, static_data.subnet ], [ ipobj.config_ip_addr_interface, vars.D2, 'Vlan{}'.format( static_data.vid), static_data.ip_addr_pc2, static_data.subnet ]])[1] ensure_no_exception(exceptions) exceptions = exec_all( True, [[delete_vlan_member, vars.D1, static_data.vid, vars.D1T1P1, True], [delete_vlan_member, vars.D2, static_data.vid, vars.D2T1P1, True]])[1] ensure_no_exception(exceptions) exceptions = exec_all( True, [[ ipobj.config_ip_addr_interface, vars.D1, vars.D1T1P1, static_data.ip_addr_po1, static_data.subnet ], [ ipobj.config_ip_addr_interface, vars.D2, vars.D2T1P1, static_data.ip_addr_po2, static_data.subnet ]])[1] ensure_no_exception(exceptions) static_data.tg.tg_traffic_control(action='reset', port_handle=static_data.tg_ph_1) static_data.tg.tg_traffic_control(action='reset', port_handle=static_data.tg_ph_3) stream = static_data.tg.tg_traffic_config( port_handle=static_data.tg_ph_1, mode='create', length_mode='fixed', mac_dst=static_data.dut1_rt_int_mac, mac_src='00:05:00:00:00:01', mac_src_mode='increment', mac_src_step='00:00:00:00:00:01', mac_dst_mode='fixed', ip_src_addr=static_data.ip41, ip_src_mode='increment', ip_src_count=static_data.ip_src_count, ip_src_step='0.0.0.1', mac_src_count=1000, ip_dst_addr=static_data.ip42, ip_dst_mode='fixed', pkts_per_burst=1000, l3_protocol='ipv4', transmit_mode='single_burst') static_data.streams['D1T1_SD_ip_Hash1'] = stream['stream_id'] if not ipobj.verify_interface_ip_address( vars.D1, vars.D1T1P1, "{}/8".format(static_data.ip_addr_po1), static_data.ipv4): st.report_fail('ip_routing_int_create_fail', static_data.ip_addr_po1) if not ipobj.verify_interface_ip_address( vars.D2, vars.D2T1P1, "{}/8".format(static_data.ip_addr_po2), static_data.ipv4): st.report_fail('ip_routing_int_create_fail', static_data.ip_addr_po2) exceptions = exec_all(True, [[ ipobj.create_static_route, vars.D1, static_data.ip_addr_pc2, static_data.static_ip2 ], [ ipobj.create_static_route, vars.D2, static_data.ip_addr_pc1, static_data.static_ip1 ]])[1] ensure_no_exception(exceptions) st.wait(5) if not arpobj.add_static_arp(vars.D2, static_data.ip42, static_data.remote_mac2, interface=vars.D2T1P1): st.report_fail("msg", "Failed to configure static ARP") # ping from dut to partner ipobj.ping(vars.D1, static_data.ip_addr_pc2, family='ipv4', count=3) exceptions = exec_all(True, [[intfobj.clear_interface_counters, vars.D1], [intfobj.clear_interface_counters, vars.D2]])[1] ensure_no_exception(exceptions) static_data.tg.tg_traffic_control( action='run', stream_handle=static_data.streams['D1T1_SD_ip_Hash1']) st.wait(2) static_data.tg.tg_traffic_control( action='stop', stream_handle=static_data.streams['D1T1_SD_ip_Hash1']) st.log("Verify that traffic is forwarding over portchannel members") verify_traffic_hashed_or_not( vars.D1, [vars.D1D2P1, vars.D1D2P2, vars.D1D2P3, vars.D1D2P4], 200, traffic_loss_verify=True, rx_port=vars.D1T1P1, tx_port=vars.D2T1P1, dut2=vars.D2) static_data.tg.tg_traffic_control(action='reset', port_handle=static_data.tg_ph_1) st.report_pass('portchannel_l3_vlan_routing_success', static_data.portchannel_name)