Catalog alignment
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / execute / sanity / PropertiesAssignmentUpdateFlow_New.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.ci.tests.execute.sanity;
22
23 import com.aventstack.extentreports.Status;
24 import fj.data.Either;
25 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
26 import org.openecomp.sdc.be.model.ComponentInstance;
27 import org.openecomp.sdc.be.model.Resource;
28 import org.openecomp.sdc.be.model.User;
29 import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
30 import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
31 import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
32 import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
33 import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
34 import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
35 import org.openecomp.sdc.ci.tests.datatypes.VendorLicenseModel;
36 import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject;
37 import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
38 import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
39 import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
40 import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
41 import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
42 import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
43 import org.openecomp.sdc.ci.tests.pages.CompositionPage;
44 import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
45 import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
46 import org.openecomp.sdc.ci.tests.pages.HeatParamNameBuilder;
47 import org.openecomp.sdc.ci.tests.pages.HomePage;
48 import org.openecomp.sdc.ci.tests.pages.PropertiesAssignmentPage;
49 import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
50 import org.openecomp.sdc.ci.tests.pages.PropertyNameBuilder;
51 import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
52 import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
53 import org.openecomp.sdc.ci.tests.utilities.FileHandling;
54 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
55 import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
56 import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
57 import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
58 import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
59 import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils;
60 import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils;
61 import org.openecomp.sdc.ci.tests.verificator.PropertiesAssignmentVerificator;
62 import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
63 import org.testng.annotations.BeforeClass;
64 import org.testng.annotations.BeforeMethod;
65 import org.testng.annotations.DataProvider;
66 import org.testng.annotations.Test;
67
68 import java.util.List;
69
70 import static org.testng.Assert.assertTrue;
71
72 public class PropertiesAssignmentUpdateFlow_New extends SetupCDTest {
73
74     private static String filePath;
75     private static String origFile = "virc_fe_be.csar";
76     private static String origFile1 = "virc.csar";
77     private User sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
78
79
80     @BeforeClass
81     public void beforeClass() {
82         filePath = FileHandling.getFilePath("");
83     }
84
85     @BeforeMethod
86     public void beforeTest() {
87         System.out.println("File repository is : " + filePath);
88 //        SetupCDTest.getExtendTest().log(Status.INFO, "File repository is : " + filePath);
89     }
90
91     //Update VSP tests - validating VF properties/inputs values after updating VF with a new VSP
92     @DataProvider(name = "assetFilesInputs", parallel = false)
93     public Object[][] createDataInputs() {
94         return new Object[][]{
95                 {"editInputValueTopChange.csar", ""},
96                 {"editInputValueNoTopChange.csar", "Updated-SRE-Mgt"}};
97     }
98
99     /**
100      * Topoplogy change in updated file - designer changes in inputs values are not kept after update
101      * No topoplogy change in updated file - designer changes in inputs values are kept after update
102      *
103      * @param updFileName     - csar for update
104      * @param validationValue - expected property value after update
105      * @throws Exception
106      */
107     @Test(dataProvider = "assetFilesInputs")
108     public void updateInputDefaultValueTest(String updFileName, String validationValue) throws Exception {
109         setLog(updFileName);
110
111         String origTestFile = origFile;
112         String componentName = "abstract_virc_fe_be_0";
113         String inputName = "management_net_name";
114         String inputUpdValue = "Updated-SRE-Mgt";
115
116         //Import csar
117         ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT,
118                 ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
119         resourceMetaData.setVersion("0.1");
120         ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, origTestFile, getUser());
121
122         //Edit Input value
123         ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
124         PropertiesAssignmentPage.clickOnComponentInComposition(componentName);
125         PropertiesAssignmentPage.clickOnInputTab();
126         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildInputField(inputName), inputUpdValue);
127         PropertiesAssignmentPage.clickOnSaveButton();
128
129         //Certify  VF via API
130         Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
131         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
132
133
134         HomePage.navigateToHomePage();
135         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
136         GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
137
138         //Update VF
139         ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
140         GeneralPageElements.clickCheckoutButton();
141         SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file"));
142         ResourceUIUtils.updateVfWithCsar(filePath, updFileName);
143
144         //Validate Input value - 1) empty in case of topology change; 2) user value is kept if no topology change
145         ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
146         PropertiesAssignmentPage.clickOnComponentInComposition(componentName);
147         PropertiesAssignmentPage.clickOnInputTab();
148         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildInputField(inputName), validationValue);
149
150     }
151
152
153     @DataProvider(name = "assetFilesProperties", parallel = false)
154     public Object[][] createDataProp() {
155         return new Object[][]{
156                 {"editedPropValueToEmpty.csar", "value-prop-vm_type_tag", "updated_by_designer", "updated_by_designer", false}, //no topology change - simple
157                 {"newPropValueToEmpty.csar", "value-prop-high_availablity", "updated_by_designer", "updated_by_designer", false},
158                 {"editedPropValueToNew.csar", "value-prop-vm_type_tag", "updated_by_designer", "updated_by_file", false},
159                 {"virc_fe_be.csar", "value-prop-vm_type_tag", "", "virc_fe_be", true},
160                 {"editedPropValueToEmptyTopChange.csar", "value-prop-vm_type_tag", "updated_by_designer", "", false}, //topology change - simple
161                 {"newPropValueToEmptyTopChange.csar", "value-prop-high_availablity", "updated_by_designer", "", false},
162                 {"editedPropValueToNewTopChange.csar", "value-prop-vm_type_tag", "updated_by_designer", "updated_by_file", false},
163                 {"virc_fe_be.csar", "value-prop-port_virc_fe_be_data_1_port_mac_requirements.mac_range_plan", "updated_by_designer", "updated_by_designer", false}, //no topology change - complex
164                 {"virc_fe_be.csar", "value-prop-service_template_filter.count", "12345", "1", false},
165                 {"virc_fe_be.csar", "value-prop-service_template_filter.substitute_service_template", "", "Nested_virc_fe_beServiceTemplate.yaml", true}};
166     }
167
168     /**
169      * No topology change in updated file - designer changes in properties values are kept after update
170      * OrigFile       Designer       UpdFile       Result After Update
171      * ---------------------------------------------------------------
172      * prop1=value1   prop1=value2   prop1=null    prop1=value2
173      * prop1=null     prop1=value1   prop1=null    prop1=value1
174      * prop1=value1   prop1=value2   prop1=value3  prop1=value3
175      * prop1=value1   prop1=null     prop1=value1  prop1=value1
176      *
177      *
178      * Topoplogy change in updated file - designer changes in properties values are not kept after update
179      * OrigFile       Designer       UpdFile       Result After Update
180      * ---------------------------------------------------------------
181      * prop1=value1   prop1=value2   prop1=null    prop1=null
182      * prop1=null     prop1=value1   prop1=null    prop1=null
183      * prop1=value1   prop1=value2   prop1=value3  prop1=value3
184      *
185      *
186      * No topology change in updated files - complex property value changes
187      * OrigFile       Designer       UpdFile       Result After Update
188      * ---------------------------------------------------------------
189      * prop1=null     prop1=value1   prop1=null    prop1=value1
190      * prop1=value1   prop1=value2   prop1=value1  prop1=value1
191      * prop1=value1   prop1=null     prop1=value1  prop1=value1
192      *
193      * @param updFileName     - csar for update
194      * @param propertyName
195      * @param validationValue - expected property value after update
196      * @throws Exception
197      */
198     @Test(dataProvider = "assetFilesProperties")
199     public void updatePropertyDefaultValueTest(String updFileName, String propertyName, String updValue, String validationValue, boolean userDeletesValue) throws Exception {
200         setLog(updFileName);
201         String origTestFile = origFile;
202         String componentName = "abstract_virc_fe_be_0";
203 //        String propertyUpdValue = "updated_by_designer";
204
205         //Import csar
206         ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT,
207                 ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
208         resourceMetaData.setVersion("0.1");
209         ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, origTestFile, getUser());
210
211         //Edit or delete Input value
212         ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
213         PropertiesAssignmentPage.clickOnComponentInComposition(componentName);
214         if (userDeletesValue) {
215             PropertiesAssignmentPage.deletePropertyValue(propertyName);
216         } else {
217             PropertiesAssignmentPage.editPropertyValue(propertyName, updValue);
218         }
219         PropertiesAssignmentPage.clickOnSaveButton();
220
221         //Certify  VF via API
222         Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
223         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
224
225         //Update VF
226         HomePage.navigateToHomePage();
227         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
228         GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
229         ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
230         GeneralPageElements.clickCheckoutButton();
231         SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file"));
232         ResourceUIUtils.updateVfWithCsar(filePath, updFileName);
233
234         //Validate Input value
235         ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
236         PropertiesAssignmentPage.clickOnComponentInComposition(componentName);
237         PropertiesAssignmentVerificator.validatePropertyValue(propertyName, validationValue);
238     }
239
240
241     //ChangeVersion tests - validating service property values after changing VFi version on service
242     @DataProvider(name = "assetFilesServiceProperties", parallel = false)
243     public Object[][] createDataServiceProp() {
244         return new Object[][]{
245                 {"max_instances", "", "111", "111"}, //edit service prop value, update with original empty value, keep user value after update
246                 {"nfc_naming_code", "virc_fe_be", "updated_by_designer", "virc_fe_be"}}; //edit service prop value, update with original value, set original value after update
247     }
248
249     @Test(dataProvider = "assetFilesServiceProperties")
250     public void changeVfiVersionServicePropertyEditValueTest(String propertyName, String origValue, String updValue, String expectedValue) throws Throwable {
251         setLog(propertyName);
252         String vnfFile = "vIRC_FE_BE.zip";
253         String componentName = "abstract_virc_fe_be_1";
254         String inputName = componentName + "_" + propertyName;
255
256         //Import VSP, create VF - v0.1
257         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
258         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
259         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
260         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
261         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
262             vendorLicenseModel, null);
263         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
264         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
265
266         //VF - Declare property as input
267         declarePropertyAsInput(propertyName, componentName, resourceReqDetails);
268         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildInputField(inputName), origValue);
269
270         //Check in VF, create Service and add VFi to Service
271         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
272         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
273         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
274         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
275                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
276         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
277         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
278
279         //Find the VF inputs in Service properties, add or edit properties values
280         findServiceProperty(inputName, serviceReqDetails);
281         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildSimpleField(inputName), updValue);
282         PropertiesAssignmentPage.clickOnSaveButton();
283
284         //Checkout and check in VF, change VFi version on Service to 0.2
285         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
286         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
287         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
288
289         //Service - Validate properties values
290         viewServiceProperties(serviceReqDetails);
291         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(inputName), expectedValue);
292     }
293
294
295     @Test
296     public void changeVfiVersionServicePropertyDeleteValueTest() throws Throwable {
297         String vnfFile = "vIRC_FE_BE.zip";
298         String componentName = "abstract_virc_fe_be_1";
299         String propertyName = "min_instances";
300         String propertyValue = "0";
301         String inputName = componentName + "_" + propertyName;
302
303         //Import VSP, create VF - v0.1
304         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
305         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
306         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
307         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
308         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
309             vendorLicenseModel, null);
310         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
311         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
312
313         //VF - Declare properties as inputs
314         declarePropertyAsInput(propertyName, componentName, resourceReqDetails);
315         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildInputField(inputName), propertyValue);
316
317         //Check in VF, create Service and add VFi to Service
318         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
319         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
320         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
321         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
322                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
323         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
324         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
325
326         //Find the VF inputs in Service properties, delete property value
327         findServiceProperty(inputName, serviceReqDetails);
328         PropertiesAssignmentPage.deletePropertyValue(PropertyNameBuilder.buildSimpleField(inputName));
329         PropertiesAssignmentPage.clickOnSaveButton();
330
331         //Checkout and check in VF, change VFi version on Service to 0.2
332         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
333         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
334         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
335
336         //Service - Validate properties values
337         viewServiceProperties(serviceReqDetails);
338         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(inputName), propertyValue);
339     }
340
341     @Test
342     public void changeVfiVersionServiceGenericPropertyValueTest() throws Throwable {
343         String vnfFile = "vIRC_FE_BE.zip";
344         String componentName = "abstract_virc_fe_be_1";
345         String propertyName = "nf_type";
346         String propertyUpdValue = "added by designer on service";
347
348         //Import VSP, create VF - v0.1
349         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
350         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
351         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
352         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
353         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
354             vendorLicenseModel, null);
355         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
356         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
357
358         //Check in VF, create Service and add VFi to Service
359         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
360         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
361         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
362         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
363                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
364         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
365         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
366
367         //Find the VF inputs in Service properties, add or edit property value
368         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
369         GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
370         CompositionPage.moveToPropertiesScreen();
371         PropertiesAssignmentPage.findSearchBoxAndClick(propertyName);
372         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildSimpleField(propertyName), propertyUpdValue);
373         PropertiesAssignmentPage.clickOnSaveButton();
374
375         //Checkout and check in VF, change VFi version on Service to 0.2
376         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
377         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
378         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
379
380         //Service - Validate property value
381         viewServiceProperties(serviceReqDetails);
382         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(propertyName), propertyUpdValue);
383     }
384
385
386     //ChangeVersion tests - validating service input values after changing VFi version on service
387     @Test
388     public void changeVfiServiceInputEditValueTest() throws Throwable {
389         String vnfFile = "vIRC_FE_BE.zip";
390         String componentName = "virc_fe_be_volume_0";
391         String propertyName = "disk_bus";
392         String propertyValue = "added_by_designer";
393         String propertyValueUpd = "updated_by_designer";
394         String inputName = componentName + "_" + propertyName;
395
396         //Import VSP, create VF - v0.1
397         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
398         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
399         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
400         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
401         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
402             vendorLicenseModel, null);
403         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
404         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
405
406         //Edit Property Value and declare as input
407         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
408         viewVfComponentProperties(componentName, resourceReqDetails);
409         editAndDeclareSimpleProperty(propertyName, propertyValue);
410         PropertiesAssignmentPage.clickOnInputTab();
411         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildInputField(inputName), propertyValue);
412
413         //Check in VF and add VFi to Service
414         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
415         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
416         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
417         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
418                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
419         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
420         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
421
422         //Find the VF input in Service properties, declare it as service input
423         viewServiceProperties(serviceReqDetails);
424         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(inputName), propertyValue);
425         findAndDeclareServiceProperty(inputName);
426         PropertiesAssignmentVerificator.validatePropertyValue(
427                 PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName), propertyValue);
428
429         //Checkout VF, update input value and check in - v0.2
430         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
431         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
432         viewVfInputs(resourceReqDetails);
433         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildDeclaredInputField(componentName, propertyName),
434                 propertyValueUpd);
435         PropertiesAssignmentPage.clickOnSaveButton();
436         ResourceGeneralPage.clickCheckinButton(resourceReqDetails.getName());
437
438         //Change resource version on service
439         resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resource.getName(), "0.2");
440         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
441
442         //Validate that service contains property with "get_input" value and input with the updated value
443         GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
444         CompositionPage.moveToPropertiesScreen();
445         PropertiesAssignmentPage.isPropertyChecked(inputName);
446         PropertiesAssignmentVerificator.validatePropertyValue(
447                 PropertyNameBuilder.buildServicePropertyValue(componentName, propertyName),
448                         PropertyNameBuilder.buildServiceDeclaredPropertyValue(componentInstance, componentName, propertyName));
449         PropertiesAssignmentPage.clickOnInputTab();
450         PropertiesAssignmentVerificator.validatePropertyValue(
451                 PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName), propertyValueUpd);
452     }
453
454     @Test
455     public void changeVfiServiceInputEditBooleanTest() throws Throwable {
456         String vnfFile = "vIRC_FE_BE.zip";
457         String componentName = "virc_fe_be_volume_0";
458         String propertyName = "multi_stage_design";
459         String origValue = "FALSE";
460         String updValue = "TRUE";
461
462         //Import VSP, create VF - v0.1
463         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
464         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
465         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
466         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
467         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
468             vendorLicenseModel, null);
469         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
470         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
471
472         //Check in VF and add VFi to Service
473         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
474         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
475         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
476         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
477                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
478         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
479         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
480
481         //Find the VF input in Service properties, declare it as service input
482         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
483         GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
484         CompositionPage.moveToPropertiesScreen();
485         PropertiesAssignmentPage.findSearchBoxAndClick(propertyName);
486         PropertiesAssignmentPage.selectBooleanPropertyValue(PropertyNameBuilder.buildSimpleField(propertyName), updValue);
487         PropertiesAssignmentPage.clickOnSaveButton();
488         PropertiesAssignmentPage.clickOnDeclareButton();
489         PropertiesAssignmentPage.clickOnInputTab();
490         PropertiesAssignmentVerificator.validateBooleanPropertyValue(
491                 PropertyNameBuilder.buildServiceDeclaredFieldServiceLevel(componentInstance, propertyName),
492                         updValue);
493
494 //        //Checkout VF and check in - v0.2
495         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
496         AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
497
498 //        //Change resource version on service
499         resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resource.getName(), "0.2");
500         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
501
502 //        //Validate that service contains property with "get_input" value and input with the updated value
503         viewServiceProperties(serviceReqDetails);
504         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(propertyName),
505                 PropertyNameBuilder.buildServiceDeclaredPropValueServiceLevel(componentInstance, propertyName));
506         PropertiesAssignmentPage.isPropertyChecked(propertyName);
507         PropertiesAssignmentPage.clickOnInputTab();
508         PropertiesAssignmentVerificator.validateBooleanPropertyValue(
509                 PropertyNameBuilder.buildServiceDeclaredFieldServiceLevel(componentInstance, propertyName),
510                         origValue);
511     }
512
513     @Test
514     public void changeVfiServiceInputDeleteValueTest() throws Throwable {
515         String vnfFile = "vIRC_FE_BE.zip";
516         String componentName = "abstract_virc_fe_be_0";
517         String propertyName = "vm_type_tag";
518         String propertyValue = "updated_by_designer";
519         String inputName = componentName + "_" + propertyName;
520
521         //Import VSP, create VF - v0.1
522         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
523         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
524         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
525         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
526         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
527             vendorLicenseModel, null);
528         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
529         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
530
531         //Edit Property Value and declare as input
532         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
533         viewVfComponentProperties(componentName, resourceReqDetails);
534         editAndDeclareSimpleProperty(propertyName, propertyValue);
535         PropertiesAssignmentPage.clickOnInputTab();
536         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildInputField(inputName), propertyValue);
537
538         //Check in VF and add VFi to Service
539         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
540         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
541         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
542         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
543                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
544         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
545         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
546
547         //Find the VF input in Service properties, declare it as service input
548         viewServiceProperties(serviceReqDetails);
549         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(inputName), propertyValue);
550         findAndDeclareServiceProperty(inputName);
551         PropertiesAssignmentVerificator.validatePropertyValue(
552                 PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName), propertyValue);
553
554         //Checkout VF, update input value and check in - v0.2
555         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
556         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
557         viewVfInputs(resourceReqDetails);
558         PropertiesAssignmentPage.deletePropertyValue(PropertyNameBuilder.buildDeclaredInputField(componentName, propertyName));
559         PropertiesAssignmentPage.clickOnSaveButton();
560         ResourceGeneralPage.clickCheckinButton(resourceReqDetails.getName());
561
562         //Change resource version on service
563         resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resource.getName(), "0.2");
564         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
565
566         //Validate that service contains property with "get_input" value and input with the updated value
567         GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
568         CompositionPage.moveToPropertiesScreen();
569         PropertiesAssignmentPage.isPropertyChecked(inputName);
570         PropertiesAssignmentVerificator.validatePropertyValue(
571                 PropertyNameBuilder.buildServicePropertyValue(componentName, propertyName),
572                         PropertyNameBuilder.buildServiceDeclaredPropertyValue(componentInstance, componentName, propertyName));
573         PropertiesAssignmentPage.clickOnInputTab();
574         PropertiesAssignmentVerificator.validatePropertyValue(
575                 PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName), propertyValue);
576     }
577
578     @Test
579     public void changeVfiServiceInputAddValueTest() throws Throwable {
580         String vnfFile = "vIRC_FE_BE.zip";
581         String componentName = "virc_fe_be_volume_0";
582         String propertyName = "disk_bus";
583         String propertyValue = "updated_by_designer";
584         String inputName = componentName + "_" + propertyName;
585
586         //Import VSP, create VF - v0.1
587         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
588         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
589         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
590         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
591         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
592             vendorLicenseModel, null);
593         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
594         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
595
596         //Edit Property Value and declare as input
597         declarePropertyAsInput(propertyName, componentName, resourceReqDetails);
598         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildInputField(inputName), "");
599
600         //Check in VF and add VFi to Service
601         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
602         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
603         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
604         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
605                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
606         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
607         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
608
609         //Find the VF input in Service properties, declare it as service input
610         viewServiceProperties(serviceReqDetails);
611         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(inputName), "");
612         findAndDeclareServiceProperty(inputName);
613         PropertiesAssignmentVerificator.validatePropertyValue(
614                 PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName), "");
615
616         //Checkout VF, update input value and check in - v0.2
617         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
618         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
619         viewVfInputs(resourceReqDetails);
620         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildDeclaredInputField(componentName, propertyName), propertyValue);
621         PropertiesAssignmentPage.clickOnSaveButton();
622         ResourceGeneralPage.clickCheckinButton(resourceReqDetails.getName());
623
624         //Change resource version on service
625         resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resource.getName(), "0.2");
626         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
627
628         //Validate that service contains property with "get_input" value and input with the updated value
629         GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
630         CompositionPage.moveToPropertiesScreen();
631         PropertiesAssignmentPage.isPropertyChecked(inputName);
632         PropertiesAssignmentVerificator.validatePropertyValue(
633                 PropertyNameBuilder.buildServicePropertyValue(componentName, propertyName),
634                         PropertyNameBuilder.buildServiceDeclaredPropertyValue(componentInstance, componentName, propertyName));
635         PropertiesAssignmentPage.clickOnInputTab();
636         PropertiesAssignmentVerificator.validatePropertyValue(
637                 PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName), propertyValue);
638     }
639
640     @Test
641     public void changeVfiServiceInputDeleteInputTest() throws Throwable {
642         String vnfFile = "vIRC_FE_BE.zip";
643         String componentName = "virc_fe_be_volume_0";
644         String propertyName = "disk_bus";
645         String propertyValue = "added_by_designer";
646         String inputName = componentName + "_" + propertyName;
647
648         //Import VSP, create VF - v0.1
649         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
650         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
651         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
652         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
653         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
654             vendorLicenseModel, null);
655         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
656         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
657
658         //Edit Property Value and declare as input
659         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
660         viewVfComponentProperties(componentName, resourceReqDetails);
661         editAndDeclareSimpleProperty(propertyName, propertyValue);
662         PropertiesAssignmentPage.clickOnInputTab();
663         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildInputField(inputName), propertyValue);
664
665         //Check in VF and add VFi to Service
666         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
667         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
668         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
669         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
670                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
671         Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
672         ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value();
673
674         //Find the VF input in Service properties, declare it as service input
675         viewServiceProperties(serviceReqDetails);
676         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildSimpleField(inputName), propertyValue);
677         findAndDeclareServiceProperty(inputName);
678         PropertiesAssignmentVerificator.validatePropertyValue(
679                 PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName), propertyValue);
680
681         //Checkout VF, delete input  and check in - v0.2
682         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
683         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
684         viewVfInputs(resourceReqDetails);
685         PropertiesAssignmentPage.clickOnDeleteInputButton();
686         PropertiesAssignmentPage.clickOnDeleteInputDialogConfirmationButton();
687         ResourceGeneralPage.clickCheckinButton(resourceReqDetails.getName());
688
689         //Change resource version on service
690         resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resource.getName(), "0.2");
691         AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true);
692
693         //Validate that service property and input are deleted
694         GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
695         CompositionPage.moveToPropertiesScreen();
696         PropertiesAssignmentPage.findProperty(inputName);
697         assertTrue(GeneralUIUtils.isElementInvisibleByTestId(PropertyNameBuilder.buildSimpleField(inputName)));
698         PropertiesAssignmentPage.clickOnInputTab();
699         assertTrue(GeneralUIUtils.isElementInvisibleByTestId(PropertyNameBuilder.buildServiceDeclaredFieldVfLevel(componentInstance, componentName, propertyName)));
700     }
701
702
703     //ChangeVersion test - validating VF input values after changing VFCi version on VF
704     @Test
705     public void updateVFCPropertyChangeVFCiVersionTest() throws Throwable {
706         ResourceReqDetails atomicResourceMetaData;
707         String prop1 = "network_role";
708         String propValue1 = "added_value_1";
709         String prop2 = "is_default";
710         String propValue2 = "TRUE";
711         String propDefaultValue2 = "FALSE";
712
713         //Import VFC, certify VFC
714         String fileName = "importVFC_VFC23.yml";
715         atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT,
716                 ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
717         ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
718         String vfcName = atomicResourceMetaData.getName();
719         ResourceGeneralPage.clickCheckinButton(vfcName);
720
721         //Create VF
722         ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
723         ResourceUIUtils.createVF(vfMetaData, getUser());
724
725         //Add VFCi to VF canvas
726         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
727         CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
728         CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(vfcName);
729
730         //VF Properties Assignment - edit properties values and declare as input
731         CompositionPage.moveToPropertiesScreen();
732         PropertiesAssignmentPage.findSearchBoxAndClick(prop1);
733         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildSimpleField(prop1), propValue1);
734         PropertiesAssignmentPage.clickOnSaveButton();
735         PropertiesAssignmentPage.clickOnDeclareButton();
736         PropertiesAssignmentPage.findSearchBoxAndClick(prop2);
737         PropertiesAssignmentPage.selectBooleanPropertyValue(PropertyNameBuilder.buildSimpleField(prop2), propValue2);
738         PropertiesAssignmentPage.clickOnSaveButton();
739         PropertiesAssignmentPage.clickOnDeclareButton();
740
741         //Check out and check in VFC - v0.2
742         HomePage.navigateToHomePage();
743         GeneralUIUtils.findComponentAndClick(vfcName);
744         ResourceGeneralPage.clickCheckoutButton();
745         ResourceGeneralPage.clickCheckinButton(vfcName);
746
747         //Change VFCi version in VF
748         GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
749         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
750         vfCanvasManager = CanvasManager.getCanvasManager();
751         CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "0.2");
752         VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "0.2");
753
754         Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vfMetaData.getName(), "0.1");
755         List<ComponentInstance> components = resource.getComponentInstances();
756         String normalizedName = components.get(0).getNormalizedName();
757         CompositionPage.moveToPropertiesScreen();
758         PropertiesAssignmentPage.clickOnInputTab();
759         //Verify that input value of the declared property that is EMPTY by default hasn't changed
760         PropertiesAssignmentVerificator.validatePropertyValue(PropertyNameBuilder.buildDeclaredInputField(normalizedName, prop1), propValue1);
761         //Verify that input value of the declared property that is NOT EMPTY by default has been changed
762         PropertiesAssignmentVerificator.validateBooleanPropertyValue(PropertyNameBuilder.buildDeclaredInputField(normalizedName, prop2), propDefaultValue2);
763
764         //Check out VFC - v0.3, delete a property, check in VFC
765         HomePage.navigateToHomePage();
766         GeneralUIUtils.findComponentAndClick(vfcName);
767         ResourceGeneralPage.clickCheckoutButton();
768         ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
769         PropertiesPage.clickDeletePropertyFromPopup(prop1);
770         PropertiesPage.clickDeletePropertyFromPopup(prop2);
771         ResourceGeneralPage.clickCheckinButton(vfcName);
772
773         //Change VFCi version in VF
774         GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
775         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
776         vfCanvasManager = CanvasManager.getCanvasManager();
777         CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "0.3");
778         VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "0.3");
779
780         //Verify that properties and inputs were removed
781         CompositionPage.moveToPropertiesScreen();
782         PropertiesAssignmentPage.findProperty(prop1);
783         assertTrue(GeneralUIUtils.isElementInvisibleByTestId(PropertyNameBuilder.buildSimpleField(prop1)));
784         PropertiesAssignmentPage.findProperty(prop2);
785         assertTrue(GeneralUIUtils.isElementInvisibleByTestId(PropertyNameBuilder.buildSimpleField(prop2)));
786         PropertiesAssignmentPage.clickOnInputTab();
787         PropertiesAssignmentPage.findProperty(normalizedName + "_" + prop1);
788         assertTrue(GeneralUIUtils.isElementInvisibleByTestId(PropertyNameBuilder.buildDeclaredInputField(normalizedName, prop1)));
789         PropertiesAssignmentPage.findProperty(normalizedName + "_" + prop2);
790         assertTrue(GeneralUIUtils.isElementInvisibleByTestId(PropertyNameBuilder.buildDeclaredInputField(normalizedName, prop2)));
791     }
792
793     //ChangeVersion test - validating HEAT param values after changing VFi version on Service
794     @Test
795     public void updateHeatParamChangeVfiVersionTest() throws Throwable {
796         String vnfFile = "vIRC_FE_BE.zip";
797         String artifactName = "base_fe_be";
798         String heatParamName = "availability_zone_0";
799         String heatParamUpdValue = "Updated_ZoneA";
800
801         //Import VSP, create VF - v0.1
802         String filePath = org.openecomp.sdc.ci.tests.utils.general.FileHandling.getVnfRepositoryPath();
803         getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile);
804         VendorLicenseModel vendorLicenseModel = VendorLicenseModelRestUtils.createVendorLicense(getUser());
805         ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT);
806         VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails,
807             vendorLicenseModel, null);
808         resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject);
809         Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails);
810
811         //Check in VF and add VFi to Service
812         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
813         ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails);
814         getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName());
815         org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(
816                 serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value();
817         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
818         GeneralUIUtils.findComponentAndClick(service.getName());
819         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
820         CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
821         CanvasElement vfElement = vfCanvasManager.createElementOnCanvas(resource.getName());
822
823         //Select VFi on canvas, open Deployment Artifacts tab
824         vfCanvasManager.clickOnCanvaElement(vfElement);
825         CompositionPage.showDeploymentArtifactTab();
826         DeploymentArtifactPage.hoverArtifact(artifactName);
827         DeploymentArtifactPage.clickEditEnvArtifact(artifactName);
828         DeploymentArtifactPage.editHeatParamValue(HeatParamNameBuilder.buildCurrentHeatParamValue(heatParamName), heatParamUpdValue);
829         DeploymentArtifactPage.clickSaveEnvParameters();
830
831         //Checkout and check in VF - v0.2
832         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
833         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
834
835         //Change VFi version on Service canvas - v0.2
836         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
837         GeneralUIUtils.findComponentAndClick(service.getName());
838         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
839         vfCanvasManager = CanvasManager.getCanvasManager();
840         CompositionPage.changeComponentVersion(vfCanvasManager, vfElement, "0.2");
841 //        VfVerificator.verifyInstanceVersion(service, getUser(), resource.getName(), "0.2");
842
843         //Validate that edited heatparam value is kept
844         CompositionPage.showDeploymentArtifactTab();
845         DeploymentArtifactPage.hoverArtifact(artifactName);
846         DeploymentArtifactPage.clickEditEnvArtifact(artifactName);
847         PropertiesAssignmentVerificator.validatePropertyValue(HeatParamNameBuilder.buildCurrentHeatParamValue(heatParamName), heatParamUpdValue);
848         DeploymentArtifactPage.clickCloseEnvParameters();
849
850         //Check out VF, delete heatparam value, check in VF - v0.3
851         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft();
852         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
853         GeneralUIUtils.findComponentAndClick(resource.getName());
854         ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
855         DeploymentArtifactPage.clickEditEnvArtifact(artifactName);
856         DeploymentArtifactPage.clickOnDeleteHeatParamValue(heatParamName);
857         DeploymentArtifactPage.clickSaveEnvParameters();
858         resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKIN, true).getLeft();
859
860         //Change VFi version on Service canvas - v0.3
861         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
862         GeneralUIUtils.findComponentAndClick(service.getName());
863         ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
864         vfCanvasManager = CanvasManager.getCanvasManager();
865         CompositionPage.changeComponentVersion(vfCanvasManager, vfElement, "0.3");
866
867         //Validate that edited heatparam value is kept, default value is empty
868         CompositionPage.showDeploymentArtifactTab();
869         DeploymentArtifactPage.hoverArtifact(artifactName);
870         DeploymentArtifactPage.clickEditEnvArtifact(artifactName);
871         PropertiesAssignmentVerificator.validatePropertyValue(HeatParamNameBuilder.buildCurrentHeatParamValue(heatParamName), heatParamUpdValue);
872         PropertiesAssignmentVerificator.validatePropertyValueIsNull(HeatParamNameBuilder.buildDefaultHeatParamValue(heatParamName));
873         DeploymentArtifactPage.clickCloseEnvParameters();
874     }
875
876
877     private void declarePropertyAsInput(String propertyName, String componentName, ResourceReqDetails resourceReqDetails) throws Exception {
878         CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
879         viewVfComponentProperties(componentName, resourceReqDetails);
880         findAndDeclareServiceProperty(propertyName);
881     }
882
883     private void viewServiceProperties(ServiceReqDetails serviceReqDetails) throws Exception {
884         GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
885         GeneralUIUtils.findComponentAndClick(serviceReqDetails.getName());
886         CompositionPage.moveToPropertiesScreen();
887     }
888
889     private void findServiceProperty(String inputName, ServiceReqDetails serviceReqDetails) throws Exception {
890         viewServiceProperties(serviceReqDetails);
891         PropertiesAssignmentPage.findSearchBoxAndClick(inputName);
892     }
893
894     private void viewVfComponentProperties(String componentName, ResourceReqDetails resourceReqDetails) throws Exception {
895         GeneralUIUtils.findComponentAndClick(resourceReqDetails.getName());
896         ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
897         PropertiesAssignmentPage.clickOnComponentInComposition(componentName);
898     }
899
900     private void findAndDeclareServiceProperty(String inputName) throws Exception {
901         PropertiesAssignmentPage.findSearchBoxAndClick(inputName);
902         PropertiesAssignmentPage.clickOnDeclareButton();
903         PropertiesAssignmentPage.clickOnInputTab();
904     }
905
906     private void editAndDeclareSimpleProperty(String propertyName, String propertyValue) throws Exception {
907         PropertiesAssignmentPage.editPropertyValue(PropertyNameBuilder.buildSimpleField(propertyName), propertyValue);
908         PropertiesAssignmentPage.clickOnSaveButton();
909         PropertiesAssignmentPage.findSearchBoxAndClick(propertyName);
910         PropertiesAssignmentPage.clickOnDeclareButton();
911     }
912
913     private void viewVfInputs(ResourceReqDetails resourceReqDetails) throws Exception {
914         GeneralUIUtils.findComponentAndClick(resourceReqDetails.getName());
915         ResourceGeneralPage.getLeftMenu().moveToPropertiesAssignmentScreen();
916         PropertiesAssignmentPage.clickOnInputTab();
917     }
918
919     @Override
920     protected UserRoleEnum getRole() {
921         return UserRoleEnum.DESIGNER;
922     }
923
924 }
925
926