diff options
author | Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> | 2019-07-22 08:25:10 +0200 |
---|---|---|
committer | Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com> | 2019-07-25 15:27:24 +0200 |
commit | 692dec121aa5ea408c6170325a63b393b755fdf1 (patch) | |
tree | 4e2eac58b33218a79fea1e67b6a9cfcc689abd9f /ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java | |
parent | 156ca46de6c9eaac3c943d2676eaa73f02dd422d (diff) |
fixing warnings from checkstyle in ui-ci
Issue-ID: SDC-2454
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: I84b1c0206b7a7c5e12d40582d97411b138eebc4e
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java')
-rw-r--r-- | ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java | 676 |
1 files changed, 342 insertions, 334 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java index 0b0a8013a0..125023c926 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardingFlowsThroughAPI.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,10 +22,17 @@ package org.openecomp.sdc.ci.tests.execute.sanity; import com.aventstack.extentreports.Status; import fj.data.Either; -import org.openecomp.sdc.be.model.*; +import org.openecomp.sdc.be.model.ArtifactDefinition; +import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.ci.tests.dataProviders.OnbordingDataProviders; -import org.openecomp.sdc.ci.tests.datatypes.*; +import org.openecomp.sdc.ci.tests.datatypes.AmdocsLicenseMembers; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum; +import org.openecomp.sdc.ci.tests.datatypes.VendorSoftwareProductObject; import org.openecomp.sdc.ci.tests.datatypes.enums.CvfcTypeEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum; import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; @@ -36,7 +43,13 @@ import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage; import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis; import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils; import org.openecomp.sdc.ci.tests.utilities.OnboardingUiUtils; -import org.openecomp.sdc.ci.tests.utils.general.*; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis; +import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtils; +import org.openecomp.sdc.ci.tests.utils.general.VendorLicenseModelRestUtils; +import org.openecomp.sdc.ci.tests.utils.general.VendorSoftwareProductRestUtils; import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; import org.openecomp.sdc.ci.tests.verificator.CatalogVerificator; import org.testng.Assert; @@ -50,49 +63,49 @@ import java.util.Map.Entry; import static org.testng.AssertJUnit.assertTrue; -public class OnboardingFlowsThroughAPI extends SetupCDTest{ - - protected boolean skipReport = false; - protected User sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); +public class OnboardingFlowsThroughAPI extends SetupCDTest { + + protected boolean skipReport = false; + private User sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + - // https://sdp.web.att.com/fa3qm1/web/console/Application_Development_Tools_QM_20.20.01#action=com.ibm.rqm.planning.home.actionDispatcher&subAction=viewTestPlan&id=6184 - - @Test - public void addVesFileToVsp() throws Exception{ - String vnfFile = "vMME_Ericsson_small_v2.zip"; - String vesArtifactFile = "VES.zip"; - String filePath = FileHandling.getFilePath("VFCArtifacts"); - String vesArtifactFileLocation = filePath + File.separator + vesArtifactFile; - List<String> vesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation); - List<String> tempVesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation); - Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>(); - cvfcArtifacts.put(CvfcTypeEnum.VES_EVENTS, vesArtifactFileLocation); - getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, cvfcArtifacts); - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - List<ComponentInstance> componentInstances = resource.getComponentInstances(); - for(ComponentInstance componentInstance : componentInstances){ - if(componentInstance.getDeploymentArtifacts() !=null && !componentInstance.getDeploymentArtifacts().isEmpty()){ - Map<String, ArtifactDefinition> deploymentArtifacts = componentInstance.getDeploymentArtifacts(); - for(Entry<String, ArtifactDefinition> entry : deploymentArtifacts.entrySet()){ - if(entry.getValue().getArtifactType().equals(CvfcTypeEnum.VES_EVENTS.getValue())){ - for(String vesArtifact : vesArtifacts){ - if(entry.getValue().getArtifactName().equals(vesArtifact)){ - tempVesArtifacts.remove(vesArtifact); - } - } - } - } - } - } - assertTrue("Not all VES_EVENTS artifact files are on the resource instance", tempVesArtifacts.isEmpty()); - } - + + @Test + public void addVesFileToVsp() throws Exception { + String vnfFile = "vMME_Ericsson_small_v2.zip"; + String vesArtifactFile = "VES.zip"; + String filePath = FileHandling.getFilePath("VFCArtifacts"); + String vesArtifactFileLocation = filePath + File.separator + vesArtifactFile; + List<String> vesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation); + List<String> tempVesArtifacts = FileHandling.getFileNamesFromZip(vesArtifactFileLocation); + Map<CvfcTypeEnum, String> cvfcArtifacts = new HashMap<>(); + cvfcArtifacts.put(CvfcTypeEnum.VES_EVENTS, vesArtifactFileLocation); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); + + AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, cvfcArtifacts); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + List<ComponentInstance> componentInstances = resource.getComponentInstances(); + for (ComponentInstance componentInstance : componentInstances) { + if (componentInstance.getDeploymentArtifacts() != null && !componentInstance.getDeploymentArtifacts().isEmpty()) { + Map<String, ArtifactDefinition> deploymentArtifacts = componentInstance.getDeploymentArtifacts(); + for (Entry<String, ArtifactDefinition> entry : deploymentArtifacts.entrySet()) { + if (entry.getValue().getArtifactType().equals(CvfcTypeEnum.VES_EVENTS.getValue())) { + for (String vesArtifact : vesArtifacts) { + if (entry.getValue().getArtifactName().equals(vesArtifact)) { + tempVesArtifacts.remove(vesArtifact); + } + } + } + } + } + } + assertTrue("Not all VES_EVENTS artifact files are on the resource instance", tempVesArtifacts.isEmpty()); + } + // 741433: Update Old VSP // 2. Updated VSP "JSA AUG 2017" with the attached zip from v3 to v4. Follow normal steps to update the VF // 3. Update the VSP "vHSS-EPC-RDM3-Lab-0830" using the attached zip. Follow the normal steps to update the VF @@ -100,113 +113,113 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest{ // public void create2(String filePath, String vnfFile) throws Exception{ // setLog(vnfFile); // } - - -// 741509: E2E flow using old VLM - @Test - public void VlmReuse() throws Exception{ - List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); - String filePath = FileHandling.getVnfRepositoryPath(); - String vnfFile = newRandomFileNamesFromFolder.get(0); - getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); + + + // 741509: E2E flow using old VLM + @Test + public void VlmReuse() throws Exception { + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile = newRandomFileNamesFromFolder.get(0); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); // setLog(vnfFile); - getExtendTest().log(Status.INFO, "Create Vendor License"); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - getExtendTest().log(Status.INFO, "Create Vendor Software Product: " + resourceReqDetails.getName()); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - getExtendTest().log(Status.INFO, "Create Resource: " + resourceReqDetails.getName()); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - getExtendTest().log(Status.INFO, "Certify the Resource: " + resourceReqDetails.getName()); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - - ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); - getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName()); - org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - - getExtendTest().log(Status.INFO, "Add VF to service"); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); - addComponentInstanceToComponentContainer.left().value(); - getExtendTest().log(Status.INFO, "Certify the service"); - service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, "Start distributing the service"); - Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - getExtendTest().log(Status.INFO, "Service distributed"); - assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); - + getExtendTest().log(Status.INFO, "Create Vendor License"); + AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + getExtendTest().log(Status.INFO, "Create Vendor Software Product: " + resourceReqDetails.getName()); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + getExtendTest().log(Status.INFO, "Create Resource: " + resourceReqDetails.getName()); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + getExtendTest().log(Status.INFO, "Certify the Resource: " + resourceReqDetails.getName()); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); + getExtendTest().log(Status.INFO, "Create Service: " + serviceReqDetails.getName()); + org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + + getExtendTest().log(Status.INFO, "Add VF to service"); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, "Certify the service"); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, "Start distributing the service"); + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, "Service distributed"); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + // update - vnfFile = newRandomFileNamesFromFolder.get(1); - getExtendTest().log(Status.INFO, "Going to update VLM with new file " + vnfFile); - VendorLicenseModelRestUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails, false); - vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); - getExtendTest().log(Status.INFO, "Create new VSP: " + vendorSoftwareProductObject.getName()); - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - getExtendTest().log(Status.INFO, "Create new resource: " + resourceReqDetails.getName()); - resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - getExtendTest().log(Status.INFO, "Certify the resource"); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - - serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); - getExtendTest().log(Status.INFO, "Create new service: " + serviceReqDetails.getName()); - service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - - getExtendTest().log(Status.INFO, "Add VF to service"); - addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); - addComponentInstanceToComponentContainer.left().value(); - getExtendTest().log(Status.INFO, "Certify the service"); - service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, "Start distributing the service"); - distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - getExtendTest().log(Status.INFO, "Service distributed"); - assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); - } - - -// 741607: E2E flow using old VSP - @Test - public void updateVfiVersionOnServiceLevel() throws Throwable{ - List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); - String filePath = FileHandling.getVnfRepositoryPath(); - String vnfFile = newRandomFileNamesFromFolder.get(0); - getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - - ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); - org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); - ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); - service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + vnfFile = newRandomFileNamesFromFolder.get(1); + getExtendTest().log(Status.INFO, "Going to update VLM with new file " + vnfFile); + VendorLicenseModelRestUtils.updateVendorLicense(amdocsLicenseMembers, sdncDesignerDetails, false); + vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + getExtendTest().log(Status.INFO, "Create new VSP: " + vendorSoftwareProductObject.getName()); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + getExtendTest().log(Status.INFO, "Create new resource: " + resourceReqDetails.getName()); + resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + getExtendTest().log(Status.INFO, "Certify the resource"); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); + getExtendTest().log(Status.INFO, "Create new service: " + serviceReqDetails.getName()); + service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + + getExtendTest().log(Status.INFO, "Add VF to service"); + addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, "Certify the service"); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, "Start distributing the service"); + distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, "Service distributed"); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + } + + + // 741607: E2E flow using old VSP + @Test + public void updateVfiVersionOnServiceLevel() throws Throwable { + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(2, fileNamesFromFolder); + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile = newRandomFileNamesFromFolder.get(0); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); + AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(getUser()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails); + org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); // update resource to v2.0 - String updateVnfFile = newRandomFileNamesFromFolder.get(1); - getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile); - VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails, filePath, updateVnfFile); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - resourceReqDetails.setUniqueId(resource.getUniqueId()); - resourceReqDetails.setVersion(resource.getVersion()); - resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - - service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true); - - service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); - } - - + String updateVnfFile = newRandomFileNamesFromFolder.get(1); + getExtendTest().log(Status.INFO, "Going to update VNF with file " + vnfFile); + VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails, filePath, updateVnfFile); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource.getUniqueId()); + resourceReqDetails.setVersion(resource.getVersion()); + resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true); + + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + assertTrue("Distribution of service " + service.getName() + " failed", distributeAndValidateService); + } + + // 741608: E2E flow using old Service // @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "randomVNF_List") // public void create5(String filePath, String vnfFile) throws Exception{ @@ -216,18 +229,17 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest{ // // 3. Update old Service: fetch few new resources and few old resources -> Certify this Service - > Distribute // // 4. Service is distributed // } - -// 741633: Update HEAT parameter value - @Test() - public void updateHeatParametersValue() throws Throwable{ - String msg = "VfArtifacts-->checkDefaultCreatedEnvArtifactsAfterVspUpdate tests with data provider index 4(last one) check it fully"; - getExtendTest().log(Status.INFO, msg); - } - - // temporaly disabled, until fixed + + // 741633: Update HEAT parameter value + @Test() + public void updateHeatParametersValue() throws Throwable { + String msg = "VfArtifacts-->checkDefaultCreatedEnvArtifactsAfterVspUpdate tests with data provider index 4(last one) check it fully"; + getExtendTest().log(Status.INFO, msg); + } + + // temporaly disabled, until fixed @Test() - public void updateVSPNameTest() throws Throwable - { + public void updateVSPNameTest() throws Throwable { // External Defect: 430425 // Import VSP v1.0 List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); @@ -238,9 +250,9 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest{ User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName()); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName()); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); // Create VF, certify - v1.0 is created resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); @@ -252,15 +264,15 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest{ // Update VSP to v2.0 wih the zip from v1.0, update VSP name getExtendTest().log(Status.INFO, "Update VSP to version 2.0"); String origVspName = vendorSoftwareProductObject.getName(); - vendorSoftwareProductObject.setName("Upd" + ElementFactory.generateUUIDforSufix()); + vendorSoftwareProductObject.setName("Upd" + ElementFactory.generateUUIDforSufix()); vendorSoftwareProductObject = VendorSoftwareProductRestUtils.updateVSPWithNewVLMParameters(vendorSoftwareProductObject, amdocsLicenseMembers, sdncDesignerDetails1); VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); - //Validate that VF cannot be found by the updated VSP name + //Validate that VF cannot be found by the updated VSP name CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG); CatalogUIUtilitis.catalogSearchBox(vendorSoftwareProductObject.getName()); - int numOfElementsInFilteredCatalog = CatalogVerificator.getNumberOfElementsFromCatalogHeader(); - assertTrue(String.format("Wrong number fo elements, Expected : %s , Actual: %s", 0, numOfElementsInFilteredCatalog), numOfElementsInFilteredCatalog == 0 ); + int numOfElementsInFilteredCatalog = CatalogVerificator.getNumberOfElementsFromCatalogHeader(); + assertTrue(String.format("Wrong number fo elements, Expected : %s , Actual: %s", 0, numOfElementsInFilteredCatalog), numOfElementsInFilteredCatalog == 0); //Update VF with the new VSP version GeneralUIUtils.findComponentAndClick(origVspName); @@ -277,202 +289,198 @@ public class OnboardingFlowsThroughAPI extends SetupCDTest{ Assert.assertTrue(origVspName.equals(ResourceGeneralPage.getNameText())); } - @Test() - public void UpdateVSPRevertToEarlierVersion() throws Throwable - { - // Test Case: 745821 + @Test() + public void UpdateVSPRevertToEarlierVersion() throws Throwable { + // Test Case: 745821 // 1. Import VSP v1.0 - List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); - List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); - String filePath = FileHandling.getVnfRepositoryPath(); - String vnfFile = newRandomFileNamesFromFolder.get(0); - getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); - User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName()); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource();//getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); - getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName()); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure(); + List<String> newRandomFileNamesFromFolder = OnbordingDataProviders.getRandomElements(1, fileNamesFromFolder); + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile = newRandomFileNamesFromFolder.get(0); + getExtendTest().log(Status.INFO, "Going to upload VNF " + vnfFile); + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Create Vendor License Model " + amdocsLicenseMembers.getVendorLicenseName()); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); //getResourceReqDetails(ComponentConfigurationTypeEnum.DEFAULT); + getExtendTest().log(Status.INFO, "Create Vendor Software Product " + resourceReqDetails.getName()); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); // 2. Create VF, certify - v1.0 is created - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - getExtendTest().log(Status.INFO, "Create VF " + resourceReqDetails.getName()); - Resource resource_v1 = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - getExtendTest().log(Status.INFO, "Certify VF " + resourceReqDetails.getName()); - resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + getExtendTest().log(Status.INFO, "Create VF " + resourceReqDetails.getName()); + Resource resource_v1 = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + getExtendTest().log(Status.INFO, "Certify VF " + resourceReqDetails.getName()); + resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); // 3. Update VSP to v2.0 - getExtendTest().log(Status.INFO, "Update VSP to version 2.0"); - VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, filePath, vnfFile); - VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Update VSP to version 2.0"); + VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, filePath, vnfFile); + VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); // 4. Update the VF with v2.0 of the VSP - getExtendTest().log(Status.INFO, "Checkout VF v1.1"); - resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - resourceReqDetails.setUniqueId(resource_v1.getUniqueId()); - resourceReqDetails.setVersion("1.1"); - resourceReqDetails.setCsarVersion("2.0"); - getExtendTest().log(Status.INFO, "Update VF to v2.0"); - resource_v1 = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); - getExtendTest().log(Status.INFO, "Certify VF"); - Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, "Checkout VF v1.1"); + resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource_v1.getUniqueId()); + resourceReqDetails.setVersion("1.1"); + resourceReqDetails.setCsarVersion("2.0"); + getExtendTest().log(Status.INFO, "Update VF to v2.0"); + resource_v1 = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); + getExtendTest().log(Status.INFO, "Certify VF"); + Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); // 5. Update VSP to v3.0 wih the zip from v1.0 - getExtendTest().log(Status.INFO, "Update VSP to version 3.0"); - VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, false); - VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); - getExtendTest().log(Status.INFO, "Checkout VF v2.1"); - resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - resourceReqDetails.setUniqueId(resource_v1.getUniqueId()); - resourceReqDetails.setVersion("2.1"); - resourceReqDetails.setCsarVersion("3.0"); - getExtendTest().log(Status.INFO, "Update VF to v3.0"); - ResourceRestUtils.updateResource(resourceReqDetails,sdncDesignerDetails1,resource_v1.getUniqueId()); + getExtendTest().log(Status.INFO, "Update VSP to version 3.0"); + VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, false); + VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Checkout VF v2.1"); + resource_v1 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource_v1.getUniqueId()); + resourceReqDetails.setVersion("2.1"); + resourceReqDetails.setCsarVersion("3.0"); + getExtendTest().log(Status.INFO, "Update VF to v3.0"); + ResourceRestUtils.updateResource(resourceReqDetails, sdncDesignerDetails1, resource_v1.getUniqueId()); // 6. Update VF to v3.0 - getExtendTest().log(Status.INFO, "Certify VF"); - Resource resource_v3 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, "Certify VF"); + Resource resource_v3 = (Resource) AtomicOperationUtils.changeComponentState(resource_v1, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); // 7. Compare versions v1.0 and v3.0 - should be the same // TODO: Shay add resource comparison. // 8. Add each of the versions to service, certify - OK - ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, "Create Service " + serviceReqDetails.getName() ); - org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - getExtendTest().log(Status.INFO, "Add vf's v1 & v2 to service"); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v1, service, UserRoleEnum.DESIGNER, true); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v3, service, UserRoleEnum.DESIGNER, true); - getExtendTest().log(Status.INFO, "Certify Service"); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - System.out.println(""); - } - - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "updateList") - public void updateVSPFlowFromOnboardToDistribution(String vnfFile1, String vnfFile2) throws Throwable - { - setLog(String.format("Create VSP from %s , update VSP with %s ", vnfFile1, vnfFile2)); + ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Create Service " + serviceReqDetails.getName()); + org.openecomp.sdc.be.model.Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, "Add vf's v1 & v2 to service"); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v1, service, UserRoleEnum.DESIGNER, true); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer1 = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource_v3, service, UserRoleEnum.DESIGNER, true); + getExtendTest().log(Status.INFO, "Certify Service"); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + System.out.println(""); + } + + @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "updateList") + public void updateVSPFlowFromOnboardToDistribution(String vnfFile1, String vnfFile2) throws Throwable { + setLog(String.format("Create VSP from %s , update VSP with %s ", vnfFile1, vnfFile2)); // 1. Import VSP v1.0 - String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath(); - User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); + String filePath = org.openecomp.sdc.ci.tests.utilities.FileHandling.getUpdateVSPVnfRepositoryPath(); + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createAndFillVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails, amdocsLicenseMembers, null); // 2. Create VF, certify - v1.0 is created - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); - getExtendTest().log(Status.INFO, String.format("Certify the VF")); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); + getExtendTest().log(Status.INFO, String.format("Certify the VF")); // 3. Create Service add to it the certified VF and certify the Service v1.0 - ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); - Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); - ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); - getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, String.format("Certify the Service")); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Certify the Service")); // 4. Distribute the Service v1.0 - Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); - assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); // 5. Update VSP to v2.0 - getExtendTest().log(Status.INFO, "Upgrading the VSP with new file: " + vnfFile2); - VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, filePath, vnfFile2); - getExtendTest().log(Status.INFO, String.format("Validating VSP %s upgrade to version 2.0: " ,vnfFile2)); - VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); + getExtendTest().log(Status.INFO, "Upgrading the VSP with new file: " + vnfFile2); + VendorSoftwareProductRestUtils.updateVendorSoftwareProductToNextVersion(vendorSoftwareProductObject, sdncDesignerDetails1, filePath, vnfFile2); + getExtendTest().log(Status.INFO, String.format("Validating VSP %s upgrade to version 2.0: ", vnfFile2)); + VendorSoftwareProductRestUtils.validateVspExist(vendorSoftwareProductObject, sdncDesignerDetails1); // 6. Update the VF with v2.0 of the VSP and certify the VF - getExtendTest().log(Status.INFO, String.format("Checkout the VF %s v1.1 " ,resourceReqDetails.getName())); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - resourceReqDetails.setUniqueId(resource.getUniqueId()); - resourceReqDetails.setVersion("1.1"); - resourceReqDetails.setCsarVersion("2.0"); - getExtendTest().log(Status.INFO, String.format("Upgrade the VF %s v1.1 with the new VSP %s v2.0 " ,resourceReqDetails.getName(),vendorSoftwareProductObject.getName())); - resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); - getExtendTest().log(Status.INFO, String.format("Certify the VF to v2.0")); - Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Checkout the VF %s v1.1 ", resourceReqDetails.getName())); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + resourceReqDetails.setUniqueId(resource.getUniqueId()); + resourceReqDetails.setVersion("1.1"); + resourceReqDetails.setCsarVersion("2.0"); + getExtendTest().log(Status.INFO, String.format("Upgrade the VF %s v1.1 with the new VSP %s v2.0 ", resourceReqDetails.getName(), vendorSoftwareProductObject.getName())); + resource = AtomicOperationUtils.updateResource(resourceReqDetails, sdncDesignerDetails, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Certify the VF to v2.0")); + Resource resource_v2 = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); // 7. Update the Service with the VFi version 2.0 - getExtendTest().log(Status.INFO, String.format("Checkout the Service v1.1")); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); - getExtendTest().log(Status.INFO, String.format("Change the instance of the VF in the service to VFi v2.0")); - AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true); - getExtendTest().log(Status.INFO, String.format("Certify the Service to v2.0")); - service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Checkout the Service v1.1")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CHECKOUT, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Change the instance of the VF in the service to VFi v2.0")); + AtomicOperationUtils.changeComponentInstanceVersion(service, componentInstance, resource, UserRoleEnum.DESIGNER, true); + getExtendTest().log(Status.INFO, String.format("Certify the Service to v2.0")); + service = (org.openecomp.sdc.be.model.Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); // 8. Distribute the service v2.0 - distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); - assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); - } - - @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "VNF_List") - public void fromOnboardToDistribution(String filePath, String vnfFile) throws Throwable - { + distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + } + + @Test(dataProviderClass = org.openecomp.sdc.ci.tests.dataProvider.OnbordingDataProviders.class, dataProvider = "VNF_List") + public void fromOnboardToDistribution(String filePath, String vnfFile) throws Throwable { // String vnfFile1 = "1-2016-20-visbc3vf-(VOIP)_v2.1.zip"; // String vnfFile2 = "2-2016-20-visbc3vf-(VOIP)_v2.0.zip"; - setLog(String.format("%s", vnfFile)); + setLog(String.format("%s", vnfFile)); // 1. Import VSP v1.0 - //String filePath = FileHandling.getVnfRepositoryPath(); - User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + //String filePath = FileHandling.getVnfRepositoryPath(); + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile)); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile, filePath, sdncDesignerDetails1, amdocsLicenseMembers); // VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile, createVendorSoftwareProduct); // 2. Create VF, certify - v1.0 is created - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); - getExtendTest().log(Status.INFO, String.format("Certify the VF")); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); + getExtendTest().log(Status.INFO, String.format("Certify the VF")); // 3. Create Service add to it the certified VF and certify the Service v1.0 - ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); - Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); - ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); - getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, String.format("Certify the Service")); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Certify the Service")); // 4. Distribute the Service v1.0 - Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); - assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); - } - - @Test() - public void onboardE2EviaAPI() throws Throwable - { + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + } + + @Test() + public void onboardE2EviaAPI() throws Throwable { // 1. Import VSP v1.0 - String filePath = FileHandling.getVnfRepositoryPath(); - String vnfFile1 = "1-VF-vCSCF-StateDB-new-update_v3.0.zip"; - User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); - AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); - ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); - getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); - VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers); + String filePath = FileHandling.getVnfRepositoryPath(); + String vnfFile1 = "1-VF-vCSCF-StateDB-new-update_v3.0.zip"; + User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); + AmdocsLicenseMembers amdocsLicenseMembers = VendorLicenseModelRestUtils.createVendorLicense(sdncDesignerDetails1); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software License (VLM): %s v1.0", amdocsLicenseMembers.getVendorLicenseName())); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + getExtendTest().log(Status.INFO, String.format("Creating Vendor Software Product (VSP): %s v1.0 from heat file: %s ", resourceReqDetails.getName(), vnfFile1)); + VendorSoftwareProductObject vendorSoftwareProductObject = VendorSoftwareProductRestUtils.createVendorSoftwareProduct(resourceReqDetails, vnfFile1, filePath, sdncDesignerDetails1, amdocsLicenseMembers); // VendorSoftwareProductObject vendorSoftwareProductObject = OnboardViaApis.fillVendorSoftwareProductObjectWithMetaData(vnfFile1, createVendorSoftwareProduct); // 2. Create VF, certify - v1.0 is created - resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); - getExtendTest().log(Status.INFO, String.format("Certify the VF")); + resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Creating Virtual Function (VF): %s v1.0", resourceReqDetails.getName())); + getExtendTest().log(Status.INFO, String.format("Certify the VF")); // 3. Create Service add to it the certified VF and certify the Service v1.0 - ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); - Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); - getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); - Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); - ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); - getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); - getExtendTest().log(Status.INFO, String.format("Certify the Service")); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); + getExtendTest().log(Status.INFO, String.format("Creating Service: %s v1.0", serviceReqDetails.getName())); + Either<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); + ComponentInstance componentInstance = addComponentInstanceToComponentContainer.left().value(); + getExtendTest().log(Status.INFO, String.format("Adding VF instance to Service")); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + getExtendTest().log(Status.INFO, String.format("Certify the Service")); // 4. Distribute the Service v1.0 - Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); - getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); - assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); - } - - @Override - protected UserRoleEnum getRole() { - return UserRoleEnum.DESIGNER; - } + Boolean distributeAndValidateService = AtomicOperationUtils.distributeAndValidateService(service); + getExtendTest().log(Status.INFO, String.format("Distribute and validate the Service")); + assertTrue("Distribution status is " + distributeAndValidateService, distributeAndValidateService); + } + + @Override + protected UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } } |