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