summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Prokes <jirix.x.prokes@intel.com>2017-11-20 04:09:11 -0800
committerJiri Prokes <jirix.x.prokes@intel.com>2017-12-19 05:18:53 -0800
commitcc14902afe897d5402dcdd655587113fab420350 (patch)
treed325ee1a780e0ab01aa3e16f7db8be6d9fa95a16
parente268fa7ae7c17604ecad787d6940fdf77426dc0f (diff)
Variable local_iface_name is read before it is set
Moving variable setting before reading Verified via TC: yardstick/samples/vnf_samples/nsut/ping/tc_ping_heat_context.yaml JIRA: YARDSTICK-899 Change-Id: Ia2feac1ed4e67dccd02446ba27afc9d40e87be35 Signed-off-by: Jiri Prokes <jirix.x.prokes@intel.com>
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py8
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_ping.py3
2 files changed, 5 insertions, 6 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
index c1b2d27eb..ab3570740 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
@@ -228,7 +228,7 @@ class TestPingTrafficGen(unittest.TestCase):
CMD_KWARGS = {
'target_ip': u'152.16.100.20',
'local_ip': u'152.16.100.19',
- 'local_if_name': u'xe0',
+ 'local_if_name': u'xe0_fake',
}
@mock.patch("yardstick.ssh.SSH")
@@ -270,7 +270,7 @@ class TestPingTrafficGen(unittest.TestCase):
mock_ssh(ssh, spec=VnfSshHelper, exec_result=(0, "success", ""))
ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
ping_traffic_gen.setup_helper.ssh_helper = mock.MagicMock(
- **{"execute.return_value": (0, "success", "")})
+ **{"execute.return_value": (0, "xe0_fake", "")})
self.assertIsInstance(ping_traffic_gen.ssh_helper, mock.Mock)
self.assertEqual(ping_traffic_gen._result, {})
@@ -278,12 +278,12 @@ class TestPingTrafficGen(unittest.TestCase):
self.assertEqual(
ping_traffic_gen.vnfd_helper.interfaces[0]['virtual-interface']['local_iface_name'],
- 'success')
+ 'xe0_fake')
self.assertEqual(self.CMD_KWARGS, ping_traffic_gen.resource_helper.cmd_kwargs)
self.assertIsNotNone(ping_traffic_gen._result)
@mock.patch("yardstick.ssh.SSH")
- def test_listen_traffic(self, ssh):
+ def test_listen_traffic(self, *args):
ping_traffic_gen = PingTrafficGen('vnf1', self.VNFD_0)
self.assertIsNone(ping_traffic_gen.listen_traffic({}))
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ping.py b/yardstick/network_services/vnf_generic/vnf/tg_ping.py
index 30a917862..5238a5f02 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_ping.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_ping.py
@@ -126,11 +126,10 @@ class PingTrafficGen(SampleVNFTrafficGen):
"packets_received": 0,
"rtt": 0,
}
+ self.setup_helper.setup_vnf_environment()
intf = self.vnfd_helper.interfaces[0]["virtual-interface"]
self.resource_helper.cmd_kwargs = {
'target_ip': IPv4Interface(intf["dst_ip"]).ip.exploded,
'local_ip': IPv4Interface(intf["local_ip"]).ip.exploded,
'local_if_name': intf["local_iface_name"].split('/')[0],
}
-
- self.setup_helper.setup_vnf_environment()