Fix bug 760
[osm/N2VC.git] / tests / integration / test_non_existent_primitive.py
1 """
2 Deploy a VNF and execute a non-existent primitive
3 """
4 import asyncio
5 import logging
6 import pytest
7 from .. import base
8 # import n2vc.vnf
9
10 # @pytest.mark.serial
11 class TestCharm(base.TestN2VC):
12
13 NSD_YAML = """
14 nsd:nsd-catalog:
15 nsd:
16 - id: nonexistent-ns
17 name: nonexistent-ns
18 short-name: nonexistent-ns
19 description: NS with 1 VNFs charmnative-vnf connected by datanet and mgmtnet VLs
20 version: '1.0'
21 logo: osm.png
22 constituent-vnfd:
23 - vnfd-id-ref: charmnative-vnf
24 member-vnf-index: '1'
25 vld:
26 - id: mgmtnet
27 name: mgmtnet
28 short-name: mgmtnet
29 type: ELAN
30 mgmt-network: 'true'
31 vim-network-name: mgmt
32 vnfd-connection-point-ref:
33 - vnfd-id-ref: charmnative-vnf
34 member-vnf-index-ref: '1'
35 vnfd-connection-point-ref: vnf-mgmt
36 - vnfd-id-ref: charmnative-vnf
37 member-vnf-index-ref: '2'
38 vnfd-connection-point-ref: vnf-mgmt
39 - id: datanet
40 name: datanet
41 short-name: datanet
42 type: ELAN
43 vnfd-connection-point-ref:
44 - vnfd-id-ref: charmnative-vnf
45 member-vnf-index-ref: '1'
46 vnfd-connection-point-ref: vnf-data
47 - vnfd-id-ref: charmnative-vnf
48 member-vnf-index-ref: '2'
49 vnfd-connection-point-ref: vnf-data
50 """
51
52 VNFD_YAML = """
53 vnfd:vnfd-catalog:
54 vnfd:
55 - id: charmnative-vnf
56 name: charmnative-vnf
57 short-name: charmnative-vnf
58 version: '1.0'
59 description: A VNF consisting of 2 VDUs w/charms connected to an internal VL, and one VDU with cloud-init
60 logo: osm.png
61 connection-point:
62 - id: vnf-mgmt
63 name: vnf-mgmt
64 short-name: vnf-mgmt
65 type: VPORT
66 - id: vnf-data
67 name: vnf-data
68 short-name: vnf-data
69 type: VPORT
70 mgmt-interface:
71 cp: vnf-mgmt
72 internal-vld:
73 - id: internal
74 name: internal
75 short-name: internal
76 type: ELAN
77 internal-connection-point:
78 - id-ref: mgmtVM-internal
79 - id-ref: dataVM-internal
80 vdu:
81 - id: mgmtVM
82 name: mgmtVM
83 image: xenial
84 count: '1'
85 vm-flavor:
86 vcpu-count: '1'
87 memory-mb: '1024'
88 storage-gb: '10'
89 interface:
90 - name: mgmtVM-eth0
91 position: '1'
92 type: EXTERNAL
93 virtual-interface:
94 type: VIRTIO
95 external-connection-point-ref: vnf-mgmt
96 - name: mgmtVM-eth1
97 position: '2'
98 type: INTERNAL
99 virtual-interface:
100 type: VIRTIO
101 internal-connection-point-ref: mgmtVM-internal
102 internal-connection-point:
103 - id: mgmtVM-internal
104 name: mgmtVM-internal
105 short-name: mgmtVM-internal
106 type: VPORT
107 cloud-init-file: cloud-config.txt
108 vdu-configuration:
109 juju:
110 charm: native-ci
111 proxy: false
112 initial-config-primitive:
113 - seq: '1'
114 name: idonotexist
115 - seq: '2'
116 name: test
117 """
118
119 # @pytest.mark.serial
120 @pytest.mark.asyncio
121 async def test_charm_non_existent_primitive(self, event_loop):
122 """Deploy and execute the initial-config-primitive of a VNF."""
123
124 if self.nsd and self.vnfd:
125 vnf_index = 0
126
127 for config in self.get_config():
128 juju = config['juju']
129 charm = juju['charm']
130
131 await self.deploy(
132 vnf_index,
133 charm,
134 config,
135 event_loop,
136 )
137
138 while await self.running():
139 print("Waiting for test to finish...")
140 await asyncio.sleep(15)
141 logging.debug("test_charm_non_string_parameter stopped")
142
143
144 # assert False
145 return 'ok'