def dut2_unconfig(config=''): st.log( 'On DUT2 unconfigure loopback and remove IPv4 and IPv6 addresses on it' ) ip_obj.delete_ip_interface(data.dut2_server, data.dut2_loopback[0], data.dut2_loopback_ipv6[0], data.dut2_loopback_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut2_server, data.dut2_loopback[0], data.dut2_loopback_ip[0], data.dut2_loopback_ip_subnet, 'ipv4') ip_obj.configure_loopback(data.dut2_server, config='no', loopback_name=data.dut2_loopback[0]) st.log( 'On DUT2 unconfigure portchannel and remove IPv4 and IPv6 addresses on it' ) ip_obj.delete_ip_interface(data.dut2_server, data.portchannel, data.dut2_dut1_ipv6[2], data.dut2_dut1_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut2_server, data.portchannel, data.dut2_dut1_ip[2], data.dut2_dut1_ip_subnet, 'ipv4') pc_obj.add_del_portchannel_member( data.dut2_server, data.portchannel, [data.d2_d1_ports[2], data.d2_d1_ports[3]], 'del') pc_obj.delete_portchannel(data.dut2_server, data.portchannel) st.log('On DUT2 unconfigure vlan and remove IPv4 and IPv6 addresses on it') ip_obj.delete_ip_interface(data.dut2_server, 'Vlan' + data.dut1_dut2_vlan[0], data.dut2_dut1_ipv6[1], data.dut2_dut1_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut2_server, 'Vlan' + data.dut1_dut2_vlan[0], data.dut2_dut1_ip[1], data.dut2_dut1_ip_subnet, 'ipv4') vlan_obj.delete_vlan_member(data.dut2_server, data.dut1_dut2_vlan[0], data.d2_d1_ports[1], True) vlan_obj.delete_vlan(data.dut2_server, data.dut1_dut2_vlan[0]) st.log('On DUT2 remove IPv4 and IPv6 addresses on physical interface') ip_obj.delete_ip_interface(data.dut2_server, data.d2_d1_ports[0], data.dut2_dut1_ipv6[0], data.dut2_dut1_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut2_server, data.d2_d1_ports[0], data.dut2_dut1_ip[0], data.dut2_dut1_ip_subnet, 'ipv4') st.log('On DUT2 remove IPv4 and IPv6 addresses on management interface') ip_obj.delete_ip_interface(data.dut2_server, data.mgmt_intf, data.dut2_mgmt_ipv6[0], data.dut2_mgmt_ipv6_subnet, 'ipv6') return True
def test_ft_verify_static_portchannel_del_with_member_ports(): ''' Author: Venkatesh Terli <*****@*****.**> Scenario - 3.2.1 Verify that deletion of a Static Port Channel with member ports Present is not Successful. ''' st.log( "Scenario - 3.2.1 Verify that deletion of a Static Port Channel with member ports Present is not Successful." ) portchannelobj.delete_portchannel(vars.D1, static_data.portchannel_name) st.report_pass('portchannel_with_vlan_membership_should_not_successful', static_data.portchannel_name)
def dut1_unconfig(config=''): st.banner('Unconfigure IPv4 and IPv6 addresses on the loopback interfaces') ip_obj.delete_ip_interface(data.dut1_client, data.dut1_loopback[0], data.dut1_loopback_ipv6[0], data.dut1_loopback_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut1_client, data.dut1_loopback[0], data.dut1_loopback_ip[0], data.dut1_loopback_ip_subnet, 'ipv4') ip_obj.configure_loopback(data.dut1_client, config='no', loopback_name=data.dut1_loopback[0]) st.banner('Unconfigure IPv4 and IPv6 addresses on portchannel of DUT1') ip_obj.delete_ip_interface(data.dut1_client, data.portchannel, data.dut1_dut2_ipv6[2], data.dut1_dut2_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut1_client, data.portchannel, data.dut1_dut2_ip[2], data.dut1_dut2_ip_subnet, 'ipv4') pc_obj.add_del_portchannel_member( data.dut1_client, data.portchannel, [data.d1_d2_ports[2], data.d1_d2_ports[3]], 'del') pc_obj.delete_portchannel(data.dut1_client, data.portchannel) st.log('On DUT1 unconfigure vlan and IPv4 and IPv6 addresses on it') ip_obj.delete_ip_interface(data.dut1_client, 'Vlan' + data.dut1_dut2_vlan[0], data.dut1_dut2_ipv6[1], data.dut1_dut2_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut1_client, 'Vlan' + data.dut1_dut2_vlan[0], data.dut1_dut2_ip[1], data.dut1_dut2_ip_subnet, 'ipv4') vlan_obj.delete_vlan_member(data.dut1_client, data.dut1_dut2_vlan[0], data.d1_d2_ports[1], True) vlan_obj.create_vlan(data.dut1_client, data.dut1_dut2_vlan[0]) st.banner( 'Unconfigure IPv4 and IPv6 addresses on physical interface of DUT1') ip_obj.delete_ip_interface(data.dut1_client, data.d1_d2_ports[0], data.dut1_dut2_ipv6[0], data.dut1_dut2_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut1_client, data.d1_d2_ports[0], data.dut1_dut2_ip[0], data.dut1_dut2_ip_subnet, 'ipv4') st.log('Unconfigure IPv6 address on management interface of DUT1') ip_obj.delete_ip_interface(data.dut1_client, data.mgmt_intf, data.dut1_mgmt_ipv6[0], data.dut1_mgmt_ipv6_subnet, 'ipv6') return True
def test_ft_verify_static_portchannel_del_from_ip_assigned_vlan(): ''' Author: Venkatesh Terli <*****@*****.**> Scenario - 3.2.1 Verify that deletion of a Static Port Channel which is member of vlan with an IP address is assigned on it is not Successful. ''' st.log( 'Scenario - 3.2.1 Verify that deletion of a Static Port Channel which is member of vlan with an IP address is assigned on it is not Successful' ) portchannelobj.delete_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1) ipobj.config_ip_addr_interface(vars.D1, 'Vlan{}'.format(static_data.vid), static_data.ip41, static_data.ip_mask) portchannelobj.delete_portchannel(vars.D1, static_data.portchannel_name) st.report_pass('portchannel_delete_with_ip_configured_vlan', static_data.portchannel_name, 'Vlan{}'.format(static_data.vid))
def test_ft_verify_static_portchannel_add_member_to_other_portchannel(): ''' Author: Venkatesh Terli <*****@*****.**> Scenario - 3.2.5 A member port already part of a port-channel shouldn't be allowed to add it to another port-channel. ''' st.log( "Scenario - 3.2.5 A member port already part of a port-channel shouldn't be allowed to add it to another port-channel." ) if not portchannelobj.create_portchannel( vars.D1, static_data.portchannel_name2, static=True): st.report_fail('portchannel_create_failed', static_data.portchannel_name2, vars.D1) portchannelobj.add_del_portchannel_member(vars.D1, static_data.portchannel_name2, static_data.members_dut1[0], skip_verify=False, skip_err_check=True) portchannelobj.delete_portchannel(vars.D1, static_data.portchannel_name2) st.report_pass('add_member_ports_to_other_portchannel')
def test_ft_verify_static_portchannel_is_up_with_active_members_when_no_lag_in_partner( ): ''' Author: Venkatesh Terli <*****@*****.**> Scenario - 3.1.7 Verify that the static LAG in main DUT is UP with lag configured with active members when LAG is not created at partner DUT. ''' st.log( 'Scenario - 3.1.7 Verifying that the static LAG in main DUT is UP with lag configured with active members when LAG is not created at partner DUT' ) portchannelobj.add_del_portchannel_member(vars.D2, static_data.portchannel_name, static_data.members_dut2, 'del') delete_vlan_member(vars.D2, static_data.vid, static_data.portchannel_name, tagging_mode=True) portchannelobj.delete_portchannel(vars.D2, static_data.portchannel_name) if not portchannelobj.poll_for_portchannel_status( vars.D1, static_data.portchannel_name, 'up', iteration=10): st.report_fail('portchannel_state_fail', static_data.portchannel_name, vars.D1, 'down') st.report_pass('portchannel_state_with_partner_dut', static_data.portchannel_name)
def test_ft_del_ip_assigned_portchannel(): ''' Author: Venkatesh Terli <*****@*****.**> Scenario - 3.2.2 Verify that deletion of a Static Port Channel with IP address is assigned on it is not Successful. ''' st.log( 'Scenario - 3.2.2 Verify that deletion of a Static Port Channel with IP address is assigned on it is not Successful.' ) portchannelobj.delete_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1) exceptions = exec_all(True, [ ExecAllFunc(delete_vlan_member, vars.D1, static_data.vid, static_data.portchannel_name, tagging_mode=True), ExecAllFunc(delete_vlan_member, vars.D2, static_data.vid, static_data.portchannel_name, tagging_mode=True) ])[1] ensure_no_exception(exceptions) ipobj.config_ip_addr_interface(vars.D1, static_data.portchannel_name, static_data.ip41, static_data.ip_mask) result = portchannelobj.delete_portchannel(vars.D1, static_data.portchannel_name, skip_error=True) cli_type = st.get_ui_type(vars.D1) if cli_type == 'click': if result: st.report_fail( 'msg', 'Allowed to delete PortChannel which is configured with IP address' ) else: if not result: st.report_fail( 'msg', 'Delete PortChannel which is configured with IP address is not allowed' ) st.report_pass('portchannel_delete_with_ip_configured_portchannel')
def f4(): pc_obj.add_del_portchannel_member(data.d4, data.d4_d1_pc_1, data.d4_d1_intf_1, 'del') pc_obj.add_del_portchannel_member(data.d4, data.d4_d1_pc_1, data.d4_d1_intf_2, 'del') pc_obj.delete_portchannel(data.d4, data.d4_d1_pc_1)
def portchannel_func_hooks(request): yield if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_is_up_or_not_with_one_active_member': portchannelobj.add_del_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1[1:]) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_is_up_with_active_members_when_no_lag_in_partner': portchannelobj.create_portchannel(vars.D2, static_data.portchannel_name, static=True) portchannelobj.add_del_portchannel_member(vars.D2, static_data.portchannel_name, static_data.members_dut2) add_vlan_member(vars.D2, static_data.vid, static_data.portchannel_name, tagging_mode=True) if st.get_func_name( request ) == 'test_ft_verify_fallback_is_configure_or_not_on_static_portchannel': if portchannelobj.get_portchannel(vars.D1, static_data.portchannel_name2): portchannelobj.delete_portchannel(vars.D1, static_data.portchannel_name2) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_del_from_ip_assigned_vlan': st.wait(2) ipobj.config_ip_addr_interface(vars.D1, 'Vlan{}'.format(static_data.vid), static_data.ip41, static_data.ip_mask, config='remove') portchannelobj.add_del_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1) if st.get_func_name(request) == 'test_ft_del_ip_assigned_portchannel': if not portchannelobj.get_portchannel(vars.D1, static_data.portchannel_name): portchannelobj.create_portchannel(vars.D1, static_data.portchannel_name, static=True) ipobj.delete_ip_interface(vars.D1, static_data.portchannel_name, static_data.ip41, static_data.ip_mask, skip_error=True) portchannelobj.add_del_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1) exceptions = exec_all(True, [[ add_vlan_member, vars.D1, static_data.vid, static_data.portchannel_name, True ], [ add_vlan_member, vars.D2, static_data.vid, static_data.portchannel_name, True ]])[1] ensure_no_exception(exceptions) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_l3_hash_sip_dip_l4port': arpobj.delete_static_arp(vars.D2, static_data.ip42, interface=vars.D2T1P1, mac=static_data.remote_mac2) ipobj.clear_ip_configuration([vars.D1, vars.D2], family='ipv4', thread=True) exceptions = exec_all( True, [[ add_vlan_member, vars.D1, static_data.vid, [static_data.portchannel_name, vars.D1T1P1], True ], [ add_vlan_member, vars.D2, static_data.vid, [static_data.portchannel_name, vars.D2T1P1], True ]])[1] ensure_no_exception(exceptions) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_vlan_routing_l3_traffic': arpobj.delete_static_arp(vars.D2, static_data.ip42, interface=vars.D2T1P1, mac=static_data.remote_mac2) ipobj.clear_ip_configuration([vars.D1, vars.D2], family='ipv4', thread=True) exceptions = exec_all(True, [[ add_vlan_member, vars.D1, static_data.vid, vars.D1T1P1, True ], [add_vlan_member, vars.D2, static_data.vid, vars.D2T1P1, True]])[1] ensure_no_exception(exceptions)
def f3(): pc_obj.add_del_portchannel_member(data.d3, data.d3_d2_pc_1, data.d3_d2_intf_1, 'del') pc_obj.add_del_portchannel_member(data.d3, data.d3_d2_pc_1, data.d3_d2_intf_2, 'del') pc_obj.delete_portchannel(data.d3, data.d3_d2_pc_1)
def f2(): pc_obj.add_del_portchannel_member(data.d2, data.d2_d3_pc_1, data.d2_d3_intf_1, 'del') pc_obj.add_del_portchannel_member(data.d2, data.d2_d3_pc_1, data.d2_d3_intf_2, 'del') pc_obj.delete_portchannel(data.d2, data.d2_d3_pc_1)
def f1(): pc_obj.add_del_portchannel_member(data.d1, data.d1_d4_pc_1, data.d1_d4_intf_1, 'del') pc_obj.add_del_portchannel_member(data.d1, data.d1_d4_pc_1, data.d1_d4_intf_2, 'del') pc_obj.delete_portchannel(data.d1, data.d1_d4_pc_1)
def dut2_unconfig(): result = 0 st.log('On Configure IP addresses on DUT2 - TG interfaces') result = ip_obj.delete_ip_interface(data.dut2, data.dut2_tg_ports[0], data.dut2_tg_ipv6[0], data.tg_ipv6_subnet, 'ipv6') result = ip_obj.delete_ip_interface(data.dut2, data.dut2_tg_ports[0], data.dut2_tg_ip[0], data.tg_ip_subnet, 'ipv4') result = arp_obj.config_static_ndp(data.dut2, data.tg_dut2_ipv6[0], '00:00:33:33:33:02', data.dut2_tg_ports[0], operation="del") result = arp_obj.delete_static_arp(data.dut2, data.tg_dut2_ip[0], '00:00:33:33:33:01') st.log( 'On DUT2 unconfigure OSPF router ID, ospf networks and add all the ospf interfaces' ) result = ospf_obj.config_interface_ip_ospf_network_type( data.dut2, data.d2_d1_ports[0], 'point-to-point', 'default', 'no') result = ospf_obj.config_interface_ip_ospf_network_type( data.dut2, 'Vlan' + data.dut1_dut2_vlan[0], 'point-to-point', 'default', 'no') result = ospf_obj.config_interface_ip_ospf_network_type( data.dut2, data.portchannel, 'point-to-point', 'default', 'no') result = ospf_obj.config_ospf_network( data.dut2, data.dut2_loopback_ip[0] + '/' + data.ip_loopback_prefix, 0, 'default', '', 'no') result = ospf_obj.config_ospf_router_id(data.dut2, data.dut2_ospf_router_id, 'default', '', 'no') st.log( 'On DUT2 unconfigure loopback and remove IPv4 and IPv6 addresses on it' ) result = ip_obj.delete_ip_interface(data.dut2_server, data.dut2_loopback[0], data.dut2_loopback_ipv6[0], data.dut2_loopback_ipv6_subnet, 'ipv6') result = ip_obj.delete_ip_interface(data.dut2_server, data.dut2_loopback[0], data.dut2_loopback_ip[0], data.dut2_loopback_ip_subnet, 'ipv4') result = ip_obj.configure_loopback(data.dut2_server, config='no', loopback_name=data.dut2_loopback[0]) st.log( 'On DUT2 unconfigure portchannel and remove IPv4 and IPv6 addresses on it' ) result = ip_obj.delete_ip_interface(data.dut2_server, data.portchannel, data.dut2_dut1_ipv6[2], data.dut2_dut1_ipv6_subnet, 'ipv6') result = ip_obj.delete_ip_interface(data.dut2_server, data.portchannel, data.dut2_dut1_ip[2], data.dut2_dut1_ip_subnet, 'ipv4') result = pc_obj.add_del_portchannel_member( data.dut2_server, data.portchannel, [data.d2_d1_ports[2], data.d2_d1_ports[3]], 'del') result = pc_obj.delete_portchannel(data.dut2_server, data.portchannel) st.log('On DUT2 unconfigure vlan and remove IPv4 and IPv6 addresses on it') result = ip_obj.delete_ip_interface(data.dut2, 'Vlan' + data.dut1_dut2_vlan[0], data.dut2_dut1_ipv6[1], data.dut2_dut1_ipv6_subnet, 'ipv6') result = ip_obj.delete_ip_interface(data.dut2, 'Vlan' + data.dut1_dut2_vlan[0], data.dut2_dut1_ip[1], data.dut2_dut1_ip_subnet, 'ipv4') result = vlan_obj.delete_vlan_member(data.dut2, data.dut1_dut2_vlan[0], data.d2_d1_ports[1], True) result = vlan_obj.delete_vlan(data.dut2, data.dut1_dut2_vlan[0]) st.log('On DUT2 remove IPv4 and IPv6 addresses on physical interface') result = ip_obj.delete_ip_interface(data.dut2, data.d2_d1_ports[0], data.dut2_dut1_ipv6[0], data.dut2_dut1_ipv6_subnet, 'ipv6') result = ip_obj.delete_ip_interface(data.dut2, data.d2_d1_ports[0], data.dut2_dut1_ip[0], data.dut2_dut1_ip_subnet, 'ipv4') return result
def dut1_unconfig(): result = 0 st.log('On DUT1 unconfigure IP addresses on DUT - TG interfaces') ip_obj.delete_ip_interface(data.dut1, data.dut1_tg_ports[0], data.dut1_tg_ipv6[0], data.tg_ipv6_subnet, 'ipv6') ip_obj.delete_ip_interface(data.dut1, data.dut1_tg_ports[0], data.dut1_tg_ip[0], data.tg_ip_subnet, 'ipv4') st.log( 'On DUT1 Unonfigure OSPF router ID, ospf network and add all the ospf interfaces' ) result = ospf_obj.config_interface_ip_ospf_network_type( data.dut1, data.d1_d2_ports[0], 'point-to-point', data.dut1_vrf[0], 'no') result = ospf_obj.config_interface_ip_ospf_network_type( data.dut1, 'Vlan' + data.dut1_dut2_vlan[0], 'point-to-point', data.dut1_vrf[0], 'no') result = ospf_obj.config_interface_ip_ospf_network_type( data.dut1, data.portchannel, 'point-to-point', data.dut1_vrf[0], 'no') result = ospf_obj.config_ospf_network( data.dut1, data.dut1_loopback_ip[0] + '/' + data.ip_loopback_prefix, 0, data.dut1_vrf[0], '', 'no') result = ospf_obj.config_ospf_network( data.dut1, data.dut1_loopback_ip[1] + '/' + data.ip_loopback_prefix, 0, data.dut1_vrf[0], '', 'no') result = ospf_obj.config_ospf_network( data.dut1, data.dut1_loopback_ip[2] + '/' + data.ip_loopback_prefix, 0, data.dut1_vrf[0], '', 'no') result = ospf_obj.config_ospf_router_id(data.dut1, data.dut1_ospf_router_id, data.dut1_vrf[0], '', 'no') st.banner('Unconfigure IPv4 and IPv6 addresses on the loopback interfaces') result = ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[0], data.dut1_loopback_ipv6[0], data.ipv6_loopback_prefix, 'ipv6') result = ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[0], data.dut1_loopback_ip[0], data.ip_loopback_prefix, 'ipv4') result = ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[1], data.dut1_loopback_ipv6[1], data.ipv6_loopback_prefix, 'ipv6') result = ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[1], data.dut1_loopback_ip[1], data.ip_loopback_prefix, 'ipv4') result = ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[2], data.dut1_loopback_ipv6[2], data.ipv6_loopback_prefix, 'ipv6') result = ip_obj.delete_ip_interface(data.dut1, data.dut1_loopback[2], data.dut1_loopback_ip[2], data.ip_loopback_prefix, 'ipv4') st.log( 'On DUT1 unbind all the loopbacks, physical, vlan and portchannel interfaces to the VRF' ) result = vrf_obj.bind_vrf_interface( dut=data.dut1, vrf_name=data.dut1_vrf[0], intf_name=[ data.dut1_loopback[0], data.dut1_loopback[1], data.dut1_loopback[2], data.d1_d2_ports[0], 'Vlan' + data.dut1_dut2_vlan[0], data.portchannel ], config='no') st.log('On DUT1 unconfigure vlan') result = vlan_obj.delete_vlan_member(data.dut1_client, data.dut1_dut2_vlan[0], data.d1_d2_ports[1], True) result = vlan_obj.create_vlan(data.dut1_client, data.dut1_dut2_vlan[0]) st.banner('Unconfigure portchannel on DUT1') result = pc_obj.add_del_portchannel_member( data.dut1_client, data.portchannel, [data.d1_d2_ports[2], data.d1_d2_ports[3]], 'del') result = pc_obj.delete_portchannel(data.dut1_client, data.portchannel) st.log('On DUT1 unconfigure vrfs and loopbacks') result = ip_obj.configure_loopback(data.dut1, config='no', loopback_name=[ data.dut1_loopback[0], data.dut1_loopback[1], data.dut1_loopback[2] ]) result = vrf_obj.config_vrf(dut=data.dut3_client, vrf_name=data.dut1_vrf[0], config='no') return result