def init(): global bw_loader from core.bandwidth_limit.bw_loader import BWLoader bw_loader=BWLoader() bw_loader.loadAll() registerInParents() global tc from core.bandwidth_limit.tc import TC tc=TC() global mark_id_pool from core.bandwidth_limit.idpool import IDPool mark_id_pool=IDPool([10000,4294967295],"iptables mark") global iptables from core.bandwidth_limit.iptables import IPTables iptables=IPTables() initTree() global manager from core.bandwidth_limit.bw_manager import BWManager,UpdateCounters manager=BWManager() periodic_events.getManager().register(UpdateCounters()) global actions from core.bandwidth_limit.bw_actions import BWActions actions=BWActions() from core.bandwidth_limit.bw_handler import BWHandler handlers_manager.getManager().registerHandler(BWHandler()) applyStatics()
def init(): global radius_server_started if defs.RADIUS_SERVER_ENABLED==0: return toLog("Initializing IBS Radius Server", LOG_DEBUG) stat_main.getStatKeeper().registerStat("auth_packets", "int") stat_main.getStatKeeper().registerStat("acct_packets", "int") stat_main.getStatKeeper().registerStat("auth_duplicate_packets", "int") stat_main.getStatKeeper().registerStat("acct_duplicate_packets", "int") stat_main.getStatKeeper().registerStat("auth_avg_response_time", "seconds") stat_main.getStatKeeper().registerStat("acct_avg_response_time", "seconds") stat_main.getStatKeeper().registerStat("auth_max_response_time", "seconds") stat_main.getStatKeeper().registerStat("acct_max_response_time", "seconds") global ibs_dic ibs_dic=dictionary.Dictionary("%s/radius_server/dictionary"%defs.IBS_ROOT, "%s/radius_server/dictionary.usr"%defs.IBS_ROOT, "%s/radius_server/dictionary.ser"%defs.IBS_ROOT, "%s/radius_server/dictionary.sip"%defs.IBS_ROOT) from radius_server.request_list import RequestList, CleanRequestListPeriodicEvent global request_list request_list = RequestList() periodic_events.getManager().register(CleanRequestListPeriodicEvent()) startRadiusServer() radius_server_started=True
def _registerEvent(self): class GeneralUpdateEvent(periodic_events.PeriodicEvent): def __init__(my_self): periodic_events.PeriodicEvent.__init__(my_self,"%s general_update"%self.ras_ip,self.getAttribute("general_update_interval"),[],0) def run(my_self): self.generalUpdate() self.__general_update_event=GeneralUpdateEvent() periodic_events.getManager().register(self.__general_update_event)
def _registerEvent(self): class GeneralUpdateEvent(periodic_events.PeriodicEvent): def __init__(my_self): periodic_events.PeriodicEvent.__init__( my_self, "%s general_update" % self.ras_ip, int(self.getAttribute("general_update_interval")), [], 0) def run(my_self): self.generalUpdate() self.__general_update_event = GeneralUpdateEvent() periodic_events.getManager().register(self.__general_update_event)
def _registerEvent(self): GeneralUpdateRas._registerEvent(self) class UpdateUserListEvent(periodic_events.PeriodicEvent): def __init__(my_self): periodic_events.PeriodicEvent.__init__(my_self,"%s update userlist"%self.getRasIP(),self.getAttribute("update_users_interval"),[],0) def run(my_self): self.updateUserList() if self.getAttribute("online_check"): self.__update_userlist_event=UpdateUserListEvent() periodic_events.getManager().register(self.__update_userlist_event)
def _registerEvent(self): GeneralUpdateRas._registerEvent(self) class UpdateUserListEvent(periodic_events.PeriodicEvent): def __init__(my_self): periodic_events.PeriodicEvent.__init__( my_self, "%s update userlist" % self.getRasIP(), int(self.getAttribute("update_users_interval")), [], 0) def run(my_self): self.updateUserList() if self.getAttribute("online_check"): self.__update_userlist_event = UpdateUserListEvent() periodic_events.getManager().register(self.__update_userlist_event)
def init(): from core.user import user_actions,user_plugin,attribute_manager global attr_manager attr_manager=attribute_manager.AttributeManager() global user_loader from core.user.user_loader import UserLoader user_loader=UserLoader() global user_pool from core.user.user_pool import UserPool user_pool=UserPool() global user_action_manager user_action_manager=user_actions.UserActions() global user_plugin_manager user_plugin_manager=user_plugin.UserPluginManager() global credit_change_log_actions from core.user.credit_change_log import CreditChangeLogActions credit_change_log_actions=CreditChangeLogActions() global connection_log_manager from core.user.connection_log import ConnectionLogActions connection_log_manager=ConnectionLogActions() global add_user_save_actions from core.user.add_user_save import AddUserSaveActions,AddUserSaveHandler add_user_save_actions=AddUserSaveActions() handlers_manager.getManager().registerHandler(AddUserSaveHandler()) global ras_msg_dispatcher from core.user.ras_msg_dispatcher import RasMsgDispatcher ras_msg_dispatcher=RasMsgDispatcher() global online from core.user.online import OnlineUsers,OnlineCheckPeriodicEvent online=OnlineUsers() periodic_events.getManager().register(OnlineCheckPeriodicEvent()) plugin_loader.loadPlugins(defs.IBS_CORE+"/user/plugins") from core.user.user_handler import UserHandler handlers_manager.getManager().registerHandler(UserHandler())
def init(): global bw_loader from core.bandwidth_limit.bw_loader import BWLoader bw_loader=BWLoader() bw_loader.loadAll() registerInParents() global tc from core.bandwidth_limit.tc import TC tc=TC() global mark_id_pool from core.bandwidth_limit.idpool import IDPool mark_id_pool=IDPool([10000,4294967295],"iptables mark") global iptables from core.bandwidth_limit.iptables import IPTables iptables=IPTables() initTree() global manager from core.bandwidth_limit.bw_manager import BWManager,UpdateCounters manager=BWManager() periodic_events.getManager().register(UpdateCounters()) global actions from core.bandwidth_limit.bw_actions import BWActions actions=BWActions() from core.bandwidth_limit.bw_handler import BWHandler handlers_manager.getManager().registerHandler(BWHandler()) applyStatics() setReCreateTreeSignalHandler()
def init(): global onlines_loop from core.snapshot.onlines_loop import OnlinesLoop onlines_loop = OnlinesLoop() global realtime_manager from core.snapshot.realtime_manager import RealTimeManager realtime_manager = RealTimeManager() from core.snapshot.realtime_manager import RealTimePeriodicEvent periodic_events.getManager().register(RealTimePeriodicEvent()) plugin_loader.loadPlugins(defs.IBS_CORE + "/snapshot/plugins") from core.snapshot.snapshot_handler import SnapShotHandler handlers_manager.getManager().registerHandler(SnapShotHandler()) from core.snapshot.bw_snapshot import BWSnapShotOnlinesLoopClient getOnlinesLoop().registerClient(BWSnapShotOnlinesLoopClient()) from core.snapshot.onlines_snapshot import OnlinesSnapShotOnlinesLoopClient getOnlinesLoop().registerClient(OnlinesSnapShotOnlinesLoopClient()) getOnlinesLoop().doLoop() #do loop for first time
def init(): global user_audit_log_manager from core.user.user_audit_log import UserAuditLog user_audit_log_manager = UserAuditLog() from core.user import user_actions, user_plugin, attribute_manager global attr_manager attr_manager = attribute_manager.AttributeManager() global user_loader from core.user.user_loader import UserLoader user_loader = UserLoader() global user_pool from core.user.user_pool import UserPool user_pool = UserPool() global mail_actions from core.user.mail_actions import MailActions mail_actions = MailActions() global user_action_manager user_action_manager = user_actions.UserActions() global user_plugin_manager user_plugin_manager = user_plugin.UserPluginManager() global credit_change_log_actions from core.user.credit_change_log import CreditChangeLogActions credit_change_log_actions = CreditChangeLogActions() global connection_log_manager from core.user.connection_log import ConnectionLogActions connection_log_manager = ConnectionLogActions() global add_user_save_actions from core.user.add_user_save import AddUserSaveActions, AddUserSaveHandler add_user_save_actions = AddUserSaveActions() handlers_manager.getManager().registerHandler(AddUserSaveHandler()) global ras_msg_dispatcher from core.user.ras_msg_dispatcher import RasMsgDispatcher ras_msg_dispatcher = RasMsgDispatcher() global online from core.user.online import OnlineUsers, OnlineCheckPeriodicEvent online = OnlineUsers() periodic_events.getManager().register(OnlineCheckPeriodicEvent()) global user_server_auth from core.user.server_auth import UserServerAuth user_server_auth = UserServerAuth() global dialer_errors from core.user.dialer_errors import DialerErrors dialer_errors = DialerErrors() global voip_errors from core.user.voip_errors import VoIPErrors voip_errors = VoIPErrors() global ip_map from core.user.ip_map import IPMap ip_map = IPMap() global user_plugin_modules user_plugin_modules = plugin_loader.loadPlugins(defs.IBS_CORE + "/user/plugins") from core.user.user_handler import UserHandler handlers_manager.getManager().registerHandler(UserHandler())
def _delEvent(self): periodic_events.getManager().unRegister(self.__general_update_event)
def postInit(): from core.event import periodic_events from core.threadpool.twrapper_checker import TWrapperChecker periodic_events.getManager().register(TWrapperChecker())
def init(): db_pool_check = DBPoolCheck('dbcheck', defs.DB_POOL_CHECK_INTERVAL, [], 1) periodic_events.getManager().register(db_pool_check)
def __removeLoginRetry(self): periodic_events.getManager().unRegister(self.plan_login_retry)
def __initLoginRetry(self): self.plan_login_retry = PLanLoginRetry(self) periodic_events.getManager().register(self.plan_login_retry)
def _delEvent(self): GeneralUpdateRas._delEvent(self) if self.getAttribute("online_check"): periodic_events.getManager().unRegister(self.__update_userlist_event)
def _delEvent(self): GeneralUpdateRas._delEvent(self) if self.getAttribute("online_check"): periodic_events.getManager().unRegister( self.__update_userlist_event)
def __initLoginRetry(self): self.plan_login_retry=PLanLoginRetry(self) periodic_events.getManager().register(self.plan_login_retry)
from core.event import periodic_events i=0 for evt in periodic_events.getManager().events: print i,evt i+=1
def init(): db_pool_check=DBPoolCheck('dbcheck',defs.DB_POOL_CHECK_INTERVAL,[],1) periodic_events.getManager().register(db_pool_check)