def _setUp(self): self.temp_dir = self.useFixture(fixtures.TempDir()).path self.rabbitmq_environment = self.useFixture( process.RabbitmqEnvironmentFixture()) plugin_cfg_fixture = self.useFixture( config.ML2ConfigFixture(self.temp_dir, 'vlan')) neutron_cfg_fixture = self.useFixture( config.NeutronConfigFixture(self.temp_dir, cfg.CONF.database.connection, self.rabbitmq_environment)) self.neutron_server = self.useFixture( process.NeutronServerFixture(self.test_name, neutron_cfg_fixture, plugin_cfg_fixture)) self.central_data_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-data')).bridge self.central_external_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-ex')).bridge self.hosts = [ self._create_host(description) for description in self.hosts_descriptions ] self.wait_until_env_is_up()
def setUp(self): cfg.CONF.set_override('enable_distributed_routing', True, group='AGENT') super(OVSFlowTestCase, self).setUp() self.phys_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.br_phys = self.br_phys_cls(self.phys_br.br_name) self.br_phys.set_secure_mode() self.br_phys.setup_controllers(cfg.CONF) self.router_addr = '192.168.0.1/24' self.namespace = self.useFixture( net_helpers.NamespaceFixture()).name self.phys_p = self.useFixture( net_helpers.OVSPortFixture(self.br_phys, self.namespace)).port self.tun_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.br_tun = self.br_tun_cls(self.tun_br.br_name) self.br_tun.set_secure_mode() self.br_tun.setup_controllers(cfg.CONF) self.tun_p = self.br_tun.add_patch_port( common_utils.get_rand_device_name( prefix=cfg.CONF.OVS.tun_peer_patch_port), common_utils.get_rand_device_name( prefix=cfg.CONF.OVS.int_peer_patch_port)) self.br_tun.setup_default_table(self.tun_p, True)
def _setUp(self): agent_cfg_fixture = config.OVSConfigFixture( self.neutron_config.temp_dir) self.useFixture(agent_cfg_fixture) br_phys = self.useFixture( net_helpers.OVSBridgeFixture( agent_cfg_fixture.get_br_phys_name())).bridge self.connect_to_internal_network_via_vlans(br_phys) self.ovs_agent = self.useFixture( process.OVSAgentFixture(self.test_name, self.neutron_config, agent_cfg_fixture)) if self.host_description.l3_agent: l3_agent_cfg_fixture = self.useFixture( config.L3ConfigFixture( self.neutron_config.temp_dir, self.ovs_agent.agent_cfg_fixture.get_br_int_name())) br_ex = self.useFixture( net_helpers.OVSBridgeFixture( l3_agent_cfg_fixture.get_external_bridge())).bridge self.connect_to_external_network(br_ex) self.l3_agent = self.useFixture( process.L3AgentFixture(self.test_name, self.neutron_config, l3_agent_cfg_fixture))
def _configure_agent(self, host, agent_mode='dvr_snat'): conf = self._get_config_opts() l3_agent_main.register_opts(conf) conf.set_override('interface_driver', self.INTERFACE_DRIVER) br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge br_ex = self.useFixture(net_helpers.OVSBridgeFixture()).bridge conf.set_override('ovs_integration_bridge', br_int.br_name) conf.set_override('external_network_bridge', br_ex.br_name) temp_dir = self.get_new_temp_dir() get_temp_file_path = functools.partial(self.get_temp_file_path, root=temp_dir) conf.set_override('state_path', temp_dir.path) conf.set_override('log_file', get_temp_file_path('log_file')) conf.set_override('metadata_proxy_socket', get_temp_file_path('metadata_proxy')) conf.set_override('ha_confs_path', get_temp_file_path('ha_confs')) conf.set_override('external_pids', get_temp_file_path('external/pids')) conf.set_override('host', host) conf.set_override('agent_mode', agent_mode) conf.set_override('root_helper', cfg.CONF.AGENT.root_helper, group='AGENT') conf.set_override('root_helper_daemon', cfg.CONF.AGENT.root_helper_daemon, group='AGENT') return conf
def test_do_main_default_options(self): int_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge ext_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.conf.set_override("ovs_integration_bridge", int_br.br_name) self.conf.set_override("external_network_bridge", ext_br.br_name) self.conf.set_override("ovs_all_ports", False) noskip = collections.defaultdict(list) skip = collections.defaultdict(list) # add two vifs, one skipped, and a non-vif port to int_br and ext_br for br in (int_br, ext_br): for collection in (noskip, skip): collection[br].append( self.useFixture(net_helpers.OVSPortFixture(br)).port.name) # set skippable vif to be skipped br.ovsdb.db_set('Interface', skip[br][0], ('external_ids', { constants.SKIP_CLEANUP: "True" })).execute(check_error=True) device_name = utils.get_rand_name() skip[br].append(device_name) br.add_port(device_name, ('type', 'internal')) # sanity check for collection in (noskip, skip): for bridge, ports in collection.items(): port_list = bridge.get_port_name_list() for port in ports: self.assertIn(port, port_list) ovs_cleanup.do_main(self.conf) for br in (int_br, ext_br): ports = br.get_port_name_list() for vif in noskip[br]: self.assertNotIn(vif, ports) for port in skip[br]: self.assertIn(port, ports)
def test_do_main_default_options(self): int_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge ext_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.conf.set_override("ovs_integration_bridge", int_br.br_name) self.conf.set_override("external_network_bridge", ext_br.br_name) self.conf.set_override("ovs_all_ports", False) noskip = collections.defaultdict(list) skip = collections.defaultdict(list) # add two vifs and a non-vif port to int_br and ext_br for br in (int_br, ext_br): for i in range(2): noskip[br].append( self.useFixture(net_helpers.OVSPortFixture(br)).port.name) device_name = utils.get_rand_name() skip[br].append(device_name) br.add_port(device_name, ('type', 'internal')) # sanity check for collection in (noskip, skip): for bridge, ports in collection.items(): port_list = bridge.get_port_name_list() for port in ports: self.assertIn(port, port_list) ovs_cleanup.do_main(self.conf) for br in (int_br, ext_br): ports = br.get_port_name_list() for vif in noskip[br]: self.assertNotIn(vif, ports) for port in skip[br]: self.assertIn(port, ports)
def _setUp(self): self.temp_dir = self.useFixture(fixtures.TempDir()).path #we need this bridge before rabbit and neutron service will start self.central_data_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-data')).bridge self.central_external_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-ex')).bridge #Get rabbitmq address (and cnt-data network) rabbitmq_ip_address = self._configure_port_for_rabbitmq() self.rabbitmq_environment = self.useFixture( process.RabbitmqEnvironmentFixture(host=rabbitmq_ip_address)) plugin_cfg_fixture = self.useFixture( config.ML2ConfigFixture(self.env_desc, self.hosts_desc, self.temp_dir, self.env_desc.network_type)) neutron_cfg_fixture = self.useFixture( config.NeutronConfigFixture(self.env_desc, None, self.temp_dir, cfg.CONF.database.connection, self.rabbitmq_environment)) self.neutron_server = self.useFixture( process.NeutronServerFixture(self.env_desc, None, self.test_name, neutron_cfg_fixture, plugin_cfg_fixture)) self.hosts = [self._create_host(desc) for desc in self.hosts_desc] self.wait_until_env_is_up()
def _configure_agent(self, host): conf = self._get_config_opts() l3_agent_main.register_opts(conf) cfg.CONF.set_override('debug', False) agent_config.setup_logging() conf.set_override('interface_driver', 'neutron.agent.linux.interface.OVSInterfaceDriver') conf.set_override('router_delete_namespaces', True) br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge br_ex = self.useFixture(net_helpers.OVSBridgeFixture()).bridge conf.set_override('ovs_integration_bridge', br_int.br_name) conf.set_override('external_network_bridge', br_ex.br_name) temp_dir = self.get_new_temp_dir() get_temp_file_path = functools.partial(self.get_temp_file_path, root=temp_dir) conf.set_override('state_path', temp_dir.path) conf.set_override('metadata_proxy_socket', get_temp_file_path('metadata_proxy')) conf.set_override('ha_confs_path', get_temp_file_path('ha_confs')) conf.set_override('external_pids', get_temp_file_path('external/pids')) conf.set_override('host', host) agent = neutron_l3_agent.L3NATAgentWithStateReport(host, conf) mock.patch.object(ip_lib, '_arping').start() return agent
def _configure_agent(self, host, agent_mode='dvr_snat'): conf = self._get_config_opts() l3_agent_main.register_opts(conf) conf.set_override('interface_driver', self.INTERFACE_DRIVER) br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge br_ex = self.useFixture(net_helpers.OVSBridgeFixture()).bridge conf.set_override('ovs_integration_bridge', br_int.br_name) conf.set_override('external_network_bridge', br_ex.br_name) temp_dir = self.get_new_temp_dir() get_temp_file_path = functools.partial(self.get_temp_file_path, root=temp_dir) conf.set_override('state_path', temp_dir.path) # NOTE(cbrandily): log_file or log_dir must be set otherwise # metadata_proxy_watch_log has no effect conf.set_override('log_file', get_temp_file_path('log_file')) conf.set_override('metadata_proxy_socket', get_temp_file_path('metadata_proxy')) conf.set_override('ha_confs_path', get_temp_file_path('ha_confs')) conf.set_override('external_pids', get_temp_file_path('external/pids')) conf.set_override('host', host) conf.set_override('agent_mode', agent_mode) return conf
def setup_host_with_ovs_agent(self): agent_cfg_fixture = config.OVSConfigFixture( self.env_desc, self.host_desc, self.neutron_config.temp_dir, self.local_ip, test_name=self.test_name) self.useFixture(agent_cfg_fixture) self.br_phys = self.useFixture( net_helpers.OVSBridgeFixture( agent_cfg_fixture.get_br_phys_name())).bridge if self.env_desc.tunneling_enabled: self.useFixture( net_helpers.OVSBridgeFixture( agent_cfg_fixture.get_br_tun_name())).bridge self.connect_to_central_network_via_tunneling() else: self.connect_to_central_network_via_vlans(self.br_phys) self.ovs_agent = self.useFixture( process.OVSAgentFixture( self.env_desc, self.host_desc, self.test_name, self.neutron_config, agent_cfg_fixture)) if self.host_desc.l3_agent: self.l3_agent_cfg_fixture = self.useFixture( config.L3ConfigFixture( self.env_desc, self.host_desc, self.neutron_config.temp_dir, self.ovs_agent.agent_cfg_fixture.get_br_int_name())) if self.host_desc.dhcp_agent: self.dhcp_agent_cfg_fixture = self.useFixture( config.DhcpConfigFixture( self.env_desc, self.host_desc, self.neutron_config.temp_dir, self.ovs_agent.agent_cfg_fixture.get_br_int_name()))
def setUp(self): super(TestDestroyPatchPorts, self).setUp() self.int_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge bridge_mappings = {} self.bridges = [] for network in ('foo', 'bar'): bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self._create_patch_ports_to_int_br(bridge) self.bridges.append(bridge) bridge_mappings[network] = bridge.br_name self.config = self._create_config_file(bridge_mappings)
def _setUp(self): self.useFixture(net_helpers.OVSBridgeFixture(self._get_br_int_name())) self.useFixture(net_helpers.OVSBridgeFixture(self._get_br_phys_name())) config_filenames = [self.neutron_cfg_fixture.filename, self.plugin_cfg_fixture.filename] self.process_fixture = self.useFixture(ProcessFixture( test_name=self.test_name, process_name=self.NEUTRON_OVS_AGENT, exec_name=self.NEUTRON_OVS_AGENT, config_filenames=config_filenames))
def _setUp(self): self.temp_dir = self.useFixture(fixtures.TempDir()).path # We need this bridge before rabbit and neutron service will start self.central_data_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-data')).bridge self.central_external_bridge = self.useFixture( net_helpers.OVSBridgeFixture('cnt-ex')).bridge # Get rabbitmq address (and cnt-data network) rabbitmq_ip_address = self._configure_port_for_rabbitmq() self.rabbitmq_environment = self.useFixture( neutron_proc.RabbitmqEnvironmentFixture(host=rabbitmq_ip_address)) plugin_cfg_fixture = self.useFixture( bagpipe_ml2_cfg.ML2ConfigFixture(self.env_desc, self.hosts_desc, self.temp_dir, self.env_desc.network_type)) neutron_cfg_fixture = self.useFixture( bgpvpn_cfg.NeutronConfigFixture(self.env_desc, None, self.temp_dir, cfg.CONF.database.connection, self.rabbitmq_environment)) service_cfg_fixtures = list() if self.env_desc.bgpvpn: service_cfg_fixtures.append( self.useFixture( bgpvpn_cfg.BGPVPNProviderConfigFixture( self.env_desc, self.hosts_desc, self.temp_dir))) self.neutron_server = self.useFixture( neutron_proc.NeutronServerFixture(self.env_desc, None, self.test_name, neutron_cfg_fixture, plugin_cfg_fixture, service_cfg_fixtures)) gobgp_host = self._create_gobgp_host(rabbitmq_ip_address) self.hosts = [ self._bagpipe_host_fixture(desc, rabbitmq_ip_address, gobgp_host.bgp_port) for desc in self.hosts_desc ] gobgp_host.hosts = self.hosts self.useFixture(gobgp_host) self.wait_until_env_is_up()
def test_get_events(self): utils.wait_until_true(lambda: self.monitor.has_updates) devices = self.monitor.get_events() self.assertTrue(devices.get('added'), 'Initial call should always be true') br = self.useFixture(net_helpers.OVSBridgeFixture()) p1 = self.useFixture(net_helpers.OVSPortFixture(br.bridge)) p2 = self.useFixture(net_helpers.OVSPortFixture(br.bridge)) added_devices = [p1.port.name, p2.port.name] utils.wait_until_true( lambda: self._expected_devices_events(added_devices, 'added')) br.bridge.delete_port(p1.port.name) br.bridge.delete_port(p2.port.name) removed_devices = [p1.port.name, p2.port.name] utils.wait_until_true( lambda: self._expected_devices_events(removed_devices, 'removed')) # restart self.monitor.stop(block=True) # NOTE(slaweq): lets give async process few more seconds to receive # "error" from the old ovsdb monitor process and then start new one time.sleep(5) self.monitor.start(block=True, timeout=60) try: utils.wait_until_true( lambda: self.monitor.get_events().get('added')) except utils.WaitTimeout: raise AssertionError('Initial call should always be true')
def setUp(self): super(TestMonitorDaemon, self).setUp() self.conf_dir = self.get_default_temp_dir().path self.pid_file = os.path.join(self.conf_dir, 'pid_file') self.log_file = os.path.join(self.conf_dir, 'log_file') self.state_file = os.path.join(self.conf_dir, 'keepalived-state-change') self.cidr = '169.254.151.1/24' bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.machines = self.useFixture(mf.PeerMachines(bridge)) self.router, self.peer = self.machines.machines[:2] self.router_id = uuidutils.generate_uuid() self._generate_cmd_opts() self.ext_process = external_process.ProcessManager( conf=None, uuid=self.router_id, namespace=self.router.namespace, service='test_ip_mon', pids_path=self.conf_dir, default_cmd_callback=self._callback, run_as_root=True, pid_file=self.pid_file) server = linux_utils.UnixDomainWSGIServer( 'neutron-keepalived-state-change', num_threads=1) server.start(ha.KeepalivedStateChangeHandler(mock.Mock()), self.state_file, workers=0, backlog=ha.KEEPALIVED_STATE_CHANGE_SERVER_BACKLOG) self.addCleanup(server.stop)
def test_resync_ancillary_devices(self): external_bridge = self.useFixture( net_helpers.OVSBridgeFixture()).bridge self.setup_agent_and_ports(port_dicts=self.create_test_ports(), ancillary_bridge=external_bridge, trigger_resync=True) self.wait_until_ports_state(self.ports, up=True)
def _configure_agent(self, host): """Override specific config options""" config = self._get_config_opts() l3_agent_main.register_opts(config) cfg.CONF.set_override('debug', True) agent_config.setup_logging() config.set_override('extensions', ['vpnaas'], 'agent') config.set_override( 'interface_driver', 'neutron.agent.linux.interface.OVSInterfaceDriver') br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge config.set_override('ovs_integration_bridge', br_int.br_name) temp_dir = self.get_new_temp_dir() get_temp_file_path = functools.partial(self.get_temp_file_path, root=temp_dir) config.set_override('state_path', temp_dir.path) config.set_override('metadata_proxy_socket', get_temp_file_path('metadata_proxy')) config.set_override('ha_confs_path', get_temp_file_path('ha_confs')) config.set_override('external_pids', get_temp_file_path('external/pids')) config.set_override('host', host) ipsec_config_base_dir = '%s/%s' % (temp_dir.path, 'ipsec') config.set_override('config_base_dir', ipsec_config_base_dir, group='ipsec') # Assign ip address to br-int port because it is a gateway ex_port = ip_lib.IPDevice(br_int.br_name) ex_port.addr.add(str(PUBLIC_NET[1])) return config
def test_get_events(self): utils.wait_until_true(lambda: self.monitor.data_received is True) devices = self.monitor.get_events() self.assertTrue(devices.get('added'), 'Initial call should always be true') p_attrs = [('external_ids', {'iface-status': 'active'})] br = self.useFixture(net_helpers.OVSBridgeFixture()) p1 = self.useFixture( net_helpers.OVSPortFixture(br.bridge, None, p_attrs)) p2 = self.useFixture( net_helpers.OVSPortFixture(br.bridge, None, p_attrs)) added_devices = [p1.port.name, p2.port.name] utils.wait_until_true( lambda: self._expected_devices_events(added_devices, 'added')) br.bridge.delete_port(p1.port.name) br.bridge.delete_port(p2.port.name) removed_devices = [p1.port.name, p2.port.name] utils.wait_until_true( lambda: self._expected_devices_events(removed_devices, 'removed')) # restart self.monitor.stop(block=True) self.monitor.start(block=True, timeout=60) devices = self.monitor.get_events() self.assertTrue(devices.get('added'), 'Initial call should always be true')
def test_plug_with_namespace_sets_mtu_higher_than_bridge(self): device_mtu = 1450 # Create a new OVS bridge ovs_bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.assertFalse(ovs_bridge.get_port_name_list()) # Add a new linuxbridge port with reduced MTU to OVS bridge lb_bridge = self.useFixture(net_helpers.LinuxBridgeFixture()).bridge lb_bridge_port = self.useFixture( net_helpers.LinuxBridgePortFixture(lb_bridge)) lb_bridge_port.port.link.set_mtu(device_mtu - 1) ovs_bridge.add_port(lb_bridge_port.port.name) # Now plug a device with intended MTU that is higher than for the port # above and validate that its MTU is not reduced to the least MTU on # the bridge device_name = utils.get_rand_name() mac_address = utils.get_random_mac('fa:16:3e:00:00:00'.split(':')) namespace = self.useFixture(net_helpers.NamespaceFixture()).name self.interface.plug(network_id=uuidutils.generate_uuid(), port_id=uuidutils.generate_uuid(), device_name=device_name, mac_address=mac_address, bridge=ovs_bridge.br_name, namespace=namespace, mtu=device_mtu) self.assertIn(device_name, ovs_bridge.get_port_name_list()) self.assertTrue(ip_lib.device_exists(device_name, namespace)) self.assertEqual( device_mtu, ip_lib.IPDevice(device_name, namespace=namespace).link.mtu)
def _setUp(self): super(OVSConnectionTester, self)._setUp() self.bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self._peer, self._vm = self.useFixture( machine_fixtures.PeerMachines(self.bridge, self.ip_cidr)).machines self._set_port_attrs(self._peer.port) self._set_port_attrs(self._vm.port)
def setUp(self): super(DHCPAgentOVSTestFramework, self).setUp() config.setup_logging() self.conf_fixture = self.useFixture(fixture_config.Config()) self.conf = self.conf_fixture.conf dhcp_agent.register_options(self.conf) # NOTE(cbrandily): TempDir fixture creates a folder with 0o700 # permissions but agent dir must be readable by dnsmasq user (nobody) agent_config_dir = self.useFixture(fixtures.TempDir()).path self.useFixture( helpers.RecursivePermDirFixture(agent_config_dir, 0o555)) self.conf.set_override("dhcp_confs", agent_config_dir) self.conf.set_override( 'interface_driver', 'neutron.agent.linux.interface.OVSInterfaceDriver') self.conf.set_override('report_interval', 0, 'AGENT') br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.conf.set_override('integration_bridge', br_int.br_name, 'OVS') self.mock_plugin_api = mock.patch( 'neutron.agent.dhcp.agent.DhcpPluginApi').start().return_value mock.patch('neutron.agent.rpc.PluginReportStateAPI').start() self.agent = agent.DhcpAgentWithStateReport('localhost') self.ovs_driver = interface.OVSInterfaceDriver(self.conf) self.conf.set_override('check_child_processes_interval', 1, 'AGENT')
def _add_new_bridge_and_restart_agent(self, host): l2_agent = host.l2_agent l2_agent_config = l2_agent.agent_cfg_fixture.config if 'ovs' in host.agents: new_dev = utils.get_rand_device_name(prefix='br-new') self._change_agent_conf_and_restart_agent(l2_agent_config['ovs'], l2_agent, self.BR_MAPPINGS, new_dev) physnets = self._get_physnet_names_from_mapping( l2_agent_config['ovs'][self.BR_MAPPINGS]) br_phys_new = host.useFixture( net_helpers.OVSBridgeFixture(new_dev)).bridge host.connect_to_central_network_via_vlans(br_phys_new) elif 'sriov' in host.agents: new_dev = utils.get_rand_device_name(prefix='ens7') self._change_agent_conf_and_restart_agent( l2_agent_config['sriov_nic'], l2_agent, 'physical_device_mappings', new_dev) physnets = self._get_physnet_names_from_mapping( l2_agent_config['sriov_nic']['physical_device_mappings']) l2_agent.restart() return physnets
def test_interface_monitor_filtering(self): br_1 = self.useFixture(net_helpers.OVSBridgeFixture()).bridge br_2 = self.useFixture(net_helpers.OVSBridgeFixture()).bridge mon_no_filter = ovsdb_monitor.SimpleInterfaceMonitor( respawn_interval=30, ovsdb_connection=cfg.CONF.OVS.ovsdb_connection) mon_no_filter.start(block=True) mon_br_1 = ovsdb_monitor.SimpleInterfaceMonitor( respawn_interval=30, ovsdb_connection=cfg.CONF.OVS.ovsdb_connection, bridge_names=[br_1.br_name], ovs=br_1) mon_br_1.start(block=True) mon_br_2 = ovsdb_monitor.SimpleInterfaceMonitor( respawn_interval=30, ovsdb_connection=cfg.CONF.OVS.ovsdb_connection, bridge_names=[br_2.br_name], ovs=br_1) mon_br_2.start(block=True) self.addCleanup(self._stop_monitors, [mon_no_filter, mon_br_1, mon_br_2]) p1 = self.useFixture(net_helpers.OVSPortFixture(br_1)) p2 = self.useFixture(net_helpers.OVSPortFixture(br_2)) ports_expected = {p1.port.name, p2.port.name} try: common_utils.wait_until_true(lambda: not self._check_port_events( mon_no_filter, ports_expected=ports_expected), timeout=5) except common_utils.WaitTimeout: self.fail('Interface monitor not filtered did not received an ' 'event for ports %s' % ports_expected) self.assertIs( 0, len( self._check_port_events(mon_br_1, ports_expected={p1.port.name}, ports_not_expected={p2.port.name}))) self.assertIs( 0, len( self._check_port_events(mon_br_2, ports_expected={p2.port.name}, ports_not_expected={p1.port.name})))
def setUp(self): super(OVSAgentTestBase, self).setUp() self.br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.start_of_controller(cfg.CONF) self.br_int = self.br_int_cls(self.br.br_name) self.br_int.set_secure_mode() self.br_int.setup_controllers(cfg.CONF) self.br_int.setup_default_table()
def _setUp(self): if self.env_desc.bgpvpn: self.mpls_bridge = self.useFixture( net_helpers.OVSBridgeFixture( self.generate_mpls_bridge())).bridge self.mpls_bridge.set_secure_mode() super(BaGPipeHost, self)._setUp() self.setup_host_with_bagpipe_bgp()
def test_get_vif_port_set_on_empty_bridge_returns_empty_set(self): # Create a port on self.br self.create_ovs_vif_port() # Create another, empty bridge br_2 = self.useFixture(net_helpers.OVSBridgeFixture()).bridge # Assert that get_vif_port_set on an empty bridge returns an empty set, # and does not return the other bridge's ports. self.assertEqual(set(), br_2.get_vif_port_set())
def setUp(self): super(TrunkManagerDisposeTrunkTestCase, self).setUp() trunk_id = uuidutils.generate_uuid() self.trunk = trunk_manager.TrunkParentPort(trunk_id, uuidutils.generate_uuid()) self.trunk.bridge = self.useFixture( net_helpers.OVSTrunkBridgeFixture( self.trunk.bridge.br_name)).bridge self.br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.trunk_manager = trunk_manager.TrunkManager(self.br_int)
def test_resync_ancillary_dev_up_after_failure(self): external_bridge = self.useFixture( net_helpers.OVSBridgeFixture()).bridge self.setup_agent_and_ports(port_dicts=self.create_test_ports(), ancillary_bridge=external_bridge, failed_dev_up=True) # in the RPC mock the first port fails and should # be re-synced expected_ports = self.ports + [self.ports[0]] self.wait_until_ports_state(expected_ports, up=True)
def setUp(self): super(TrunkParentPortTestCase, self).setUp() trunk_id = uuidutils.generate_uuid() port_id = uuidutils.generate_uuid() port_mac = net.get_random_mac('fa:16:3e:00:00:00'.split(':')) self.trunk = trunk_manager.TrunkParentPort(trunk_id, port_id, port_mac) self.trunk.bridge = self.useFixture( net_helpers.OVSTrunkBridgeFixture( self.trunk.bridge.br_name)).bridge self.br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
def _setUp(self): super(OVSTrunkConnectionTester, self)._setUp() self.bridge = self.useFixture(net_helpers.OVSBridgeFixture()).bridge self.br_trunk = self.useFixture( net_helpers.OVSTrunkBridgeFixture(self._br_trunk_name)).bridge self._peer = self.useFixture( machine_fixtures.FakeMachine(self.bridge, self.ip_cidr)) ip_cidr = net_helpers.increment_ip_cidr(self.ip_cidr, 1) self._vm = self.useFixture( machine_fixtures.FakeMachine(self.br_trunk, ip_cidr))