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_5_BASE_DIRECTORY =
33 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern5/";
34 private static final String PATTERN_4_BASE_DIRECTORY =
35 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern4/";
38 public void testSubInterfaceComputePortNetwork() throws IOException {
40 * Heat file with one compute, one port and one subinterface resource group with only port
41 * connected to network
43 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "computePortNetworkSubInterface");
47 public void testSubInterfaceNodesConnectedOut() throws IOException {
49 * Heat file with one compute, one port and one subinterface resource group with
50 * 1. Port connected to network
51 * 2. Sub-interface connected to same network
52 * 3. Sub-interface has depends on (out) connectivity with network resource
54 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
58 public void testSubInterfaceNodesConnectedIn() throws IOException {
60 * Heat file with one compute, one port and one subinterface resource group with
61 * 1. Port connected to network
62 * 2. Sub-interface connected to different network
63 * 3. Sub-interface has depends on (in) connectivity from network resource
65 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
69 public void testSubInterfaceGetAttrInOut() throws IOException {
71 * Heat file with one compute, one port and one subinterface resource group with
72 * 1. Port connected to network
73 * 2. Sub-interface connected to different network
74 * 3. Sub-interface has get attribute (in) connectivity from network resource
75 * 4. Sub-interface has get attribute (out) connectivity to second network resource
76 * 5. Sub-interface has get attribute (in) connectivity from output param
78 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
82 public void testSubInterfaceMultipleVlanSameNestedFile() throws IOException {
84 * Heat file with one compute, one port and two subinterface resource groups with
85 * 1. Port connected to network
86 * 2. Sub-interfaces with same nested files
88 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanSameType");
92 public void testSubInterfaceMultipleVlanDiffNestedFile() throws IOException {
94 * Heat file with one compute, one port and two subinterface resource groups with
95 * 1. Port connected to network
96 * 2. Sub-interfaces with different nested files
98 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanDiffType");
102 public void testSubInterfaceMultiplePortsMultipleVlans() throws IOException {
104 * Heat file with one compute, two ports and two subinterface resource groups with
105 * 1. Port connected to network
106 * 2. Sub-interfaces each with different nested files
108 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multiplePortsMultipleVlans");
112 public void testSubInterfaceRegularNested() throws IOException {
114 * Heat file with one compute, one port and one subinterface resource represented through a
115 * regular nested resource and not using a resource group
117 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "regularNestedSubInterface");
121 public void testSubInterfaceNotBoundToPort() throws IOException {
123 * Heat file with one compute, one port and one subinterface resource group with
124 * 1. Resource group missing virtual_machine_interface_refs property
125 * 2. Resource group missing virtual_machine_interface_properties_sub_interface_vlan_tag
127 * 3. Resource group parent port as get_param
129 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "notBoundToParentPort");
134 public void testDiffComputeSubInterface() throws IOException {
136 * Heat file with one compute, one port and one subinterface resource group with
137 * 1. There are two compute both of different type
139 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "diffComputeSubInterface");
143 public void testOnePortIsConnectedWithSubInf() throws IOException {
145 * Heat file with one compute, one port and one subinterface resource group with
146 * 1. Two compute of same type
147 * 2. Two port of same type but only one of them is having sub interface binding
149 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "onePortIsConnectedWithSubInf");
153 public void testRegularNestedSubInterface() throws IOException {
155 * Heat file with one compute, one port and one sub interface without resource group
156 * 1. Two compute of same type
157 * 2. Two port are of different type
158 * 3. Sub interface properties are same in both port
160 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "regularNestedSubInterface");
164 public void testSameComputeDiffPortSubInterface() throws IOException {
166 * Heat file with one compute, one port and one subinterface resource group with
167 * 1. Two compute of same type
168 * 2. Two port are of different type
169 * 3. Sub interface properties are same in both port
171 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeDiffPortSubInterface");
175 public void testSameComputeSamePortDiffSubInterfaceFile() throws IOException {
177 * Heat file with one compute, one port and one subinterface resource group with
178 * 1. Two compute of same type
179 * 2. Two port are of same type connected with different sub interface nested file
180 * 3. Sub interface property are same for both port
182 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY
183 + "sameComputeSamePortDiffSubInterfaceFile");
186 //****************** PATTERN 1C1 Tests ***************************
189 public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
191 * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
193 * 1. Compute has one port each
194 * 2. Port has one sub-interface each
195 * 3. Port connected to network
196 * 3. Sub-interface not connected to network
198 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
202 public void testSubInterfaceScalingMultiplePortsMultipleVlans() throws IOException {
204 * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
206 * 1. Each compute has two ports, one of each type
207 * 2. Port has one sub-interface each
208 * 3. Ports connected to different networks
209 * 4. Sub-interface of one type connected to network
211 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
215 public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
217 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
219 * 1. Each compute has two ports, one of each type
220 * 2. One of the ports has a subinterface
221 * 3. Ports connected to network
222 * 4. Subinterfaces not connected to network
223 * 5. Optional properties contained in one subinterface and not in other
225 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
229 public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
231 * Heat file with two computes, two ports of same type connected to network and two subinterface resource
232 * represented through a regular nested resource and not using a resource group not connected to network
234 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
238 public void testSubInterfaceScalingAllConnectivities() throws IOException {
240 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
242 * 1. Each compute has two ports, one of each type
243 * 2. One of the ports has a subinterface
244 * 3. Port connected to network
245 * 4. Both ports and subinterfaces connected to network
246 * 5. All connectivities including dependency, get attribute from nodes and output param
248 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");
251 //Pattern5 Test Cases
253 public void testBaseScenarioPattern5() throws IOException {
255 * Base heat has only nested component and nested heat has reference to subinterface and
256 * two VFCs of different type
257 * 1. Each server connected with two port
258 * 2. One Port of each server connected to network
259 * 3. Only one port out of four is having sub interface connectivity
260 * 4. Sub-interface connected to different network then port
262 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "baseScenario");
266 public void testComplexVFCScalingScenarioPattern5() throws IOException {
268 * 1. Base heat has only nested component and nested has reference to subinterface and
269 * two VFCs of same type
270 * 1. Each server connected with two port
271 * 2. One Port of each server connected to network
272 * 3. Only one port out of four is having sub interface
273 * 4. Sub-interface connected to different network then port
275 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCScalingScenario");
279 public void testComplexVFCMultiLevelNestedScenarioPattern5() throws IOException {
281 * 1. First level nested is having one VFC and one Port with Sub interface
282 * 2. Second level nested is having one VFC and one Port with Sub interface which are of same
283 * type as parent heat file
285 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY + "complexVFCMultiLevelNestedScenario");
289 public void testComplexVFCMultiLevelNestedDiffComputeScenarioPattern5() throws
292 * 1. First level nested is having one VFC and one Port with Sub interface
293 * 2. Second level nested is having one VFC and one Port with Sub interface which are of
294 * different type as parent heat file
296 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY +
297 "complexVFCMultiLevelNestedDiffComputeScenario");
301 public void testComplexVFCMultiComputeInAllHeatPattern5() throws
304 * 1. Main is having 4 VFC of 2 type and 2 port and all having sub interface
305 * 2. Second level nested is having 4 VFC of 2 type and 2 port and all having sub interface
307 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY +
308 "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 +
319 "complexVFCMultiLevelNestedMultiComputeScenario");
323 public void testComplexVFCWithDiffSubInfConnectivityScenarioPattern5()
327 * 1. First level nested is having one VFC and one Port with Sub interface
328 * 2. Second level nested is having two VFC of same type and one Port with only one port
329 * connected to Sub interface
331 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY +
332 "complexVFCWithDiffSubInfConnectivityScenario");
335 //Catalog instance will start working with 1C2 changes in place
337 public void testComplexVFCWithDiffSubInfCountScenarioPattern5()
341 * 1. First level nested is having one VFC and one Port with Sub interface
342 * 2. Second level nested is having two VFC of same type and connected to Sub interface but
343 * having different count
345 testTranslationWithInit(PATTERN_5_BASE_DIRECTORY +
346 "complexVFCWithDiffSubInfCountScenario");
349 //Pattern 4 Test Cases
351 public void testSubInterfaceComputePortNetworkPattern4() throws IOException {
353 * Nested Heat file with one compute, one port and one subinterface resource group with only
354 * port connected to network
356 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY +
357 "computePortNetworkSubInterface");
361 public void testSubInterfaceMultiplePortsMultipleVlansPattern4() throws IOException {
363 * Nested Heat file with one compute, two ports and two subinterface resource groups with
364 * 1. Port connected to network
365 * 2. Sub-interfaces each with different nested files
367 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multiplePortsMultipleVlans");
371 public void testSubInterfaceMultipleVlanDiffFilePattern4() throws IOException {
373 * Nested Heat file with one compute, one port and two subinterface resource groups with
374 * 1. Port connected to network
375 * 2. Sub-interfaces with different nested files
377 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanDiffFile");
381 public void testSubInterfaceMultipleVlanSameFilePattern4() throws IOException {
383 * Nested Heat file with one compute, one port and two subinterface resource groups with
384 * 1. Port connected to network
385 * 2. Sub-interfaces with same nested files
387 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "multipleVlanSameFile");
391 public void testSubInterfaceRegularNestedPattern4() throws IOException {
393 * Nested Heat file with one compute, one port and one subinterface resource represented
394 * through a regular nested resource and not using a resource group
396 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "regularNestedSubInterface");
400 public void testSubInterfaceGetAttrInOutPattern4() throws IOException {
402 * Nested Heat file with one compute, one port and one subinterface resource group with
403 * 1. Port connected to network
404 * 2. Sub-interface connected to different network
405 * 3. Sub-interface has get attribute (in) connectivity from network resource
406 * 4. Sub-interface has get attribute (out) connectivity to second network resource
407 * 5. Sub-interface has get attribute (in) connectivity from output param
409 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
413 public void testSubInterfaceNodesConnectedInPattern4() 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 depends on (in) connectivity from network resource
420 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
424 public void testSubInterfaceNodesConnectedOutPattern4() throws IOException {
426 * Nested Heat file with one compute, one port and one subinterface resource group with
427 * 1. Port connected to network
428 * 2. Sub-interface connected to same network
429 * 3. Sub-interface has depends on (out) connectivity with network resource
431 testTranslationWithInit(PATTERN_4_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");