from neutron.tests.common import net_helpers
+def _generate_port():
+ """Get a free TCP port from the Operating System and return it.
+
+ This might fail if some other process occupies this port after this
+ function finished but before the neutron-server process started.
+ """
+ return str(net_helpers.get_free_namespace_port(
+ constants.PROTO_NAME_TCP))
+
+
class ConfigFixture(fixtures.Fixture):
"""A fixture that holds an actual Neutron configuration.
'host': self._generate_host(),
'state_path': self._generate_state_path(self.temp_dir),
'lock_path': '$state_path/lock',
- 'bind_port': self._generate_port(),
+ 'bind_port': _generate_port(),
'api_paste_config': self._generate_api_paste(),
'policy_file': self._generate_policy_json(),
'core_plugin': 'neutron.plugins.ml2.plugin.Ml2Plugin',
self.state_path = tempfile.mkdtemp(prefix='state_path', dir=temp_dir)
return self.state_path
- def _generate_port(self):
- """Get a free TCP port from the Operating System and return it.
-
- This might fail if some other process occupies this port after this
- function finished but before the neutron-server process started.
- """
- return str(net_helpers.get_free_namespace_port(
- constants.PROTO_NAME_TCP))
-
def _generate_api_paste(self):
return c_helpers.find_sample_file('api-paste.ini')
'ovs': {
'local_ip': local_ip,
'integration_bridge': self._generate_integration_bridge(),
+ 'of_interface': host_desc.of_interface,
},
'securitygroup': {
'firewall_driver': ('neutron.agent.linux.iptables_firewall.'
}
})
+ if self.config['ovs']['of_interface'] == 'native':
+ self.config['ovs'].update({
+ 'of_listen_port': _generate_port()})
+
if self.tunneling_enabled:
self.config['agent'].update({
'tunnel_types': self.env_desc.network_type})
class TestConnectivitySameNetwork(base.BaseFullStackTestCase):
- scenarios = [
+ network_scenarios = [
('VXLAN', {'network_type': 'vxlan',
'l2_pop': False}),
('GRE and l2pop', {'network_type': 'gre',
'l2_pop': True}),
('VLANs', {'network_type': 'vlan',
'l2_pop': False})]
+ interface_scenarios = [
+ ('Ofctl', {'of_interface': 'ovs-ofctl'}),
+ ('Native', {'of_interface': 'native'})]
+ scenarios = testscenarios.multiply_scenarios(
+ network_scenarios, interface_scenarios)
def setUp(self):
host_descriptions = [
# is enabled, because l2pop code makes assumptions about the
# agent types present on machines.
environment.HostDescription(
- l3_agent=self.l2_pop) for _ in range(2)]
+ l3_agent=self.l2_pop,
+ of_interface=self.of_interface) for _ in range(2)]
env = environment.Environment(
environment.EnvironmentDescription(
network_type=self.network_type,