Пример #1
0
def check_pm_accurate_sbc(ne_info_cfg, counter_info_cfg, server_info_path,
                          rounds):
    global sep, logger_pm
    ne_info = get_ne_info_from_cfg(ne_info_cfg)
    counters_pm = get_pm_counters_map(counter_info_cfg)
    server_info = TrimableProps(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    dict_browser_firefox = {
        "browser_type": 'firefox',
        "browser_path":
        'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
        "driver_path": ''
    }

    driver = CommonStatic.login_rsnms(dict_browser_chrome,
                                      server_info.getProperty('host'),
                                      logger_pm,
                                      server_info.getProperty('username'),
                                      server_info.getProperty('password'),
                                      server_info.getProperty('port'),
                                      server_info.getProperty('url'))
    if driver:
        try:
            NeCommon.to_ne_management_page_by_url(driver, logger_pm,
                                                  server_info)
            dict_ne_info = NeCommon.check_and_add_ne(driver, logger_pm,
                                                     ne_info)

            PmCommon.to_pm_management_page_by_url(driver, logger_pm,
                                                  ne_info['ne_type'],
                                                  server_info)
            PmCommon.make_in_correct_tab(driver, logger_pm, ne_info['tab_pre'],
                                         '')
            if PmCommon.wait_until_pm_date_show_up(driver, logger_pm, 600,
                                                   dict_ne_info['ne_name']):
                PmCommon.init_and_search(driver, logger_pm,
                                         dict_ne_info['ne_name'])

                dict_additional = {"rounds": rounds}

                ok = PmCommon.wait_until_rounds_ok(driver, logger_pm,
                                                   dict_additional['rounds'],
                                                   10, None)
                if ok:
                    PmCommon.check_pm_rows(driver, logger_pm,
                                           dict_ne_info['ne_type'],
                                           counters_pm, 10, dict_additional)
                else:
                    logger_pm.error('FAILED: Wait for SBC PM timeout.')
            else:
                logger_pm.error('No PM data show up after waiting.')
            CommonStatic.logout_rsnms(driver)
            # CommonStatic.quite_driver(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #2
0
def check_pm_accurate(ne_info_cfg, counter_info_cfg, server_info_path, str_end_time, number_of_lic, check_rounds=12,
                      me_counter_cfg=None, me_types_cfg=None):
    ne_info = get_ne_info_from_cfg(ne_info_cfg)
    counters_pm = get_pm_counters_map(counter_info_cfg)
    if 12 * number_of_lic != len(counters_pm):
        test.error('Lines of expected counters should equal 12 multiple number of LICs.')
    server_info = TrimableProps(server_info_path)
    dict_browser_chrome = {
        "browser_type": os.path.normpath(server_info.getProperty('browser_type')),
        "browser_path": os.path.normpath(server_info.getProperty('browser_path')),
        "driver_path": os.path.normpath(server_info.getProperty('driver_path'))
    }

    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')
    dict_additinal = {
        'number_of_lic': number_of_lic,
        'check_rounds': check_rounds
    }

    driver = CommonStatic.login_rsnms(dict_browser_chrome, host, username, password, port, url)
    if driver:
        try:
            end_time = datetime.strptime(str_end_time, '%Y-%m-%d %H:%M:%S')
            rounds = len(counters_pm) / dict_additinal['number_of_lic']
            start_time = end_time + timedelta(minutes=-5 * check_rounds)

            NeCommon.to_ne_management_page_by_url(driver, server_info)
            dict_ne_info = NeCommon.check_and_add_ne(driver, ne_info)

            PmCommon.to_pm_management_page_by_url(driver, ne_info['ne_type'], server_info)

            PmCommon.make_in_correct_tab(driver, ne_info['tab_pre'], '')
            PmCommon.wait_until_pm_date_show_up(driver, dict_ne_info['ne_name'])
            PmCommon.init_and_search(driver, dict_ne_info['ne_name'], end_time, start_time)
            PmCommon.check_pm_rows_updated(driver, dict_ne_info['ne_type'], counters_pm, 10, dict_additinal)

            if ne_info.has_key('tab_me') and me_counter_cfg is not None and me_types_cfg is not None:
                test.info('Found ME Tab information, will check ME counters.')
                dict_me_add = {
                    'rows_each_period': 1,
                    'check_rounds': check_rounds
                }
                me_counters = get_pm_counters_map(me_counter_cfg)
                me_types = get_me_types_map(me_types_cfg)
                if 12 * dict_me_add['rows_each_period'] != len(me_counters):
                    test.error('Expected ME counters mis-match.')
                PmCommon.make_in_correct_tab(driver, ne_info['tab_me'], '')
                PmCommon.wait_until_pm_date_show_up(driver, dict_ne_info['ne_name'])
                PmCommon.init_and_search(driver, dict_ne_info['ne_name'], end_time, start_time)
                # PmCommon.wait_until_rounds_ok(driver, len(me_counters), 10, dict_me_add)
                PmCommon.check_me_counters(driver, dict_ne_info['ne_name'], me_counters, 10, dict_me_add, me_types)

            CommonStatic.logout_rsnms(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #3
0
def check_pm_accurate_lic(ne_info_cfg, counter_info_cfg, server_info_path, str_end_time):
    global sep, logger_pm
    ne_info = get_ne_info_from_cfg(ne_info_cfg)
    counters_pm = get_pm_counters_map(counter_info_cfg)
    server_info = Properties(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    dict_browser_firefox = {
        "browser_type": 'firefox',
        "browser_path": 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
        "driver_path": ''
    }

    driver = CommonStatic.login_rsnms(dict_browser_chrome, server_info.getProperty('host'), logger_pm,
                                      server_info.getProperty('username'), server_info.getProperty('password'),
                                      server_info.getProperty('port'), server_info.getProperty('url'))
    if driver:
        try:
            NeCommon.to_ne_management_page_by_url(driver, logger_pm, server_info)
            dict_ne_info = NeCommon.check_and_add_ne(driver, logger_pm, ne_info)

            PmCommon.to_pm_management_page_by_url(driver, logger_pm, ne_info['ne_type'], server_info)
            PmCommon.make_in_correct_tab(driver, logger_pm, ne_info['tab_pre'], '')

            if PmCommon.wait_until_pm_date_show_up(driver, logger_pm, 600, dict_ne_info['ne_name']):
                t_now = datetime.now()
                # minute_delta = t_now.minute % 5
                # end_time = t_now + timedelta(minutes=-(delay_time + minute_delta))
                end_time = datetime.strptime(str_end_time, '%Y-%m-%d %H:%M:%S')
                pm_rounds = len(counters_pm)
                if 'OCGAS' == ne_info['ne_type']:
                    pm_rounds = len(counters_pm) / 2
                elif 'IMSHSS' == ne_info['ne_type']:
                    pm_rounds = len(counters_pm) / 4
                start_time = end_time + timedelta(minutes=-5 * pm_rounds)
                PmCommon.init_and_search(driver, logger_pm, dict_ne_info['ne_name'], end_time, start_time)
                ok = PmCommon.wait_until_rounds_ok(driver, logger_pm, pm_rounds, 10, 5)
                if ok:
                    PmCommon.check_pm_rows(driver, logger_pm, dict_ne_info['ne_type'], counters_pm, 10, None)
                else:
                    logger_pm.error('Timeout ERROR.')
            CommonStatic.logout_rsnms(driver)
            # CommonStatic.quite_driver(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #4
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)
Пример #5
0
def check_pm_accurate_sbc(ne_info_cfg, counter_info_cfg, server_info_path, rounds):
    global sep, logger_pm
    ne_info = get_ne_info_from_cfg(ne_info_cfg)
    counters_pm = get_pm_counters_map(counter_info_cfg)
    server_info = Properties(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    dict_browser_firefox = {
        "browser_type": 'firefox',
        "browser_path": 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
        "driver_path": ''
    }

    driver = CommonStatic.login_rsnms(dict_browser_chrome, server_info.getProperty('host'), logger_pm,
                                      server_info.getProperty('username'), server_info.getProperty('password'),
                                      server_info.getProperty('port'), server_info.getProperty('url'))
    if driver:
        try:
            NeCommon.to_ne_management_page_by_url(driver, logger_pm, server_info)
            dict_ne_info = NeCommon.check_and_add_ne(driver, logger_pm, ne_info)

            PmCommon.to_pm_management_page_by_url(driver, logger_pm, ne_info['ne_type'], server_info)
            PmCommon.make_in_correct_tab(driver, logger_pm, ne_info['tab_pre'], '')
            if PmCommon.wait_until_pm_date_show_up(driver, logger_pm, 600, dict_ne_info['ne_name']):
                PmCommon.init_and_search(driver, logger_pm, dict_ne_info['ne_name'])

                dict_additional = {"rounds": rounds}

                ok = PmCommon.wait_until_rounds_ok(driver, logger_pm, dict_additional['rounds'], 10, None)
                if ok:
                    PmCommon.check_pm_rows(driver, logger_pm, dict_ne_info['ne_type'], counters_pm, 10, dict_additional)
                else:
                    logger_pm.error('FAILED: Wait for SBC PM timeout.')
            else:
                logger_pm.error('No PM data show up after waiting.')
            CommonStatic.logout_rsnms(driver)
            # CommonStatic.quite_driver(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #6
0
def check_pm_accurate(ne_info_cfg, counter_info_cfg, server_info_path, str_end_time):
    ne_info = get_ne_info_from_cfg(ne_info_cfg)
    counters_pm = get_pm_counters_map(counter_info_cfg)
    server_info = Properties(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    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')
    dict_additinal = {
        'number_of_lic': 4
    }

    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)
            dict_ne_info = NeCommon.check_and_add_ne(driver, ne_info)

            PmCommon.to_pm_management_page_by_url(driver, ne_info['ne_type'], server_info)
            PmCommon.make_in_correct_tab(driver, ne_info['tab_pre'], '')
            PmCommon.wait_until_pm_date_show_up(driver, dict_ne_info['ne_name'])

            end_time = datetime.strptime(str_end_time, '%Y-%m-%d %H:%M:%S')
            if 0 != len(counters_pm) % dict_additinal['number_of_lic']:
                test.error('Expected couters config file mismatch with the lic number.')
            else:
                start_time = end_time + timedelta(minutes=-5 * len(counters_pm) / dict_additinal['number_of_lic'])
                PmCommon.init_and_search(driver, dict_ne_info['ne_name'], end_time, start_time)
                PmCommon.wait_until_rounds_ok(driver, len(counters_pm), 10, dict_additinal)
                PmCommon.check_pm_rows_updated(driver, dict_ne_info['ne_type'], counters_pm, 10, dict_additinal)
                CommonStatic.logout_rsnms(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #7
0
def check_sbc_pm(ne_info_cfg, counter_info_cfg, server_info_path, number_of_lic, check_rounds=4, me_counter_cfg=None):
    ne_info = get_ne_info_from_cfg(ne_info_cfg)
    counters_pm = get_pm_counters_map(counter_info_cfg)

    server_info = TrimableProps(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    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')
    dict_additinal = {
        'number_of_lic': number_of_lic,
        'check_rounds': check_rounds
    }

    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)
            dict_ne_info = NeCommon.check_and_add_ne(driver, ne_info)

            PmCommon.to_pm_management_page_by_url(driver, ne_info['ne_type'], server_info)
            PmCommon.make_in_correct_tab(driver, ne_info['tab_pre'], '')
            PmCommon.wait_until_pm_date_show_up(driver, dict_ne_info['ne_name'])
            if 12 * dict_additinal['number_of_lic'] != len(counters_pm):
                test.error('Expected counters file error.')
            PmCommon.init_and_search(driver, dict_ne_info['ne_name'])
            # PmCommon.wait_until_rounds_ok(driver, len(counters_pm), 10, dict_additinal)
            PmCommon.check_pm_rows_updated(driver, dict_ne_info['ne_type'], counters_pm, 10, dict_additinal)
            CommonStatic.logout_rsnms(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #8
0
def check_pm_accurate_lic(ne_info_cfg, counter_info_cfg, server_info_path,
                          str_end_time):
    global sep, logger_pm
    ne_info = get_ne_info_from_cfg(ne_info_cfg)
    counters_pm = get_pm_counters_map(counter_info_cfg)
    server_info = TrimableProps(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    dict_browser_firefox = {
        "browser_type": 'firefox',
        "browser_path":
        'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
        "driver_path": ''
    }

    driver = CommonStatic.login_rsnms(dict_browser_chrome,
                                      server_info.getProperty('host'),
                                      logger_pm,
                                      server_info.getProperty('username'),
                                      server_info.getProperty('password'),
                                      server_info.getProperty('port'),
                                      server_info.getProperty('url'))
    if driver:
        try:
            NeCommon.to_ne_management_page_by_url(driver, logger_pm,
                                                  server_info)
            dict_ne_info = NeCommon.check_and_add_ne(driver, logger_pm,
                                                     ne_info)

            PmCommon.to_pm_management_page_by_url(driver, logger_pm,
                                                  ne_info['ne_type'],
                                                  server_info)
            PmCommon.make_in_correct_tab(driver, logger_pm, ne_info['tab_pre'],
                                         '')

            if PmCommon.wait_until_pm_date_show_up(driver, logger_pm, 600,
                                                   dict_ne_info['ne_name']):
                t_now = datetime.now()
                # minute_delta = t_now.minute % 5
                # end_time = t_now + timedelta(minutes=-(delay_time + minute_delta))
                end_time = datetime.strptime(str_end_time, '%Y-%m-%d %H:%M:%S')
                pm_rounds = len(counters_pm)
                if 'OCGAS' == ne_info['ne_type']:
                    pm_rounds = len(counters_pm) / 2
                elif 'IMSHSS' == ne_info['ne_type']:
                    pm_rounds = len(counters_pm) / 4
                start_time = end_time + timedelta(minutes=-5 * pm_rounds)
                PmCommon.init_and_search(driver, logger_pm,
                                         dict_ne_info['ne_name'], end_time,
                                         start_time)
                ok = PmCommon.wait_until_rounds_ok(driver, logger_pm,
                                                   pm_rounds, 10, 5)
                if ok:
                    PmCommon.check_pm_rows(driver, logger_pm,
                                           dict_ne_info['ne_type'],
                                           counters_pm, 10, None)
                else:
                    logger_pm.error('Timeout ERROR.')
            CommonStatic.logout_rsnms(driver)
            # CommonStatic.quite_driver(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #9
0
def check_pm_accurate_all_ne(dict_all_nes, server_info_path):
    global sep, logger_pm
    server_info = TrimableProps(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    dict_browser_firefox = {
        "browser_type": 'firefox',
        "browser_path":
        'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
        "driver_path": ''
    }

    driver = CommonStatic.login_rsnms(dict_browser_chrome,
                                      server_info.getProperty('host'),
                                      logger_pm,
                                      server_info.getProperty('username'),
                                      server_info.getProperty('password'),
                                      server_info.getProperty('port'),
                                      server_info.getProperty('url'))
    if driver:
        try:
            # check the sbc
            logger_pm.info(
                '******************** Start to check PM for SBC ************************'
            )
            sbc_ne_dict = dict_all_nes['SBC']
            ne_info = get_ne_info_from_cfg(sbc_ne_dict['ne_cfg'])
            counters_pm = get_pm_counters_map(sbc_ne_dict['ct_cfg'])

            NeCommon.to_ne_management_page(driver, logger_pm)
            dict_ne_info = NeCommon.check_and_add_ne(driver, logger_pm,
                                                     ne_info)

            PmCommon.to_pm_management_page(driver, logger_pm)
            # PmCommon.to_second_page(driver, logger_pm)
            PmCommon.to_tab_by_ne_type(driver, dict_ne_info['ne_type'],
                                       logger_pm)
            if PmCommon.wait_until_pm_date_show_up(driver, logger_pm, 600,
                                                   dict_ne_info['ne_name']):
                PmCommon.init_and_search(driver, logger_pm,
                                         dict_ne_info['ne_name'])

                dict_additional = {"rounds": sbc_ne_dict['rounds']}

                ok = PmCommon.wait_until_rounds_ok(driver, logger_pm,
                                                   dict_additional['rounds'],
                                                   10, None)
                if ok:
                    PmCommon.check_pm_rows(driver, logger_pm,
                                           dict_ne_info['ne_type'],
                                           counters_pm, 10, dict_additional)
                else:
                    logger_pm.error('FAILED: Wait for SBC PM timeout.')

            # check other 5 NEs
            for k, v in dict_all_nes.iteritems:
                if 'SBC' != k:
                    logger_pm.info(
                        '******************** Start to check PM for ' +
                        str(k) + ' ************************')
                    ne_info = get_ne_info_from_cfg(v['ne_cfg'])
                    counters_pm = get_pm_counters_map(v['ct_cfg'])

                    NeCommon.to_ne_management_page(driver, logger_pm)
                    dict_ne_info = NeCommon.check_and_add_ne(
                        driver, logger_pm, ne_info)
                    PmCommon.to_pm_management_page(driver, logger_pm)
                    # PmCommon.to_second_page(driver, logger_pm)
                    PmCommon.to_tab_by_ne_type(driver, dict_ne_info['ne_type'],
                                               logger_pm)
                    if PmCommon.wait_until_pm_date_show_up(
                            driver, logger_pm, 600, dict_ne_info['ne_name']):
                        # t_now = datetime.now()
                        # minute_delta = t_now.minute % 5
                        # end_time = t_now + timedelta(minutes=-(delay_time + minute_delta))
                        end_time = datetime.strptime(v['end_time'],
                                                     '%Y-%m-%d %H:%M:%S')
                        pm_rounds = len(counters_pm)
                        if 'OCGAS' == ne_info['ne_type']:
                            pm_rounds = len(counters_pm) / 2

                        check_rounds = len(counters_pm)
                        if 'SGW' == ne_info['ne_type'] or 'PGW' == ne_info[
                                'ne_type']:
                            check_rounds

                        start_time = end_time + timedelta(minutes=-5 *
                                                          pm_rounds)
                        PmCommon.init_and_search(driver, logger_pm,
                                                 dict_ne_info['ne_name'],
                                                 end_time, start_time)
                        ok = PmCommon.wait_until_rounds_ok(
                            driver, logger_pm, check_rounds, 10, 5)
                        if ok:
                            PmCommon.check_pm_rows(driver, logger_pm,
                                                   dict_ne_info['ne_type'],
                                                   counters_pm, 10, None)
                        else:
                            logger_pm.error('Timeout ERROR.')

            CommonStatic.logout_rsnms(driver)
            # CommonStatic.quite_driver(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #10
0
def check_pm_accurate_all_ne(dict_all_nes, server_info_path):
    global sep, logger_pm
    server_info = Properties(server_info_path)
    dict_browser_chrome = {
        "browser_type": server_info.getProperty('browser_type'),
        "browser_path": server_info.getProperty('browser_path'),
        "driver_path": server_info.getProperty('driver_path')
    }

    dict_browser_firefox = {
        "browser_type": 'firefox',
        "browser_path": 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
        "driver_path": ''
    }

    driver = CommonStatic.login_rsnms(dict_browser_chrome, server_info.getProperty('host'), logger_pm,
                                      server_info.getProperty('username'), server_info.getProperty('password'),
                                      server_info.getProperty('port'), server_info.getProperty('url'))
    if driver:
        try:
            # check the sbc
            logger_pm.info('******************** Start to check PM for SBC ************************')
            sbc_ne_dict = dict_all_nes['SBC']
            ne_info = get_ne_info_from_cfg(sbc_ne_dict['ne_cfg'])
            counters_pm = get_pm_counters_map(sbc_ne_dict['ct_cfg'])

            NeCommon.to_ne_management_page(driver, logger_pm)
            dict_ne_info = NeCommon.check_and_add_ne(driver, logger_pm, ne_info)

            PmCommon.to_pm_management_page(driver, logger_pm)
            # PmCommon.to_second_page(driver, logger_pm)
            PmCommon.to_tab_by_ne_type(driver, dict_ne_info['ne_type'], logger_pm)
            if PmCommon.wait_until_pm_date_show_up(driver, logger_pm, 600, dict_ne_info['ne_name']):
                PmCommon.init_and_search(driver, logger_pm, dict_ne_info['ne_name'])

                dict_additional = {"rounds": sbc_ne_dict['rounds']}

                ok = PmCommon.wait_until_rounds_ok(driver, logger_pm, dict_additional['rounds'], 10, None)
                if ok:
                    PmCommon.check_pm_rows(driver, logger_pm, dict_ne_info['ne_type'], counters_pm, 10, dict_additional)
                else:
                    logger_pm.error('FAILED: Wait for SBC PM timeout.')

            # check other 5 NEs
            for k, v in dict_all_nes.iteritems:
                if 'SBC' != k:
                    logger_pm.info('******************** Start to check PM for ' + str(k) + ' ************************')
                    ne_info = get_ne_info_from_cfg(v['ne_cfg'])
                    counters_pm = get_pm_counters_map(v['ct_cfg'])

                    NeCommon.to_ne_management_page(driver, logger_pm)
                    dict_ne_info = NeCommon.check_and_add_ne(driver, logger_pm, ne_info)
                    PmCommon.to_pm_management_page(driver, logger_pm)
                    # PmCommon.to_second_page(driver, logger_pm)
                    PmCommon.to_tab_by_ne_type(driver, dict_ne_info['ne_type'], logger_pm)
                    if PmCommon.wait_until_pm_date_show_up(driver, logger_pm, 600, dict_ne_info['ne_name']):
                        # t_now = datetime.now()
                        # minute_delta = t_now.minute % 5
                        # end_time = t_now + timedelta(minutes=-(delay_time + minute_delta))
                        end_time = datetime.strptime(v['end_time'], '%Y-%m-%d %H:%M:%S')
                        pm_rounds = len(counters_pm)
                        if 'OCGAS' == ne_info['ne_type']:
                            pm_rounds = len(counters_pm) / 2

                        check_rounds = len(counters_pm)
                        if 'SGW' == ne_info['ne_type'] or 'PGW' == ne_info['ne_type']:
                            check_rounds

                        start_time = end_time + timedelta(minutes=-5 * pm_rounds)
                        PmCommon.init_and_search(driver, logger_pm, dict_ne_info['ne_name'], end_time, start_time)
                        ok = PmCommon.wait_until_rounds_ok(driver, logger_pm, check_rounds, 10, 5)
                        if ok:
                            PmCommon.check_pm_rows(driver, logger_pm, dict_ne_info['ne_type'], counters_pm, 10, None)
                        else:
                            logger_pm.error('Timeout ERROR.')

            CommonStatic.logout_rsnms(driver)
            # CommonStatic.quite_driver(driver)
        finally:
            CommonStatic.quite_driver(driver)
Пример #11
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))