Example #1
0
    def start(cls, config_path: str = CONFIG_PATH) -> None:
        """
        Starts the runtime server with all components

        :param config_path: Path to an alternative config directory
        """
        cls.CONFIG_PATH = config_path
        # set the config_path at the manager
        ConfigManager.set_config_path(config_path)

        # read from config the Vlan mode
        vlan_activate = ConfigManager.get_server_property("Vlan_On")
        cls.VLAN = vlan_activate

        # read from config if debug mode is on
        log_level = int(ConfigManager.get_server_property("Log_Level"))
        debug_mode = False
        if log_level is 10:
            debug_mode = True
        cls.DEBUG = debug_mode

        # create instance and give params to the logger object
        Logger().setup(log_level, log_level, log_level)

        # load Router configs
        cls.__load_configuration()

        if cls.VLAN:
            from util.router_info import RouterInfo
            # TODO: Die Funktion 'cls.update_router_info' sollte verwendet werden
            RouterInfo.update(cls.get_routers()[0])

        print("Runtime Server started")

        cls._ipc_server.start_ipc_server(cls, True)  # serves forever - works like a while(true)
Example #2
0
    def start(cls, config_path: str = CONFIG_PATH) -> None:
        """
        Starts the runtime server with all components

        :param config_path: Path to an alternative config directory
        """
        cls.CONFIG_PATH = config_path
        # set the config_path at the manager
        ConfigManager.set_config_path(config_path)

        # read from config the Vlan mode
        vlan_activate = ConfigManager.get_server_property("Vlan_On")
        cls.VLAN = vlan_activate

        # read from config if debug mode is on
        log_level = ConfigManager.get_server_property("Log_Level")
        debug_mode = False
        if log_level is 10:
            debug_mode = True
        cls.DEBUG = debug_mode

        # load Router configs
        cls.__load_configuration()

        if cls.VLAN:
            from util.router_info import RouterInfo
            # TODO: Die Funktion 'cls.update_router_info' sollte verwendet werden
            RouterInfo.update(cls.get_routers()[0])

        print("Runtime Server started")

        cls._ipc_server.start_ipc_server(
            cls, True)  # serves forever - works like a while(true)
    def update_router_info(cls, router_ids: List[int], update_all: bool) -> None:
        """
        Updates all the information about the :py:class:`Router`

        :param router_ids: List of unique numbers to identify a :py:class:`Router`
        :param update_all: Is True if all Routers should be updated
        """
        from util.router_info import RouterInfo
        if update_all:
            for router in cls.get_routers():
                RouterInfo.update(router)
        else:
            for router_id in router_ids:
                router = cls.get_router_by_id(router_id)
                RouterInfo.update(router)
Example #4
0
    def update_router_info(cls, router_ids: List[int],
                           update_all: bool) -> None:
        """
        Updates all the information about the :py:class:`Router`

        :param router_ids: List of unique numbers to identify a :py:class:`Router`
        :param update_all: Is True if all Routers should be updated
        """
        from util.router_info import RouterInfo
        if update_all:
            for router in cls.get_routers():
                RouterInfo.update(router)
        else:
            for router_id in router_ids:
                router = cls.get_router_by_id(router_id)
                RouterInfo.update(router)