def __init__(self, config): self.config = config self.port_targets = {} self.port_gateways = {} self.mac_targets = {} self.result_sets = {} self.active_ports = {} self._device_groups = {} self._gateway_sets = {} self._target_mac_ip = {} self.gcp = gcp.GcpManager(self.config) self.description = config.get('site_description', '').strip("\"") self.version = os.environ['DAQ_VERSION'] self.network = network.TestNetwork(config) self.result_linger = config.get('result_linger', False) self.faucet_events = None self.single_shot = config.get('single_shot', False) self.event_trigger = config.get('event_trigger', False) self.fail_mode = config.get('fail_mode', False) self.run_tests = True self.stream_monitor = None self.exception = None self.run_count = 0 self.run_limit = int(config.get('run_limit', 0)) self.result_log = self._open_result_log() test_list = self._get_test_list( config.get('host_tests', _DEFAULT_TESTS_FILE), []) if self.config.get('keep_hold'): test_list.append('hold') config['test_list'] = test_list LOGGER.info('Configured with tests %s', config['test_list'])
def test_cleanup_remote_tap_with_no_device_session(self): """Test port flap timeout config override""" net = network.TestNetwork(self.config) net.sec = FakeSwitch() net.sec.cmd = MagicMock(return_value=None) device = Devices().new_device("mac") net._cleanup_remote_tap(device) self.assertFalse(net._vxlan_port_sets) net.sec.cmd.assert_not_called()
def __init__(self, config): self.config = config self.port_targets = {} self.port_gateways = {} self.mac_targets = {} self.result_sets = {} self._active_ports = {} self._device_groups = {} self._gateway_sets = {} self._target_mac_ip = {} self._callback_queue = [] self._callback_lock = threading.Lock() self.gcp = gcp.GcpManager(self.config, self._queue_callback) self._base_config = self._load_base_config() self.description = config.get('site_description', '').strip('\"') self._daq_version = os.environ['DAQ_VERSION'] self._lsb_release = os.environ['DAQ_LSB_RELEASE'] self._sys_uname = os.environ['DAQ_SYS_UNAME'] self.network = network.TestNetwork(config) self.result_linger = config.get('result_linger', False) self._linger_exit = 0 self.faucet_events = None self.single_shot = config.get('single_shot', False) self.event_trigger = config.get('event_trigger', False) self.fail_mode = config.get('fail_mode', False) self.run_tests = True self.stream_monitor = None self.exception = None self.run_count = 0 self.run_limit = int(config.get('run_limit', 0)) self.result_log = self._open_result_log() self._system_active = False self._dhcp_ready = set() self._ip_info = {} logging_client = self.gcp.get_logging_client() self._daq_run_id = uuid.uuid4() if logging_client: logger.set_stackdriver_client( logging_client, labels={"daq_run_id": str(self._daq_run_id)}) test_list = self._get_test_list( config.get('host_tests', self._DEFAULT_TESTS_FILE), []) if self.config.get('keep_hold'): LOGGER.info('Appending test_hold to master test list') test_list.append('hold') config['test_list'] = test_list LOGGER.info('DAQ RUN id: %s' % self._daq_run_id) LOGGER.info('Configured with tests %s' % ', '.join(config['test_list'])) LOGGER.info('DAQ version %s' % self._daq_version) LOGGER.info('LSB release %s' % self._lsb_release) LOGGER.info('system uname %s' % self._sys_uname)
def __init__(self, config): self.configurator = configurator.Configurator() self.gateway_sets = set(range(1, self.MAX_GATEWAYS + 1)) self.config = config self._result_sets = {} self._devices = Devices() self._ports = {} self._callback_queue = [] self._event_lock = threading.Lock() self.gcp = gcp.GcpManager(self.config, self._queue_callback) self._base_config = self._load_base_config() self.description = config.get('site_description', '').strip('\"') self._daq_version = os.environ['DAQ_VERSION'] self._lsb_release = os.environ['DAQ_LSB_RELEASE'] self._sys_uname = os.environ['DAQ_SYS_UNAME'] self.network = network.TestNetwork(config) self.result_linger = config.get('result_linger', False) self._linger_exit = 0 self.faucet_events = None self.single_shot = config.get('single_shot', False) self.fail_mode = config.get('fail_mode', False) self.run_trigger = config.get('run_trigger', {}) self.run_tests = True self.stream_monitor = None self.exception = None self.run_count = 0 self.run_limit = int(config.get('run_limit', 0)) self._default_port_flap_timeout = int( config.get('port_flap_timeout_sec', 0)) self.result_log = self._open_result_log() self._system_active = False logging_client = self.gcp.get_logging_client() self.daq_run_id = self._init_daq_run_id() self._device_result_client = self._init_device_result_client() if logging_client: logger.set_stackdriver_client( logging_client, labels={"daq_run_id": self.daq_run_id}) test_list = self._get_test_list( config.get('host_tests', self._DEFAULT_TESTS_FILE)) if self.config.get('keep_hold'): LOGGER.info('Appending test_hold to master test list') if 'hold' not in test_list: test_list.append('hold') config['test_list'] = test_list config['test_metadata'] = self._get_test_metadata() LOGGER.info('DAQ RUN id: %s' % self.daq_run_id) LOGGER.info('Configured with tests %s' % ', '.join(config['test_list'])) LOGGER.info('DAQ version %s' % self._daq_version) LOGGER.info('LSB release %s' % self._lsb_release) LOGGER.info('system uname %s' % self._sys_uname)
def test_configure_remote_tap_simple(self): """Test port flap timeout config override""" net = network.TestNetwork(self.config) net.sec = FakeSwitch() net.sec.cmd = MagicMock(return_value=None) device = Devices().new_device("mac") device.session_endpoint = TunnelEndpoint() net._configure_remote_tap(device) self.assertEqual(net._vxlan_port_sets, set([2])) net.sec.cmd.assert_any_call('ip link set vxlan2 up') self.assertEqual(device.port.vxlan, 2) net._cleanup_remote_tap(device) self.assertFalse(net._vxlan_port_sets) net.sec.cmd.assert_any_call('ip link set vxlan2 down') net.sec.cmd.assert_any_call('ip link del vxlan2')
def __init__(self, config): self.config = config self.target_sets = {} self.result_sets = {} self.active_ports = {} self.gcp = gcp.GcpManager(self.config) self.description = config.get('site_description', '').strip("\"") self.version = os.environ['DAQ_VERSION'] self.network = network.TestNetwork(config) self.result_linger = config.get('result_linger', False) self.faucet_events = None self.single_shot = config.get('single_shot') self.flap_ports = config.get('flap_ports') self.event_trigger = config.get('event_trigger') self.stream_monitor = None self.exception = None
def __init__(self, config): self.configurator = configurator.Configurator() self.gateway_sets = set(range(1, self.MAX_GATEWAYS + 1)) self.config = config self._result_sets = {} self._devices = Devices() self._ports = {} self._callback_queue = [] self._event_lock = threading.RLock() self.daq_run_id = self._init_daq_run_id() self._init_gcp() self._base_config = self._load_base_config() self.description = config.get('site_description', '').strip('\"') self._daq_version = os.environ['DAQ_VERSION'] self._lsb_release = os.environ['DAQ_LSB_RELEASE'] self._sys_uname = os.environ['DAQ_SYS_UNAME'] self.network = network.TestNetwork(config) self.result_linger = config.get('result_linger', False) self.run_trigger = config.setdefault('run_trigger', {}) self._native_vlan = self.run_trigger.get('native_vlan') self._native_gateway = None self._linger_exit = 0 self.faucet_events = None self.single_shot = config.get('single_shot', False) self.fail_mode = config.get('fail_mode', False) self.run_tests = True self.stream_monitor = None self.exception = None self.run_count = 0 self.run_limit = int(config.get('run_limit', 0)) self._default_port_flap_timeout = int( config.get('port_flap_timeout_sec', 0)) self.result_log = self._open_result_log() self._system_active = False self._device_result_handler = self._init_device_result_handler() self._cleanup_previous_runs() self._init_test_list() self._target_set_queue = [] self._max_hosts = self.run_trigger.get('max_hosts') or float('inf') LOGGER.info('DAQ RUN id: %s', self.daq_run_id) tests_string = ', '.join(config['test_list']) or '**none**' LOGGER.info('Configured with tests %s', tests_string) LOGGER.info('DAQ version %s', self._daq_version) LOGGER.info('LSB release %s', self._lsb_release) LOGGER.info('system uname %s', self._sys_uname)
def __init__(self, config): self.config = config self.port_targets = {} self.port_gateways = {} self.mac_targets = {} self.result_sets = {} self._active_ports = {} self._device_groups = {} self._gateway_sets = {} self._target_mac_ip = {} self._callback_queue = [] self._callback_lock = threading.Lock() self.gcp = gcp.GcpManager(self.config, self._queue_callback) self._base_config = self._load_base_config() self.description = config.get('site_description', '').strip('\"') self.version = os.environ['DAQ_VERSION'] self.network = network.TestNetwork(config) self.result_linger = config.get('result_linger', False) self._linger_exit = 0 self.faucet_events = None self.single_shot = config.get('single_shot', False) self.event_trigger = config.get('event_trigger', False) self.fail_mode = config.get('fail_mode', False) self.run_tests = True self.stream_monitor = None self.exception = None self.run_count = 0 self.run_limit = int(config.get('run_limit', 0)) self.result_log = self._open_result_log() self._system_active = False self._dhcp_ready = set() self._ip_info = {} logging_client = self.gcp.get_logging_client() if logging_client: logger.set_stackdriver_client(logging_client) test_list = self._get_test_list( config.get('host_tests', self._DEFAULT_TESTS_FILE), []) if self.config.get('keep_hold'): test_list.append('hold') config['test_list'] = test_list LOGGER.info('Configured with tests %s', config['test_list'])
def test_configure_remote_tap(self): """Test port flap timeout config override""" net = network.TestNetwork(self.config) net.sec = FakeSwitch() net.sec.cmd = MagicMock(return_value=None) device1 = Devices().new_device("mac") device1.session_endpoint = TunnelEndpoint() net._configure_remote_tap(device1) device2 = Devices().new_device("mac") device2.session_endpoint = TunnelEndpoint() net._configure_remote_tap(device2) self.assertEqual(net._vxlan_port_sets, set([2, 3])) net._cleanup_remote_tap(device1) self.assertEqual(net._vxlan_port_sets, set([3])) device3 = Devices().new_device("mac") device3.session_endpoint = TunnelEndpoint() net._configure_remote_tap(device3) self.assertEqual(net._vxlan_port_sets, set([2, 3])) net._configure_remote_tap(device1) self.assertEqual(net._vxlan_port_sets, set([2, 3, 4]))
def __init__(self, config): self.config = config self.port_targets = {} self.port_gateways = {} self.mac_targets = {} self.result_sets = {} self.active_ports = {} self._device_groups = {} self._gateway_sets = {} self.gcp = gcp.GcpManager(self.config) self.description = config.get('site_description', '').strip("\"") self.version = os.environ['DAQ_VERSION'] self.network = network.TestNetwork(config) self.result_linger = config.get('result_linger', False) self.faucet_events = None self.single_shot = config.get('single_shot', False) self.event_trigger = config.get('event_trigger', False) self.fail_mode = config.get('fail_mode', False) self.run_tests = True self.stream_monitor = None self.exception = None self.run_count = 0 self.run_limit = int(config.get('run_limit', 0)) self.result_log = self._open_result_log()