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