Beispiel #1
0
def lldp_snmp_pre_config():
    """
    LLDP Pre Config
    """
    global lldp_value
    global ipaddress
    global lldp_value_remote, lldp_value_gran
    global lldp_total_value
    data.ipaddress_d1 = basic_obj.get_ifconfig_inet(vars.D1, data.mgmt_int)
    data.ipaddress_d2 = basic_obj.get_ifconfig_inet(vars.D2, data.mgmt_int)
    if not data.ipaddress_d1:
        st.error(" Ip address is not a valid one or the ip is not presented on the device")
        st.report_fail("operation_failed")
    ipaddress = data.ipaddress_d1[0]
    if not intf_obj.poll_for_interfaces(vars.D1,iteration_count=60,delay=1):
        st.report_fail("interfaces_not_up_after_poll")
    if not intf_obj.poll_for_interfaces(vars.D2,iteration_count=60,delay=1):
        st.report_fail("interfaces_not_up_after_poll")
    if not lldp_obj.poll_lldp_neighbors(vars.D1, iteration_count=30, delay=1, interface=vars.D1D2P1):
        st.report_fail("lldp_neighbors_info_not_found_after_poll")
    if not lldp_obj.poll_lldp_neighbors(vars.D2, iteration_count=30, delay=1, interface=vars.D2D1P1):
        st.report_fail("lldp_neighbors_info_not_found_after_poll")
    st.log(" Getting Ip address of the Device")
    lldp_value = lldp_obj.get_lldp_neighbors(vars.D1, interface=vars.D1D2P1)
    lldp_value_remote = lldp_obj.get_lldp_neighbors(vars.D2, interface=vars.D2D1P1)
    st.log(" LLDP Neighbors value is: {} ".format(lldp_value))
    st.log(" Remote LLDP Neighbors value is: {} ".format(lldp_value_remote))
    if not lldp_value:
        st.error("No lldp entries are available")
        st.report_fail("operation_failed")
    if not lldp_value_remote:
        st.error(" No lldp entries are available in Remote")
        st.report_fail("operation_failed")
    lldp_value = lldp_value[0]
    lldp_total_value = lldp_value_remote
    lldp_value_remote = lldp_value_remote[0]
    lldp_value_gran = lldp_value['chassis_mgmt_ip']
    if not data.ipaddress_d2[0] == lldp_value_gran:
        st.error("LLDP info IP and device IP are not matching")
        st.report_fail("operation_failed")
    # TODO : Need to check the below once the infra defect SONIC-5374 is Fixed
    '''
    mac_output = basic_obj.get_platform_syseeprom(vars.D1, 'Serial Number', 'Value')
    lldp_value_mac = lldp_value['chassis_id_value']
    st.log("lldp_value_gran is :{}".format(lldp_value_gran))
    if not mac_output == lldp_value_mac:
        st.report_fail(" MAC Addresses are not matching ")
    '''
    snmp_obj.set_snmp_config(vars.D1, snmp_rocommunity=data.ro_community, snmp_location=data.location)
    if not snmp_obj.poll_for_snmp(vars.D1, 30 , 1 , ipaddress= data.ipaddress_d1[0],
                                  oid=data.oid_sysName, community_name=data.ro_community):
        st.log("Post SNMP config , snmp is not working")
        st.report_fail("operation_failed")
Beispiel #2
0
def test_ft_lldp_docker_restart():
    """
     Author : Karthikeya Kumar CH<*****@*****.**>
     Verify the LLDP functionality after docker restart.
     Reference Test Bed : D1 <--2--> D2
     """
    st.log("Checking the LLDP functionality with docker restart")
    service_name = "lldp"
    basic_obj.service_operations_by_systemctl(vars.D1, service_name, 'stop')
    basic_obj.service_operations_by_systemctl(vars.D1, service_name, 'restart')
    if not basic_obj.poll_for_system_status(vars.D1, service_name, 30, 1):
        st.report_fail("service_not_running", service_name)
    if not basic_obj.verify_service_status(vars.D1, service_name):
        st.report_fail("lldp_service_not_up")
    if not intf_obj.poll_for_interfaces(vars.D1, iteration_count=30, delay=1):
        st.report_fail("interfaces_not_up_after_poll")
    if not lldp_obj.poll_lldp_neighbors(
            vars.D1, iteration_count=30, delay=1, interface=vars.D1D2P1):
        st.report_fail("lldp_neighbors_info_not_found_after_poll")
    lldp_info = lldp_obj.get_lldp_neighbors(vars.D1, interface=vars.D1D2P1)
    if not lldp_info:
        st.error("No lldp entries are available")
        st.report_fail("operation_failed")
    lldp_value_dut1 = lldp_info[0]
    lldp_output_dut1 = lldp_value_dut1['chassis_name']
    hostname_cli_output = basic_obj.get_hostname(vars.D2)
    if lldp_output_dut1 != hostname_cli_output:
        st.report_fail("lldp_cli_not_matching")
    st.log("LLDP and CLI output values are : LLDP:{} , CLI:{} ".format(
        lldp_output_dut1, hostname_cli_output))
    st.report_pass("test_case_passed")
Beispiel #3
0
def test_ft_sys_soft_reboot_multiple_iter():
    '''
    Author : Sreenivasula Reddy <*****@*****.**>
    '''
    st.log("Performing save and soft-reboot")
    reboot_obj.config_save(vars.D1)
    st.log("Soft rebooting device for multiple iterations")
    for each_iter in range(1, data.iter_count + 1):
        st.log("Reload iteration number {}".format(each_iter))
        st.log("About to reload the switch")
        st.reboot(vars.D1, "fast")
        intf_obj.poll_for_interfaces(vars.D1, iteration_count=180, delay=1)
    st.log("After reload about to check 'show platform summary'")
    if not basic_obj.get_hwsku(vars.D1):
        st.report_fail("After_soft_reboot_DUT_access_fail", data.iter_count)
    st.log("performing clearconfig operation")
    reboot_obj.config_reload(vars.D1)
    st.report_pass('test_case_passed')
Beispiel #4
0
def test_ft_sys_hard_reboot_multiple_iter():
    """
    Author : Sreenivasula Reddy <*****@*****.**>
    """
    st.log("Hard rebooting device for multiple iterations")
    for each_iter in range(1, data.iter_count + 1):
        st.log("Hard Reboot iteration number {}".format(each_iter))
        st.log("About to power off power to switch")
        st.do_rps(vars.D1, "Off")
        st.log("About to Power ON switch")
        st.do_rps(vars.D1, "On")
        intf_obj.poll_for_interfaces(vars.D1, iteration_count=180, delay=1)
    st.log("After hard reboot about to check 'show reboot-cause' reason")
    if not reboot_obj.get_reboot_cause(vars.D1):
        st.report_fail("verify_hard_reboot_show_reboot_cause_fail", vars.D1)
    intf_obj.poll_for_interfaces(vars.D1, iteration_count=180, delay=1)
    if not log.get_logging_count(vars.D1):
        st.report_fail("logs_are_not_getting_generated_after_reboot")
    st.report_pass('test_case_passed')