Support for additional EPA parameters for resource allocation and placement
[osm/IM.git] / tests / test_python.py
1 import osm_im.vnfd as vnfd_catalog
2 from pyangbind.lib.serialise import pybindJSONDecoder
3 import unittest
4 import yaml
5
6 VNFD_YAML = """
7 vnfd-catalog:
8 vnfd:
9 - id: cirros_vnfd
10 name: cirros_vnf
11 short-name: cirros_vnf
12 description: Simple VNF example with a cirros
13 vendor: OSM
14 version: '1.0'
15
16 # Place the logo as png in icons directory and provide the name here
17 logo: cirros-64.png
18
19 # Management interface
20 mgmt-interface:
21 cp: eth0
22
23 # Atleast one VDU need to be specified
24 vdu:
25 - id: cirros_vnfd-VM
26 name: cirros_vnfd-VM
27 description: cirros_vnfd-VM
28 count: 1
29
30 # Flavour of the VM to be instantiated for the VDU
31 # flavor below can fit into m1.micro
32 vm-flavor:
33 vcpu-count: 1
34 memory-mb: 256
35 storage-gb: 2
36
37 # Image/checksum or image including the full path
38 image: 'cirros034'
39 #checksum:
40
41 interface:
42 # Specify the external interfaces
43 # There can be multiple interfaces defined
44 - name: eth0
45 type: EXTERNAL
46 virtual-interface:
47 type: PARAVIRT
48 bandwidth: '0'
49 vpci: 0000:00:0a.0
50 external-connection-point-ref: eth0
51
52 connection-point:
53 - name: eth0
54 type: VPORT
55 """
56
57 class PythonTest(unittest.TestCase):
58
59
60 def test_python_compatibility(self):
61 """A simple test to verify Python compatibility.
62
63 This test exercises basic IM interoperability with supported versions
64 of Python in order to verify the IM libraries compatibility.
65
66 As of 30 Nov 2017, the IM library fails with Python3. This invokes that
67 failing code so that it can be repeatably tested:
68
69 ValueError: '_pybind_generated_by' in __slots__ conflicts with class variable
70 """
71
72 try:
73 data = yaml.load(VNFD_YAML)
74
75 myvnfd = vnfd_catalog.vnfd()
76 pybindJSONDecoder.load_ietf_json(data, None, None, obj=myvnfd)
77 except ValueError:
78 assert False