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/";
34 public void testSubInterfaceComputePortNetwork() throws IOException {
36 * Heat file with one compute, one port and one subinterface resource group with only port
37 * connected to network
39 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "computePortNetworkSubInterface");
43 public void testSubInterfaceNodesConnectedOut() throws IOException {
45 * Heat file with one compute, one port and one subinterface resource group with
46 * 1. Port connected to network
47 * 2. Sub-interface connected to same network
48 * 3. Sub-interface has depends on (out) connectivity with network resource
50 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
54 public void testSubInterfaceNodesConnectedIn() throws IOException {
56 * Heat file with one compute, one port and one subinterface resource group with
57 * 1. Port connected to network
58 * 2. Sub-interface connected to different network
59 * 3. Sub-interface has depends on (in) connectivity from network resource
61 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
65 public void testSubInterfaceGetAttrInOut() throws IOException {
67 * Heat file with one compute, one port and one subinterface resource group with
68 * 1. Port connected to network
69 * 2. Sub-interface connected to different network
70 * 3. Sub-interface has get attribute (in) connectivity from network resource
71 * 4. Sub-interface has get attribute (out) connectivity to second network resource
72 * 5. Sub-interface has get attribute (in) connectivity from output param
74 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
78 public void testSubInterfaceMultipleVlanSameNestedFile() throws IOException {
80 * Heat file with one compute, one port and two subinterface resource groups with
81 * 1. Port connected to network
82 * 2. Sub-interfaces with same nested files
84 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanSameType");
88 public void testSubInterfaceMultipleVlanDiffNestedFile() throws IOException {
90 * Heat file with one compute, one port and two subinterface resource groups with
91 * 1. Port connected to network
92 * 2. Sub-interfaces with different nested files
94 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanDiffType");
98 public void testSubInterfaceMultiplePortsMultipleVlans() throws IOException {
100 * Heat file with one compute, two ports and two subinterface resource groups with
101 * 1. Port connected to network
102 * 2. Sub-interfaces each with different nested files
104 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multiplePortsMultipleVlans");
108 public void testSubInterfaceRegularNested() throws IOException {
110 * Heat file with one compute, one port and one subinterface resource represented through a
111 * regular nested resource and not using a resource group
113 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "regularNestedSubInterface");
117 public void testSubInterfaceNotBoundToPort() throws IOException {
119 * Heat file with one compute, one port and one subinterface resource group with
120 * 1. Resource group missing virtual_machine_interface_refs property
121 * 2. Resource group missing virtual_machine_interface_properties_sub_interface_vlan_tag
123 * 3. Resource group parent port as get_param
125 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "notBoundToParentPort");
130 public void testDiffComputeSubInterface() throws IOException {
132 * Heat file with one compute, one port and one subinterface resource group with
133 * 1. There are two compute both of different type
135 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "diffComputeSubInterface");
139 public void testOnePortIsConnectedWithSubInf() throws IOException {
141 * Heat file with one compute, one port and one subinterface resource group with
142 * 1. Two compute of same type
143 * 2. Two port of same type but only one of them is having sub interface binding
145 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "onePortIsConnectedWithSubInf");
149 public void testRegularNestedSubInterface() throws IOException {
151 * Heat file with one compute, one port and one sub interface without resource group
152 * 1. Two compute of same type
153 * 2. Two port are of different type
154 * 3. Sub interface properties are same in both port
156 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "regularNestedSubInterface");
160 public void testSameComputeDiffPortSubInterface() throws IOException {
162 * Heat file with one compute, one port and one subinterface resource group with
163 * 1. Two compute of same type
164 * 2. Two port are of different type
165 * 3. Sub interface properties are same in both port
167 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY + "sameComputeDiffPortSubInterface");
171 public void testSameComputeSamePortDiffSubInterfaceFile() throws IOException {
173 * Heat file with one compute, one port and one subinterface resource group with
174 * 1. Two compute of same type
175 * 2. Two port are of same type connected with different sub interface nested file
176 * 3. Sub interface property are same for both port
178 testTranslationWithInit(PATTERN_1B_BASE_DIRECTORY
179 + "sameComputeSamePortDiffSubInterfaceFile");
182 //****************** PATTERN 1C1 Tests ***************************
185 public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
187 * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
189 * 1. Compute has one port each
190 * 2. Port has one sub-interface each
191 * 3. Port connected to network
192 * 3. Sub-interface not connected to network
194 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
198 public void testSubInterfaceScalingMultiplePortsMultipleVlans() throws IOException {
200 * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
202 * 1. Each compute has two ports, one of each type
203 * 2. Port has one sub-interface each
204 * 3. Ports connected to different networks
205 * 4. Sub-interface of one type connected to network
207 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
211 public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
213 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
215 * 1. Each compute has two ports, one of each type
216 * 2. One of the ports has a subinterface
217 * 3. Ports connected to network
218 * 4. Subinterfaces not connected to network
219 * 5. Optional properties contained in one subinterface and not in other
221 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
225 public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
227 * Heat file with two computes, two ports of same type connected to network and two subinterface resource
228 * represented through a regular nested resource and not using a resource group not connected to network
230 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
234 public void testSubInterfaceScalingAllConnectivities() throws IOException {
236 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
238 * 1. Each compute has two ports, one of each type
239 * 2. One of the ports has a subinterface
240 * 3. Port connected to network
241 * 4. Both ports and subinterfaces connected to network
242 * 5. All connectivities including dependency, get attribute from nodes and output param
244 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");