Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / java / org / openecomp / sdc / translator / services / heattotosca / impl / resourcetranslation / ResourceTranslationContrailV2VmInterfaceImplTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
22
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
26
27 import java.io.IOException;
28
29 import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_CONNECTIVITY_POSITIVE;
30
31 /**
32  * @author Avrahamg
33  * @since August 10, 2016
34  */
35 public class ResourceTranslationContrailV2VmInterfaceImplTest extends BaseResourceTranslationTest {
36
37   @Override
38   @Before
39   public void setUp() throws IOException {
40     // do not delete this function. it prevents the superclass setup from running
41   }
42
43   @Test
44   public void testTranslateVMIWithGetResource() throws Exception {
45     inputFilesPath = "/mock/services/heattotosca/contrailv2VMinterface/oneNet/inputfiles";
46     outputFilesPath = "/mock/services/heattotosca/contrailv2VMinterface/oneNet/expectedoutputfiles";
47     initTranslatorAndTranslate();
48     testTranslation();
49     validatePortTemplateConsolidationData(ConsolidationDataValidationType
50         .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE);
51   }
52
53   @Test
54   public void testTranslateVMIWithListOfNetworks() throws Exception {
55     inputFilesPath = "/mock/services/heattotosca/contrailv2VMinterface/listNet/inputfiles";
56     outputFilesPath =
57         "/mock/services/heattotosca/contrailv2VMinterface/listNet/expectedoutputfiles";
58     initTranslatorAndTranslate();
59     testTranslation();
60     validatePortTemplateConsolidationData(ConsolidationDataValidationType
61         .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE);
62   }
63
64   @Test
65   public void testMacAddressesValueMapOfListWithOneItem() throws IOException {
66     inputFilesPath =
67         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapOneItem/inputfiles";
68     outputFilesPath =
69         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapOneItem/expectedoutputfiles";
70     initTranslatorAndTranslate();
71     testTranslation();
72   }
73
74   @Test
75   public void testMacAddressesValueMapOfListWithTwoItems() throws IOException {
76     inputFilesPath =
77         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapTwoItems/inputfiles";
78     outputFilesPath =
79         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapTwoItems/expectedoutputfiles";
80     initTranslatorAndTranslate();
81     testTranslation();
82   }
83
84   @Test
85   public void testMacAddressesValueMapOfListWithStaticValue() throws IOException {
86     inputFilesPath =
87         "/mock/services/heattotosca/contrailv2VMinterface/macAddressStaticValue/inputfiles";
88     outputFilesPath =
89         "/mock/services/heattotosca/contrailv2VMinterface/macAddressStaticValue/expectedoutputfiles";
90     initTranslatorAndTranslate();
91     testTranslation();
92   }
93
94   @Test
95   public void testMacAddressesValueNotList() throws IOException {
96     inputFilesPath =
97         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueNotAList/inputfiles";
98     outputFilesPath =
99         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueNotAList/expectedoutputfiles";
100     initTranslatorAndTranslate();
101     testTranslation();
102   }
103
104   @Test
105   public void testMacAddressesValueInProperForm() throws IOException {
106     inputFilesPath =
107         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueInProperForm/inputfiles";
108     outputFilesPath =
109         "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueInProperForm/expectedoutputfiles";
110     initTranslatorAndTranslate();
111     testTranslation();
112   }
113 }