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");
137 public void testIfSubInfNotPresentPortPropShouldBeFalse() throws IOException {
139 * Nested Heat file with one compute, two port and one subinterface resource group with
140 * 1. Port connected with compute
141 * 2. Sub-interface connected to only on Port
142 * 3. Need to verify if sub interface resource is not bind with Port then
143 * subinterface_indicator property under port value should be false
145 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "twoPortOnlyOneConnectedWithSubInf");
150 public void testDiffComputeSubInterface() throws IOException {
152 * Heat file with one compute, one port and one subinterface resource group with
153 * 1. There are two compute both of different type
155 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "diffComputeSubInterface");
159 public void testOnePortIsConnectedWithSubInf() throws IOException {
161 * Heat file with one compute, one port and one subinterface resource group with
162 * 1. Two compute of same type
163 * 2. Two port of same type but only one of them is having sub interface binding
165 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "onePortIsConnectedWithSubInf");
169 public void testRegularNestedSubInterface() throws IOException {
171 * Heat file with one compute, one port and one sub interface without resource group
172 * 1. Two compute of same type
173 * 2. Two port are of different type
174 * 3. Sub interface properties are same in both port
176 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "regularNestedSubInterface");
180 public void testSameComputeDiffPortSubInterface() throws IOException {
182 * Heat file with one compute, one port and one subinterface resource group with
183 * 1. Two compute of same type
184 * 2. Two port are of different type
185 * 3. Sub interface properties are same in both port
187 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeDiffPortSubInterface");
191 public void testSameComputeSamePortDiffSubInterfaceFile() throws IOException {
193 * Heat file with one compute, one port and one subinterface resource group with
194 * 1. Two compute of same type
195 * 2. Two port are of same type connected with different sub interface nested file
196 * 3. Sub interface property are same for both port
198 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeSamePortDiffSubInterfaceFile");
201 //****************** PATTERN 1C1 Tests ***************************
204 public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
206 * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
208 * 1. Compute has one port each
209 * 2. Port has one sub-interface each
210 * 3. Port connected to network
211 * 3. Sub-interface not connected to network
213 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
217 public void testSubInterfaceScalingMultiplePortsMultipleVlansWithGroup() throws IOException {
219 * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
221 * 1. Each compute has two ports, one of each type
222 * 2. Port has one sub-interface each
223 * 3. Ports connected to different networks
224 * 4. Sub-interface of one type connected to network
226 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
230 public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
232 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
234 * 1. Each compute has two ports, one of each type
235 * 2. One of the ports has a subinterface
236 * 3. Ports connected to network
237 * 4. Subinterfaces not connected to network
238 * 5. Optional properties contained in one subinterface and not in other
240 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
244 public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
246 * Heat file with two computes, two ports of same type connected to network and two subinterface resource
247 * represented through a regular nested resource and not using a resource group not connected to network
249 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
253 public void testSubInterfaceScalingAllConnectivities() throws IOException {
255 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
257 * 1. Each compute has two ports, one of each type
258 * 2. One of the ports has a subinterface
259 * 3. Port connected to network
260 * 4. Both ports and subinterfaces connected to network
261 * 5. All connectivities including dependency, get attribute from nodes and output param
263 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");
267 public void testSubInterfaceWithDifferentResourceGroupCount() throws IOException {
269 * Heat file with two computes of the same type, each one has one port with one sub interface
271 * resource group have a different count which creates a catalog instance
274 testTranslationWithInit(PATTERN_1C2_BASE_DIRECTORY + "differentResourceGroupCount");
278 public void testSubInterfaceDifferentNodesConnectedOutToResourceGroup() throws IOException {
279 testTranslationWithInit(PATTERN_1C2_BASE_DIRECTORY + "differentNodesConnectedOut");
283 public void testSubInterfaceDifferentNetwork() throws IOException {
284 testTranslationWithInit(PATTERN_1C2_BASE_DIRECTORY + "differentNetwork");
287 //Pattern5 Test Cases
289 public void testBaseScenarioPattern5() throws IOException {
291 * Base heat has only nested component and nested heat has reference to subinterface and
292 * two VFCs of different type
293 * 1. Each server connected with two port
294 * 2. One Port of each server connected to network
295 * 3. Only one port out of four is having sub interface connectivity
296 * 4. Sub-interface connected to different network then port
298 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "baseScenario");
302 public void testComplexVFCScalingScenarioPattern5() throws IOException {
304 * 1. Base heat has only nested component and nested has reference to subinterface and
305 * two VFCs of same type
306 * 1. Each server connected with two port
307 * 2. One Port of each server connected to network
308 * 3. Only one port out of four is having sub interface
309 * 4. Sub-interface connected to different network then port
311 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCScalingScenario");
315 public void testComplexVFCMultiLevelNestedScenarioPattern5() throws IOException {
317 * 1. First level nested is having one VFC and one Port with Sub interface
318 * 2. Second level nested is having one VFC and one Port with Sub interface which are of same
319 * type as parent heat file
321 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedScenario");
325 public void testComplexVFCMultiLevelNestedDiffComputeScenarioPattern5() throws
328 * 1. First level nested is having one VFC and one Port with Sub interface
329 * 2. Second level nested is having one VFC and one Port with Sub interface which are of
330 * different type as parent heat file
332 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedDiffComputeScenario");
336 public void testComplexVFCMultiComputeInAllHeatPattern5() throws
339 * 1. Main is having 4 VFC of 2 type and 2 port and all having sub interface
340 * 2. Second level nested is having 4 VFC of 2 type and 2 port and all having sub interface
342 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiVFCInAllHeatScalingScenario");
346 public void testComplexVFCMultiLevelNestedMultiComputeScenarioPattern5() throws
349 * 1. First level nested is having one VFC and one Port with Sub interface
350 * 2. Second level nested is having two VFC of same type and two Port with Sub interface
352 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedMultiComputeScenario");
356 public void testComplexVFCWithDiffSubInfConnectivityScenarioPattern5() throws IOException {
358 * 1. First level nested is having one VFC and one Port with Sub interface
359 * 2. Second level nested is having two VFC of same type and one Port with only one port
360 * connected to Sub interface
362 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCWithDiffSubInfConnectivityScenario");
366 public void testComplexVFCWithDiffSubInfCountScenarioPattern5() throws IOException {
368 * 1. First level nested is having one VFC and one Port with Sub interface
369 * 2. Second level nested is having two VFC of same type and connected to Sub interface but
370 * having different count
372 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCWithDiffSubInfCountScenario");
375 //Pattern 4 Test Cases
377 public void testSubInterfaceComputePortNetworkPattern4() throws IOException {
379 * Nested Heat file with one compute, one port and one subinterface resource group with only
380 * port connected to network
382 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "computePortNetworkSubInterface");
386 public void testSubInterfaceMultiplePortsMultipleVlansPattern4() throws IOException {
388 * Nested Heat file with one compute, two ports and two subinterface resource groups with
389 * 1. Port connected to network
390 * 2. Sub-interfaces each with different nested files
392 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multiplePortsMultipleVlans");
396 public void testSubInterfaceMultipleVlanDiffFilePattern4() throws IOException {
398 * Nested Heat file with one compute, one port and two subinterface resource groups with
399 * 1. Port connected to network
400 * 2. Sub-interfaces with different nested files
402 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanDiffFile");
406 public void testSubInterfaceMultipleVlanSameFilePattern4() throws IOException {
408 * Nested Heat file with one compute, one port and two subinterface resource groups with
409 * 1. Port connected to network
410 * 2. Sub-interfaces with same nested files
412 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanSameFile");
416 public void testSubInterfaceRegularNestedPattern4() throws IOException {
418 * Nested Heat file with one compute, one port and one subinterface resource represented
419 * through a regular nested resource and not using a resource group
421 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "regularNestedSubInterface");
425 public void testSubInterfaceGetAttrInOutPattern4() throws IOException {
427 * Nested Heat file with one compute, one port and one subinterface resource group with
428 * 1. Port connected to network
429 * 2. Sub-interface connected to different network
430 * 3. Sub-interface has get attribute (in) connectivity from network resource
431 * 4. Sub-interface has get attribute (out) connectivity to second network resource
432 * 5. Sub-interface has get attribute (in) connectivity from output param
434 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
438 public void testSubInterfaceNodesConnectedInPattern4() throws IOException {
440 * Nested Heat file with one compute, one port and one subinterface resource group with
441 * 1. Port connected to network
442 * 2. Sub-interface connected to different network
443 * 3. Sub-interface has depends on (in) connectivity from network resource
445 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
449 public void testSubInterfaceNodesConnectedOutPattern4() throws IOException {
451 * Nested Heat file with one compute, one port and one subinterface resource group with
452 * 1. Port connected to network
453 * 2. Sub-interface connected to same network
454 * 3. Sub-interface has depends on (out) connectivity with network resource
456 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
460 //****************** VFC Instance Group Tests ***************************
463 public void testGroupingOneSubInterfaceTypeOneAbstractNode() throws IOException {
464 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "oneSubInterfaceNetworkRole");
468 public void testGroupingOneSubInterfaceTypeAndTwoAbstractNodes() throws IOException {
469 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "oneSubInterfaceNetworkRoleAndTwoAbstractNodes");
473 public void testGroupingTwoSubInterfaceTypeAndTwoAbstractNodes() throws IOException {
474 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "twoSubInterfaceNetworkRoleAndTwoAbstractNodes");
478 public void testSubInterfacePattern4WithGroup() throws IOException {
480 * Nested Heat file with one compute, one port and one subinterface resource group with
481 * 1. Port connected to network
482 * 2. Sub-interface connected to same network
483 * 3. Sub-interface has depends on (out) connectivity with network resource
485 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "pattern4SubInterfaceNodesConnectedOut");