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