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

        # Config
        config = ConfigManager().get_web_interface_dict()[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=False)
        router_web_config.start()
        router_web_config.join()

        assert router.mode == Mode.configuration
        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()
    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.
        """
        # Create router
        router = Router(1, "vlan1", 21, "10.223.254.254", 16, "192.168.1.1", 24, "root", "root", 1)
        router.model = "TP-LINK TL-WR841N/ND v9"
        router.mac = "e8:de:27:b7:7c:e2"
        router.mode = Mode.configuration
        assert isinstance(router, Router)
        # Config
        config = ConfigManager().get_web_interface_dict()[0]
        self.assertEqual(len(config), 30, "Wrong size of the Config-Directory")
        # Create NetworkCrtl
        network_ctrl = NetworkCtrl(router, 'eth0')
        assert isinstance(network_ctrl, NetworkCtrl)

        try:
            web_config_assist = RouterWebConfiguration(router, config, wizard=True)
            web_config_assist.start()
            web_config_assist.join()
        except Exception as e:
            Logger().error(str(e))
        finally:
            assert router.mode == Mode.normal
            network_ctrl.exit()
Exemplo n.º 4
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.
        """
        # Create router
        router = Router(1, "vlan1", 21, "10.223.254.254", 16, "192.168.1.1",
                        24, "root", "root", 1)
        router.model = "TP-LINK TL-WR841N/ND v9"
        router.mac = "e8:de:27:b7:7c:e2"
        router.mode = Mode.configuration
        assert isinstance(router, Router)
        # Config
        config = ConfigManager().get_web_interface_dict()[0]
        self.assertEqual(len(config), 30, "Wrong size of the Config-Directory")
        # Create NetworkCrtl
        network_ctrl = NetworkCtrl(router, 'eth0')
        assert isinstance(network_ctrl, NetworkCtrl)

        try:
            web_config_assist = RouterWebConfiguration(router,
                                                       config,
                                                       wizard=True)
            web_config_assist.start()
            web_config_assist.join()
        except Exception as e:
            Logger().error(str(e))
        finally:
            assert router.mode == Mode.normal
            network_ctrl.exit()