diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-08-29 00:07:35 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-29 00:07:35 +0000 |
commit | b583d4bfe6bc49e0f3bf4beec6612390a1d4bd24 (patch) | |
tree | 41b230ec1a663c4cb4baef4e5368098862a73835 /tests | |
parent | a66b78d60d7d062218df8e6b9c279f7931a030cd (diff) | |
parent | d254d748b607c43167876f28c74b9ea839090df2 (diff) |
Merge "Add common openstack opertation scenarios: router & port"
Diffstat (limited to 'tests')
5 files changed, 179 insertions, 0 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() |