Пример #1
0
    def _docker_test(self, test_name):
        self._state_transition(_STATE.TESTING, _STATE.NEXT)
        params = {
            'target_ip': self.target_ip,
            'target_mac': self.target_mac,
            'gateway_ip': self.gateway.IP(),
            'gateway_mac': self.gateway.MAC(),
            'inst_base': self._inst_config_path(),
            'port_base': self._port_base,
            'device_base': self._device_aux_path(),
            'type_base': self._type_aux_path(),
            'scan_base': self.scan_base
        }

        self.test_host = docker_test.DockerTest(self.runner, self.target_port,
                                                self.devdir, test_name)
        self.test_port = self.runner.allocate_test_port(self.target_port)
        if 'ext_loip' in self.config:
            ext_loip = self.config['ext_loip'].replace('@', '%d')
            params['local_ip'] = ext_loip % self.test_port
            params['switch_ip'] = self.config['ext_addr']
            params['switch_port'] = str(self.target_port)
        LOGGER.debug('test_host start %s/%s', self.test_name,
                     self._host_name())
        self._set_module_config(test_name, self._loaded_config)
        self.record_result(test_name, state=MODE.EXEC)
        self.test_host.start(self.test_port, params, self._docker_callback)
Пример #2
0
 def _docker_test(self, test_name):
     self._state_transition(_STATE.TESTING, _STATE.READY)
     self.record_result(test_name, state='run')
     port = self.pri_base + self.TEST_OFFSET
     params = {
         'target_ip': self.target_ip,
         'target_mac': self.target_mac,
         'gateway_ip': self.networking.IP(),
         'gateway_mac': self.networking.MAC(),
         'scan_base': self.scan_base
     }
     test = docker_test.DockerTest(self.runner, self, test_name)
     test.start(port, params, self._docker_callback)
Пример #3
0
 def _docker_test(self, test_name):
     self._state_transition(_STATE.TESTING, _STATE.NEXT)
     self.record_result(test_name, state='run')
     params = {
         'target_ip': self.target_ip,
         'target_mac': self.target_mac,
         'gateway_ip': self.gateway.IP(),
         'gateway_mac': self.gateway.MAC(),
         'scan_base': self.scan_base
     }
     self.test_host = docker_test.DockerTest(self.runner, self, test_name)
     self.test_port = self.runner.allocate_test_port(self.target_port)
     host_name = self.test_host.host_name if self.test_host else 'unknown'
     LOGGER.debug('test_host start %s/%s', self.test_name, host_name)
     self.test_host.start(self.test_port, params, self._docker_callback)
Пример #4
0
    def _docker_test(self, test_name):
        self._state_transition(_STATE.TESTING, _STATE.NEXT)
        self.record_result(test_name, state='run')
        params = {
            'target_ip': self.target_ip,
            'target_mac': self.target_mac,
            'gateway_ip': self.gateway.IP(),
            'gateway_mac': self.gateway.MAC(),
            'scan_base': self.scan_base
        }

        self.test_host = docker_test.DockerTest(self.runner, self, test_name)
        self.test_port = self.runner.allocate_test_port(self.target_port)
        host_name = self.test_host.host_name if self.test_host else 'unknown'
        if 'ext_loip' in self.config:
            params['local_ip'] = self.config['ext_loip'].replace(
                '@', str(self.test_port))
            params['switch_ip'] = self.config['ext_addr']
        LOGGER.debug('test_host start %s/%s', self.test_name, host_name)
        self.test_host.start(self.test_port, params, self._docker_callback)
Пример #5
0
    def _docker_test(self, test_name):
        self.test_name = test_name
        self.test_start = gcp.get_timestamp()
        self._state_transition(_STATE.TESTING, _STATE.NEXT)
        params = {
            'target_ip': self.target_ip,
            'target_mac': self.target_mac,
            'gateway_ip': self.gateway.host.IP(),
            'gateway_mac': self.gateway.host.MAC(),
            'inst_base': self._inst_config_path(),
            'port_base': self._port_base,
            'device_base': self._device_aux_path(),
            'type_base': self._type_aux_path(),
            'scan_base': self.scan_base
        }
        self.test_host = docker_test.DockerTest(self.runner, self.target_port,
                                                self.devdir, test_name)
        self.test_port = self.runner.allocate_test_port(self.target_port)
        if 'ext_loip' in self.config:
            ext_loip = self.config['ext_loip'].replace('@', '%d')
            params['local_ip'] = ext_loip % self.test_port
            params['switch_ip'] = self.config['ext_addr']
            params['switch_port'] = str(self.target_port)
            params['switch_model'] = self.config['switch_model']

        try:
            LOGGER.debug('test_host start %s/%s', test_name, self._host_name())
            self._set_module_config(self._loaded_config)
            self.record_result(test_name, state=MODE.EXEC)
            self._monitor_scan(
                os.path.join(self.scan_base, 'test_%s.pcap' % test_name))
            self.test_host.start(self.test_port, params, self._docker_callback,
                                 self._finish_hook)
        except:
            self.test_host = None
            raise