Merge "Add UEFI support in functest"
[functest.git] / functest / tests / unit / vnf / router / test_cloudify_vrouter.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2017 Okinawa Open Laboratory and others.
4 #
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
9
10 import logging
11 import unittest
12
13 import mock
14
15 from functest.core import vnf
16 from functest.opnfv_tests.vnf.router import cloudify_vrouter
17
18
19 class CloudifyVrouterTesting(unittest.TestCase):
20
21     def setUp(self):
22
23         self.tenant = 'cloudify_vrouter'
24         self.creds = {'username': 'user',
25                       'password': 'pwd'}
26         self.orchestrator = {'name': 'cloudify',
27                              'version': '4.0',
28                              'object': 'foo',
29                              'requirements': {'flavor': {'name': 'm1.medium',
30                                                          'ram_min': 4096},
31                                               'os_image': 'manager_4.0'}}
32
33         self.vnf = {'name': 'vrouter',
34                     'descriptor': {'version': '100',
35                                    'file_name': 'function-test-' +
36                                                 'openstack-blueprint.yaml',
37                                    'name': 'vrouter-opnfv',
38                                    'url': 'https://foo',
39                                    'requirements': {'flavor':
40                                                     {'name': 'm1.medium',
41                                                      'ram_min': 2048}}}}
42
43         with mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.'
44                         'os.makedirs'), \
45             mock.patch('functest.opnfv_tests.vnf.router.cloudify_vrouter.'
46                        'get_config', return_value={
47                            'tenant_images': 'foo',
48                            'orchestrator': self.orchestrator,
49                            'vnf': self.vnf,
50                            'vnf_test_suite': '',
51                            'version': 'whatever'}):
52
53             self.router_vnf = cloudify_vrouter.CloudifyVrouter()
54
55         self.images = {'image1': 'url1',
56                        'image2': 'url2'}
57         self.details = {'orchestrator': {'status': 'PASS', 'duration': 120},
58                         'vnf': {},
59                         'test_vnf':  {}}
60
61     def test_prepare_missing_param(self):
62         with self.assertRaises(vnf.VnfPreparationException):
63             self.router_vnf.prepare()
64
65
66 if __name__ == "__main__":
67     logging.disable(logging.CRITICAL)
68     unittest.main(verbosity=2)