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_1C2_BASE_DIRECTORY =
33 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c2/";
34 private static final String PATTERN_4_BASE_DIRECTORY =
35 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern4/";
36 private static final String PATTERN_5_BASE_DIRECTORY =
37 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern5/";
38 private static final String VFC_INSTANCE_GROUP_BASE_DIRECTORY =
39 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/vfcInstanceGroup/";
42 public void testSubInterfaceComputePortNetworkWithGroup() throws IOException {
44 * Heat file with one compute, one port and one subinterface resource group with only port
45 * connected to network
47 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "computePortNetworkSubInterface");
51 public void testSubInterfaceNodesConnectedOut() throws IOException {
53 * Heat file with one compute, one port and one subinterface resource group with
54 * 1. Port connected to network
55 * 2. Sub-interface connected to same network
56 * 3. Sub-interface has depends on (out) connectivity with network resource
58 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
62 public void testSubInterfaceNodesConnectedIn() throws IOException {
64 * Heat file with one compute, one port and one subinterface resource group with
65 * 1. Port connected to network
66 * 2. Sub-interface connected to different network
67 * 3. Sub-interface has depends on (in) connectivity from network resource
69 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
73 public void testSubInterfaceGetAttrInOut() throws IOException {
75 * Heat file with one compute, one port and one subinterface resource group with
76 * 1. Port connected to network
77 * 2. Sub-interface connected to different network
78 * 3. Sub-interface has get attribute (in) connectivity from network resource
79 * 4. Sub-interface has get attribute (out) connectivity to second network resource
80 * 5. Sub-interface has get attribute (in) connectivity from output param
82 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
86 public void testSubInterfaceMultipleVlanSameNestedFile() throws IOException {
88 * Heat file with one compute, one port and two subinterface resource groups with
89 * 1. Port connected to network
90 * 2. Sub-interfaces with same nested files
92 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanSameType");
96 public void testSubInterfaceMultipleVlanDiffNestedFile() throws IOException {
98 * Heat file with one compute, one port and two subinterface resource groups with
99 * 1. Port connected to network
100 * 2. Sub-interfaces with different nested files
102 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanDiffType");
106 public void testSubInterfaceMultiplePortsMultipleVlans() throws IOException {
108 * Heat file with one compute, two ports and two subinterface resource groups with
109 * 1. Port connected to network
110 * 2. Sub-interfaces each with different nested files
112 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multiplePortsMultipleVlans");
116 public void testSubInterfaceRegularNested() throws IOException {
118 * Heat file with one compute, one port and one subinterface resource represented through a
119 * regular nested resource and not using a resource group
121 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "regularNestedSubInterface");
125 public void testSubInterfaceNotBoundToPort() throws IOException {
127 * Heat file with one compute, one port and one subinterface resource group with
128 * 1. Resource group missing virtual_machine_interface_refs property
129 * 2. Resource group missing virtual_machine_interface_properties_sub_interface_vlan_tag
131 * 3. Resource group parent port as get_param
133 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "notBoundToParentPort");
138 public void testDiffComputeSubInterface() throws IOException {
140 * Heat file with one compute, one port and one subinterface resource group with
141 * 1. There are two compute both of different type
143 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "diffComputeSubInterface");
147 public void testOnePortIsConnectedWithSubInf() throws IOException {
149 * Heat file with one compute, one port and one subinterface resource group with
150 * 1. Two compute of same type
151 * 2. Two port of same type but only one of them is having sub interface binding
153 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "onePortIsConnectedWithSubInf");
157 public void testRegularNestedSubInterface() throws IOException {
159 * Heat file with one compute, one port and one sub interface without resource group
160 * 1. Two compute of same type
161 * 2. Two port are of different type
162 * 3. Sub interface properties are same in both port
164 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "regularNestedSubInterface");
168 public void testSameComputeDiffPortSubInterface() throws IOException {
170 * Heat file with one compute, one port and one subinterface resource group with
171 * 1. Two compute of same type
172 * 2. Two port are of different type
173 * 3. Sub interface properties are same in both port
175 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeDiffPortSubInterface");
179 public void testSameComputeSamePortDiffSubInterfaceFile() throws IOException {
181 * Heat file with one compute, one port and one subinterface resource group with
182 * 1. Two compute of same type
183 * 2. Two port are of same type connected with different sub interface nested file
184 * 3. Sub interface property are same for both port
186 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeSamePortDiffSubInterfaceFile");
189 //****************** PATTERN 1C1 Tests ***************************
192 public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
194 * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
196 * 1. Compute has one port each
197 * 2. Port has one sub-interface each
198 * 3. Port connected to network
199 * 3. Sub-interface not connected to network
201 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
205 public void testSubInterfaceScalingMultiplePortsMultipleVlansWithGroup() throws IOException {
207 * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
209 * 1. Each compute has two ports, one of each type
210 * 2. Port has one sub-interface each
211 * 3. Ports connected to different networks
212 * 4. Sub-interface of one type connected to network
214 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
218 public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
220 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
222 * 1. Each compute has two ports, one of each type
223 * 2. One of the ports has a subinterface
224 * 3. Ports connected to network
225 * 4. Subinterfaces not connected to network
226 * 5. Optional properties contained in one subinterface and not in other
228 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
232 public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
234 * Heat file with two computes, two ports of same type connected to network and two subinterface resource
235 * represented through a regular nested resource and not using a resource group not connected to network
237 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
241 public void testSubInterfaceScalingAllConnectivities() throws IOException {
243 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
245 * 1. Each compute has two ports, one of each type
246 * 2. One of the ports has a subinterface
247 * 3. Port connected to network
248 * 4. Both ports and subinterfaces connected to network
249 * 5. All connectivities including dependency, get attribute from nodes and output param
251 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");
255 public void testSubInterfaceWithDifferentResourceGroupCount() throws IOException {
257 * Heat file with two computes of the same type, each one has one port with one sub interface
259 * resource group have a different count which creates a catalog instance
262 testTranslationWithInit(PATTERN_1C2_BASE_DIRECTORY + "differentResourceGroupCount");
266 public void testSubInterfaceDifferentNodesConnectedOutToResourceGroup() throws IOException {
267 testTranslationWithInit(PATTERN_1C2_BASE_DIRECTORY + "differentNodesConnectedOut");
271 public void testSubInterfaceDifferentNetwork() throws IOException {
272 testTranslationWithInit(PATTERN_1C2_BASE_DIRECTORY + "differentNetwork");
275 //Pattern5 Test Cases
277 public void testBaseScenarioPattern5() throws IOException {
279 * Base heat has only nested component and nested heat has reference to subinterface and
280 * two VFCs of different type
281 * 1. Each server connected with two port
282 * 2. One Port of each server connected to network
283 * 3. Only one port out of four is having sub interface connectivity
284 * 4. Sub-interface connected to different network then port
286 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "baseScenario");
290 public void testComplexVFCScalingScenarioPattern5() throws IOException {
292 * 1. Base heat has only nested component and nested has reference to subinterface and
293 * two VFCs of same type
294 * 1. Each server connected with two port
295 * 2. One Port of each server connected to network
296 * 3. Only one port out of four is having sub interface
297 * 4. Sub-interface connected to different network then port
299 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCScalingScenario");
303 public void testComplexVFCMultiLevelNestedScenarioPattern5() throws IOException {
305 * 1. First level nested is having one VFC and one Port with Sub interface
306 * 2. Second level nested is having one VFC and one Port with Sub interface which are of same
307 * type as parent heat file
309 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedScenario");
313 public void testComplexVFCMultiLevelNestedDiffComputeScenarioPattern5() throws
316 * 1. First level nested is having one VFC and one Port with Sub interface
317 * 2. Second level nested is having one VFC and one Port with Sub interface which are of
318 * different type as parent heat file
320 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedDiffComputeScenario");
324 public void testComplexVFCMultiComputeInAllHeatPattern5() throws
327 * 1. Main is having 4 VFC of 2 type and 2 port and all having sub interface
328 * 2. Second level nested is having 4 VFC of 2 type and 2 port and all having sub interface
330 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiVFCInAllHeatScalingScenario");
334 public void testComplexVFCMultiLevelNestedMultiComputeScenarioPattern5() throws
337 * 1. First level nested is having one VFC and one Port with Sub interface
338 * 2. Second level nested is having two VFC of same type and two Port with Sub interface
340 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedMultiComputeScenario");
344 public void testComplexVFCWithDiffSubInfConnectivityScenarioPattern5() throws IOException {
346 * 1. First level nested is having one VFC and one Port with Sub interface
347 * 2. Second level nested is having two VFC of same type and one Port with only one port
348 * connected to Sub interface
350 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCWithDiffSubInfConnectivityScenario");
354 public void testComplexVFCWithDiffSubInfCountScenarioPattern5() throws IOException {
356 * 1. First level nested is having one VFC and one Port with Sub interface
357 * 2. Second level nested is having two VFC of same type and connected to Sub interface but
358 * having different count
360 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCWithDiffSubInfCountScenario");
363 //Pattern 4 Test Cases
365 public void testSubInterfaceComputePortNetworkPattern4() throws IOException {
367 * Nested Heat file with one compute, one port and one subinterface resource group with only
368 * port connected to network
370 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "computePortNetworkSubInterface");
374 public void testSubInterfaceMultiplePortsMultipleVlansPattern4() throws IOException {
376 * Nested Heat file with one compute, two ports and two subinterface resource groups with
377 * 1. Port connected to network
378 * 2. Sub-interfaces each with different nested files
380 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multiplePortsMultipleVlans");
384 public void testSubInterfaceMultipleVlanDiffFilePattern4() throws IOException {
386 * Nested Heat file with one compute, one port and two subinterface resource groups with
387 * 1. Port connected to network
388 * 2. Sub-interfaces with different nested files
390 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanDiffFile");
394 public void testSubInterfaceMultipleVlanSameFilePattern4() throws IOException {
396 * Nested Heat file with one compute, one port and two subinterface resource groups with
397 * 1. Port connected to network
398 * 2. Sub-interfaces with same nested files
400 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanSameFile");
404 public void testSubInterfaceRegularNestedPattern4() throws IOException {
406 * Nested Heat file with one compute, one port and one subinterface resource represented
407 * through a regular nested resource and not using a resource group
409 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "regularNestedSubInterface");
413 public void testSubInterfaceGetAttrInOutPattern4() throws IOException {
415 * Nested Heat file with one compute, one port and one subinterface resource group with
416 * 1. Port connected to network
417 * 2. Sub-interface connected to different network
418 * 3. Sub-interface has get attribute (in) connectivity from network resource
419 * 4. Sub-interface has get attribute (out) connectivity to second network resource
420 * 5. Sub-interface has get attribute (in) connectivity from output param
422 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
426 public void testSubInterfaceNodesConnectedInPattern4() throws IOException {
428 * Nested Heat file with one compute, one port and one subinterface resource group with
429 * 1. Port connected to network
430 * 2. Sub-interface connected to different network
431 * 3. Sub-interface has depends on (in) connectivity from network resource
433 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
437 public void testSubInterfaceNodesConnectedOutPattern4() throws IOException {
439 * Nested Heat file with one compute, one port and one subinterface resource group with
440 * 1. Port connected to network
441 * 2. Sub-interface connected to same network
442 * 3. Sub-interface has depends on (out) connectivity with network resource
444 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
448 //****************** VFC Instance Group Tests ***************************
451 public void testGroupingOneSubInterfaceTypeOneAbstractNode() throws IOException {
452 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "oneSubInterfaceNetworkRole");
456 public void testGroupingOneSubInterfaceTypeAndTwoAbstractNodes() throws IOException {
457 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "oneSubInterfaceNetworkRoleAndTwoAbstractNodes");
461 public void testGroupingTwoSubInterfaceTypeAndTwoAbstractNodes() throws IOException {
462 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "twoSubInterfaceNetworkRoleAndTwoAbstractNodes");
466 public void testSubInterfacePattern4WithGroup() throws IOException {
468 * Nested Heat file with one compute, one port and one subinterface resource group with
469 * 1. Port connected to network
470 * 2. Sub-interface connected to same network
471 * 3. Sub-interface has depends on (out) connectivity with network resource
473 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "pattern4SubInterfaceNodesConnectedOut");