aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py3
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_network.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_port.py34
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_router.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py36
-rw-r--r--tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py37
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_vnf_generic.py6
-rw-r--r--tests/unit/network_services/libs/ixia_libs/test_IxNet.py24
-rw-r--r--tests/unit/test_ssh.py4
-rw-r--r--yardstick/benchmark/contexts/heat.py1
-rw-r--r--yardstick/benchmark/contexts/model.py1
-rw-r--r--yardstick/benchmark/scenarios/lib/create_server.py2
-rw-r--r--yardstick/benchmark/scenarios/lib/delete_network.py55
-rw-r--r--yardstick/benchmark/scenarios/lib/delete_port.py54
-rw-r--r--yardstick/benchmark/scenarios/lib/delete_router.py55
-rw-r--r--yardstick/benchmark/scenarios/lib/delete_router_gateway.py55
-rw-r--r--yardstick/benchmark/scenarios/lib/delete_router_interface.py57
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py8
-rw-r--r--yardstick/common/openstack_utils.py40
-rw-r--r--yardstick/common/utils.py2
-rw-r--r--yardstick/network_services/helpers/samplevnf_helper.py14
-rw-r--r--yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py4
-rwxr-xr-xyardstick/network_services/nfvi/collectd.sh36
-rw-r--r--yardstick/network_services/nfvi/resource.py6
-rw-r--r--yardstick/network_services/traffic_profile/ixia_rfc2544.py2
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py3
26 files changed, 558 insertions, 53 deletions
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index 658a8e580..cc0c7bc8e 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -185,9 +185,7 @@ class HeatContextTestCase(unittest.TestCase):
def test_add_server_port(self):
network1 = mock.MagicMock()
- network1.vld_id = 'vld111'
network2 = mock.MagicMock()
- network2.vld_id = 'vld777'
self.test_context.name = 'foo'
self.test_context.stack = mock.MagicMock()
self.test_context.networks = {
@@ -229,7 +227,6 @@ class HeatContextTestCase(unittest.TestCase):
"network_name": 'a',
"local_mac": '00:01',
"local_ip": '10.20.30.45',
- "vld_id": 'vld111',
}
self.test_context.add_server_port(server)
self.assertEqual(server.private_ip, '10.20.30.45')
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_network.py b/tests/unit/benchmark/scenarios/lib/test_delete_network.py
new file mode 100644
index 000000000..9ccaa8232
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_network.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import unittest
+import mock
+import paramiko
+
+from yardstick.benchmark.scenarios.lib.delete_network import DeleteNetwork
+
+
+class DeleteNetworkTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
+ @mock.patch('yardstick.common.openstack_utils.delete_neutron_net')
+ def test_delete_network(self, mock_get_neutron_client, mock_delete_neutron_net):
+ options = {
+ 'network_id': '123-123-123'
+ }
+ args = {"options": options}
+ obj = DeleteNetwork(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_neutron_client.called)
+ self.assertTrue(mock_delete_neutron_net.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_port.py b/tests/unit/benchmark/scenarios/lib/test_delete_port.py
new file mode 100644
index 000000000..77b9c7009
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_port.py
@@ -0,0 +1,34 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import unittest
+import mock
+import paramiko
+
+from yardstick.benchmark.scenarios.lib.delete_port import DeletePort
+
+
+class DeletePortTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
+ def test_delete_port(self, mock_get_neutron_client):
+ options = {
+ 'port_id': '123-123-123'
+ }
+ args = {"options": options}
+ obj = DeletePort(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_neutron_client.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_router.py b/tests/unit/benchmark/scenarios/lib/test_delete_router.py
new file mode 100644
index 000000000..ab1ad5d35
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_router.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import unittest
+import mock
+import paramiko
+
+from yardstick.benchmark.scenarios.lib.delete_router import DeleteRouter
+
+
+class DeleteRouterTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
+ @mock.patch('yardstick.common.openstack_utils.delete_neutron_router')
+ def test_delete_router(self, mock_get_neutron_client, mock_delete_neutron_router):
+ options = {
+ 'router_id': '123-123-123'
+ }
+ args = {"options": options}
+ obj = DeleteRouter(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_neutron_client.called)
+ self.assertTrue(mock_delete_neutron_router.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py b/tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py
new file mode 100644
index 000000000..1150dccda
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_router_gateway.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import unittest
+import mock
+import paramiko
+
+from yardstick.benchmark.scenarios.lib.delete_router_gateway import DeleteRouterGateway
+
+
+class DeleteRouterGatewayTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
+ @mock.patch('yardstick.common.openstack_utils.remove_gateway_router')
+ def test_delete_router_gateway(self, mock_get_neutron_client, mock_remove_gateway_router):
+ options = {
+ 'router_id': '123-123-123'
+ }
+ args = {"options": options}
+ obj = DeleteRouterGateway(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_neutron_client.called)
+ self.assertTrue(mock_remove_gateway_router.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py b/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py
new file mode 100644
index 000000000..2cc9c9f37
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/lib/test_delete_router_interface.py
@@ -0,0 +1,37 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import unittest
+import mock
+import paramiko
+
+from yardstick.benchmark.scenarios.lib.delete_router_interface import DeleteRouterInterface
+
+
+class DeleteRouterInterfaceTestCase(unittest.TestCase):
+
+ @mock.patch('yardstick.common.openstack_utils.get_neutron_client')
+ @mock.patch('yardstick.common.openstack_utils.remove_interface_router')
+ def test_delete_router_interface(self, mock_get_neutron_client, mock_remove_interface_router):
+ options = {
+ 'router_id': '123-123-123',
+ 'subnet_id': '321-321-321'
+ }
+ args = {"options": options}
+ obj = DeleteRouterInterface(args, {})
+ obj.run({})
+ self.assertTrue(mock_get_neutron_client.called)
+ self.assertTrue(mock_remove_interface_router.called)
+
+
+def main():
+ unittest.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index df5047a0d..fe7b6a57f 100644
--- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -362,7 +362,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
def test__get_ip_flow_range(self):
self.scenario_cfg["traffic_options"]["flow"] = \
self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml")
- result = '152.16.100.1-152.16.100.254'
+ result = '152.16.100.2-152.16.100.254'
self.assertEqual(result, self.s._get_ip_flow_range({"tg__1": 'xe0'}))
def test___get_traffic_flow(self):
@@ -384,8 +384,8 @@ class TestNetworkServiceTestCase(unittest.TestCase):
'public_ip': ['1.1.1.1'],
},
}
- result = {'flow': {'dst_ip0': '152.16.40.1-152.16.40.254',
- 'src_ip0': '152.16.100.1-152.16.100.254'}}
+ result = {'flow': {'dst_ip0': '152.16.40.2-152.16.40.254',
+ 'src_ip0': '152.16.100.2-152.16.100.254'}}
self.assertEqual(result, self.s._get_traffic_flow())
diff --git a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
index ae4c58de1..7fe83406a 100644
--- a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
+++ b/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
@@ -268,7 +268,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v4(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -308,7 +308,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -366,7 +366,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v4_nothing_to_do(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -406,7 +406,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -464,7 +464,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v6(self):
static_traffic_profile = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -497,7 +497,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -547,7 +547,7 @@ class TestIxNextgen(unittest.TestCase):
def test_add_ip_header_v6_nothing_to_do(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -579,7 +579,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -684,7 +684,7 @@ class TestIxNextgen(unittest.TestCase):
def test_ix_update_ether(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -723,7 +723,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
@@ -787,7 +787,7 @@ class TestIxNextgen(unittest.TestCase):
def test_ix_update_ether_nothing_to_do(self):
static_traffic_params = {
- "private": {
+ "private_1": {
"id": 1,
"bidir": "False",
"duration": 60,
@@ -820,7 +820,7 @@ class TestIxNextgen(unittest.TestCase):
},
"traffic_type": "continuous"
},
- "public": {
+ "public_1": {
"id": 2,
"bidir": "False",
"duration": 60,
diff --git a/tests/unit/test_ssh.py b/tests/unit/test_ssh.py
index 24a9d0c83..27ed68c7b 100644
--- a/tests/unit/test_ssh.py
+++ b/tests/unit/test_ssh.py
@@ -455,8 +455,8 @@ class SSHRunTestCase(unittest.TestCase):
self.test_client._put_file_sftp("localfile", "remotefile")
sftp.put.assert_called_once_with("localfile", "remotefile")
- mock_stat.assert_called_once_with("localfile")
- sftp.chmod.assert_called_once_with("remotefile", 0o753)
+ mock_stat.assert_any_call("localfile")
+ sftp.chmod.assert_any_call("remotefile", 0o753)
sftp.__exit__.assert_called_once_with(None, None, None)
def test__put_file_sftp_mode(self):
diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py
index deed4af93..575467f8f 100644
--- a/yardstick/benchmark/contexts/heat.py
+++ b/yardstick/benchmark/contexts/heat.py
@@ -359,7 +359,6 @@ class HeatContext(Context):
# to match vnf_generic
"local_mac": mac_address,
"local_ip": private_ip,
- "vld_id": self.networks[network_name].vld_id,
}
def undeploy(self):
diff --git a/yardstick/benchmark/contexts/model.py b/yardstick/benchmark/contexts/model.py
index 2db96bade..0b8197ce9 100644
--- a/yardstick/benchmark/contexts/model.py
+++ b/yardstick/benchmark/contexts/model.py
@@ -127,7 +127,6 @@ class Network(Object):
if "external_network" in attrs:
self.router = Router("router", self.name,
context, attrs["external_network"])
- self.vld_id = attrs.get("vld_id")
Network.list.append(self)
diff --git a/yardstick/benchmark/scenarios/lib/create_server.py b/yardstick/benchmark/scenarios/lib/create_server.py
index 273b0045a..31ba18ed4 100644
--- a/yardstick/benchmark/scenarios/lib/create_server.py
+++ b/yardstick/benchmark/scenarios/lib/create_server.py
@@ -21,7 +21,7 @@ LOG = logging.getLogger(__name__)
class CreateServer(base.Scenario):
"""Create an OpenStack server"""
- __scenario_type__ = "CreateSever"
+ __scenario_type__ = "CreateServer"
def __init__(self, scenario_cfg, context_cfg):
self.scenario_cfg = scenario_cfg
diff --git a/yardstick/benchmark/scenarios/lib/delete_network.py b/yardstick/benchmark/scenarios/lib/delete_network.py
new file mode 100644
index 000000000..e8796bf82
--- /dev/null
+++ b/yardstick/benchmark/scenarios/lib/delete_network.py
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from __future__ import print_function
+from __future__ import absolute_import
+
+import logging
+
+from yardstick.benchmark.scenarios import base
+import yardstick.common.openstack_utils as op_utils
+
+LOG = logging.getLogger(__name__)
+
+
+class DeleteNetwork(base.Scenario):
+ """Delete an OpenStack network"""
+
+ __scenario_type__ = "DeleteNetwork"
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.options = self.scenario_cfg['options']
+
+ self.network_id = self.options.get("network_id", None)
+
+ self.neutron_client = op_utils.get_neutron_client()
+
+ self.setup_done = False
+
+ def setup(self):
+ """scenario setup"""
+
+ self.setup_done = True
+
+ def run(self, result):
+ """execute the test"""
+
+ if not self.setup_done:
+ self.setup()
+
+ status = op_utils.delete_neutron_net(self.neutron_client,
+ network_id=self.network_id)
+ if status:
+ result.update({"delete_network": 1})
+ LOG.info("Delete network successful!")
+ else:
+ result.update({"delete_network": 0})
+ LOG.error("Delete network failed!")
diff --git a/yardstick/benchmark/scenarios/lib/delete_port.py b/yardstick/benchmark/scenarios/lib/delete_port.py
new file mode 100644
index 000000000..436902998
--- /dev/null
+++ b/yardstick/benchmark/scenarios/lib/delete_port.py
@@ -0,0 +1,54 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from __future__ import print_function
+from __future__ import absolute_import
+
+import logging
+
+from yardstick.benchmark.scenarios import base
+import yardstick.common.openstack_utils as op_utils
+
+LOG = logging.getLogger(__name__)
+
+
+class DeletePort(base.Scenario):
+ """Delete an OpenStack subnetwork"""
+
+ __scenario_type__ = "DeletePort"
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.options = self.scenario_cfg['options']
+
+ self.port_id = self.options.get("port_id", None)
+
+ self.neutron_client = op_utils.get_neutron_client()
+
+ self.setup_done = False
+
+ def setup(self):
+ """scenario setup"""
+
+ self.setup_done = True
+
+ def run(self, result):
+ """execute the test"""
+
+ if not self.setup_done:
+ self.setup()
+
+ status = self.neutron_client.delete_port(self.port_id)
+ if status:
+ result.update({"delete_port": 1})
+ LOG.info("Delete Port successful!")
+ else:
+ result.update({"delete_port": 0})
+ LOG.error("Delete Port failed!")
diff --git a/yardstick/benchmark/scenarios/lib/delete_router.py b/yardstick/benchmark/scenarios/lib/delete_router.py
new file mode 100644
index 000000000..358fd40cf
--- /dev/null
+++ b/yardstick/benchmark/scenarios/lib/delete_router.py
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from __future__ import print_function
+from __future__ import absolute_import
+
+import logging
+
+from yardstick.benchmark.scenarios import base
+import yardstick.common.openstack_utils as op_utils
+
+LOG = logging.getLogger(__name__)
+
+
+class DeleteRouter(base.Scenario):
+ """Delete an OpenStack router"""
+
+ __scenario_type__ = "DeleteRouter"
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.options = self.scenario_cfg['options']
+
+ self.router_id = self.options.get("router_id", None)
+
+ self.neutron_client = op_utils.get_neutron_client()
+
+ self.setup_done = False
+
+ def setup(self):
+ """scenario setup"""
+
+ self.setup_done = True
+
+ def run(self, result):
+ """execute the test"""
+
+ if not self.setup_done:
+ self.setup()
+
+ status = op_utils.delete_neutron_router(self.neutron_client,
+ router_id=self.router_id)
+ if status:
+ result.update({"delete_router": 1})
+ LOG.info("Delete router successful!")
+ else:
+ result.update({"delete_router": 0})
+ LOG.error("Delete router failed!")
diff --git a/yardstick/benchmark/scenarios/lib/delete_router_gateway.py b/yardstick/benchmark/scenarios/lib/delete_router_gateway.py
new file mode 100644
index 000000000..af4f33f94
--- /dev/null
+++ b/yardstick/benchmark/scenarios/lib/delete_router_gateway.py
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from __future__ import print_function
+from __future__ import absolute_import
+
+import logging
+
+from yardstick.benchmark.scenarios import base
+import yardstick.common.openstack_utils as op_utils
+
+LOG = logging.getLogger(__name__)
+
+
+class DeleteRouterGateway(base.Scenario):
+ """Unset an OpenStack router gateway"""
+
+ __scenario_type__ = "DeleteRouterGateway"
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.options = self.scenario_cfg['options']
+
+ self.router_id = self.options.get("router_id", None)
+
+ self.neutron_client = op_utils.get_neutron_client()
+
+ self.setup_done = False
+
+ def setup(self):
+ """scenario setup"""
+
+ self.setup_done = True
+
+ def run(self, result):
+ """execute the test"""
+
+ if not self.setup_done:
+ self.setup()
+
+ status = op_utils.remove_gateway_router(self.neutron_client,
+ router_id=self.router_id)
+ if status:
+ result.update({"delete_router_gateway": 1})
+ LOG.info("Delete router gateway successful!")
+ else:
+ result.update({"delete_router_gateway": 0})
+ LOG.error("Delete router gateway failed!")
diff --git a/yardstick/benchmark/scenarios/lib/delete_router_interface.py b/yardstick/benchmark/scenarios/lib/delete_router_interface.py
new file mode 100644
index 000000000..117c80811
--- /dev/null
+++ b/yardstick/benchmark/scenarios/lib/delete_router_interface.py
@@ -0,0 +1,57 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from __future__ import print_function
+from __future__ import absolute_import
+
+import logging
+
+from yardstick.benchmark.scenarios import base
+import yardstick.common.openstack_utils as op_utils
+
+LOG = logging.getLogger(__name__)
+
+
+class DeleteRouterInterface(base.Scenario):
+ """Unset an OpenStack router interface"""
+
+ __scenario_type__ = "DeleteRouterInterface"
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.options = self.scenario_cfg['options']
+
+ self.subnet_id = self.options.get("subnet_id", None)
+ self.router_id = self.options.get("router_id", None)
+
+ self.neutron_client = op_utils.get_neutron_client()
+
+ self.setup_done = False
+
+ def setup(self):
+ """scenario setup"""
+
+ self.setup_done = True
+
+ def run(self, result):
+ """execute the test"""
+
+ if not self.setup_done:
+ self.setup()
+
+ status = op_utils.remove_interface_router(self.neutron_client,
+ router_id=self.router_id,
+ subnet_id=self.subnet_id)
+ if status:
+ result.update({"delete_router_interface": 1})
+ LOG.info("Delete router interface successful!")
+ else:
+ result.update({"delete_router_interface": 0})
+ LOG.error("Delete router interface failed!")
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 5453c22d6..aaf850c1d 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -153,7 +153,13 @@ class NetworkServiceTestCase(base.Scenario):
ipaddr = ipaddress.ip_network(six.text_type('{}/{}'.format(ip, mask)), strict=False)
hosts = list(ipaddr.hosts())
- ip_addr_range = "{}-{}".format(hosts[0], hosts[-1])
+ if len(hosts) > 2:
+ # skip the first host in case of gateway
+ ip_addr_range = "{}-{}".format(hosts[1], hosts[-1])
+ else:
+ LOG.warning("Only single IP in range %s", ipaddr)
+ # fall back to single IP range
+ ip_addr_range = ip
else:
# we are manually specifying the range
ip_addr_range = range_or_interface
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py
index c862a6ba2..d1223edd2 100644
--- a/yardstick/common/openstack_utils.py
+++ b/yardstick/common/openstack_utils.py
@@ -457,6 +457,15 @@ def create_neutron_net(neutron_client, json_body): # pragma: no cover
return None
+def delete_neutron_net(neutron_client, network_id): # pragma: no cover
+ try:
+ neutron_client.delete_network(network_id)
+ return True
+ except Exception:
+ log.error("Error [delete_neutron_net(neutron_client, '%s')]" % network_id)
+ return False
+
+
def create_neutron_subnet(neutron_client, json_body): # pragma: no cover
try:
subnet = neutron_client.create_subnet(body=json_body)
@@ -477,6 +486,37 @@ def create_neutron_router(neutron_client, json_body): # pragma: no cover
return None
+def delete_neutron_router(neutron_client, router_id): # pragma: no cover
+ try:
+ neutron_client.delete_router(router=router_id)
+ return True
+ except Exception:
+ log.error("Error [delete_neutron_router(neutron_client, '%s')]" % router_id)
+ return False
+
+
+def remove_gateway_router(neutron_client, router_id): # pragma: no cover
+ try:
+ neutron_client.remove_gateway_router(router_id)
+ return True
+ except Exception:
+ log.error("Error [remove_gateway_router(neutron_client, '%s')]" % router_id)
+ return False
+
+
+def remove_interface_router(neutron_client, router_id, subnet_id,
+ **json_body): # pragma: no cover
+ json_body.update({"subnet_id": subnet_id})
+ try:
+ neutron_client.remove_interface_router(router=router_id,
+ body=json_body)
+ return True
+ except Exception:
+ log.error("Error [remove_interface_router(neutron_client, '%s', "
+ "'%s')]" % (router_id, subnet_id))
+ return False
+
+
def create_floating_ip(neutron_client, extnet_id): # pragma: no cover
props = {'floating_network_id': extnet_id}
try:
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index 1d7ea071c..68c9ed63f 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -90,7 +90,7 @@ def import_modules_from_package(package):
for module_name in missing_modules:
try:
sys.modules[module_name] = importutils.import_module(module_name)
- except ImportError:
+ except (ImportError, SyntaxError):
logger.exception("unable to import %s", module_name)
diff --git a/yardstick/network_services/helpers/samplevnf_helper.py b/yardstick/network_services/helpers/samplevnf_helper.py
index ae5451020..dfc5cb972 100644
--- a/yardstick/network_services/helpers/samplevnf_helper.py
+++ b/yardstick/network_services/helpers/samplevnf_helper.py
@@ -333,10 +333,20 @@ class MultiPortConfig(object):
'nd_route_tbl': "(0100::,64,0,::1)"
}
self.pktq_out_os = swq_out_str.split(' ')
- # why?
+ # HWLB is a run to complition. So override the pktq_in/pktq_out
if self.lb_config == self.HW_LB:
- arpicmp_data['pktq_in'] = swq_in_str
self.swq = 0
+ swq_in_str = \
+ self.make_range_str('SWQ{}', self.swq,
+ offset=(self.lb_count * self.worker_threads))
+ arpicmp_data['pktq_in'] = swq_in_str
+ # WA: Since port_pairs will not be populated during arp pipeline
+ self.port_pairs = self.port_pair_list
+ port_iter = \
+ self.make_port_pairs_iter(self.float_x_plus_one_tenth_of_y, [self.mul])
+ pktq_out = self.make_str('TXQ{}', port_iter)
+ arpicmp_data['pktq_out'] = pktq_out
+
return arpicmp_data
def generate_final_txrx_data(self):
diff --git a/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py b/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py
index 2b8905b4f..38831ee86 100644
--- a/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py
+++ b/yardstick/network_services/libs/ixia_libs/IxNet/IxNet.py
@@ -113,10 +113,10 @@ class IxNextgen(object):
}
MODE_SEEDS_MAP = {
- 0: ('private', ['256', '2048']),
+ 0: ('private_1', ['256', '2048']),
}
- MODE_SEEDS_DEFAULT = 'public', ['2048', '256']
+ MODE_SEEDS_DEFAULT = 'public_1', ['2048', '256']
@staticmethod
def find_view_obj(view_name, views):
diff --git a/yardstick/network_services/nfvi/collectd.sh b/yardstick/network_services/nfvi/collectd.sh
index 8162ec539..7666404e4 100755
--- a/yardstick/network_services/nfvi/collectd.sh
+++ b/yardstick/network_services/nfvi/collectd.sh
@@ -13,7 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
INSTALL_NSB_BIN="/opt/nsb_bin"
cd $INSTALL_NSB_BIN
@@ -23,19 +22,17 @@ if [ "$(whoami)" != "root" ]; then
fi
echo "setup proxy..."
-http_proxy=$1
-https_proxy=$2
-if [[ "$http_proxy" != "" ]]; then
- export http_proxy=$http_proxy
- export https_proxy=$http_proxy
+if [[ -n $1 ]]; then
+ export http_proxy=$1
+ export https_proxy=$2
fi
-if [[ "$https_proxy" != "" ]]; then
- export https_proxy=$https_proxy
+if [[ -n $2 ]]; then
+ export https_proxy=$2
fi
echo "Install required libraries to run collectd..."
-pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev librabbitmq-dev rabbitmq-server cmake)
+pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev librabbitmq-dev rabbitmq-server cmake libvirt-dev)
for i in "${pkg[@]}"; do
dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed"
if [ "$?" -eq "1" ]; then
@@ -44,9 +41,7 @@ dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed"
done
echo "Done"
-ldconfig -p | grep libpqos >/dev/null
-if [ $? -eq 0 ]
-then
+if ldconfig -p | grep -q libpqos ; then
echo "Intel RDT library already installed. Done"
else
pushd .
@@ -54,32 +49,27 @@ else
echo "Get intel_rdt repo and install..."
rm -rf intel-cmt-cat >/dev/null
git clone https://github.com/01org/intel-cmt-cat.git
- pushd intel-cmt-cat
- make install PREFIX=/usr
- popd
+
+ (cd intel-cmt-cat; make install PREFIX=/usr)
popd
echo "Done."
fi
-ls /usr/lib/libdpdk.so >/dev/null
-if [ $? -eq 0 ]
-then
+if [[ -r /usr/lib/libdpdk.so ]]; then
echo "DPDK already installed. Done"
else
pushd .
echo "Get dpdk and install..."
mkdir -p $INSTALL_NSB_BIN
- rm -rf "$INSTALL_NSB_BIN"/dpdk >/dev/null
- git clone http://dpdk.org/git/dpdk
- pushd dpdk
+ pushd dpdk-16.07
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g' config/common_base
sed -i 's/CONFIG_RTE_EAL_PMD_PATH=""/CONFIG_RTE_EAL_PMD_PATH="\/usr\/lib\/dpdk-pmd\/"/g' config/common_base
- echo "Build dpdk v16.04"
+ echo "Build dpdk v16.07"
make config T=x86_64-native-linuxapp-gcc
make
sudo make install prefix=/usr
@@ -125,7 +115,7 @@ else
git clone https://github.com/collectd/collectd.git
pushd collectd
git stash
- git checkout -n nfvi 47c86ace348a1d7a5352a83d10935209f89aa4f5
+ git checkout -b nfvi 47c86ace348a1d7a5352a83d10935209f89aa4f5
./build.sh
./configure --with-libpqos=/usr/ --with-libdpdk=/usr --with-libyajl=/usr/local --enable-debug --enable-dpdkstat --enable-virt --enable-ovs_stats
make install > /dev/null
diff --git a/yardstick/network_services/nfvi/resource.py b/yardstick/network_services/nfvi/resource.py
index 48bcd3118..2a9a1a1a2 100644
--- a/yardstick/network_services/nfvi/resource.py
+++ b/yardstick/network_services/nfvi/resource.py
@@ -222,6 +222,12 @@ class ResourceProfile(object):
connection.execute("sudo rabbitmqctl start_app")
connection.execute("sudo service rabbitmq-server restart")
+ LOG.debug("Creating amdin user for rabbitmq in order to collect data from collectd")
+ connection.execute("sudo rabbitmqctl delete_user guest")
+ connection.execute("sudo rabbitmqctl add_user admin admin")
+ connection.execute("sudo rabbitmqctl authenticate_user admin admin")
+ connection.execute("sudo rabbitmqctl set_permissions -p / admin \".*\" \".*\" \".*\"")
+
LOG.debug("Start collectd service.....")
connection.execute("sudo %s" % collectd_path)
LOG.debug("Done")
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
index 5ba00180b..ba532b820 100644
--- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py
+++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
@@ -74,7 +74,7 @@ class IXIARFC2544Profile(TrexProfile):
traffic[key]["iload"] = str(self.rate)
ixia_obj.ix_update_frame(traffic)
ixia_obj.ix_update_ether(traffic)
- # ixia_obj.ix_update_ipv4(traffic)
+ ixia_obj.add_ip_header(traffic, 4)
ixia_obj.ix_start_traffic()
self.tmp_drop = 0
self.tmp_throughput = 0
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index 7a756837e..d7874a1a4 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -966,6 +966,9 @@ class SampleVNFTrafficGen(GenericTrafficGen):
# Wait for traffic process to start
while self.resource_helper.client_started.value == 0:
time.sleep(self.RUN_WAIT)
+ # what if traffic process takes a few seconds to start?
+ if not self._traffic_process.is_alive():
+ break
return self._traffic_process.is_alive()