Manual update of pip requirements
[osm/N2VC.git] / integration / test_metrics_native.py
1 """
2 Deploy a VNF w/native charm that collects metrics
3 """
4 import asyncio
5 import logging
6 import pytest
7 from .. import base
8
9
10 # @pytest.mark.serial
11 class TestCharm(base.TestN2VC):
12
13 NSD_YAML = """
14 nsd:nsd-catalog:
15 nsd:
16 - id: metricsnative-ns
17 name: metricsnative-ns
18 short-name: metricsnative-ns
19 description: NS with 1 VNFs metricsnative-vnf connected by datanet and mgmtnet VLs
20 version: '1.0'
21 logo: osm.png
22 constituent-vnfd:
23 - vnfd-id-ref: metricsnative-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: metricsnative-vnf
34 member-vnf-index-ref: '1'
35 vnfd-connection-point-ref: vnf-mgmt
36 - vnfd-id-ref: metricsnative-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: metricsnative-vnf
45 member-vnf-index-ref: '1'
46 vnfd-connection-point-ref: vnf-data
47 - vnfd-id-ref: metricsnative-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: metricsnative-vnf
56 name: metricsnative-vnf
57 short-name: metricsnative-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 vnf-configuration:
109 juju:
110 charm: metrics-ci
111 proxy: false
112 config-primitive:
113 - name: touch
114 parameter:
115 - name: filename
116 data-type: STRING
117 default-value: '/home/ubuntu/touched'
118 """
119
120 # @pytest.mark.serial
121 @pytest.mark.asyncio
122 async def test_metrics_native(self, event_loop):
123 """Deploy and execute the initial-config-primitive of a VNF."""
124
125 if self.nsd and self.vnfd:
126 vnf_index = 0
127
128 for config in self.get_config():
129 juju = config['juju']
130 charm = juju['charm']
131
132 await self.deploy(
133 vnf_index,
134 charm,
135 config,
136 event_loop,
137 )
138
139 while await self.running():
140 print("Waiting for test to finish...")
141 await asyncio.sleep(15)
142
143 logging.debug("test_metrics_native stopped")
144
145 return 'ok'