def test_ft_snmp_dot1q_dot1db_mib(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify that snmpwalk on dot1q MIB object functions properly. Reference Test Bed : D1 --- Mgmt Network """ snmp_obj.poll_for_snmp_walk(vars.D1, data.wait_time, 3, ipaddress=ipaddress, oid=data.oid_dot1q_mib, community_name=data.ro_community) get_snmp_output_dot1q = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_mib, community_name=data.ro_community) if not get_snmp_output_dot1q: st.report_fail("get_snmp_output_fail") get_snmp_output_dot1db = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1db_mib, community_name=data.ro_community) if not get_snmp_output_dot1db: st.report_fail("get_snmp_output_fail") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_tp_fdb_address(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qTpFdbAddress Object functions properly. """ snmp_obj.poll_for_snmp_walk(vars.D1, data.wait_time, 1, ipaddress=ipaddress, oid=data.dot1q_Tp_Fdb_Table, community_name=data.ro_community) get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.dot1q_Tp_Fdb_Table, community_name=data.ro_community) out = snmp_obj.get_oids_from_walk_output(get_snmp_output) out = [str(x) for x in out] for x in out: get_snmp_output = snmp_obj.get_snmp_operation( ipaddress=ipaddress, oid=x, community_name=data.ro_community) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1qTpFdbAddress") get_snmp_output = snmp_obj.get_snmp_operation( ipaddress=ipaddress, oid=x, community_name=data.ro_community, get_next=True) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1qTpFdbAddress") st.report_pass("test_case_passed")
def test_ft_lldp_lldplocportid(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify the syntax check of the object lldplocportid. Reference Test Bed : D1 <---> D2 """ cli_output = '' lldp_value_remote_val = lldp_obj.get_lldp_neighbors(vars.D2, interface=vars.D2D1P1) output = lldp_value_remote_val[-1] cli_output = '"{}"'.format(output['portid_value']) snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_lldplocportid, community_name=data.ro_community, filter=data.filter) if not snmp_output: st.report_fail(" No SNMP Entries are available") st.log("lldp CLI port is : {} ".format(cli_output)) st.log("lldp SNMP output is : {} ".format(snmp_output)) if cli_output not in str(snmp_output): st.error("Port ID in CLI is not matching with Port ID in SNMP") st.report_fail("lldp_snmp_not_matching") st.log("Port ID in CLI is matching with Port ID in SNMP") st.report_pass("test_case_passed")
def test_ft_lldp_ConfigManAddrEntry(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify that the ConfigManAddrEntry MIB object functions properly. Reference Test Bed : D1 --- Mgmt Network """ #### ToDo the below steps for validation as we have a open defect for testing this TC(SONIC-5258) get_snmp_output = snmp_obj.walk_snmp_operation(ipaddress=ipaddress, oid=data.oid_locmanaddrentry, community_name=data.ro_community,filter=data.filter) st.log(" Getting LLDP port description:{} from the snmp output ".format(get_snmp_output)) st.report_pass("test_case_passed")
def test_ft_snmp_ipv6_If_Forward_default_HopLimit(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify that snmpwalk on ipv6IpForwarding and ipv6IpDefaultHopLimit MIB object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_IPV6_MIB_ipv6IpForwarding, community_name=data.ro_community) get_snmp_output_1 = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_IPV6_MIB_ipv6IpDefaultHopLimit, community_name=data.ro_community) if not get_snmp_output: st.report_fail("get_snmp_output_fail") if not get_snmp_output_1: st.report_fail("get_snmp_output_fail") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_vlan_num_deletes(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qVlanNumDeletes Object functions properly. """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Vlan_Num_Deletes, community_name=data.ro_community) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1qVlanNumDeletes") st.report_pass("test_case_passed")
def test_ft_snmp_dot1d_tp_aging_time(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1dTpAgingTime Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1d_Tp_Aging_Time, community_name=data.ro_community) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1dTpAgingTime") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_vlan_static_row_status(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qVlanStaticRowStatus Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Vlan_Static_Row_Status, community_name=data.ro_community) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1qVlanStaticRowStatus") st.report_pass("test_case_passed")
def test_ft_snmp_ipv6scope_index_table(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify that snmpwalk on ipv6ScopeZoneIndexTable MIB object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_IPV6_MIB_ipv6ScopeZoneIndexTable, community_name=data.ro_community) if not get_snmp_output: st.report_fail("get_snmp_output_fail") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_vlan_static_name(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qVlanStaticName Object functions properly. """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Vlan_Static_Name, community_name=data.ro_community, filter=data.filter) if data.vlan not in get_snmp_output[0]: st.report_fail("snmp_output_failed", "dot1qVlanStaticName") st.report_pass("test_case_passed")
def test_ft_snmp_ipv6_If_AdminStatus(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify that snmpwalk on IPV6-MIB::ipv6IfAdminStatus MIB object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_IPV6_MIB_ipv6IfAdminStatus, community_name=data.ro_community) if not get_snmp_output: st.report_fail("get_snmp_output_fail") st.report_pass("test_case_passed")
def test_ft_snmp_entity_sensor_mib(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify that snmpwalk on entity_sensor_mib MIB object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_entity_sensor_mib, community_name=data.ro_community) if not get_snmp_output: st.report_fail("get_snmp_output_fail") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_vlan_static_egress_ports(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qVlanStaticEgressPorts Object functions properly. """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Vlan_Static_Egress_Ports, community_name=data.ro_community, filter=data.filter) if len(get_snmp_output[0].split(" ")) != 2: st.report_fail("snmp_output_failed", "dot1qVlanStaticEgressPorts") st.report_pass("test_case_passed")
def test_ft_snmp_dot1d_base_port_ifindex(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1dBasePortIfIndex Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1d_Base_PortIf_Index, community_name=data.ro_community) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1dBasePortIfIndex") st.report_pass("test_case_passed")
def test_ft_snmp_dot1d_base_bridge_address(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1dBaseBridgeAddress Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1d_Base_Bridge_Address, community_name=data.ro_community) mac_address = basic_obj.get_ifconfig_ether(vars.D1, 'eth0') if not str(mac_address) in get_snmp_output[0]: st.report_fail("snmp_output_failed", "dot1dBaseBridgeAddress") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_max_vlanid(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qMaxVlanId Object functions properly. """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Max_VlanId, community_name=data.ro_community, filter=data.filter) if st.get_datastore(vars.D1, "constants", "default")['MAX_VLAN_ID'] not in get_snmp_output[0]: st.report_fail("snmp_output_failed", "dot1qMaxVlanId") st.report_pass("test_case_passed")
def test_ft_snmp_dot1d_base_num_ports(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1dBaseNumPorts Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1d_Base_Num_Ports, community_name=data.ro_community, filter=data.filter) if str(2) not in get_snmp_output: st.report_fail("snmp_output_failed", "dot1dBaseNumPorts") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_num_vlans(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qNumVlans Object functions properly. """ count = vlan_obj.get_vlan_count(vars.D1) get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Num_Vlans, community_name=data.ro_community, filter=data.filter) if str(count) not in get_snmp_output: st.report_fail("snmp_output_failed", "dot1qNumVlans") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_pvid(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qPvid Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Pvid, community_name=data.ro_community, filter=data.filter) if str(data.vlan) not in str(get_snmp_output): st.report_fail("snmp_output_failed", "dot1qPvid") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_tp_fdb_port(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qTpFdbPort Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Tp_Fdb_Port, community_name=data.ro_community) intf_name = util_obj.get_interface_number_from_name(vars.D1T1P2) if intf_name.get('number') not in get_snmp_output[0]: st.report_fail("snmp_output_failed", "dot1qTpFdbPort") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_fdb_dynamic_count(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qFdbDynamicCount Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1q_Fdb_Dynamic_Count, community_name=data.ro_community) count = mac_obj.get_mac_count(vars.D1) if str(count - 1) not in get_snmp_output[0]: st.report_fail("snmp_output_failed", "dot1qFdbDynamicCount") st.report_pass("test_case_passed")
def test_ft_lldp_rem_man_addr_table(): """ Author : Prasad Darnasi<*****@*****.**> Verify the syntax check of the object LLDPRemManAddrTable. Reference Test Bed : D1 <---> D2 """ snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_lldp_rem_man_addr_table, community_name=data.ro_community, filter=data.filter) if not snmp_output: st.report_fail(" No SNMP Entries are available") st.log(" LLDP value is passed ") st.report_pass("test_case_passed")
def test_ft_lldp_lldplocportdesc(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify the syntax check of the object lldplocsysdesc. Reference Test Bed : D1 <---> D2 """ snmp_output = snmp_obj.walk_snmp_operation(ipaddress=ipaddress, oid= data.oid_lldplocportdesc, community_name=data.ro_community,filter=data.filter) if not snmp_output: st.report_fail(" No SNMP Entries are available") st.log(" Getting LLDP port description:{} from the snmp output ".format(snmp_output)) cli_output = lldp_value['portdescr'] st.log(" lldp value port is : {} ".format(cli_output)) if not cli_output in str(snmp_output): st.report_fail("lldp_snmp_not_matching") st.log(" LLDP value is passed ") st.report_pass("test_case_passed")
def test_ft_snmp_dot1d_base_port(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1dBasePort Object functions properly. Reference Test Bed : D1 --- Mgmt Network """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_dot1d_Base_Port, community_name=data.ro_community, filter=data.filter) intf_name1 = util_obj.get_interface_number_from_name(vars.D1T1P1) intf_name2 = util_obj.get_interface_number_from_name(vars.D1T1P2) if (intf_name1.get('number') not in str(get_snmp_output)) and (intf_name2.get('number') not in str(get_snmp_output)): st.report_fail("snmp_output_failed", "dot1dBasePort") st.report_pass("test_case_passed")
def test_ft_snmp_ipcidr_route_table(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify that snmpwalk walk on ipCidrroutetable MIB functions properly Reference Test Bed : D1 --- Mgmt Network """ snmp_obj.poll_for_snmp_walk(vars.D1, data.wait_time, 3, ipaddress=ipaddress, oid=data.oid_ipcidr_route_table, community_name=data.ro_community) get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.oid_ipcidr_route_table, community_name=data.ro_community) if not get_snmp_output: st.report_fail("get_snmp_output_fail") st.report_pass("test_case_passed")
def test_ft_snmp_dot1q_fdb_table(): """ Author : Prasad Darnasi<*****@*****.**> Verify that the dot1qFdbEntry Object functions properly. """ get_snmp_output = snmp_obj.walk_snmp_operation( ipaddress=ipaddress, oid=data.dot1q_Fdb_Table, community_name=data.ro_community) out = snmp_obj.get_oids_from_walk_output(get_snmp_output) out = [str(x) for x in out] for x in out: get_snmp_output = snmp_obj.get_snmp_operation( ipaddress=ipaddress, oid=x, community_name=data.ro_community) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1qFdbTable") get_snmp_output = snmp_obj.get_snmp_operation( ipaddress=ipaddress, oid=x, community_name=data.ro_community, get_next=True) if not get_snmp_output: st.report_fail("snmp_output_failed", "dot1qFdbTable") st.report_pass("test_case_passed")
def test_ft_lldp_lldplocportid(): """ Author : Karthikeya Kumar CH<*****@*****.**> Verify the syntax check of the object lldplocportid. Reference Test Bed : D1 <---> D2 """ lldp_value_remote_val = lldp_obj.get_lldp_neighbors(vars.D2, interface=vars.D2D1P1) snmp_output = snmp_obj.walk_snmp_operation(ipaddress= ipaddress, oid= data.oid_lldplocportid, community_name= data.ro_community,filter=data.filter) if not snmp_output: st.report_fail(" No SNMP Entries are available") st.log(" Getting LLDP port description:{} from the snmp output ".format(snmp_output)) output = lldp_value_remote_val[-1] for port_id in output: if port_id == "portid_type": if output[port_id].lower() == 'local': cli_output = output['portid_value'] break cli_output = '"{}"'.format(cli_output) st.log(" lldp value port is : {} ".format(cli_output)) if not cli_output in snmp_output: st.report_fail("lldp_snmp_not_matching") st.log(" LLDP value is passed ") st.report_pass("test_case_passed")