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_1C1_BASE_DIRECTORY =
29 "/mock/services/heattotosca/fulltest/subinterface/vlantagging/pattern1c1/";
32 public void testSubInterfaceComputePortNetwork() throws IOException {
34 * Heat file with one compute, one port and one subinterface resource group with only port
35 * connected to network
37 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "computePortNetworkSubInterface");
41 public void testSubInterfaceNodesConnectedOut() throws IOException {
43 * Heat file with one compute, one port and one subinterface resource group with
44 * 1. Port connected to network
45 * 2. Sub-interface connected to same network
46 * 3. Sub-interface has depends on (out) connectivity with network resource
48 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
52 public void testSubInterfaceNodesConnectedIn() throws IOException {
54 * Heat file with one compute, one port and one subinterface resource group with
55 * 1. Port connected to network
56 * 2. Sub-interface connected to different network
57 * 3. Sub-interface has depends on (in) connectivity from network resource
59 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
63 public void testSubInterfaceGetAttrInOut() throws IOException {
65 * Heat file with one compute, one port and one subinterface resource group with
66 * 1. Port connected to network
67 * 2. Sub-interface connected to different network
68 * 3. Sub-interface has get attribute (in) connectivity from network resource
69 * 4. Sub-interface has get attribute (out) connectivity to second network resource
70 * 5. Sub-interface has get attribute (in) connectivity from output param
72 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
76 public void testSubInterfaceMultipleVlanSameNestedFile() throws IOException {
78 * Heat file with one compute, one port and two subinterface resource groups with
79 * 1. Port connected to network
80 * 2. Sub-interfaces with same nested files
82 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanSameType");
86 public void testSubInterfaceMultipleVlanDiffNestedFile() 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 different nested files
92 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanDiffType");
96 public void testSubInterfaceMultiplePortsMultipleVlans() throws IOException {
98 * Heat file with one compute, two ports and two subinterface resource groups with
99 * 1. Port connected to network
100 * 2. Sub-interfaces each with different nested files
102 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multiplePortsMultipleVlans");
106 public void testSubInterfaceRegularNested() throws IOException {
108 * Heat file with one compute, one port and one subinterface resource represented through a
109 * regular nested resource and not using a resource group
111 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "regularNestedSubInterface");
115 public void testSubInterfaceNotBoundToPort() throws IOException {
117 * Heat file with one compute, one port and one subinterface resource group with
118 * 1. Resource group missing virtual_machine_interface_refs property
119 * 2. Resource group missing virtual_machine_interface_properties_sub_interface_vlan_tag
121 * 3. Resource group parent port as get_param
123 testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "notBoundToParentPort");
126 //****************** PATTERN 1C1 Tests ***************************
129 public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
131 * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
133 * 1. Compute has one port each
134 * 2. Port has one sub-interface each
135 * 3. Port connected to network
136 * 3. Sub-interface not connected to network
138 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
142 public void testSubInterfaceScalingMultiplePortsMultipleVlans() throws IOException {
144 * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
146 * 1. Each compute has two ports, one of each type
147 * 2. Port has one sub-interface each
148 * 3. Ports connected to different networks
149 * 4. Sub-interface of one type connected to network
151 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
155 public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
157 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
159 * 1. Each compute has two ports, one of each type
160 * 2. One of the ports has a subinterface
161 * 3. Ports connected to network
162 * 4. Subinterfaces not connected to network
163 * 5. Optional properties contained in one subinterface and not in other
165 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
169 public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
171 * Heat file with two computes, two ports of same type connected to network and two subinterface resource
172 * represented through a regular nested resource and not using a resource group not connected to network
174 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
178 public void testSubInterfaceScalingAllConnectivities() throws IOException {
180 * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
182 * 1. Each compute has two ports, one of each type
183 * 2. One of the ports has a subinterface
184 * 3. Port connected to network
185 * 4. Both ports and subinterfaces connected to network
186 * 5. All connectivities including dependency, get attribute from nodes and output param
188 testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");