Ejemplo n.º 1
0
    def setup_web_configuration(cls, router_ids: Union[List[int], None],
                                setup_all: bool, wizard: bool):
        """
        After a systemupgrade, the Router starts in config-mode without the possibility to connect again via SSH.
        Therefore this class uses selenium to parse the given webpage. All options given by the web interface of the
        Router can be set via the 'web_interface_config.yaml', except for the sysupgrade which isn't implemented yet

        :param router_ids: List of unique numbers to identify a Router
        :param setup_all: If True all Routers will be setuped via the webinterface
        :param wizard
        """

        if setup_all:
            for i, router in enumerate(cls.get_routers()):
                cls.start_job(
                    router,
                    RouterWebConfigurationJob(
                        ConfigManager.get_web_interface_list()[i], wizard))
        else:
            for i, router_id in enumerate(router_ids):
                router = cls.get_router_by_id(router_id)
                cls.start_job(
                    router,
                    RouterWebConfigurationJob(
                        ConfigManager.get_web_interface_list()[i], wizard))
Ejemplo n.º 2
0
 def __load_configuration(cls):
     logging.debug("Load configuration")
     cls._routers = ConfigManager.get_routers_list()
     for i, r in enumerate(cls._routers):
         if len(ConfigManager.get_web_interface_list()) >= i:
             if 'node_name' in ConfigManager.get_web_interface_list()[i]:
                 r.node_name = ConfigManager.get_web_interface_list()[i]['node_name']
     cls._power_strips = ConfigManager.get_power_strip_list()
     cls._test_sets = ConfigManager.get_test_sets()
Ejemplo n.º 3
0
    def test_setup_expert(self):
        """
        This UnitTest executes the wca_setup_expert-function with the given config-file.
        It sets the values of all the  from WebInterface of the Router.
        """
        print("Test if the 'wca_setup_wizard'-function is working")
        router = self._create_router()
        # NVAssisten
        nv_assist = NVAssistent("eth0")
        nv_assist.create_namespace_vlan(router)
        # Set netns for the current process
        netns.setns(router.namespace_name)
        try:
            # Config
            config = ConfigManager.get_web_interface_list()[router.id]
            self.assertEqual(len(config), 30,
                             "Wrong size of the Config-Directory")

            print("Set the following configuration: \n" + str(config))

            router_web_config = RouterWebConfiguration(router,
                                                       config,
                                                       wizard=True)
            router_web_config.start()
            router_web_config.join()
        except Exception as e:
            nv_assist.close()
            raise e

        assert router.mode == Mode.normal
        nv_assist.close()
    def test_setup_expert(self):
        """
        This UnitTest executes the wca_setup_expert-function with the given config-file.
        It sets the values of all the  from WebInterface of the Router.
        """
        print("Test if the 'wca_setup_wizard'-function is working")
        router = self._create_router()
        # NVAssisten
        nv_assist = NVAssistent("eth0")
        nv_assist.create_namespace_vlan(router)
        # Set netns for the current process
        netns.setns(router.namespace_name)
        try:
            # Config
            config = ConfigManager.get_web_interface_list()[router.id]
            self.assertEqual(len(config), 30, "Wrong size of the Config-Directory")

            print("Set the following configuration: \n" + str(config))

            router_web_config = RouterWebConfiguration(router, config, wizard=True)
            router_web_config.start()
            router_web_config.join()
        except Exception as e:
            nv_assist.close()
            raise e

        assert router.mode == Mode.normal
        nv_assist.close()
Ejemplo n.º 5
0
 def test_web_interface_list(self):
     """
     Tests the web interface config
     :return: Tests results
     """
     data = ConfigManager.get_web_interface_list()
     self.assertEqual(len(data), 60, "web_interface_Yaml: Wrong size of the List")
Ejemplo n.º 6
0
 def test_web_interface_list(self):
     """
     Tests the web interface config
     :return: Tests results
     """
     data = ConfigManager.get_web_interface_list()
     self.assertEqual(len(data), 60,
                      "web_interface_Yaml: Wrong size of the List")
Ejemplo n.º 7
0
    def setup_web_configuration(cls, router_ids: Union[List[int], None], setup_all: bool, wizard: bool):
        """
        After a systemupgrade, the Router starts in config-mode without the possibility to connect again via SSH.
        Therefore this class uses selenium to parse the given webpage. All options given by the web interface of the
        Router can be set via the 'web_interface_config.yaml', except for the sysupgrade which isn't implemented yet.

        :param router_ids: List of unique numbers to identify a Router
        :param setup_all: If True all Routers will be setuped via the webinterface
        :param wizard
        """

        if setup_all:
            for router in cls.get_routers():
                cls.start_job(router, RouterWebConfigurationJob(ConfigManager.get_web_interface_list()[router.id], wizard))
        else:
            for router_id in router_ids:
                router = cls.get_router_by_id(router_id)
                cls.start_job(router, RouterWebConfigurationJob(ConfigManager.get_web_interface_list()[router_id], wizard))