]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use namespace names in NetcatTester
authorCedric Brandily <zzelle@gmail.com>
Fri, 15 May 2015 16:10:09 +0000 (18:10 +0200)
committerCedric Brandily <zzelle@gmail.com>
Fri, 15 May 2015 23:37:06 +0000 (01:37 +0200)
Currently NetcatTester requests namespace IPWrapper instances as
client/server_namespace arguments but functional tests commonly use
namespace names as arguments not IPWrapper instances (because IPWrapper
is cheap to instantiate) and NetcatTester needs only namespace names.

This change requests names as NetcatTester client/server_namespace
arguments in order to simplify NetcatTester and its use.

Change-Id: Ic4a297efdeaef00e70892d1c871ce1c9174055b8

neutron/tests/functional/agent/linux/helpers.py
neutron/tests/functional/agent/linux/test_iptables.py
neutron/tests/functional/agent/test_l3_agent.py

index 6e003b515a09b385e531651adc1df4c032739b35..ed4d1b0eade3861cf3d519d72653448b47bedf6b 100644 (file)
@@ -171,7 +171,7 @@ class NetcatTester(object):
             if not self._server_process:
                 self._spawn_server_process()
             self._client_process = self._spawn_nc_in_namespace(
-                self.client_namespace.namespace,
+                self.client_namespace,
                 address=self.client_address)
         return self._client_process
 
@@ -183,7 +183,7 @@ class NetcatTester(object):
 
     def _spawn_server_process(self):
         self._server_process = self._spawn_nc_in_namespace(
-            self.server_namespace.namespace,
+            self.server_namespace,
             address=self.server_address,
             listen=True)
 
index 43a8dc7b4f49ccb1ff3bc7afbe76602a02cf62cb..7b2b0a722d46c655059d19074d3c3625066562e7 100644 (file)
@@ -16,7 +16,6 @@ import os.path
 
 import testtools
 
-from neutron.agent.linux import ip_lib
 from neutron.agent.linux import iptables_manager
 from neutron.agent.linux import utils
 from neutron.tests import base
@@ -80,8 +79,7 @@ class IptablesManagerTestCase(functional_base.BaseSudoTestCase):
 
     def _test_with_nc(self, fw_manager, direction, port, udp):
         netcat = helpers.NetcatTester(
-            ip_lib.IPWrapper(self.client.namespace),
-            ip_lib.IPWrapper(self.server.namespace),
+            self.client.namespace, self.server.namespace,
             self.server.ip, self.port, run_as_root=True, udp=udp)
         self.addCleanup(netcat.stop_processes)
         protocol = 'tcp'
index cda969ced4f65b1ae5a6136e9d5c6ba105ca2b2b..98e5d661e119fdccaf097753f8a7f0dd025eba74 100644 (file)
@@ -409,7 +409,7 @@ class L3AgentTestCase(L3AgentTestFramework):
         router.process(self.agent)
 
         router_ns = ip_lib.IPWrapper(namespace=router.ns_name)
-        netcat = helpers.NetcatTester(router_ns, router_ns,
+        netcat = helpers.NetcatTester(router.ns_name, router.ns_name,
                                       server_address, port,
                                       client_address=client_address,
                                       run_as_root=True,
@@ -708,8 +708,7 @@ class L3AgentTestCase(L3AgentTestFramework):
         protocol_port = helpers.get_free_namespace_port(dst_machine.namespace)
         # client sends to fip
         netcat = helpers.NetcatTester(
-            ip_lib.IPWrapper(src_machine.namespace),
-            ip_lib.IPWrapper(dst_machine.namespace),
+            src_machine.namespace, dst_machine.namespace,
             dst_machine.ip, protocol_port, client_address=dst_fip,
             run_as_root=True, udp=False)
         self.addCleanup(netcat.stop_processes)