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)
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)
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)
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)
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)
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)