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/";
34 private static final String PATTERN_5_BASE_DIRECTORY =
35 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern5/";
36 private static final String VFC_INSTANCE_GROUP_BASE_DIRECTORY =
37 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/vfcInstanceGroup/";
40 public void testSubInterfaceComputePortNetworkWithGroup() throws IOException {
42 * Heat file with one compute, one port and one subinterface resource group with only port
43 * connected to network
45 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "computePortNetworkSubInterface");
49 public void testSubInterfaceNodesConnectedOut() throws IOException {
51 * Heat file with one compute, one port and one subinterface resource group with
52 * 1. Port connected to network
53 * 2. Sub-interface connected to same network
54 * 3. Sub-interface has depends on (out) connectivity with network resource
56 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
60 public void testSubInterfaceNodesConnectedIn() throws IOException {
62 * Heat file with one compute, one port and one subinterface resource group with
63 * 1. Port connected to network
64 * 2. Sub-interface connected to different network
65 * 3. Sub-interface has depends on (in) connectivity from network resource
67 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
71 public void testSubInterfaceGetAttrInOut() throws IOException {
73 * Heat file with one compute, one port and one subinterface resource group with
74 * 1. Port connected to network
75 * 2. Sub-interface connected to different network
76 * 3. Sub-interface has get attribute (in) connectivity from network resource
77 * 4. Sub-interface has get attribute (out) connectivity to second network resource
78 * 5. Sub-interface has get attribute (in) connectivity from output param
80 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
84 public void testSubInterfaceMultipleVlanSameNestedFile() throws IOException {
86 * Heat file with one compute, one port and two subinterface resource groups with
87 * 1. Port connected to network
88 * 2. Sub-interfaces with same nested files
90 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanSameType");
94 public void testSubInterfaceMultipleVlanDiffNestedFile() throws IOException {
96 * Heat file with one compute, one port and two subinterface resource groups with
97 * 1. Port connected to network
98 * 2. Sub-interfaces with different nested files
100 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanDiffType");
104 public void testSubInterfaceMultiplePortsMultipleVlans() throws IOException {
106 * Heat file with one compute, two ports and two subinterface resource groups with
107 * 1. Port connected to network
108 * 2. Sub-interfaces each with different nested files
110 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multiplePortsMultipleVlans");
114 public void testSubInterfaceRegularNested() throws IOException {
116 * Heat file with one compute, one port and one subinterface resource represented through a
117 * regular nested resource and not using a resource group
119 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "regularNestedSubInterface");
123 public void testSubInterfaceNotBoundToPort() throws IOException {
125 * Heat file with one compute, one port and one subinterface resource group with
126 * 1. Resource group missing virtual_machine_interface_refs property
127 * 2. Resource group missing virtual_machine_interface_properties_sub_interface_vlan_tag
129 * 3. Resource group parent port as get_param
131 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "notBoundToParentPort");
136 public void testDiffComputeSubInterface() throws IOException {
138 * Heat file with one compute, one port and one subinterface resource group with
139 * 1. There are two compute both of different type
141 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "diffComputeSubInterface");
145 public void testOnePortIsConnectedWithSubInf() throws IOException {
147 * Heat file with one compute, one port and one subinterface resource group with
148 * 1. Two compute of same type
149 * 2. Two port of same type but only one of them is having sub interface binding
151 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "onePortIsConnectedWithSubInf");
155 public void testRegularNestedSubInterface() throws IOException {
157 * Heat file with one compute, one port and one sub interface without resource group
158 * 1. Two compute of same type
159 * 2. Two port are of different type
160 * 3. Sub interface properties are same in both port
162 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "regularNestedSubInterface");
166 public void testSameComputeDiffPortSubInterface() throws IOException {
168 * Heat file with one compute, one port and one subinterface resource group with
169 * 1. Two compute of same type
170 * 2. Two port are of different type
171 * 3. Sub interface properties are same in both port
173 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeDiffPortSubInterface");
177 public void testSameComputeSamePortDiffSubInterfaceFile() throws IOException {
179 * Heat file with one compute, one port and one subinterface resource group with
180 * 1. Two compute of same type
181 * 2. Two port are of same type connected with different sub interface nested file
182 * 3. Sub interface property are same for both port
184 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY
185 + "sameComputeSamePortDiffSubInterfaceFile");
188 //****************** PATTERN 1C1 Tests ***************************
191 public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
193 * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
195 * 1. Compute has one port each
196 * 2. Port has one sub-interface each
197 * 3. Port connected to network
198 * 3. Sub-interface not connected to network
200 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
204 public void testSubInterfaceScalingMultiplePortsMultipleVlansWithGroup() throws IOException {
206 * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
208 * 1. Each compute has two ports, one of each type
209 * 2. Port has one sub-interface each
210 * 3. Ports connected to different networks
211 * 4. Sub-interface of one type connected to network
213 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
217 public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
219 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
221 * 1. Each compute has two ports, one of each type
222 * 2. One of the ports has a subinterface
223 * 3. Ports connected to network
224 * 4. Subinterfaces not connected to network
225 * 5. Optional properties contained in one subinterface and not in other
227 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
231 public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
233 * Heat file with two computes, two ports of same type connected to network and two subinterface resource
234 * represented through a regular nested resource and not using a resource group not connected to network
236 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
240 public void testSubInterfaceScalingAllConnectivities() throws IOException {
242 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
244 * 1. Each compute has two ports, one of each type
245 * 2. One of the ports has a subinterface
246 * 3. Port connected to network
247 * 4. Both ports and subinterfaces connected to network
248 * 5. All connectivities including dependency, get attribute from nodes and output param
250 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");
253 //Pattern5 Test Cases
255 public void testBaseScenarioPattern5() throws IOException {
257 * Base heat has only nested component and nested heat has reference to subinterface and
258 * two VFCs of different type
259 * 1. Each server connected with two port
260 * 2. One Port of each server connected to network
261 * 3. Only one port out of four is having sub interface connectivity
262 * 4. Sub-interface connected to different network then port
264 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "baseScenario");
268 public void testComplexVFCScalingScenarioPattern5() throws IOException {
270 * 1. Base heat has only nested component and nested has reference to subinterface and
271 * two VFCs of same type
272 * 1. Each server connected with two port
273 * 2. One Port of each server connected to network
274 * 3. Only one port out of four is having sub interface
275 * 4. Sub-interface connected to different network then port
277 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCScalingScenario");
281 public void testComplexVFCMultiLevelNestedScenarioPattern5() throws IOException {
283 * 1. First level nested is having one VFC and one Port with Sub interface
284 * 2. Second level nested is having one VFC and one Port with Sub interface which are of same
285 * type as parent heat file
287 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedScenario");
291 public void testComplexVFCMultiLevelNestedDiffComputeScenarioPattern5() throws
294 * 1. First level nested is having one VFC and one Port with Sub interface
295 * 2. Second level nested is having one VFC and one Port with Sub interface which are of
296 * different type as parent heat file
298 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedDiffComputeScenario");
302 public void testComplexVFCMultiComputeInAllHeatPattern5() throws
305 * 1. Main is having 4 VFC of 2 type and 2 port and all having sub interface
306 * 2. Second level nested is having 4 VFC of 2 type and 2 port and all having sub interface
308 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiVFCInAllHeatScalingScenario");
312 public void testComplexVFCMultiLevelNestedMultiComputeScenarioPattern5() throws
315 * 1. First level nested is having one VFC and one Port with Sub interface
316 * 2. Second level nested is having two VFC of same type and two Port with Sub interface
318 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedMultiComputeScenario");
322 public void testComplexVFCWithDiffSubInfConnectivityScenarioPattern5()
326 * 1. First level nested is having one VFC and one Port with Sub interface
327 * 2. Second level nested is having two VFC of same type and one Port with only one port
328 * connected to Sub interface
330 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCWithDiffSubInfConnectivityScenario");
333 //Catalog instance will start working with 1C2 changes in place
335 public void testComplexVFCWithDiffSubInfCountScenarioPattern5()
339 * 1. First level nested is having one VFC and one Port with Sub interface
340 * 2. Second level nested is having two VFC of same type and connected to Sub interface but
341 * having different count
343 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCWithDiffSubInfCountScenario");
346 //Pattern 4 Test Cases
348 public void testSubInterfaceComputePortNetworkPattern4() throws IOException {
350 * Nested Heat file with one compute, one port and one subinterface resource group with only
351 * port connected to network
353 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY +
354 "computePortNetworkSubInterface");
358 public void testSubInterfaceMultiplePortsMultipleVlansPattern4() throws IOException {
360 * Nested Heat file with one compute, two ports and two subinterface resource groups with
361 * 1. Port connected to network
362 * 2. Sub-interfaces each with different nested files
364 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multiplePortsMultipleVlans");
368 public void testSubInterfaceMultipleVlanDiffFilePattern4() throws IOException {
370 * Nested Heat file with one compute, one port and two subinterface resource groups with
371 * 1. Port connected to network
372 * 2. Sub-interfaces with different nested files
374 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanDiffFile");
378 public void testSubInterfaceMultipleVlanSameFilePattern4() throws IOException {
380 * Nested Heat file with one compute, one port and two subinterface resource groups with
381 * 1. Port connected to network
382 * 2. Sub-interfaces with same nested files
384 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanSameFile");
388 public void testSubInterfaceRegularNestedPattern4() throws IOException {
390 * Nested Heat file with one compute, one port and one subinterface resource represented
391 * through a regular nested resource and not using a resource group
393 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "regularNestedSubInterface");
397 public void testSubInterfaceGetAttrInOutPattern4() throws IOException {
399 * Nested Heat file with one compute, one port and one subinterface resource group with
400 * 1. Port connected to network
401 * 2. Sub-interface connected to different network
402 * 3. Sub-interface has get attribute (in) connectivity from network resource
403 * 4. Sub-interface has get attribute (out) connectivity to second network resource
404 * 5. Sub-interface has get attribute (in) connectivity from output param
406 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
410 public void testSubInterfaceNodesConnectedInPattern4() throws IOException {
412 * Nested Heat file with one compute, one port and one subinterface resource group with
413 * 1. Port connected to network
414 * 2. Sub-interface connected to different network
415 * 3. Sub-interface has depends on (in) connectivity from network resource
417 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
421 public void testSubInterfaceNodesConnectedOutPattern4() throws IOException {
423 * Nested Heat file with one compute, one port and one subinterface resource group with
424 * 1. Port connected to network
425 * 2. Sub-interface connected to same network
426 * 3. Sub-interface has depends on (out) connectivity with network resource
428 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
431 //****************** VFC Instance Group Tests ***************************
434 public void testGroupingOneSubInterfaceTypeOneAbstractNode() throws IOException {
435 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "oneSubInterfaceNetworkRole");
439 public void testGroupingOneSubInterfaceTypeAndTwoAbstractNodes() throws IOException {
440 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "oneSubInterfaceNetworkRoleAndTwoAbstractNodes");
444 public void testGroupingTwoSubInterfaceTypeAndTwoAbstractNodes() throws IOException {
445 testTranslationWithInit(VFC_INSTANCE_GROUP_BASE_DIRECTORY + "twoSubInterfaceNetworkRoleAndTwoAbstractNodes");