558ebf44b3b41704ae265db84a6370e63156d439
[sdc.git] /
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
18
19 import org.junit.Test;
20 import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
21
22 import java.io.IOException;
23
24 public class UnifiedCompositionSubInterfaceFullTest extends BaseFullTranslationTest {
25
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/";
30
31   @Test
32   public void testSubInterfaceComputePortNetwork() throws IOException {
33     /**
34      * Heat file with one compute, one port and one subinterface resource group with only port
35      * connected to network
36      */
37     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "computePortNetworkSubInterface");
38   }
39
40   @Test
41   public void testSubInterfaceNodesConnectedOut() throws IOException {
42     /**
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
47      */
48     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedOut");
49   }
50
51   @Test
52   public void testSubInterfaceNodesConnectedIn() throws IOException {
53     /**
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
58      */
59     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceNodesConnectedIn");
60   }
61
62   @Test
63   public void testSubInterfaceGetAttrInOut() throws IOException {
64     /**
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
71      */
72     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "subInterfaceGetAttrInOut");
73   }
74
75   @Test
76   public void testSubInterfaceMultipleVlanSameNestedFile() throws IOException {
77     /**
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
81      */
82     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanSameType");
83   }
84
85   @Test
86   public void testSubInterfaceMultipleVlanDiffNestedFile() throws IOException {
87     /**
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
91      */
92     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multipleVlanDiffType");
93   }
94
95   @Test
96   public void testSubInterfaceMultiplePortsMultipleVlans() throws IOException {
97     /**
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
101      */
102     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "multiplePortsMultipleVlans");
103   }
104
105   @Test
106   public void testSubInterfaceRegularNested() throws IOException {
107     /**
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
110      */
111     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "regularNestedSubInterface");
112   }
113
114   @Test
115   public void testSubInterfaceNotBoundToPort() throws IOException {
116     /**
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
120      *    property
121      * 3. Resource group parent port as get_param
122      */
123     testTranslationWithInit(PATTERN_1A_BASE_DIRECTORY + "notBoundToParentPort");
124   }
125
126   //****************** PATTERN 1C1 Tests ***************************
127
128   @Test
129   public void testSubInterfaceScalingOnePortVlanSameType() throws IOException {
130     /**
131      * Heat file with two computes of same type, two ports of same type and two subinterface resource groups of same
132      * type with
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
137      */
138     testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "onePortVlanSameType");
139   }
140
141   @Test
142   public void testSubInterfaceScalingMultiplePortsMultipleVlans() throws IOException {
143     /**
144      * Heat file with two computes of different type, four ports of two types each and four subinterface resource groups
145      * of two types each
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
150      */
151     testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "multiplePortsMultipleVlans");
152   }
153
154   @Test
155   public void testSubInterfaceScalingOptionalPropertiesConsolidation() throws IOException {
156     /**
157      * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
158      * of same type
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
164      */
165     testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "optionalPropertiesConsolidation");
166   }
167
168   @Test
169   public void testSubInterfaceScalingRegularNestedSubInterface() throws IOException {
170     /**
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
173      */
174     testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "regularNestedSubInterface");
175   }
176
177   @Test
178   public void testSubInterfaceScalingAllConnectivities() throws IOException {
179     /**
180      * Heat file with two computes of same type, four ports of two types each and two subinterface resource groups
181      * of same type
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
187      */
188     testTranslationWithInit(PATTERN_1C1_BASE_DIRECTORY + "allConnectivities");
189   }
190 }