2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
19 import org.junit.Test;
20 import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
22 import java.io.IOException;
24 public class UnifiedCompositionSubInterfaceFullTest extends BaseFullTranslationTest {
26 private static final String PATTERN_1A_BASE_DIRECTORY =
27 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1a/";
28 private static final String PATTERN_1B_BASE_DIRECTORY =
29 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1b/";
30 private static final String PATTERN_1C1_BASE_DIRECTORY =
31 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c1/";
32 private static final String PATTERN_4_BASE_DIRECTORY =
33 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern4/";
36 public void testSubInterfaceComputePortNetwork() throws IOException {
38 * Heat file with one compute, one port and one subinterface resource group with only port
39 * connected to network
41 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "computePortNetworkSubInterface");
45 public void testSubInterfaceNodesConnectedOut() throws IOException {
47 * Heat file with one compute, one port and one subinterface resource group with
48 * 1. Port connected to network
49 * 2. Sub-interface connected to same network
50 * 3. Sub-interface has depends on (out) connectivity with network resource
52 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
56 public void testSubInterfaceNodesConnectedIn() throws IOException {
58 * Heat file with one compute, one port and one subinterface resource group with
59 * 1. Port connected to network
60 * 2. Sub-interface connected to different network
61 * 3. Sub-interface has depends on (in) connectivity from network resource
63 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
67 public void testSubInterfaceGetAttrInOut() throws IOException {
69 * Heat file with one compute, one port and one subinterface resource group with
70 * 1. Port connected to network
71 * 2. Sub-interface connected to different network
72 * 3. Sub-interface has get attribute (in) connectivity from network resource
73 * 4. Sub-interface has get attribute (out) connectivity to second network resource
74 * 5. Sub-interface has get attribute (in) connectivity from output param
76 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
80 public void testSubInterfaceMultipleVlanSameNestedFile() throws IOException {
82 * Heat file with one compute, one port and two subinterface resource groups with
83 * 1. Port connected to network
84 * 2. Sub-interfaces with same nested files
86 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanSameType");
90 public void testSubInterfaceMultipleVlanDiffNestedFile() throws IOException {
92 * Heat file with one compute, one port and two subinterface resource groups with
93 * 1. Port connected to network
94 * 2. Sub-interfaces with different nested files
96 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanDiffType");
100 public void testSubInterfaceMultiplePortsMultipleVlans() throws IOException {
102 * Heat file with one compute, two ports and two subinterface resource groups with
103 * 1. Port connected to network
104 * 2. Sub-interfaces each with different nested files
106 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multiplePortsMultipleVlans");
110 public void testSubInterfaceRegularNested() throws IOException {
112 * Heat file with one compute, one port and one subinterface resource represented through a
113 * regular nested resource and not using a resource group
115 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "regularNestedSubInterface");
119 public void testSubInterfaceNotBoundToPort() throws IOException {
121 * Heat file with one compute, one port and one subinterface resource group with
122 * 1. Resource group missing virtual_machine_interface_refs property
123 * 2. Resource group missing virtual_machine_interface_properties_sub_interface_vlan_tag
125 * 3. Resource group parent port as get_param
127 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "notBoundToParentPort");
132 public void testDiffComputeSubInterface() throws IOException {
134 * Heat file with one compute, one port and one subinterface resource group with
135 * 1. There are two compute both of different type
137 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "diffComputeSubInterface");
141 public void testOnePortIsConnectedWithSubInf() throws IOException {
143 * Heat file with one compute, one port and one subinterface resource group with
144 * 1. Two compute of same type
145 * 2. Two port of same type but only one of them is having sub interface binding
147 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "onePortIsConnectedWithSubInf");
151 public void testRegularNestedSubInterface() throws IOException {
153 * Heat file with one compute, one port and one sub interface without resource group
154 * 1. Two compute of same type
155 * 2. Two port are of different type
156 * 3. Sub interface properties are same in both port
158 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "regularNestedSubInterface");
162 public void testSameComputeDiffPortSubInterface() throws IOException {
164 * Heat file with one compute, one port and one subinterface resource group with
165 * 1. Two compute of same type
166 * 2. Two port are of different type
167 * 3. Sub interface properties are same in both port
169 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeDiffPortSubInterface");
173 public void testSameComputeSamePortDiffSubInterfaceFile() throws IOException {
175 * Heat file with one compute, one port and one subinterface resource group with
176 * 1. Two compute of same type
177 * 2. Two port are of same type connected with different sub interface nested file
178 * 3. Sub interface property are same for both port
180 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY
181 + "sameComputeSamePortDiffSubInterfaceFile");
184 //****************** PATTERN 1C1 Tests ***************************
187 public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
189 * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
191 * 1. Compute has one port each
192 * 2. Port has one sub-interface each
193 * 3. Port connected to network
194 * 3. Sub-interface not connected to network
196 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
200 public void testSubInterfaceScalingMultiplePortsMultipleVlans() throws IOException {
202 * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
204 * 1. Each compute has two ports, one of each type
205 * 2. Port has one sub-interface each
206 * 3. Ports connected to different networks
207 * 4. Sub-interface of one type connected to network
209 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
213 public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
215 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
217 * 1. Each compute has two ports, one of each type
218 * 2. One of the ports has a subinterface
219 * 3. Ports connected to network
220 * 4. Subinterfaces not connected to network
221 * 5. Optional properties contained in one subinterface and not in other
223 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
227 public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
229 * Heat file with two computes, two ports of same type connected to network and two subinterface resource
230 * represented through a regular nested resource and not using a resource group not connected to network
232 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
236 public void testSubInterfaceScalingAllConnectivities() throws IOException {
238 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
240 * 1. Each compute has two ports, one of each type
241 * 2. One of the ports has a subinterface
242 * 3. Port connected to network
243 * 4. Both ports and subinterfaces connected to network
244 * 5. All connectivities including dependency, get attribute from nodes and output param
246 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");
249 //Pattern 4 Test Cases
251 public void testSubInterfaceComputePortNetworkPattern4() throws IOException {
253 * Nested Heat file with one compute, one port and one subinterface resource group with only
254 * port connected to network
256 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY +
257 "computePortNetworkSubInterface");
261 public void testSubInterfaceMultiplePortsMultipleVlansPattern4() throws IOException {
263 * Nested Heat file with one compute, two ports and two subinterface resource groups with
264 * 1. Port connected to network
265 * 2. Sub-interfaces each with different nested files
267 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multiplePortsMultipleVlans");
271 public void testSubInterfaceMultipleVlanDiffFilePattern4() throws IOException {
273 * Nested Heat file with one compute, one port and two subinterface resource groups with
274 * 1. Port connected to network
275 * 2. Sub-interfaces with different nested files
277 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanDiffFile");
281 public void testSubInterfaceMultipleVlanSameFilePattern4() throws IOException {
283 * Nested Heat file with one compute, one port and two subinterface resource groups with
284 * 1. Port connected to network
285 * 2. Sub-interfaces with same nested files
287 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanSameFile");
291 public void testSubInterfaceRegularNestedPattern4() throws IOException {
293 * Nested Heat file with one compute, one port and one subinterface resource represented
294 * through a regular nested resource and not using a resource group
296 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "regularNestedSubInterface");
300 public void testSubInterfaceGetAttrInOutPattern4() throws IOException {
302 * Nested Heat file with one compute, one port and one subinterface resource group with
303 * 1. Port connected to network
304 * 2. Sub-interface connected to different network
305 * 3. Sub-interface has get attribute (in) connectivity from network resource
306 * 4. Sub-interface has get attribute (out) connectivity to second network resource
307 * 5. Sub-interface has get attribute (in) connectivity from output param
309 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
313 public void testSubInterfaceNodesConnectedInPattern4() throws IOException {
315 * Nested Heat file with one compute, one port and one subinterface resource group with
316 * 1. Port connected to network
317 * 2. Sub-interface connected to different network
318 * 3. Sub-interface has depends on (in) connectivity from network resource
320 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
324 public void testSubInterfaceNodesConnectedOutPattern4() throws IOException {
326 * Nested Heat file with one compute, one port and one subinterface resource group with
327 * 1. Port connected to network
328 * 2. Sub-interface connected to same network
329 * 3. Sub-interface has depends on (out) connectivity with network resource
331 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");