Пример #1
0
def check_common_accuracy(attr_name,dict_nbi_notif,expected_value):
    notif_value = {}
    if dict_nbi_notif.has_key(attr_name):
        notif_value[attr_name] = dict_nbi_notif[attr_name]
        test.info("check '" + attr_name + "',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
        compare_data(notif_value, expected_value)
    else:
        test.failed("get '" + attr_name + "' from nbi notification Failed")
Пример #2
0
def check_notify_accuracy(ne_info_cfg,server_info_cfg,mapping_info_cfg):
    dict_ne_info,dict_server_info,dict_browser_chrome = data_init(ne_info_cfg,server_info_cfg)
    server_info = Properties(server_info_cfg)
    mysqlInst = PyMysql.PyMysql()
    driver = CommonStatic.login_rsnms(dict_browser_chrome,dict_server_info["host"],dict_server_info["username"],dict_server_info["password"],dict_server_info["port"],dict_server_info["url"])
    if driver:
        try:
            NeCommon.to_ne_management_page_by_url(driver,server_info)
            new_ne_info=NeCommon.check_and_add_ne(driver,dict_ne_info)
            ne_name = new_ne_info["ne_name"]
            #ne_name = 'IMSHSS-9A8ACC8039B1B283'
            quitDriver(driver)

            mappingInstance = AlarmMapping.alarmMapping(mapping_info_cfg)
            mysqlInst.newConnection(dict_server_info["host"],'root','root','xoam')
            nodeid = get_nodeid_by_nename(ne_name,mysqlInst)
            if dict_ne_info["ne_type"] == "LTEHSS" or dict_ne_info["ne_type"] == "IMSHSS":
                snmp_auth_info = []
                snmp_auth_info.append(dict_ne_info["usm_user"])
                snmp_auth_info.append(dict_ne_info["auth_password"])
                snmp_auth_info.append(dict_ne_info["priv_password"])
            else:
                snmp_auth_info = None

            alarmtypes = mappingInstance.dict_mapping_info["alarm_types"]
            alarm_type_list = []
            if type(alarmtypes) is types.StringType:
                alarm_type_list.append(alarmtypes)
            else:
                alarm_type_list = alarmtypes

            for alarm_type in alarm_type_list:
                test.info("send and get NBI notification for " + dict_ne_info["ne_type"] + ":" + alarm_type + "...")
                #alarm_raw = getNBINotification(dict_ne_info["ne_ip"], 7070, 'xoambaseserver',dict_ne_info["ne_type"],alarm_type,dict_server_info["host"],snmp_auth_info)
                alarm_raw = base_clint_for_selenium.send_trap_nbi(dict_ne_info["ne_ip"],7070,'xoambaseserver',dict_ne_info["ne_type"],alarm_type,dict_server_info["host"],auth_info=snmp_auth_info)
                error_code = int(alarm_raw["code"])
                if error_code==1:
                    alarm_trap = alarm_raw["trap"]
                    nbi_notif = alarm_raw["nbi"]
                    test.info("get TrapInfo is:" + str(alarm_trap) + " and NotifInfo is:" + str(nbi_notif))
                    test.info("start to check " + alarm_type)
                    check_notif_items = mappingInstance.get_property("notif_attr_names")
                    attr_list = []
                    if type(check_notif_items) is types.StringType:
                        attr_list.append(check_notif_items)
                    else:
                        attr_list = check_notif_items
                    check_attr_accuracy(mappingInstance,alarm_trap,nbi_notif,ne_name,nodeid,attr_list,mysqlInst)
                else:
                    test.failed(dict_ne_info["ne_type"] + ":" + alarm_type + " accuracy test failed, reason:sending alarm trap failed, the error msg is:" + alarm_raw["msg"])
            mysqlInst.closeConnection()

        except Exception as e:

            mysqlInst.closeConnection()
            test.error(e.message)
Пример #3
0
 def get_property(self,key):
     if self.dict_mapping_info.has_key(key):
         if type(self.dict_mapping_info[key]) is types.DictionaryType or type(self.dict_mapping_info[key])is types.ListType:
             return self.dict_mapping_info[key]
         elif type(self.dict_mapping_info[key]) is types.StringType:
             value = []
             value.append(self.dict_mapping_info[key])
             return value
     else:
         test.failed("key name: " + key + " can't be found in mapping.cfg")
Пример #4
0
def check_me_single_row(driver, id_table, index_row, ne_type, dict_counters,
                        rows_of_page, list_headers, me_types):
    test.info('Start to check ME row: ' + str(index_row))

    make_sure_is_correct_page(driver, index_row, rows_of_page)
    try:
        gui_index_row = rows_of_page if 0 == index_row % rows_of_page else index_row % rows_of_page
        id_tr = (By.XPATH, ".//tbody/tr[" + str(gui_index_row) + "]")
        table = find_single_widget(driver, 10, id_table)
        time.sleep(.5)
        tr = find_single_widget(table, 10, id_tr)
        gui_str_time = find_single_widget(
            tr, 10,
            (By.XPATH, ".//td[2]")).get_attribute('innerHTML').encode('utf-8')
        gui_time = datetime.strptime(gui_str_time.strip(), "%Y-%m-%d %H:%M")
        except_counter_id = str(gui_time.minute)

        # id_lic_name = (By.XPATH, ".//td[3]")
        # lic_name = find_single_widget(tr, 5, id_lic_name).get_attribute('innerHTML').encode('utf-8')

        list_row = dict_counters[except_counter_id].split(',')
        list_types = me_types['counter_types'].split(',')
        for i in range(len(list_row)):
            try:
                id_counter = (By.XPATH, ".//td[" + str(i + 3) + "]")
                gui_counter = find_single_widget(
                    tr, 5,
                    id_counter).get_attribute('innerHTML').encode('utf-8')
                # i_gui_counter = int(gui_counter) if 'int' == list_types[i].lower().strip()
                if 'int' == list_types[i].lower().strip():
                    i_gui_counter = int(gui_counter)
                    i_expected = int(list_row[i].strip())
                elif 'float' == list_types[i].lower().strip():
                    i_gui_counter = float(gui_counter)
                    i_expected = float(list_row[i].strip())
                else:
                    test.error('Unknown counter type of me counters.')
            except Exception as e:
                i_gui_counter = None
            if i_expected == i_gui_counter:
                msg = list_headers[1] + ": " + gui_str_time.strip() + ",\t" + "; " + list_headers[i + 2] + ", GUI is " \
                      + str(i_gui_counter) + ",\tExpected is " + str(list_row[i]) + "."

                test.passed(msg)
            else:
                msg = list_headers[1] + ": " + gui_str_time.strip() + ",\t" + "; " + list_headers[i + 2] + ", GUI is " \
                      + str(i_gui_counter) + ",\tExpected is " + str(list_row[i]) + "."

                test.failed(msg)
        return gui_time
    except Exception as e:
        test.error("Test failed, ERROR: " + str(e))
Пример #5
0
def make_sure_in_pm_page(driver):
    # btn id: ebBtnSearch
    id_btn_interface = (By.ID, 'ebBtnSearch')
    try:
        find_single_widget(driver, 5, id_btn_interface)
        test.error('Page redirect to the interface management page, critical error!')
    except TimeoutException:
        id_query_btn = (By.ID, "idBtn-search")
        try:
            pm_query_btn = find_single_widget(driver, 10, id_query_btn)
            if pm_query_btn:
                test.passed('Found the query button of PM Management page, check passed.')
        except TimeoutException:
            test.failed('Cannot find the query button of PM Management page.')
Пример #6
0
def wait_until_rounds_ok(driver, rows, rows_of_page, rows_each_period):
    '''
    This function will check the number of rows that we need to check the PM.
    :param driver:
    :param rows:
    :param rows_of_page:
    :param dict_additional:
    :param ne_type:
    :return: None
    '''
    id_tbdoy_trs = (
        By.XPATH,
        "//div[@class='ebTabs']/div[2]/div/div/div/div/table/tbody/tr")
    # if dict_additional.has_key('check_rows'):
    #    rows = dict_additional['check_rows']

    # if not 0 == rows % dict_additional['number_of_lic']:
    #    test.error('Number of checked rows should be integer multiples of number of LICs.')
    t_start = datetime.now()
    # Note that most of the PM need T2-T1, for Node like SBC, we may wait 5 minutes more since SBC don't need T2-T1
    # t_end = t_start + timedelta(minutes=5 * (rows // dict_additional['number_of_lic'] + 1) + 2)
    t_end = t_start + timedelta(minutes=5 * (rows // rows_each_period + 1) + 2)
    while datetime.now() < t_end:
        # click the query button
        id_query_btn = (By.ID, "idBtn-search")
        find_single_widget(driver, 10, id_query_btn).click()
        time.sleep(.1)
        try:
            i_page = rows / rows_of_page
            tgt_page_number = i_page if 0 == rows % rows_of_page else i_page + 1
            id_tgt_pager = (By.XPATH, ("//div[@class='page']/ul/li[2]/ul/li[" +
                                       str(tgt_page_number) + "]"))
            time.sleep(.1)
            tgt_pager = get_widget_ignore_refrence_error(driver, id_tgt_pager)
            if not tgt_pager.get_attribute('class').find(
                    'ebPagination-entryAnchor_current') > -1:
                tgt_pager.click()
                trs = find_all_widgets(driver, 20, id_tbdoy_trs)
                if rows % rows_of_page <= len(trs):
                    test.passed('All the data that we need are ready now.')
                    return
        except TimeoutException:
            pass
        time.sleep(.5)
    test.failed(
        'It seems that the the data we need has not been collected as expectes, case may fail later steps.'
    )
Пример #7
0
def check_pm_by_row(driver, id_table, index_row, ne_type, dict_counters,
                    rows_of_page, list_headers, is_m_lics):
    test.info('Start to check row: ' + str(index_row))

    make_sure_is_correct_page(driver, index_row, rows_of_page)
    try:
        gui_index_row = rows_of_page if 0 == index_row % rows_of_page else index_row % rows_of_page
        id_tr = (By.XPATH, ".//tbody/tr[" + str(gui_index_row) + "]")
        table = find_single_widget(driver, 10, id_table)
        time.sleep(.5)
        tr = find_single_widget(table, 10, id_tr)
        gui_str_time = find_single_widget(
            tr, 10,
            (By.XPATH, ".//td[2]")).get_attribute('innerHTML').encode('utf-8')
        gui_time = datetime.strptime(gui_str_time.strip(), "%Y-%m-%d %H:%M")
        except_counter_id = str(gui_time.minute)

        id_lic_name = (By.XPATH, ".//td[3]")
        lic_name = find_single_widget(
            tr, 5, id_lic_name).get_attribute('innerHTML').encode('utf-8')
        if is_m_lics:
            except_counter_id = str(gui_time.minute) + '-' + lic_name
        list_row = dict_counters[except_counter_id].split(',')
        for i in range(len(list_row)):
            try:
                id_counter = (By.XPATH, ".//td[" + str(i + 4) + "]")
                gui_counter = find_single_widget(
                    tr, 5,
                    id_counter).get_attribute('innerHTML').encode('utf-8')
                i_gui_counter = int(gui_counter)
            except Exception as e:
                i_gui_counter = None
            if int(list_row[i].strip()) == i_gui_counter:
                msg = list_headers[1] + ": " + gui_str_time.strip() + ",\t" + list_headers[2] + ": " + lic_name + "; " \
                      + list_headers[i + 3] + ", GUI is " + str(i_gui_counter) + ",\tExpected is " + str(list_row[i]) \
                      + "."

                test.passed(msg)
            else:
                msg = list_headers[1] + ": " + gui_str_time.strip() + ",\t" + list_headers[2] + ": " + lic_name + "; " \
                      + list_headers[i + 3] + ", GUI is " + str(i_gui_counter) + ",\tExpected is " + str(list_row[i]) \
                      + "."

                test.failed(msg)
        return [gui_time, lic_name]
    except Exception as e:
        test.error("Test failed, ERROR: " + str(e))
Пример #8
0
def make_sure_in_pm_page(driver):
    # btn id: ebBtnSearch
    id_btn_interface = (By.ID, 'ebBtnSearch')
    try:
        find_single_widget(driver, 5, id_btn_interface)
        test.error(
            'Page redirect to the interface management page, critical error!')
    except TimeoutException:
        id_query_btn = (By.ID, "idBtn-search")
        try:
            pm_query_btn = find_single_widget(driver, 10, id_query_btn)
            if pm_query_btn:
                test.passed(
                    'Found the query button of PM Management page, check passed.'
                )
        except TimeoutException:
            test.failed('Cannot find the query button of PM Management page.')
Пример #9
0
def check_pm_by_row(driver, id_table, index_row, ne_type, dict_counters, rows_of_page, list_headers, is_m_lics):
    test.info('Start to check row: ' + str(index_row))

    make_sure_is_correct_page(driver, index_row, rows_of_page)
    try:
        gui_index_row = rows_of_page if 0 == index_row % rows_of_page else index_row % rows_of_page
        id_tr = (By.XPATH, ".//tbody/tr[" + str(gui_index_row) + "]")
        table = find_single_widget(driver, 10, id_table)
        time.sleep(.5)
        tr = find_single_widget(table, 10, id_tr)
        gui_str_time = find_single_widget(tr, 10, (By.XPATH, ".//td[2]")).get_attribute('innerHTML').encode('utf-8')
        gui_time = datetime.strptime(gui_str_time.strip(), "%Y-%m-%d %H:%M")
        except_counter_id = str(gui_time.minute)

        id_lic_name = (By.XPATH, ".//td[3]")
        lic_name = find_single_widget(tr, 5, id_lic_name).get_attribute('innerHTML').encode('utf-8')
        if is_m_lics:
            except_counter_id = str(gui_time.minute) + '-' + lic_name
        list_row = dict_counters[except_counter_id].split(',')
        for i in range(len(list_row)):
            try:
                id_counter = (By.XPATH, ".//td[" + str(i + 4) + "]")
                gui_counter = find_single_widget(tr, 5, id_counter).get_attribute('innerHTML').encode('utf-8')
                i_gui_counter = int(gui_counter)
            except Exception as e:
                i_gui_counter = None
            if int(list_row[i].strip()) == i_gui_counter:
                msg = list_headers[1] + ": " + gui_str_time.strip() + ",\t" + list_headers[2] + ": " + lic_name + "; " \
                      + list_headers[i + 3] + ", GUI is " + str(i_gui_counter) + ",\tExpected is " + str(list_row[i]) \
                      + "."

                test.passed(msg)
            else:
                msg = list_headers[1] + ": " + gui_str_time.strip() + ",\t" + list_headers[2] + ": " + lic_name + "; " \
                      + list_headers[i + 3] + ", GUI is " + str(i_gui_counter) + ",\tExpected is " + str(list_row[i]) \
                      + "."

                test.failed(msg)
        return [gui_time, lic_name]
    except Exception as e:
        test.error("Test failed, ERROR: " + str(e))
Пример #10
0
def wait_until_rounds_ok(driver, rows, rows_of_page, dict_additional):
    '''
    This function will check the number of rows that we need to check the PM.
    :param driver:
    :param rows:
    :param rows_of_page:
    :param dict_additional:
    :param ne_type:
    :return: None
    '''
    id_tbdoy_trs = (By.XPATH, "//div[@class='ebTabs']/div[2]/div/div/div/div/table/tbody/tr")
    if dict_additional.has_key('check_rows'):
        rows = dict_additional['check_rows']

    if not 0 == rows % dict_additional['number_of_lic']:
        test.error('Number of checked rows should be integer multiples of number of LICs.')
    t_start = datetime.now()
    # Note that most of the PM need T2-T1, for Node like SBC, we may wait 5 minutes more since SBC don't need T2-T1
    t_end = t_start + timedelta(minutes=5 * (rows // dict_additional['number_of_lic'] + 1) + 2)
    while datetime.now() < t_end:
        # click the query button
        id_query_btn = (By.ID, "idBtn-search")
        find_single_widget(driver, 10, id_query_btn).click()
        time.sleep(.2)
        try:
            i_page = rows / rows_of_page
            tgt_page_number = i_page if 0 == rows % rows_of_page else i_page + 1
            id_tgt_pager = (By.XPATH, ("//div[@class='page']/ul/li[2]/ul/li[" + str(tgt_page_number) + "]"))
            tgt_pager = find_single_widget(driver, 10, id_tgt_pager)
            if not tgt_pager.get_attribute('class').find('ebPagination-entryAnchor_current') > -1:
                tgt_pager.click()
                trs = find_all_widgets(driver, 20, id_tbdoy_trs)
                if rows % rows_of_page <= len(trs):
                    test.passed('All the data that we need are ready now.')
                    return
        except TimeoutException:
            pass
        time.sleep(.5)
    test.failed('It seems that the the data we need has not been collected as expectes, case may fail later steps.')
Пример #11
0
def check_me_counters(driver, ne_type, counters_expected, rows_of_page,
                      dict_me_add, me_types):
    '''
    This function will check the ME counters, the first edition suspect that only one record each 5 minutes.
    :param ne_type the type of the node
    :param counters_expected: node ME counters that will check with the counters on GUI
    :param dict_me_add: additional information, (check_rounds: how many rounds that will be checked), (
    rows_each_period: how many rows each period, default is 1, this parameter is for extending later.)
    :return: None: the function is for automation testing, critical errors will case program to exit immediately
    '''
    checked_rounds = dict_me_add['check_rounds']
    number_of_rows_be_checked = checked_rounds * dict_me_add['rows_each_period']
    wait_until_rounds_ok(driver, number_of_rows_be_checked, 10,
                         dict_me_add['rows_each_period'])
    list_returns = []
    id_table = (By.XPATH,
                "//div[@class='ebTabs']/div[2]/div/div/div/div/table")

    id_header_trs = (
        By.XPATH,
        "//div[@class='ebTabs']/div[2]/div/div/div/div/table/thead/tr/th")
    ths = find_all_widgets(driver, 20, id_header_trs)
    list_headers = []
    for th in ths:
        list_headers.append(
            th.get_attribute('innerHTML').encode('utf-8').strip())
    # number_of_rows_be_checked = len(counters_expected)
    # if dict_me_add.has_key('check_rounds'):
    # if not 0 == number_of_rows_be_checked % dict_me_add['number_of_lic']:
    #    test.error('Number of checked rows should be integer multiples of number of LICs.')
    for row_index in range(1, number_of_rows_be_checked + 1):
        # check_pm_by_row returns [gui_datettime, lic_name] in List
        time_of_gui = check_me_single_row(driver, id_table, row_index, ne_type,
                                          counters_expected, rows_of_page,
                                          list_headers, me_types)
        list_returns.append(time_of_gui)

    if number_of_rows_be_checked != len(list_returns):
        test.failed(
            'Number of rows have been checked mis-match with the number we expected.'
        )
    else:
        for i in range(len(list_returns)):
            if list_returns[i] is not None and 0 == list_returns[i].minute % 5:
                test.passed('Row ' + str(i) + ' GUI time is correct, is: ' +
                            list_returns[i].strftime('%Y-%m-%d %H:%M'))
            else:
                test.failed('Row ' + str(i) + ' GUI time is correct, is: ' +
                            list_returns[i].strftime('%Y-%m-%d %H:%M'))
            if i + 1 < len(list_returns):
                if 300 == (list_returns[i] - list_returns[i + 1]).seconds:
                    test.passed('Report delta time is 5 minutes.')
                else:
                    test.failed('Report delta time is not 5 minutes.')
Пример #12
0
def alarm_compare(alarm_expected,alarm_on_gui):
    for name,value in alarm_expected.items():
        if alarm_on_gui.has_key(name):
            if (alarm_on_gui[name] == value):
                test_logger.passed("alarm counter " + name + " accuracy test passed. GUI value is " + str(alarm_on_gui[name]) + ", and the expected value is " + str(value))
            else:
                test_logger.failed("alarm counter " + name + " accuracy test failed. GUI value is " + alarm_on_gui[name] + " ,and the expected value is " + str(value))
        else:
            test_logger.failed("alarm counter " + name + " missing on GUI")

    for name,value in alarm_on_gui.items():
        if not alarm_expected.has_key(name):
            test_logger.failed("extra alarm counter " + name + " on GUI")
Пример #13
0
def compare_data(notif_ne,expected_result):
    for key,value in expected_result.items():
        if notif_ne.has_key(key):
            if type(value) is not types.DictType:
                if notif_ne[key] ==  value:
                    test.passed(key + " accuracy test Passed. The NBI notification value is " + notif_ne[key] + ", and the expected result is " + str(value))
                else:
                    test.failed(key + " accuracy test Failed. The NBI notification value is " + notif_ne[key] + ", and the expected result is " + str(value))
            else:
                expected_result = value
                notif_ne = notif_ne[key]
                compare_data(notif_ne,expected_result)
        else:
            test.failed(key + " accuracy test Failed for " + key + " missing in NBI notification")

    for key_n,value_n in notif_ne.items():
        if expected_result.has_key(key_n) == None:
            test.failed("NBI notification attribute " + key + " accuracy test Failed for extra attribute " + key)
Пример #14
0
def check_alarm_data_accuracy(ne_info_cfg,server_info_cfg,alarm_mapping_cfg):
    
    server_info = Properties(server_info_cfg)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }
    
    ne_info = Properties(ne_info_cfg)
    dict_ne_info  = {
        "ne_name": ne_info.getProperty("ne_name"),
        "ne_user": ne_info.getProperty("ne_user"),
        "ne_type": ne_info.getProperty("ne_type"),
        "ne_ip" : ne_info.getProperty("ne_ip"),
        "ne_password" : ne_info.getProperty("ne_password"),
        "pm_path": ne_info.getProperty("pm_path"),
        "log_path": ne_info.getProperty("log_path"),
        "alarm_path": ne_info.getProperty("alarm_path"),
        "ne_port": ne_info.getProperty("ne_port"),
        "sftp_port": ne_info.getProperty("sftp_port"),
        "snmp_port": ne_info.getProperty("snmp_port"),
        "usm_user": ne_info.getProperty("usm_user"),
        "auth_password": ne_info.getProperty("auth_password"),
        "priv_password": ne_info.getProperty("priv_password"),
        "app_user": ne_info.getProperty("app_user"),
        "app_password": ne_info.getProperty("app_password"),
        "li_pwd": ne_info.getProperty("li_pwd"),
        "fro_id": ne_info.getProperty("fro_id")
    }

    mappingInstance = AlarmMapping.alarmMapping(alarm_mapping_cfg)

    host = server_info.getProperty("host")
    username = server_info.getProperty("username")
    password = server_info.getProperty("password")
    port = server_info.getProperty("port")
    url = server_info.getProperty("url")
    
    driver = CommonStatic.login_rsnms(dict_browser_chrome,host,username,password,port,url)
    if driver:
        try:
            NeCommon.to_ne_management_page_by_url(driver,server_info)
            new_ne_info=NeCommon.check_and_add_ne(driver, dict_ne_info)
            ne_name = new_ne_info["ne_name"]
            FmCommon.toAlarmManagement_by_url(driver,server_info)
            time.sleep(10)
            FmCommon.init_and_search(driver,ne_name)

            alarmtypes = mappingInstance.dict_mapping_info["alarm_types"]
            alarm_type_list = []
            if type(alarmtypes) is types.StringType:
                alarm_type_list.append(alarmtypes)
            else:
                alarm_type_list = alarmtypes
            if dict_ne_info["ne_type"] == "LTEHSS" or dict_ne_info["ne_type"] == "IMSHSS":
                snmp_auth_info = []
                snmp_auth_info.append(dict_ne_info["usm_user"])
                snmp_auth_info.append(dict_ne_info["auth_password"])
                snmp_auth_info.append(dict_ne_info["priv_password"])
            else:
                snmp_auth_info = None

            for alarm_type in alarm_type_list:
                test_logger.info("send alarm trap: " + dict_ne_info["ne_type"] + ":" + alarm_type + "...")
                alarm_from_ne = base_clint_for_selenium.send_trap(dict_ne_info["ne_ip"], 7070, 'xoambaseserver',dict_ne_info["ne_type"],alarm_type,host,snmp_auth_info)
                error_code = int(alarm_from_ne["code"])
                if error_code==1:
                    alarm_trap=alarm_from_ne["trap"]
                    test_logger.info("alarm sent successfully" + str(alarm_trap))
                    alarm_expected=alarm_converter(dict_ne_info["ne_type"],ne_name,alarm_type,alarm_trap,mappingInstance)
                    alarm_on_gui=FmCommon.fetch_alarm_on_gui(driver,dict_ne_info["ne_type"],alarm_trap,mappingInstance,alarm_type)
                    if alarm_on_gui != None:
                        test_logger.info("start to check alarm type: " + dict_ne_info["ne_type"] + ":" + alarm_type)
                        alarm_compare(alarm_expected,alarm_on_gui)
                    else:
                        test_logger.failed(dict_ne_info["ne_type"] + ":" + alarm_type + " accuracy test failed," + "reason:alarm not received on GUI")
                elif error_code < 0:
                    test_logger.failed(dict_ne_info["ne_type"] + ":" + alarm_type + " accuracy test failed, reason:sending alarm trap failed, the error msg is:" + alarm_from_ne["msg"])

            FmCommon.quitDriver(driver)
        except Exception as e:
            FmCommon.quitDriver(driver)
            test_logger.error(str(e))
Пример #15
0
 def convert_event_type(self,key):
     if self.dict_mapping_info["event_type"].has_key(str(key)):
         return self.dict_mapping_info["event_type"][str(key)]
     else:
         test.failed("event_type convert failed for alarm_category:" + str(key))
         return None
Пример #16
0
 def convert_alarmtype_cn(self,key):
     if self.dict_mapping_info["alarmtype_cn"].has_key(key):
         return self.dict_mapping_info["alarmtype_cn"][key]
     else:
         test.failed("alarmtype_cn convert failed for " + key)
Пример #17
0
def check_pm_rows_updated(driver, ne_type, dict_counters, rows_of_page, dict_additional):
    '''
    The main function that check the PM Data accurate, it will first check the data of each row,
    then check the GUI time's minutes is multiple of 5,
    then check the Lics if the node has many LICs.
    :param ne_type: the ne's type
    :param dict_counters: the base counter values in dictionary
    :param rows_of_page: how many rows each page has on the GUI, default is 10
    :param dict_additional: additional information that used for special nodes, (number_of_lic: how many lics of a no
    de), (check_rows: how many rows that will be checked, if this value exist, will only check this number of rows,
    otherwise the number of rows will checked is equal the size of dict_counters)
    :return: None
    '''
    is_m_lics = True if dict_additional['number_of_lic'] > 1 else False
    list_returns = []
    id_table = (By.XPATH, "//div[@class='ebTabs']/div[2]/div/div/div/div/table")

    id_header_trs = (By.XPATH, "//div[@class='ebTabs']/div[2]/div/div/div/div/table/thead/tr/th")
    ths = find_all_widgets(driver, 20, id_header_trs)
    list_headers = []
    for th in ths:
        list_headers.append(th.get_attribute('innerHTML').encode('utf-8').strip())
    number_of_rows_be_checked = len(dict_counters)
    if dict_additional.has_key('check_rounds'):
        number_of_rows_be_checked = dict_additional['check_rounds']
    if not 0 == number_of_rows_be_checked % dict_additional['number_of_lic']:
        test.error('Number of checked rows should be integer multiples of number of LICs.')
    for row_index in range(1, number_of_rows_be_checked + 1):
        # check_pm_by_row returns [gui_datettime, lic_name] in List
        list_returns.append(check_pm_by_row(driver, id_table, row_index, ne_type, dict_counters, rows_of_page,
                                            list_headers, is_m_lics))
    # check GUI time and lic_name
    lic_from_gui = []
    if number_of_rows_be_checked != len(list_returns):
        test.failed('Number of rows need to be checked mis-match with the number we expected.')
    else:
        number_of_lic = dict_additional['number_of_lic']
        for i in range(0, len(list_returns), number_of_lic):
            for j in range(number_of_lic):
                lic_from_gui.append(list_returns[i + j][1])
                gui_time_and_lic_name = list_returns[i + j]
                if gui_time_and_lic_name[0] is not None and 0 == gui_time_and_lic_name[0].minute % 5:
                    test.passed('Row ' + str(i + j) + ' GUI time is correct, is: ' +
                                gui_time_and_lic_name[0].strftime('%Y-%m-%d %H:%M'))
                else:
                    test.failed('Row ' + str(i + j) + ' GUI time is not multiple of 5, is: ' +
                                gui_time_and_lic_name[0].strftime('%Y-%m-%d %H:%M'))
                if is_m_lics:
                    msg = 'Node has more than one LIC, '
                    if list_returns[i][0] == list_returns[i + j][0]:
                        msg += ' different LICs have the same report time.'
                        test.passed(msg)
                    else:
                        msg += ' different LICs don\'t have the same report time.'
                        test.failed(msg)
            if i + number_of_lic < len(list_returns):
                # the pre-condition of this check point is: GUI list data decent by datetime
                if 300 == (list_returns[i][0] - list_returns[i + number_of_lic][0]).seconds:
                    test.passed('Report delta time is 5 minutes.')
                else:
                    test.failed('Report delta time is not 5 minutes.')
    # if checked 1 hour PM and node has many LICs, will check the LIC
    if 12 == int(number_of_rows_be_checked / dict_additional['number_of_lic']):
        if is_m_lics:
            expected_lic = [t.split('-', 1)[1].strip() for t in sorted(dict_counters)]
            if compare_lists(expected_lic, lic_from_gui):
                test.passed('Lic check passed.')
            else:
                test.failed('Lic check failed, E: ' + str(expected_lic) + ', G: ' + str(lic_from_gui))
Пример #18
0
def check_pm_rows_updated(driver, ne_type, dict_counters, rows_of_page,
                          dict_additional):
    '''
    The main function that check the PM Data accurate, it will first check the data of each row,
    then check the GUI time's minutes is multiple of 5,
    then check the Lics if the node has many LICs.
    :param ne_type: the ne's type
    :param dict_counters: the base counter values in dictionary
    :param rows_of_page: how many rows each page has on the GUI, default is 10
    :param dict_additional: additional information that used for special nodes, (number_of_lic: how many lics of a no
    de), (check_rows: how many rows that will be checked, if this value exist, will only check this number of rows,
    otherwise the number of rows will checked is equal the size of dict_counters)
    :return: None
    '''
    check_rounds = dict_additional['check_rounds']
    number_of_rows_be_checked = check_rounds * dict_additional['number_of_lic']
    wait_until_rounds_ok(driver, number_of_rows_be_checked, 10,
                         dict_additional['number_of_lic'])
    is_m_lics = True if dict_additional['number_of_lic'] > 1 else False
    list_returns = []
    id_table = (By.XPATH,
                "//div[@class='ebTabs']/div[2]/div/div/div/div/table")

    id_header_trs = (
        By.XPATH,
        "//div[@class='ebTabs']/div[2]/div/div/div/div/table/thead/tr/th")
    ths = find_all_widgets(driver, 20, id_header_trs)
    list_headers = []
    for th in ths:
        list_headers.append(
            th.get_attribute('innerHTML').encode('utf-8').strip())
    # if not 0 == number_of_rows_be_checked % dict_additional['number_of_lic']:
    #    test.error('Number of checked rows should be integer multiples of number of LICs.')
    for row_index in range(1, number_of_rows_be_checked + 1):
        # check_pm_by_row returns [gui_datettime, lic_name] in List
        list_returns.append(
            check_pm_by_row(driver, id_table, row_index, ne_type,
                            dict_counters, rows_of_page, list_headers,
                            is_m_lics))
    # check GUI time and lic_name
    lic_from_gui = []
    if number_of_rows_be_checked != len(list_returns):
        test.failed(
            'Number of rows need to be checked mis-match with the number we expected.'
        )
    else:
        number_of_lic = dict_additional['number_of_lic']
        for i in range(0, len(list_returns), number_of_lic):
            for j in range(number_of_lic):
                lic_from_gui.append(list_returns[i + j][1])
                gui_time_and_lic_name = list_returns[i + j]
                if gui_time_and_lic_name[
                        0] is not None and 0 == gui_time_and_lic_name[
                            0].minute % 5:
                    test.passed(
                        'Row ' + str(i + j) + ' GUI time is correct, is: ' +
                        gui_time_and_lic_name[0].strftime('%Y-%m-%d %H:%M'))
                else:
                    test.failed(
                        'Row ' + str(i + j) +
                        ' GUI time is not multiple of 5, is: ' +
                        gui_time_and_lic_name[0].strftime('%Y-%m-%d %H:%M'))
                if is_m_lics:
                    msg = 'Node has more than one LIC, '
                    if list_returns[i][0] == list_returns[i + j][0]:
                        msg += ' different LICs have the same report time.'
                        test.passed(msg)
                    else:
                        msg += ' different LICs don\'t have the same report time.'
                        test.failed(msg)
            if i + number_of_lic < len(list_returns):
                # the pre-condition of this check point is: GUI list data decent by datetime
                if 300 == (list_returns[i][0] -
                           list_returns[i + number_of_lic][0]).seconds:
                    test.passed('Report delta time is 5 minutes.')
                else:
                    test.failed('Report delta time is not 5 minutes.')
    # if checked 1 hour PM and node has many LICs, will check the LIC
    if 12 == int(number_of_rows_be_checked / dict_additional['number_of_lic']):
        if is_m_lics:
            expected_lic = [
                t.split('-', 1)[1].strip() for t in sorted(dict_counters)
            ]
            if compare_lists(expected_lic, lic_from_gui):
                test.passed('Lic check passed.')
            else:
                test.failed('Lic check failed, E: ' + str(expected_lic) +
                            ', G: ' + str(lic_from_gui))
Пример #19
0
 def convert_specific_problem(self,key):
     if self.dict_mapping_info["specific_problem"].has_key(key):
         return self.dict_mapping_info["specific_problem"][key]
     else:
         test.failed("specific_problem convert failed for " + key)
Пример #20
0
def check_attr_accuracy(mappingInstance,alarm_trap,dict_nbi_notif,nename,nodeid,attrs,mysqlInst):
    for a in attrs:
        expected_value = {}
        notif_value = {}
        if 'event_name' == a:
            if dict_nbi_notif.has_key('event_name'):
                notif_value['event_name'] = dict_nbi_notif['event_name']
                mapped_event_name = mappingInstance.convert_event_type(alarm_trap['alarmCategory'])
                if mapped_event_name != None:
                    expected_value['event_name'] = '"' + mapped_event_name + '"'
                    test.info("check 'event_name',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value,expected_value)
            else:
                test.failed("get 'event_name' from nbi notification Failed")

        elif "event_type" == a:
            if dict_nbi_notif.has_key("event_type"):
                notif_value['event_type'] = dict_nbi_notif["event_type"]
                type_name = '"' + mappingInstance.dict_mapping_info["type_name"] + '"'
                expected_value = {'event_type':{'none':{'domain_name':'"Alarm IRP V3.0.0"','type_name':type_name}}}
                test.info("check 'event_type',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                compare_data(notif_value, expected_value)
            else:
                test.failed("get 'event_type' from nbi notification Failed")

        elif 'd'  == a:
            if dict_nbi_notif.has_key("d"):
                notif_value['d'] = dict_nbi_notif["d"]
                object_class = '"' + mappingInstance.dict_mapping_info['object_class'] + '"'
                expected_value = {'d':{'value':{'CORBA::String':object_class}}}
                test.info("check 'objectClass',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                compare_data(notif_value, expected_value)
            else:
                test.failed("get 'd' from nbi notification Failed")

        elif "e" == a:
            if dict_nbi_notif.has_key("e"):
                notif_value['e'] = dict_nbi_notif["e"]
                dn = mappingInstance.convert_object_instance(nodeid,nename)
                if dn != None:
                    expected_value = {'e':{'value':{'CORBA::String':'"' + dn + '"'}}}
                    test.info("check 'objectInstance',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value,expected_value)
            else:
                test.failed("get 'e' from nbi notification Failed")
            
        elif "b" == a:
            if dict_nbi_notif.has_key("b"):
                notif_value["b"] = dict_nbi_notif["b"]
                mapped_event_time = mappingInstance.convert_event_time(alarm_trap["timeStamp"])
                if mapped_event_time!= None:
                    expected_value = {'b':{'value':{'TimeBase::UtcT':{'none':{'time':mapped_event_time,'inacclo':'0','inacchi':'0','tdf':'480'}}}}}
                    test.info("check 'eventTime',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value, expected_value)
            else:
                test.failed("get 'b' from nbi notification Failed")
           
        elif "c" == a:
            expected_value = {'c':{'value':{'CORBA::String':'"DC=Ericsson,SubNetwork=1,ManagementNode=1,IRPAgent=1"'}}}
            check_common_accuracy('c', dict_nbi_notif, expected_value)
        
        elif "jj" == a:
            if dict_nbi_notif.has_key("jj"):
                notif_value["jj"] = dict_nbi_notif["jj"]
                specific_problem = alarm_trap["specificProblem"]
                alarmtypeid = mappingInstance.convert_alarmtype_id(specific_problem)
                if alarmtypeid != None:
                    mapped_vender_specificAlarmType = '"' + alarmtypeid + "||" + specific_problem + '"'
                    expected_value = {'jj':{'value':{'CORBA::String':mapped_vender_specificAlarmType}}}
                    test.info("check 'vendorSpecificAlarmType',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value,expected_value)
            else:
                test.failed("get 'jj' from nbi notification Failed")
                
        elif "g" == a:
            if dict_nbi_notif.has_key("g"):
                notif_value["g"] = dict_nbi_notif["g"]
                mapped_probable_cause = mappingInstance.convert_probable_cause(alarm_trap["probableCause"])
                if mapped_probable_cause != None:
                    expected_value = {'g':{'value':{'CORBA::Short':mapped_probable_cause}}}
                    test.info("check 'probableCause',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value, expected_value)
            else:
                test.failed("get 'g' from nbi notification Failed")
        
        elif "h" == a:
            if dict_nbi_notif.has_key("h"):
                notif_value['h'] = dict_nbi_notif['h']
                mapped_alarm_severity = mappingInstance.convert_alarm_severity(alarm_trap["alarmLevel"])
                if mapped_alarm_severity != None:
                    expected_value = {'h':{'value':{'CORBA::Short':mapped_alarm_severity}}}
                    test.info("check 'perceivedSeverity',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value, expected_value)
            else:
                test.failed("get 'h' from nbi notification Failed")
                
        elif "a" == a:
            if dict_nbi_notif.has_key("a"):
                notif_value["a"] = dict_nbi_notif["a"]
                '''X use CORBA:LongLong although CORBA::Long is required in spec'''
                notif_id = dict_nbi_notif["a"]["value"]["CORBA::LongLong"]
                test.info("check 'notificationId',the nbi notification result is " + str(notif_value) )
                sqltext = ('SELECT notificationId from alarms where notificationId = "%s"'%notif_id)
                is_unique=check_unique_id(sqltext,mysqlInst)
                if is_unique == 0:
                    test.failed("the notificationId of " + notif_id + " not existed in database")
                elif is_unique == 1:
                    test.passed("the notificationId of " + notif_id + " is unique in database")
                elif is_unique > 1:
                    test.failed("more than one notificationId of " + notif_id + "found in database")
            else:
                test.failed("get 'a' from nbi notification Failed")
        
        elif "w" == a:
            if dict_nbi_notif.has_key("w"):
                notif_value["w"] = dict_nbi_notif["w"]
                dn = '"' + mappingInstance.convert_object_instance(nodeid,nename) + '"'
                if dn != None:
                    notification_id = dict_nbi_notif["a"]["value"]["CORBA::LongLong"]
                    expected_value = {'w':{'value':{'AlarmIRPConstDefs::CorrelatedNotification':{'none':{'source':dn,'notif_id_set':{'none':notification_id}}}}}}
                    test.info("check 'correlatedNotifications',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value, expected_value)
            else:
                test.failed("get 'w' from nbi notification Failed")
                
        elif "p" == a:
            expected_value = {'p':{'value':{'CORBA::Boolean':'FALSE'}}}
            check_common_accuracy('p',dict_nbi_notif,expected_value)
            
        elif "q"  == a:
            expected_value = {'q':{'value':{'CORBA::String':'"NULL"'}}}
            check_common_accuracy('q', dict_nbi_notif, expected_value)
            
        elif "s" == a:
            expected_value = {'s':{'value':{'AlarmIRPConstDefs::TrendIndication':'NO_CHANGE'}}}
            check_common_accuracy('s', dict_nbi_notif, expected_value)
            
        elif "v" == a:
            expected_value = {'v':{'value':{'CORBA::String':'""'}}}
            check_common_accuracy('v', dict_nbi_notif, expected_value)
            
        elif "j" == a:
            if dict_nbi_notif.has_key("j"):
                notif_value ["j"] = dict_nbi_notif["j"]
                additionaltext = '"' + alarm_trap["alarmDescription"] + '"'
                expected_value = {'j':{'value':{'CORBA::String':additionaltext}}}
                test.info("check 'additionalText',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                compare_data(notif_value, expected_value)
            else:
                test.failed("get 'j' from nbi notification Failed")
        
        elif "ai_vs_threshold" == a:
            expected_value = {'ai_vs_threshold':{'value':{'CORBA::String':'""'}}}
            check_common_accuracy('ai_vs_threshold', dict_nbi_notif, expected_value)
        
        elif "ai_ps" == a:
            if dict_nbi_notif.has_key("ai_ps"):
                notif_value["ai_ps"] = dict_nbi_notif["ai_ps"]
                mapped_alarm_severity = '"' + mappingInstance.convert_alarm_severity(alarm_trap["alarmLevel"]) + '"'
                if mapped_alarm_severity != None:
                    expected_value = {'ai_ps':{'value':{'CORBA::String':mapped_alarm_severity}}}
                    test.info("check 'AI_VS_PERCEIVED_SEVERITY',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value, expected_value)
            else:
                test.failed("get 'ai_ps' from nbi notification Failed")
                
        elif "ai_at" == a:
            if dict_nbi_notif.has_key('ai_at'):
                notif_value['ai_at'] = dict_nbi_notif['ai_at']
                mapped_event_name = '"' + mappingInstance.convert_event_type(alarm_trap['alarmCategory']) + '"'
                if mapped_event_name != None:
                    expected_value['ai_at'] = expected_value = {'ai_at':{'value':{'CORBA::String':mapped_event_name}}}
                    test.info("check 'AI_VS_ALARM_TYPE',the nbi notification result is " + str(notif_value) + ",and the expected result is " + str(expected_value))
                    compare_data(notif_value,expected_value)
            else:
                test.failed("get 'ai_at' from nbi notification Failed")
                
        elif "f"  == a:
            if dict_nbi_notif.has_key("f"):
                notif_value["f"] = dict_nbi_notif["f"]
                alarm_id = notif_value["f"]["value"]["CORBA::String"]
                sqltext = ("SELECT id from alarms where id = %s"%alarm_id)
                is_unique=check_unique_id(sqltext,mysqlInst)
                if is_unique == 0:
                    test.failed("alarmId of " + alarm_id + " not existed in database")
                elif is_unique == 1:
                    test.passed("the alarmId of " + alarm_id + " is unique in database")
                elif is_unique > 1:
                    test.failed("more than one alarmId of " + alarm_id + "found in database")
            else:
                test.failed("get 'f' from nbi notification Failed")
Пример #21
0
 def convert_probable_cause(self,key):
     if self.dict_mapping_info["probable_cause"].has_key(key):
         return self.dict_mapping_info["probable_cause"][key]
     else:
         test.failed("probable_cause convert failed for " + key)
Пример #22
0
def foo():
    test.passed('This step passed.')
    # test.error('Error occured.')
    test.failed('This step failed.')
Пример #23
0
 def get_property(self, key):
     if self.notify_mapping_info.has_key(key):
         return self.notify_mapping_info[key]
     else:
         test.failed("get " + key + " from mapping Failed")
Пример #24
0
def alarm_converter(netype,nename,alarmtype,alarm_raw,mappingInstance):
    alarm_fields = mappingInstance.get_property("alarm_gui_name")
    expected_alarm = {}.fromkeys(alarm_fields)
    for key in expected_alarm.keys():
        if(key == "网元名称"):
            expected_alarm["网元名称"]=nename
        elif(key == "告警级别"):
            ne_severity = alarm_raw["alarmLevel"]
            if ne_severity:
                gui_severity = mappingInstance.convert_alarm_severity(ne_severity)
                if(gui_severity):
                    expected_alarm["告警级别"]= gui_severity
            else:
                test_logger.failed("get alarmLevel from trap Failed")
        elif(key == "告警时间"):
            ne_event_time = alarm_raw["timeStamp"]
            if ne_event_time:
                if (re.findall(r"\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{1}",ne_event_time)[0]!= None):
                    expected_alarm["告警时间"] = ne_event_time
                else:
                    test_logger.failed("Incorrect eventTime format on Node")
            else:
                test_logger.failed("get timeStamp from trap Failed ")
        elif(key == "清除状态"):
            expected_alarm["清除状态"] = "未清除"
        elif(key == "确认状态"):
            expected_alarm["确认状态"] = "未确认"
        elif(key == "告警编号"):
            if(netype == 'OCGAS'):
                gui_alarmtype_id = mappingInstance.convert_alarmtype_id(alarmtype)
            else:
                ne_specificProblem = alarm_raw["specificProblem"]
                if ne_specificProblem:
                    gui_alarmtype_id = mappingInstance.convert_alarmtype_id(ne_specificProblem)
                else:
                    test_logger.failed("get specificProblem from trap Failed.")
            if gui_alarmtype_id:
                expected_alarm["告警编号"]=gui_alarmtype_id
        elif(key == "告警名称"):
            if(netype == 'OCGAS'):
                gui_alarmtype_cn = mappingInstance.convert_alarmtype_cn(alarmtype)
            else:
                ne_specificProblem = alarm_raw["specificProblem"]
                if ne_specificProblem:
                    gui_alarmtype_cn = mappingInstance.convert_alarmtype_cn(ne_specificProblem)
                else:
                    test_logger.failed("get specificProblem from Trap Failed.")
            if gui_alarmtype_cn:
                expected_alarm["告警名称"] = gui_alarmtype_cn
        elif(key == "定位信息"):
            ne_source_info =  alarm_raw["alarmSource"]
            if ne_source_info:
                expected_alarm["定位信息"] = ne_source_info
            else:
                test_logger.failed("The managedObject can't be found on Node")
        elif(key == "清除时间"):
            expected_alarm["清除时间"] = ""
        elif(key == "清除类型"):
            expected_alarm["清除类型"] = ""
        elif(key == "确认时间"):
            expected_alarm["确认时间"] = ""
        elif(key == "确认用户"):
            expected_alarm["确认用户"] = ""
        elif(key == "问题描述"):
            if (netype == 'OCGAS'):
                specific_problem = mappingInstance.convert_specific_problem(alarmtype)
            else:
                ne_specificProblem = alarm_raw["specificProblem"]
                if ne_specificProblem:
                    specific_problem = ne_specificProblem
                else:
                    test_logger.failed("get specificProblem from trap Failed")
            if specific_problem:
                expected_alarm["问题描述"] = specific_problem
        elif(key == "可能原因"):
            if(netype == 'OCGAS'):
                probable_cause = mappingInstance.convert_probable_cause(alarmtype)
            else:
                ne_probableCause = alarm_raw["probableCause"]
                if ne_probableCause:
                    probable_cause = mappingInstance.convert_probable_cause(ne_probableCause)
                else:
                    test_logger.failed("get probableCause from trap Failed")
            if probable_cause:
                expected_alarm["可能原因"] = probable_cause
        elif(key == "告警类型"):
            ne_event_type = alarm_raw["alarmCategory"]
            if ne_event_type:
                gui_event_type = mappingInstance.convert_event_type(ne_event_type)
                if gui_event_type:
                    expected_alarm["告警类型"] = gui_event_type
            else:
                test_logger.failed("get alarmCategory from trap Failed")
        elif(key == "补充信息"):
            additionInfo = alarm_raw["alarmDescription"]
            if additionInfo:
                expected_alarm["补充信息"] = additionInfo
            else:
                test_logger.failed("get alarmDescription from trap Failed")
    return expected_alarm
Пример #25
0
 def convert_alarm_severity(self,key):
     if self.dict_mapping_info["alarm_severity"].has_key(str(key)):
         return self.dict_mapping_info["alarm_severity"][str(key)]
     else:
         test.failed("alarm_severity convert failed for " + str(key))
         return None