2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
23 import org.junit.AfterClass;
24 import org.junit.Before;
25 import org.junit.BeforeClass;
26 import org.junit.Test;
27 import org.openecomp.sdc.common.togglz.ToggleableFeature;
28 import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
29 import org.togglz.testing.TestFeatureManagerProvider;
31 import java.io.IOException;
33 import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_PORT_POSITIVE;
34 import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_VOLUME_POSITIVE;
36 public class ResourceTranslationNovaServerImplTest extends BaseResourceTranslationTest {
40 public void setUp() throws IOException {
41 // do not delete this function. it prevents the superclass setup from running
45 public static void enablefabricConfigurationTagging() {
46 manager.enable(ToggleableFeature.FABRIC_CONFIGURATION);
47 TestFeatureManagerProvider.setFeatureManager(manager);
52 public void testTranslate() throws Exception {
53 inputFilesPath = "/mock/heat/resources/OS_Nova_Server/inputs";
54 outputFilesPath = "/mock/heat/resources/OS_Nova_Server/expectedoutputfiles";
55 initTranslatorAndTranslate();
57 validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
58 TEST_VOLUME_POSITIVE);
59 validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_PORT,
64 public void testTranslateWithOnlyPorts() throws Exception {
65 inputFilesPath = "/mock/heat/resources/Port/inputfiles";
66 outputFilesPath = "/mock/heat/resources/Port/expectedoutputfiles";
67 initTranslatorAndTranslate();
69 validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_PORT,
74 public void testFabricConfigurationOnlyOnePortTrue() throws IOException {
76 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/one_port_true/input";
78 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/one_port_true/output";
79 initTranslatorAndTranslate();
84 public void testFabricConfigurationAllFalse() throws IOException {
86 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/all_false/input";
88 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/all_false/output";
89 initTranslatorAndTranslate();
94 public void testFabricConfigurationPropertyNull() throws IOException {
96 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/property_null/input";
98 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/property_null/output";
99 initTranslatorAndTranslate();
104 public void testFabricConfigurationWithoutProperty() throws IOException {
106 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/without_property/input";
108 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/without_property/output";
109 initTranslatorAndTranslate();
114 public void testFabricConfiguration2Ports() throws IOException {
116 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/2ports/input";
118 "/mock/services/heattotosca/novaservertranslation/fabricConfiguration/2ports/output";
119 initTranslatorAndTranslate();
125 public static void disableVLANTagging() {
126 manager.disable(ToggleableFeature.FABRIC_CONFIGURATION);
128 TestFeatureManagerProvider.setFeatureManager(null);