]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add native of_interface fullstack tests
authorIWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Wed, 26 Aug 2015 06:15:00 +0000 (15:15 +0900)
committerIWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Tue, 1 Dec 2015 07:10:45 +0000 (16:10 +0900)
Related-blueprint: ovs-ofctl-to-python
Change-Id: Idb683522fc104cb04720cf431891ef07db5e7b2d

neutron/tests/fullstack/resources/config.py
neutron/tests/fullstack/resources/environment.py
neutron/tests/fullstack/test_connectivity.py

index a1c8450cdfd8d3e1dd4a97cd3832d9e6c82b5c50..6384f0703e3d4d586c350e4439a75a9d6764a110 100644 (file)
@@ -23,6 +23,16 @@ from neutron.tests.common import helpers as c_helpers
 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.
 
@@ -62,7 +72,7 @@ class NeutronConfigFixture(ConfigFixture):
                 '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',
@@ -90,15 +100,6 @@ class NeutronConfigFixture(ConfigFixture):
         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')
 
@@ -148,6 +149,7 @@ class OVSConfigFixture(ConfigFixture):
             '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.'
@@ -158,6 +160,10 @@ class OVSConfigFixture(ConfigFixture):
             }
         })
 
+        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})
index a70aa9136167e12f44be422c55a91ece30916abf..62c8d0adb39285355564b4a515bb6ad83da05b32 100644 (file)
@@ -50,8 +50,9 @@ class HostDescription(object):
     What agents should the host spawn? What mode should each agent operate
     under?
     """
-    def __init__(self, l3_agent=False):
+    def __init__(self, l3_agent=False, of_interface='ovs-ofctl'):
         self.l3_agent = l3_agent
+        self.of_interface = of_interface
 
 
 class Host(fixtures.Fixture):
index 57ff43560b4162a6969e4a87d357ff5a87701e46..31ad8f1c025af7530fe44fba50373acff8ab239a 100644 (file)
@@ -26,13 +26,18 @@ load_tests = testscenarios.load_tests_apply_scenarios
 
 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 = [
@@ -40,7 +45,8 @@ class TestConnectivitySameNetwork(base.BaseFullStackTestCase):
             # 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,