예제 #1
0
    def startNetTest(self, net_test_loader, reporters):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """

        if config.privacy.includepcap:
            if not config.reports.pcap:
                config.reports.pcap = config.generatePcapFilename(net_test_loader.testDetails)
            self.startSniffing()

        report = Report(reporters, self.reportEntryManager)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        yield net_test.initializeInputProcessor()
        self.measurementManager.schedule(net_test.generateMeasurements())

        self.activeNetTests.append(net_test)

        yield net_test.done
        yield report.close()

        self.netTestDone(net_test)
예제 #2
0
    def startNetTest(self, _, net_test_loader, reporters):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader

            _: #XXX very dirty hack
        """

        if config.privacy.includepcap:
            log.msg("Starting")
            if not config.reports.pcap:
                config.reports.pcap = config.generatePcapFilename(
                    net_test_loader.testDetails)
            self.startSniffing()

        report = Report(reporters, self.reportEntryManager)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        self.measurementManager.schedule(net_test.generateMeasurements())

        self.activeNetTests.append(net_test)

        net_test.done.addBoth(report.close)
        net_test.done.addBoth(self.netTestDone, net_test)

        yield net_test.done
예제 #3
0
    def startNetTest(self, net_test_loader, report_filename,
                     collector_client=None, no_yamloo=False):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """
        test_details = net_test_loader.getTestDetails()
        test_cases = net_test_loader.getTestCases()

        if self.allTestsDone.called:
            self.allTestsDone = defer.Deferred()

        if config.privacy.includepcap or config.global_options.get('pcapfile', None):
            self.startSniffing(test_details)
        report = Report(test_details, report_filename,
                        self.reportEntryManager,
                        collector_client,
                        no_yamloo)

        yield report.open()
        net_test = NetTest(test_cases, test_details, report)
        net_test.director = self

        yield net_test.initialize()
        try:
            self.activeNetTests.append(net_test)
            self.measurementManager.schedule(net_test.generateMeasurements())

            yield net_test.done
            yield report.close()
        finally:
            self.netTestDone(net_test)
예제 #4
0
    def startNetTest(self, _, net_test_loader, reporters):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader

            _: #XXX very dirty hack
        """

        if config.privacy.includepcap:
            log.msg("Starting")
            if not config.reports.pcap:
                config.reports.pcap = config.generatePcapFilename(net_test_loader.testDetails)
            self.startSniffing()

        report = Report(reporters, self.reportEntryManager)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        self.measurementManager.schedule(net_test.generateMeasurements())

        self.activeNetTests.append(net_test)

        net_test.done.addBoth(report.close)
        net_test.done.addBoth(self.netTestDone, net_test)

        yield net_test.done
예제 #5
0
    def startNetTest(self,
                     net_test_loader,
                     report_filename,
                     collector_address=None):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """
        if self.allTestsDone.called:
            self.allTestsDone = defer.Deferred()

        if config.privacy.includepcap:
            self.startSniffing(net_test_loader.testDetails)

        report = Report(net_test_loader.testDetails, report_filename,
                        self.reportEntryManager, collector_address)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        yield net_test.initializeInputProcessor()
        try:
            self.activeNetTests.append(net_test)
            self.measurementManager.schedule(net_test.generateMeasurements())

            yield net_test.done
            yield report.close()
        finally:
            self.netTestDone(net_test)
예제 #6
0
    def startNetTest(self, net_test_loader, report_filename,
                     collector_address=None):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """
        if self.allTestsDone.called:
            self.allTestsDone = defer.Deferred()

        if config.privacy.includepcap:
            self.startSniffing(net_test_loader.testDetails)

        report = Report(net_test_loader.testDetails, report_filename,
                        self.reportEntryManager, collector_address)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        yield net_test.initializeInputProcessor()
        try:
            self.activeNetTests.append(net_test)
            self.measurementManager.schedule(net_test.generateMeasurements())

            yield net_test.done
            yield report.close()
        finally:
            self.netTestDone(net_test)
예제 #7
0
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)
        ntl.checkOptions()
        nt = NetTest(ntl.getTestCases(), ntl.getTestDetails(), None)
        yield nt.initialize()

        for test_class, test_methods in nt.testCases:
            self.assertEqual(len(list(test_class.inputs)), 10)
예제 #8
0
    def test_generate_measurements_size(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)

        ntl.checkOptions()
        net_test = NetTest(ntl, None)

        measurements = list(net_test.generateMeasurements())
        self.assertEqual(len(measurements), 20)
예제 #9
0
    def test_generate_measurements_size(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)

        ntl.checkOptions()
        net_test = NetTest(ntl, None)

        measurements = list(net_test.generateMeasurements())
        self.assertEqual(len(measurements), 20)
예제 #10
0
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)
        ntl.checkOptions()
        nt = NetTest(ntl.getTestCases(), ntl.getTestDetails(), None)
        yield nt.initialize()

        for test_class, test_methods in nt.testCases:
            self.assertEqual(len(list(test_class.inputs)), 10)
예제 #11
0
    def test_generate_measurements_size(self):

        options = {'subargs':dummyArgsWithFile,
            'test':StringIO(net_test_string_with_file)}
        ntl = NetTestLoader(options)
        ntl.checkOptions()
        net_test = NetTest(ntl, None)

        measurements = list(net_test.generateMeasurements())
        self.assertEqual(len(measurements), 20)
