From: Cedric Brandily Date: Fri, 15 May 2015 16:10:09 +0000 (+0200) Subject: Use namespace names in NetcatTester X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b91c4e3f874407de07feef338aa2f9a0faafdadd;p=openstack-build%2Fneutron-build.git Use namespace names in NetcatTester 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 --- diff --git a/neutron/tests/functional/agent/linux/helpers.py b/neutron/tests/functional/agent/linux/helpers.py index 6e003b515..ed4d1b0ea 100644 --- a/neutron/tests/functional/agent/linux/helpers.py +++ b/neutron/tests/functional/agent/linux/helpers.py @@ -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) diff --git a/neutron/tests/functional/agent/linux/test_iptables.py b/neutron/tests/functional/agent/linux/test_iptables.py index 43a8dc7b4..7b2b0a722 100644 --- a/neutron/tests/functional/agent/linux/test_iptables.py +++ b/neutron/tests/functional/agent/linux/test_iptables.py @@ -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' diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py index cda969ced..98e5d661e 100644 --- a/neutron/tests/functional/agent/test_l3_agent.py +++ b/neutron/tests/functional/agent/test_l3_agent.py @@ -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)