1 # Copyright (c) 2018 Intel Corporation
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 from yardstick.network_services.vnf_generic.vnf import epc_vnf
24 'vnfd:vnfd-catalog': {
26 'id': 'EPCVnf', # NSB python class mapping
28 'short-name': 'EPCVnf',
29 'description': 'EPCVnf',
31 'vdu-id': 'vepcvnf-baremetal',
32 'user': 'user', # Value filled by vnfdgen
33 'password': 'password', # Value filled by vnfdgen
34 'ip': 'ip' # Value filled by vnfdgen
37 'id': 'vepcvnf-baremetal',
38 'name': 'vepc-vnf-baremetal',
39 'description': 'vEPCVnf workload',
40 'external-interface': []}],
45 class TestEPCVnf(unittest.TestCase):
48 self._id = uuid.uuid1().int
49 self.vnfd = VNFD['vnfd:vnfd-catalog']['vnfd'][0]
50 self.epc_vnf = epc_vnf.EPCVnf(NAME, self.vnfd, self._id)
52 def test___init__(self, *args):
53 _epc_vnf = epc_vnf.EPCVnf(NAME, self.vnfd, self._id)
54 for x in {'user', 'password', 'ip'}:
55 self.assertEqual(self.vnfd['mgmt-interface'][x],
56 _epc_vnf.vnfd_helper.mgmt_interface[x])
57 self.assertEqual(NAME, _epc_vnf.name)
58 self.assertEqual([], _epc_vnf.kpi)
59 self.assertEqual({}, _epc_vnf.config)
60 self.assertFalse(_epc_vnf.runs_traffic)
62 def test___init__missing_ip(self, *args):
63 _vnfd = copy.deepcopy(self.vnfd)
64 _vnfd['mgmt-interface'].pop('ip')
65 _epc_vnf = epc_vnf.EPCVnf(NAME, _vnfd, self._id)
66 for x in {'user', 'password'}:
67 self.assertEqual(_vnfd['mgmt-interface'][x],
68 _epc_vnf.vnfd_helper.mgmt_interface[x])
69 self.assertNotIn('ip', _epc_vnf.vnfd_helper.mgmt_interface)
70 self.assertEqual(NAME, _epc_vnf.name)
71 self.assertEqual([], _epc_vnf.kpi)
72 self.assertEqual({}, _epc_vnf.config)
73 self.assertFalse(_epc_vnf.runs_traffic)
75 def test_instantiate(self):
76 self.assertIsNone(self.epc_vnf.instantiate({}, {}))
78 def test_wait_for_instantiate(self):
79 self.assertIsNone(self.epc_vnf.wait_for_instantiate())
81 def test_terminate(self):
82 self.assertIsNone(self.epc_vnf.terminate())
85 self.assertIsNone(self.epc_vnf.scale())
87 def test_collect_kpi(self):
88 self.assertIsNone(self.epc_vnf.collect_kpi())
90 def test_start_collect(self):
91 self.assertIsNone(self.epc_vnf.start_collect())
93 def test_stop_collect(self):
94 self.assertIsNone(self.epc_vnf.stop_collect())