예제 #12
0
    def test_generate_measurements_size(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)
        ntl.checkOptions()

        net_test = NetTest(ntl.getTestCases(), ntl.getTestDetails(), None)

        net_test.initializeInputProcessor()
        measurements = list(net_test.generateMeasurements())
        self.assertEqual(len(measurements), 20)
예제 #13
0
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)
        ntl.checkOptions()
        nt = NetTest(ntl.getTestCases(), ntl.getTestDetails(), None)
        nt.initializeInputProcessor()

        # XXX: if you use the same test_class twice you will have consumed all
        # of its inputs!
        tested = set([])
        for test_instance, test_method, inputs in nt.testInstances:
            self.assertEqual(len(list(inputs)), 10)
예제 #14
0
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)

        ntl.checkOptions()
        nt = NetTest(ntl, None)
        nt.initializeInputProcessor()

        # XXX: if you use the same test_class twice you will have consumed all
        # of its inputs!
        tested = set([])
        for test_class, test_method in ntl.testCases:
            if test_class not in tested:
                tested.update([test_class])
                self.assertEqual(len(list(test_class.inputs)), 10)
예제 #15
0
    def test_net_test_inputs(self):
        ntl = NetTestLoader(dummyArgsWithFile)
        ntl.loadNetTestString(net_test_string_with_file)

        ntl.checkOptions()
        nt = NetTest(ntl,None)
        nt.initializeInputProcessor()

        # XXX: if you use the same test_class twice you will have consumed all
        # of its inputs!
        tested = set([])
        for test_class, test_method in ntl.testCases:
            if test_class not in tested:
                tested.update([test_class])
                self.assertEqual(len(list(test_class.inputs)), 10)
예제 #16
0
    def start_net_test_loader(self,
                              net_test_loader,
                              report_filename,
                              collector_client=None,
                              no_yamloo=False,
                              test_details=None,
                              measurement_id=None):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """
        if test_details is None:
            test_details = net_test_loader.getTestDetails()
        test_cases = net_test_loader.getTestCases()

        if self.allTestsDone.called:
            self.allTestsDone = defer.Deferred()

        if config.privacy.includepcap or config.global_options.get(
                'pcapfile', None):
            self.start_sniffing(test_details)
        report = Report(test_details, report_filename, self.reportEntryManager,
                        collector_client, no_yamloo, measurement_id)

        yield report.open()
        net_test = NetTest(test_cases, test_details, report)
        net_test.director = self

        yield net_test.initialize()
        try:
            self.activeNetTests.append(net_test)
            if measurement_id:
                self.activeMeasurements[measurement_id] = net_test
            self.measurementManager.schedule(net_test.generateMeasurements())

            yield net_test.done
            yield report.close()
        finally:
            if measurement_id:
                del self.activeMeasurements[measurement_id]
            self.netTestDone(net_test)
예제 #17
0
    def startNetTest(self, _, net_test_loader, reporters):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader

            _: #XXX very dirty hack
        """
        report = Report(reporters, self.reportEntryManager)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self
        net_test.report.open()

        self.measurementManager.schedule(net_test.generateMeasurements())

        self.activeNetTests.append(net_test)
        net_test.done.addBoth(self.netTestDone, net_test)
        net_test.done.addBoth(report.close)
        return net_test.done
예제 #18
0
    def startNetTest(self,
                     net_test_loader,
                     report_filename,
                     collector_address=None,
                     no_yamloo=False):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """
        # Here we set the test details again since the geoip lookups may
        # not have already been done and probe_asn and probe_ip
        # are not set.
        net_test_loader.setTestDetails()

        if self.allTestsDone.called:
            self.allTestsDone = defer.Deferred()

        if config.privacy.includepcap:
            self.startSniffing(net_test_loader.testDetails)
        report = Report(net_test_loader.testDetails, report_filename,
                        self.reportEntryManager, collector_address, no_yamloo)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        yield net_test.initializeInputProcessor()
        try:
            self.activeNetTests.append(net_test)
            self.measurementManager.schedule(net_test.generateMeasurements())

            yield net_test.done
            yield report.close()
        finally:
            self.netTestDone(net_test)
예제 #19
0
    def startNetTest(self, net_test_loader, reporters):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """
        report = Report(reporters, self.reportEntryManager)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        self.measurementManager.schedule(net_test.generateMeasurements())

        self.activeNetTests.append(net_test)

        yield net_test.done
        yield report.close()

        self.netTestDone(net_test)
예제 #20
0
    def startNetTest(self, net_test_loader, report_filename,
                     collector_address=None, no_yamloo=False):
        """
        Create the Report for the NetTest and start the report NetTest.

        Args:
            net_test_loader:
                an instance of :class:ooni.nettest.NetTestLoader
        """
        # Here we set the test details again since the geoip lookups may
        # not have already been done and probe_asn and probe_ip
        # are not set.
        net_test_loader.setTestDetails()

        if self.allTestsDone.called:
            self.allTestsDone = defer.Deferred()

        if config.privacy.includepcap:
            self.startSniffing(net_test_loader.testDetails)
        report = Report(net_test_loader.testDetails, report_filename,
                        self.reportEntryManager, collector_address,
                        no_yamloo)

        net_test = NetTest(net_test_loader, report)
        net_test.director = self

        yield net_test.report.open()

        yield net_test.initializeInputProcessor()
        try:
            self.activeNetTests.append(net_test)
            self.measurementManager.schedule(net_test.generateMeasurements())

            yield net_test.done
            yield report.close()
        finally:
            self.netTestDone(net_test)