aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark/scenarios')
-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
6 files changed, 182 insertions, 3 deletions
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())