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.
18 from yardstick.network_services.vnf_generic.vnf import epc_vnf
23 'vnfd:vnfd-catalog': {
25 'id': 'EPCVnf', # NSB python class mapping
27 'short-name': 'EPCVnf',
28 'description': 'EPCVnf',
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
36 'id': 'vepcvnf-baremetal',
37 'name': 'vepc-vnf-baremetal',
38 'description': 'vEPCVnf workload',
39 'external-interface': []}],
44 class TestEPCVnf(unittest.TestCase):
47 self.vnfd = VNFD['vnfd:vnfd-catalog']['vnfd'][0]
48 self.epc_vnf = epc_vnf.EPCVnf(NAME, self.vnfd)
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)
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)
73 def test_instantiate(self):
74 self.assertIsNone(self.epc_vnf.instantiate({}, {}))
76 def test_wait_for_instantiate(self):
77 self.assertIsNone(self.epc_vnf.wait_for_instantiate())
79 def test_terminate(self):
80 self.assertIsNone(self.epc_vnf.terminate())
83 self.assertIsNone(self.epc_vnf.scale())
85 def test_collect_kpi(self):
86 self.assertIsNone(self.epc_vnf.collect_kpi())
88 def test_start_collect(self):
89 self.assertIsNone(self.epc_vnf.start_collect())
91 def test_stop_collect(self):
92 self.assertIsNone(self.epc_vnf.stop_collect())