Example #1
0
    def test(self):
        """
        DELETE THIS BEFORE RELEASE
        used for internal testing (not correct way but we need to use it like
        this for now)
        """
                                                              
                       
                       
                                                                       
               
        global test_count
        test_count += 1
        model.api.showPopup("Creating test host %d" % test_count)
                                                                     
        from utils.error_report import exception_handler
        
        def raiser():
            sys.excepthook = exception_handler
            time.sleep(3)
            raise Exception("Exception from a secondary thread...")
                                            
                  
                                                                

        from model.hosts import Host
        from model.hosts import Interface
        from model.hosts import Service
        from model.hosts import HostApplication

        self._main_app.getLogger().log("testing..")
        self._main_app.getLogger().log("creating test host %d" % test_count)
        host = Host("TestHost-%d" % test_count, "Windows 2003")
        service = Service( "TestService-%d" % test_count, "TCP", [80,8080], "running")
        interface = Interface("eth%d" % test_count, mac = "00:00:00:00:00:00",
                 ipv4_address = "10.1.1.%d" % test_count, ipv4_mask = "255.255.0.0",
                 ipv4_gateway = "10.1.1.%d" % (test_count+1),
                 hostname_resolution = "TestHost-%d" % test_count)
        app = HostApplication( "AppTest-%d" % test_count, "running", "1.0 beta")

        
        host.addInterface(interface)
        host.addService(service)
        host.addApplication(app)
        interface.addService(service)
        app.addService(service)
        service.addInterface(interface)
        self._model_controller.addHostASYNC(host)
Example #2
0
    def test(self):
        """
        DELETE THIS BEFORE RELEASE
        used for internal testing (not correct way but we need to use it like
        this for now)
        """

        global test_count
        test_count += 1
        model.api.showPopup("Creating test host %d" % test_count)

        from utils.error_report import exception_handler

        def raiser():
            sys.excepthook = exception_handler
            time.sleep(3)
            raise Exception("Exception from a secondary thread...")

        from model.hosts import Host
        from model.hosts import Interface
        from model.hosts import Service
        from model.hosts import HostApplication

        self._main_app.getLogger().log("testing..")
        self._main_app.getLogger().log("creating test host %d" % test_count)
        host = Host("TestHost-%d" % test_count, "Windows 2003")
        service = Service("TestService-%d" % test_count, "TCP", [80, 8080],
                          "running")
        interface = Interface("eth%d" % test_count,
                              mac="00:00:00:00:00:00",
                              ipv4_address="10.1.1.%d" % test_count,
                              ipv4_mask="255.255.0.0",
                              ipv4_gateway="10.1.1.%d" % (test_count + 1),
                              hostname_resolution="TestHost-%d" % test_count)
        app = HostApplication("AppTest-%d" % test_count, "running", "1.0 beta")

        host.addInterface(interface)
        host.addService(service)
        host.addApplication(app)
        interface.addService(service)
        app.addService(service)
        service.addInterface(interface)
        self._model_controller.addHostASYNC(host)