Example #1
0
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()
Example #2
0
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
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
    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)
Example #6
0
    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)
Example #7
0
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())
Example #8
0
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()
Example #9
0
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
Example #10
0
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())
Example #11
0
 def _delEvent(self):
     periodic_events.getManager().unRegister(self.__general_update_event)
Example #12
0
    def _delEvent(self):
	periodic_events.getManager().unRegister(self.__general_update_event)
Example #13
0
def postInit():
    from core.event import periodic_events
    from core.threadpool.twrapper_checker import TWrapperChecker
    periodic_events.getManager().register(TWrapperChecker())
Example #14
0
def init():
    db_pool_check = DBPoolCheck('dbcheck', defs.DB_POOL_CHECK_INTERVAL, [], 1)
    periodic_events.getManager().register(db_pool_check)
Example #15
0
 def __removeLoginRetry(self):
     periodic_events.getManager().unRegister(self.plan_login_retry)
Example #16
0
 def __initLoginRetry(self):
     self.plan_login_retry = PLanLoginRetry(self)
     periodic_events.getManager().register(self.plan_login_retry)
Example #17
0
    def _delEvent(self):
	GeneralUpdateRas._delEvent(self)
	if self.getAttribute("online_check"):
	    periodic_events.getManager().unRegister(self.__update_userlist_event)
	    
Example #18
0
 def _delEvent(self):
     GeneralUpdateRas._delEvent(self)
     if self.getAttribute("online_check"):
         periodic_events.getManager().unRegister(
             self.__update_userlist_event)
Example #19
0
    def __removeLoginRetry(self):
	periodic_events.getManager().unRegister(self.plan_login_retry)
Example #20
0
    def __initLoginRetry(self):
	self.plan_login_retry=PLanLoginRetry(self)
	periodic_events.getManager().register(self.plan_login_retry)
Example #21
0
from core.event import periodic_events
i=0
for evt in periodic_events.getManager().events:
    print i,evt
    i+=1
Example #22
0
def init():
    db_pool_check=DBPoolCheck('dbcheck',defs.DB_POOL_CHECK_INTERVAL,[],1)
    periodic_events.getManager().register(db_pool_check)