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