3 # Copyright (c) 2017 Okinawa Open Laboratory and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
15 from functest.core import vnf
16 from functest.opnfv_tests.vnf.router import cloudify_vrouter
19 class CloudifyVrouterTesting(unittest.TestCase):
21 @mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.Utilvnf')
22 @mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.vrouter_base'
24 @mock.patch('os.makedirs')
25 def setUp(self, *args):
27 self.tenant = 'cloudify_vrouter'
28 self.creds = {'username': 'user',
30 self.orchestrator = {'name': 'cloudify',
33 'requirements': {'flavor': {'name': 'm1.medium',
35 'os_image': 'manager_4.0'}}
37 self.vnf = {'name': 'vrouter',
38 'descriptor': {'version': '100',
39 'file_name': 'function-test-' +
40 'openstack-blueprint.yaml',
41 'name': 'vrouter-opnfv',
43 'requirements': {'flavor':
47 with mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.'
48 'get_config', return_value={
49 'tenant_images': 'foo',
50 'orchestrator': self.orchestrator,
53 'version': 'whatever'}):
55 self.router_vnf = cloudify_vrouter.CloudifyVrouter()
57 self.images = {'image1': 'url1',
59 self.details = {'orchestrator': {'status': 'PASS', 'duration': 120},
63 def test_prepare_missing_param(self):
64 with self.assertRaises(vnf.VnfPreparationException):
65 self.router_vnf.prepare()
68 if __name__ == "__main__":
69 logging.disable(logging.CRITICAL)
70 unittest.main(verbosity=2)