Merge "Added test descriptors for vCMTS testcase"
[yardstick.git] / yardstick / tests / unit / network_services / vnf_generic / vnf / test_epc_vnf.py
1 # Copyright (c) 2018-2019 Intel Corporation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import copy
16 import unittest
17
18 from yardstick.network_services.vnf_generic.vnf import epc_vnf
19
20 NAME = 'vnf__0'
21
22 VNFD = {
23     'vnfd:vnfd-catalog': {
24         'vnfd': [{
25             'id': 'EPCVnf',  # NSB python class mapping
26             'name': 'EPCVnf',
27             'short-name': 'EPCVnf',
28             'description': 'EPCVnf',
29             'mgmt-interface': {
30                 'vdu-id': 'vepcvnf-baremetal',
31                 'user': 'user',  # Value filled by vnfdgen
32                 'password': 'password',  # Value filled by vnfdgen
33                 'ip': 'ip'  # Value filled by vnfdgen
34             },
35             'vdu': [{
36                 'id': 'vepcvnf-baremetal',
37                 'name': 'vepc-vnf-baremetal',
38                 'description': 'vEPCVnf workload',
39                 'external-interface': []}],
40             'benchmark': {
41                 'kpi': []}}]}}
42
43
44 class TestEPCVnf(unittest.TestCase):
45
46     def setUp(self):
47         self.vnfd = VNFD['vnfd:vnfd-catalog']['vnfd'][0]
48         self.epc_vnf = epc_vnf.EPCVnf(NAME, self.vnfd)
49
50     def test___init__(self, *args):
51         _epc_vnf = epc_vnf.EPCVnf(NAME, self.vnfd)
52         for x in {'user', 'password', 'ip'}:
53             self.assertEqual(self.vnfd['mgmt-interface'][x],
54                              _epc_vnf.vnfd_helper.mgmt_interface[x])
55         self.assertEqual(NAME, _epc_vnf.name)
56         self.assertEqual([], _epc_vnf.kpi)
57         self.assertEqual({}, _epc_vnf.config)
58         self.assertFalse(_epc_vnf.runs_traffic)
59
60     def test___init__missing_ip(self, *args):
61         _vnfd = copy.deepcopy(self.vnfd)
62         _vnfd['mgmt-interface'].pop('ip')
63         _epc_vnf = epc_vnf.EPCVnf(NAME, _vnfd)
64         for x in {'user', 'password'}:
65             self.assertEqual(_vnfd['mgmt-interface'][x],
66                              _epc_vnf.vnfd_helper.mgmt_interface[x])
67         self.assertNotIn('ip', _epc_vnf.vnfd_helper.mgmt_interface)
68         self.assertEqual(NAME, _epc_vnf.name)
69         self.assertEqual([], _epc_vnf.kpi)
70         self.assertEqual({}, _epc_vnf.config)
71         self.assertFalse(_epc_vnf.runs_traffic)
72
73     def test_instantiate(self):
74         self.assertIsNone(self.epc_vnf.instantiate({}, {}))
75
76     def test_wait_for_instantiate(self):
77         self.assertIsNone(self.epc_vnf.wait_for_instantiate())
78
79     def test_terminate(self):
80         self.assertIsNone(self.epc_vnf.terminate())
81
82     def test_scale(self):
83         self.assertIsNone(self.epc_vnf.scale())
84
85     def test_collect_kpi(self):
86         self.assertIsNone(self.epc_vnf.collect_kpi())
87
88     def test_start_collect(self):
89         self.assertIsNone(self.epc_vnf.start_collect())
90
91     def test_stop_collect(self):
92         self.assertIsNone(self.epc_vnf.stop_collect())