1 package vid.automation.test.test;
3 import static junit.framework.TestCase.assertNull;
4 import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
5 import static org.hamcrest.CoreMatchers.is;
6 import static org.hamcrest.CoreMatchers.startsWith;
7 import static org.hamcrest.MatcherAssert.assertThat;
8 import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.PRESET_SOME_LEGACY_REGION_TO_ATT_AIC;
9 import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE;
10 import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.DEFAULT_SERVICE_INSTANCE_ID;
11 import static org.testng.Assert.assertEquals;
12 import static org.testng.AssertJUnit.assertTrue;
13 import static vid.automation.test.infra.Features.FLAG_1902_VNF_GROUPING;
14 import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI;
15 import static vid.automation.test.infra.Features.FLAG_ASYNC_INSTANTIATION;
16 import static vid.automation.test.infra.ModelInfo.PASQUALEVmxVpeBvService488Annotations;
17 import static vid.automation.test.infra.ModelInfo.aLaCarteNetworkProvider5G;
18 import static vid.automation.test.infra.ModelInfo.aLaCarteVnfGroupingService;
19 import static vid.automation.test.infra.ModelInfo.macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails;
20 import static vid.automation.test.infra.ModelInfo.macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse;
21 import static vid.automation.test.infra.ModelInfo.macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse;
22 import static vid.automation.test.infra.ModelInfo.macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails;
23 import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
24 import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset;
25 import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
26 import static vid.automation.test.test.ALaCarteflowTest.AIC;
28 import com.google.common.collect.ImmutableList;
29 import com.google.common.collect.ImmutableMap;
30 import com.google.common.collect.ImmutableSet;
31 import com.google.common.collect.Lists;
32 import java.text.ParseException;
33 import java.text.SimpleDateFormat;
34 import java.util.ArrayList;
35 import java.util.Arrays;
36 import java.util.Collections;
37 import java.util.Date;
38 import java.util.HashMap;
39 import java.util.List;
42 import java.util.UUID;
43 import java.util.stream.Collectors;
44 import org.apache.commons.lang3.mutable.MutableInt;
45 import org.apache.logging.log4j.LogManager;
46 import org.apache.logging.log4j.Logger;
47 import org.hamcrest.Matchers;
48 import org.onap.sdc.ci.tests.datatypes.UserCredentials;
49 import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
50 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
51 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants;
52 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit;
53 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost;
54 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaCarte5G;
55 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceAlacarte5GServiceWithNetwork;
56 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService;
57 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesEcompNamingFalse;
58 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet;
59 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork;
60 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.ResponseDetails;
61 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys;
62 import org.openqa.selenium.By;
63 import org.openqa.selenium.WebElement;
64 import org.openqa.selenium.remote.RemoteWebElement;
65 import org.testng.Assert;
66 import org.testng.annotations.AfterClass;
67 import org.testng.annotations.BeforeClass;
68 import org.testng.annotations.BeforeMethod;
69 import org.testng.annotations.Test;
70 import vid.automation.test.Constants;
71 import vid.automation.test.Constants.BrowseASDC.NewServicePopup;
72 import vid.automation.test.infra.Click;
73 import vid.automation.test.infra.FeatureTogglingTest;
74 import vid.automation.test.infra.Features;
75 import vid.automation.test.infra.Get;
76 import vid.automation.test.infra.Input;
77 import vid.automation.test.infra.ModelInfo;
78 import vid.automation.test.infra.SelectOption;
79 import vid.automation.test.infra.Wait;
80 import vid.automation.test.model.Service;
81 import vid.automation.test.model.User;
82 import vid.automation.test.sections.BrowseASDCPage;
83 import vid.automation.test.sections.DrawingBoardPage;
84 import vid.automation.test.sections.InstantiationStatusPage;
85 import vid.automation.test.sections.SideMenu;
86 import vid.automation.test.sections.VidBasePage;
87 import vid.automation.test.services.AsyncJobsService;
88 import vid.automation.test.services.ServicesService;
89 import vid.automation.test.services.SimulatorApi;
90 import vid.automation.test.utils.ReadFile;
92 @FeatureTogglingTest(FLAG_ASYNC_INSTANTIATION)
93 public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest {
95 private static final String COMPLETED = "COMPLETED";
96 private static final String IN_PROGRESS = "IN_PROGRESS";
97 private static final String PENDING = "PENDING";
98 private final String vfModule0Name = "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_base_vPE_BV..module-0";
99 private final String vfModule0UUID = "f8360508-3f17-4414-a2ed-6bc71161e8db";
100 private ServicesService servicesService = new ServicesService();
101 private DrawingBoardPage drawingBoardPage = new DrawingBoardPage();
102 List<String> serviceModelLabelList = Arrays.asList("Model version", "Description", "Category", "UUID",
103 "Invariant UUID", "Service type", "Service role");
104 List<String> mandatoryServiceModelLabelList = Arrays.asList("Model version", "UUID", "Invariant UUID");
105 private final VidBasePage vidBasePage = new VidBasePage();
106 public static final String VNF_SET_BUTTON_TEST_ID = "form-set";
107 private static final Logger logger = LogManager.getLogger(NewServiceInstanceTest.class);
110 protected void dropAllAsyncJobs() {
111 AsyncJobsService asyncJobsService = new AsyncJobsService();
112 asyncJobsService.dropAllAsyncJobs();
116 protected void muteAllAsyncJobs() {
117 AsyncJobsService asyncJobsService = new AsyncJobsService();
118 asyncJobsService.muteAllAsyncJobs();
122 protected void goToWelcome() {
123 SideMenu.navigateToWelcomePage();
127 protected UserCredentials getUserCredentials() {
128 String userName = Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA;
129 User user = usersService.getUser(userName);
130 return new UserCredentials(user.credentials.userId, user.credentials.password, userName, "", "");
134 public void createNewServiceInstance_fullModelData_LeftPaneLabelsCorrect() throws Exception {
135 prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false);
136 loadServicePopup(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails);
137 assertServiceModelLabelsCorrect(serviceModelLabelList);
141 public void createNewServiceInstance_partialModelData_LeftPaneLabelsCorrect() throws Exception {
142 prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails, false);
143 loadServicePopup(macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails);
144 assertServiceModelLabelsCorrect(mandatoryServiceModelLabelList);
148 public void createNewServiceInstance_setFieldValue_resetDependenciesListsAndValues() {
149 resetGetTenantsCache();
151 BrowseASDCPage browseASDCPage = new BrowseASDCPage();
152 prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false);
153 SimulatorApi.registerExpectation(Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CAR_2020_ER, SimulatorApi.RegistrationStrategy.APPEND);
154 registerExpectationFromPreset(
155 new PresetAAIGetTenants(
157 "MSO-dev-service-type",
158 "registration_to_simulator/create_new_instance/aai_get_tenants_for_customer_CAR_2020_ER.json"),
159 SimulatorApi.RegistrationStrategy.APPEND);
161 loadServicePopup(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails);
162 Wait.waitByClassAndText(Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS, "SILVIA ROBBINS", 30);
163 VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
164 GeneralUIUtils.ultimateWait();
165 String serviceType = "TYLER SILVIA";
166 Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30);
167 browseASDCPage.selectServiceTypeByName(serviceType);
168 String lcpRegion = "hvf6";
169 Wait.waitByClassAndText("lcpRegionOption", lcpRegion, 30);
170 viewEditPage.selectLcpRegion(lcpRegion, AIC);
171 browseASDCPage.selectTenant("bae71557c5bb4d5aac6743a4e5f1d054");
173 VidBasePage.selectSubscriberById("CAR_2020_ER");
174 assertElementDisabled("lcpRegion-select");
175 serviceType = "MSO-dev-service-type";
176 Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30);
177 browseASDCPage.selectServiceTypeByName(serviceType);
178 lcpRegion = "CAR_2020_ER";
179 Wait.waitByClassAndText("lcpRegionOption", lcpRegion, 30);
180 viewEditPage.selectLcpRegion(lcpRegion, AIC);
181 browseASDCPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e66");
183 resetGetTenantsCache();
188 * asserts that the provided labels list is visible and that no other detail item appears in the model details panel.
190 protected void assertServiceModelLabelsCorrect(List<String> serviceModelLabelList) throws Exception {
191 WebElement genericPopup = getDriver().findElement(By.tagName("generic-form-popup"));
192 WebElement modelInformation = genericPopup.findElement(By.id("model-information"));
193 List<WebElement> modelInformationItems = modelInformation.findElements(By.xpath("./div"));
194 assertEquals(modelInformationItems.size(), serviceModelLabelList.size());
195 serviceModelLabelList.forEach(label -> {
196 WebElement webElement = Get.byTestId("model-item-" + label);
197 WebElement itemWarpper = webElement.findElements(By.className("wrapper")).get(0);
198 assertEquals(itemWarpper.findElements(By.tagName("label")).get(0).getText(), label, "model details item label is incorrect.");
203 public void createNewServiceInstance_leftPane_serviceModelDataCorrect() {
204 Service service = servicesService.getService(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails.modelVersionId);
205 String prefix = NewServicePopup.SERVICE_MODEL_DATA_TEST_ID_VALUE_PREFIX;
206 prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false);
207 loadServicePopup(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails);
208 logger.info("Expected service model properties: "+service.toString());
209 assertModelDataCorrect(NewServicePopup.SERVICE_MODEL_FIELD_TO_DATA_TESTS_ID, prefix, service);
213 public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingFalse() {
215 ServiceData serviceData = new ServiceData(
216 macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails.modelVersionId,
218 false, true, true, true,
219 "2017-488_PASQUALE-vPE 0",
220 "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, new ArrayList<>(), "25284168-24bb-4698-8cb4-3f509146eca5");
222 prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false);
224 final String serviceInstanceName = createSriovService(serviceData, true);
225 createVnf(serviceData, true, true, serviceInstanceName);
227 createVfModule(serviceData, serviceInstanceName, false, false);
231 @Test(groups = "underDevelopment")
232 public void createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_DEV() {
234 Upon failure in test dynamicFieldsEcompNamingFalse_FLESH(), exception will provide
235 the needed data for this DEV method:
237 1. "Current step" when the failure occurred
238 2. "Random alphabetic" that was randomized while test
239 3. "Starting reduxState" that was on the step that failed.
241 These data can be used for, accordingly, 1. startInStep param; 2, randomAlphabetic
242 param; 3. reduxForStep param.
245 // It should be easier to put `reduxForStep` in this file, to avoid Java's code-clutter and json escaping.
246 final String reduxForStep = ReadFile.loadResourceAsString(
247 "NewServiceInstanceTest/createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse.json");
249 createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_FLESH("DEV", 5, reduxForStep, "mCaNk");
253 public void createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse() {
254 createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_FLESH("RUNTIME", 0, null, randomAlphabetic(5));
257 private void createNewServiceInstance_macro_validPopupDataAndUI__dynamicFieldsEcompNamingFalse_FLESH(String mode, int startInStep, String reduxForStep, String randomAlphabetic) {
259 MutableInt i = new MutableInt();
260 Map<String, String> reduxStates = new HashMap<>();
262 ServiceData serviceData = new ServiceData(
263 macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse.modelVersionId,
264 Collections.singletonList("2017488 PASQUALEvpe0 asn:"),
265 false, false, true, false,
266 "2017-488_PASQUALE-vPE 0",
267 "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, ImmutableList.of("Bandwidth", "Bandwidth units"),
268 "25284168-24bb-4698-8cb4-3f509146eca5");
270 // this is the instance-name that createSriovService is going to use
271 String serviceInstanceName = randomAlphabetic + "instancename";
273 doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> {
274 prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse,
276 createSriovService(serviceData, false, randomAlphabetic);
279 doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () ->
280 createVnf(serviceData, false, true, serviceInstanceName)
283 final String vnfInstanceName2 = randomAlphabetic + "instanceName";
284 final String vnfName2 = "2017-388_PASQUALE-vPE";
286 doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () ->
287 createVnf(new VnfData(vnfName2 + " 0", "afacccf6-397d-45d6-b5ae-94c39734b168", vnfInstanceName2, false),
288 false, Features.FLAG_DEFAULT_VNF.isActive(), serviceInstanceName)
291 doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () ->
292 createVfModule(serviceData, serviceInstanceName, false, true)
295 doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> {
297 editVfModuleAndJustSetName(vfModule0Name, vfModule0UUID);
298 if (Features.FLAG_DUPLICATE_VNF.isActive()) {
299 duplicateVnf(serviceData.vnfData, 2);
301 vidBasePage.screenshotDeployDialog(serviceInstanceName);
304 doReduxStep(reduxStates, randomAlphabetic, startInStep, reduxForStep, i, mode, () -> {
305 prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse,
308 final String vfModuleName1 = "2017488PASQUALEVpe..PASQUALE_base_vPE_BV..module-0";
309 final String vfModuleName2 = "2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1";
310 final String request1 = PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID;
311 final String request2 = "ce010256-3fdd-4cb5-aed7-37112a2c6e93";
312 final ImmutableMap<Keys, String> vars = ImmutableMap.<Keys, String>builder()
313 .put(Keys.SERVICE_NAME, serviceInstanceName)
314 .put(Keys.VNF_NAME, cleanSeparators("2017-488_PASQUALE-vPE", serviceData.vnfData.vnfInstanceName))
315 .put(Keys.VFM_NAME1, cleanSeparators(vfModuleName1 , "VF instance name ZERO"))
316 .put(Keys.VFM_NAME2, cleanSeparators(vfModuleName2 , "VF instance name"))
317 .put(Keys.VG_NAME, cleanSeparators(vfModuleName2 , "VF instance name") + "_vol_abc")
318 .put(Keys.VNF_NAME2, cleanSeparators(vnfName2, vnfInstanceName2))
320 registerExpectationFromPresets(ImmutableList.of(
321 // although "some legacy region" is provided for vnf, Service's region "hvf6" overrides it
322 PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN6_TO_ATT_AIC,
323 new PresetMSOCreateServiceInstanceGen2WithNamesEcompNamingFalse(vars, 0, request1),
324 new PresetMSOCreateServiceInstanceGen2WithNamesEcompNamingFalse(vars, 1, request2)
325 ), SimulatorApi.RegistrationStrategy.APPEND);
327 deployAndVerifyModuleInPendingTableMacro(serviceInstanceName, request1, request2);
328 verifyOpenAuditInfo(serviceInstanceName);
329 verifyOpenViewEdit(serviceInstanceName);
330 verifyDeleteJob(serviceInstanceName);
331 verifyHideJob(serviceInstanceName);
336 @FeatureTogglingTest(FLAG_1902_VNF_GROUPING)
337 public void createNewServiceInstance_aLaCarte_VnfGrouping() {
339 String randomAlphabetic = randomAlphabetic(5);
341 ServiceData serviceData = new ServiceData(
342 aLaCarteVnfGroupingService.modelVersionId,
344 false, false, true, false,
345 null, null, 0, 1, ImmutableList.of(), null);
346 prepareServicePreset(aLaCarteVnfGroupingService, false);
348 createALaCarteService(serviceData, randomAlphabetic);
350 // this is the instance-name that createALaCarteService is using
351 String serviceInstanceName = randomAlphabetic + "instancename";
353 final String requestId = PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID;
354 final String serviceInstanceId = "d2391436-8d55-4fde-b4d5-72dd2cf13cgh";
355 final ImmutableMap<Keys, String> names = ImmutableMap.<Keys, String>builder()
356 .put(Keys.SERVICE_NAME, serviceInstanceName)
358 SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
359 new PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService(names, 0, requestId, serviceInstanceId, "us16807000"),
360 new PresetAAIPostNamedQueryForViewEdit(serviceInstanceId, serviceInstanceName, false, false)
361 ), SimulatorApi.RegistrationStrategy.APPEND);
364 verifyModuleInPendingTable(serviceInstanceName, requestId, null, ImmutableSet.of(IN_PROGRESS), false, false);
365 verifyModuleInPendingTable(serviceInstanceName, requestId, null, ImmutableSet.of(COMPLETED), false, true);
366 InstantiationStatusPage.verifyOpenNewViewEdit(serviceInstanceName, serviceInstanceId, aLaCarteVnfGroupingService.modelVersionId, "TYLER SILVIA", "e433710f-9217-458d-a79d-1c7aff376d89", "EDIT");
369 public interface Invoker{
373 private void doReduxStep(Map<String, String> reduxStates, String randomAlphabetic, int startInStep, String reduxForStep, MutableInt currentStep, String mode, Invoker todo) {
377 if (currentStep.getValue() < startInStep) {
378 // skip up to startInStep
380 } else if (currentStep.getValue() == startInStep) {
382 setReduxState(reduxForStep);
384 vidBasePage.navigateTo("serviceModels.htm#/servicePlanning?serviceModelId=6b528779-44a3-4472-bdff-9cd15ec93450");
385 vidBasePage.goToIframe();
388 reduxStates.put(String.valueOf(currentStep), getReduxState());
393 // log current redux state, before invocation
394 reduxStates.put(String.valueOf(currentStep), getReduxState());
395 logger.info("reduxGator runtime reduxState for step {}:\n{}", currentStep, getReduxState());
401 } catch (AssertionError | Exception e) {
402 throw new AssertionError(String.join("\n",
403 "Current step: " + currentStep,
404 "Random alphabetic: " + randomAlphabetic,
405 "Starting reduxState: " + reduxStates.get(String.valueOf(currentStep)),
406 "Current reduxState: " + getReduxState()
410 logger.info("Cumulative reduxState: {}", reduxStates);
411 currentStep.increment();
415 private void duplicateVnf(VnfData vnfData, int count) {
416 hoverAndClickDuplicateButton(extractNodeToEdit(vnfData));
417 vidBasePage.screenshotDeployDialog("duplicateVnf-" + vnfData.vnfName);
418 List<WebElement> options = ((RemoteWebElement)Get.byId("duplicate-select")).findElementsByTagName("option");
419 assertThat(options.stream().map(x -> x.getText()).collect(Collectors.toList()), Matchers.contains("1","2"));
420 SelectOption.byIdAndVisibleText("duplicate-select", String.valueOf(count));
421 Click.byClassAndVisibleText("sdc-button__primary", "DUPLICATE");
424 private String cleanSeparators(String... s) {
425 return String.join("", s).replace(" ", "");
428 private void editVfModuleAndJustSetName(String vfModuleName, String vfModuleUUID) {
429 if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) {
430 hoverAndClickEditButton(vfModuleUUID + "-" + vfModuleName);
432 drawingBoardPage.clickAddButtonByNodeName(vfModuleName);
434 Input.text("VF instance name ZERO", "instanceName");
435 Click.byTestId("form-set");
439 public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingServiceFalseVnfTrue_vgNameFalse() {
440 ServiceData serviceData = new ServiceData(
441 macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails.modelVersionId,
443 false, true, false, true,
444 "2017-488_PASQUALE-vPE 0",
445 vfModule0Name, 1, 1, new ArrayList<>(), vfModule0UUID);
447 prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails, false);
449 final String serviceInstanceName = createSriovService(serviceData, true);
450 createVnf(serviceData, true, true, serviceInstanceName);
451 createVfModule(serviceData, serviceInstanceName, true, false);
456 public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingServiceFalseVnfFalse_vgNameFalse() {
457 ServiceData serviceData = new ServiceData(
458 macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse.modelVersionId,
460 false, false, false, false,
461 "2017-488_PASQUALE-vPE 0",
462 vfModule0Name, 1, 1, new ArrayList<>(), vfModule0UUID);
464 prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse, false);
466 final String serviceInstanceName = createSriovService(serviceData, true);
467 createVnf(serviceData, true, true, serviceInstanceName);
468 createVfModule(serviceData, serviceInstanceName, true, false);
473 public void createNewServiceInstance_macro_validPopupDataAndUI__ecompNamingServiceFalseVnfFalse_vgNameTrue() throws Exception {
474 ServiceData serviceData = new ServiceData(
475 macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse.modelVersionId,
477 false, false, true, false,
478 "2017-488_PASQUALE-vPE 0",
479 "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, new ArrayList<>(), "25284168-24bb-4698-8cb4-3f509146eca5");
481 prepareServicePreset(macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse, false);
483 final String serviceInstanceName = createSriovService(serviceData, true);
484 createVnf(serviceData, true, true, serviceInstanceName);
485 clickRemoveVfModule(vfModule0UUID, vfModule0Name);
486 createVfModule(serviceData, serviceInstanceName, false, true);
492 @FeatureTogglingTest(FLAG_5G_IN_NEW_INSTANTIATION_UI)
493 public void createNewServiceInstance_aLaCarte_validPopupDataAndUI() {
494 String serviceInstanceName = "NcService"+randomAlphabetic(5);
495 String networkInstanceName= "NcNetowrk"+randomAlphabetic(5);
496 String defactoNetworkInstanceName = "ExtVL"+networkInstanceName;
497 BrowseASDCPage browseASDCPage = new BrowseASDCPage();
498 prepareServicePreset(aLaCarteNetworkProvider5G, true);
499 String serviceRequestId = UUID.randomUUID().toString();
500 String networkRequestId = UUID.randomUUID().toString();
501 String requestorID = getUserCredentials().getUserId();
502 registerExpectationFromPresets(
504 new PresetMSOCreateServiceInstanceAlacarte5GServiceWithNetwork(
505 ImmutableMap.of(Keys.SERVICE_NAME, serviceInstanceName),
508 new PresetMSOOrchestrationRequestGet(COMPLETE, serviceRequestId),
509 PRESET_SOME_LEGACY_REGION_TO_ATT_AIC,
510 new PresetMSOCreateNetworkALaCarte5G(networkRequestId, DEFAULT_SERVICE_INSTANCE_ID, defactoNetworkInstanceName, requestorID),
511 new PresetMSOOrchestrationRequestGet(COMPLETE, networkRequestId),
512 new PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork(
513 new ResponseDetails(serviceInstanceName, serviceRequestId, COMPLETE, "service"),
514 new ResponseDetails(defactoNetworkInstanceName, networkRequestId, COMPLETE, "network"),
515 DEFAULT_SERVICE_INSTANCE_ID)
519 loadServicePopup(aLaCarteNetworkProvider5G.modelVersionId);
520 WebElement instanceNameInput = Get.byId("instanceName");
521 instanceNameInput.sendKeys(serviceInstanceName);
522 VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
523 String serviceType = "TYLER SILVIA";
524 Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30);
525 browseASDCPage.selectServiceTypeByName(serviceType);
526 SelectOption.byTestIdAndVisibleText("WayneHolland", (Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID));
527 SelectOption.byTestIdAndVisibleText("WATKINS", Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
528 Click.byTestId("form-set");
529 VidBasePage.goOutFromIframe();
530 browseASDCPage.goToIframe();
531 VnfData networkData = new VnfData("SR-IOV Provider-1", "840ffc47-e4cf-46de-8e23-525fd8c6fdc3", defactoNetworkInstanceName, false);
532 createNetwork(networkData, false, false, serviceInstanceName);
533 drawingBoardPage.clickDeployButton();
535 VidBasePage.goOutFromIframe();
536 GeneralUIUtils.ultimateWait();
537 vidBasePage.goToIframe();
538 GeneralUIUtils.ultimateWait();
540 DrawingBoardPage.ServiceStatusChecker serviceStatusChecker = new DrawingBoardPage.ServiceStatusChecker(serviceInstanceName, Collections.singleton(COMPLETED));
541 boolean statusIsShown = Wait.waitFor(serviceStatusChecker, null, 20, 2);
542 assertTrue("service "+serviceInstanceName+" wasnt completed after in time", statusIsShown);
544 VidBasePage.goOutFromIframe();
548 public void createNewServiceInstance_macro_validPopupDataAndUI() {
550 List<String> serviceDynamicFields = Arrays.asList("2017488 PASQUALEvpe0 asn:");
551 ServiceData serviceData = new ServiceData(
552 macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails.modelVersionId,
553 serviceDynamicFields,
554 true, true, true, false,
555 "2017-488_PASQUALE-vPE 0",
556 "2017488_PASQUALEvpe0..2017488PASQUALEVpe..PASQUALE_vRE_BV..module-1", 0, 1, new ArrayList<>(), "25284168-24bb-4698-8cb4-3f509146eca5");
558 prepareServicePreset(macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails, false);
560 final String serviceInstanceName = createSriovService(serviceData, true);
561 createVnf(serviceData, true, true, serviceInstanceName);
562 clickRemoveVfModule(vfModule0UUID, vfModule0Name);
563 createVfModule(serviceData, serviceInstanceName, false, false);
567 private void deployAndVerifyModuleInPendingTableMacro(String serviceInstanceName, String requestId1, String requestId2) {
570 boolean simulatorUpdated = false;
572 int[] ids = {0, 0, 1, 2};
573 String[] statuses = {IN_PROGRESS, COMPLETED, IN_PROGRESS, PENDING};
574 for (int i = 0; i < ids.length; i++) {
575 String actualInstanceName = getActualInstanceName(serviceInstanceName, ids[i], statuses[i]);
576 verifyModuleInPendingTable(actualInstanceName, requestId1, requestId2, ImmutableSet.of(statuses[i]), true, simulatorUpdated);
577 simulatorUpdated = true;
579 vidBasePage.screenshotDeployDialog(serviceInstanceName);
582 private void deploy() {
584 logger.info("Redux state before deploy:");
585 logger.info(getReduxState());
587 catch (Exception e) {
588 //do nothing just logging
590 drawingBoardPage.clickDeployButton();
592 VidBasePage.goOutFromIframe();
593 GeneralUIUtils.ultimateWait();
594 vidBasePage.goToIframe();
595 GeneralUIUtils.ultimateWait();
598 private void verifyModuleInPendingTable(String serviceInstanceName, String requestId1, String requestId2, Set<String> expectedStatuses, boolean isMacro, boolean simulatorUpdated) {
599 DrawingBoardPage.ServiceStatusChecker serviceStatusChecker = new DrawingBoardPage.ServiceStatusChecker(serviceInstanceName, expectedStatuses);
600 boolean statusIsShown = Wait.waitFor(serviceStatusChecker, null, 20, 2);
601 final String assertionMessage = String.format("service %s: none of rowClasses [%s] is in expectedStatuses: [%s] ",
603 String.join(",", serviceStatusChecker.getColumnClassesSet()),
604 String.join(",", expectedStatuses));
606 assertTrue(assertionMessage, statusIsShown);
609 InstantiationStatusPage.assertInstantiationStatusRow(
610 serviceInstanceName, expectedRowFields(serviceInstanceName));
612 InstantiationStatusPage.assertInstantiationStatusRow(
613 serviceInstanceName, expectedALaCarteRowFields(serviceInstanceName));
616 if (!simulatorUpdated) {
617 if (requestId2 != null) {
618 registerExpectationFromPreset(new PresetMSOOrchestrationRequestGet(IN_PROGRESS, requestId2), APPEND);
620 registerExpectationFromPreset(new PresetMSOOrchestrationRequestGet("COMPLETE", requestId1), APPEND);
622 vidBasePage.screenshotDeployDialog(serviceInstanceName);
625 private String getActualInstanceName(String serviceInstanceName, Integer i, String status) {
626 return i==0 ? serviceInstanceName : serviceInstanceName + "_00" + i;
629 private void verifyOpenViewEdit(String serviceInstanceName) {
630 boolean[] openEnabled = {true, false, false};
631 String[] statuses = {COMPLETED, IN_PROGRESS, PENDING};
632 ImmutableList.of(0, 1, 2).forEach(i -> {
633 String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i]);
634 if (Features.FLAG_1902_NEW_VIEW_EDIT.isActive()) {
635 InstantiationStatusPage.verifyOpenNewViewEdit(actualInstanceName, openEnabled[i], "EDIT");
638 vidBasePage.verifyOpenOldViewEdit(actualInstanceName, null, openEnabled[i], true, true);
643 private void verifyOpenAuditInfo(String serviceInstanceName) {
644 boolean auditInfoEnabled = true;
645 String[] statuses = {COMPLETED, IN_PROGRESS, PENDING};
646 for (Integer i : ImmutableList.of(0, 1, 2)) {
647 String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i]);
648 InstantiationStatusPage.checkMenuItem(actualInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HEADER_AUDIT_INFO_ITEM, auditInfoEnabled, contextMenuOpen -> {
649 Click.byTestId(contextMenuOpen);
650 checkAuditInfoModal(actualInstanceName, i, statuses);
652 final WebElement row = InstantiationStatusPage.getInstantiationStatusRow(actualInstanceName);
653 row.findElement(By.id(Constants.InstantiationStatus.TD_JOB_STATUS_ICON + "-" + (i))).click();
654 checkAuditInfoModal(actualInstanceName, i, statuses);
658 private void checkAuditInfoModal(String actualInstanceName, Integer i, String[] statuses) {
660 Wait.waitByTestId("vidJobStatus", 10);
662 WebElement webElement = Get.byTestId("model-item-value-serviceInstanceName");
663 assertEquals(webElement.getText(), actualInstanceName, "Service Instance Name must be equal");
665 WebElement vidTableElement = Get.byId("service-instantiation-audit-info-vid");
666 assertEquals(3, vidTableElement.findElement(By.tagName("thead")).findElements(By.tagName("th")).size(), "VID table must contain 3 columns");
668 List<WebElement> vidStatusesElements = vidTableElement.findElements(By.id("vidJobStatus"));
669 List<String> vidStatuses = vidStatusesElements.stream()
671 convertUITextCapitalizeAndFormatPipe(s.getText()))
672 .collect(Collectors.toList());
674 List<String> serviceStatus = Arrays.asList(Arrays.copyOfRange(statuses, i, statuses.length));
675 assertThat("statuses for " + actualInstanceName + " must be as expected", vidStatuses, is(Lists.reverse(serviceStatus)));
677 String dateString = vidTableElement.findElements(By.id("vidStatusTime")).get(0).getText();
678 assertTrue("vid Status Time column must contains valid date in format : MMM dd, yyyy HH:mm", isDateValid(dateString, "MMM dd, yyyy HH:mm"));
680 WebElement MSOTableElement = Get.byId("service-instantiation-audit-info-mso");
681 assertEquals(3, MSOTableElement.findElement(By.tagName("thead")).findElements(By.tagName("th")).size(), "MSO table must contain 3 columns");
683 if (statuses[i].equals(PENDING)) {
684 assertEquals(0, MSOTableElement.findElement(By.tagName("tbody")).findElements(By.tagName("tr")).size(), "When status is PENDING MSO table is empty");
687 vidBasePage.screenshotDeployDialog("audit-info-" + actualInstanceName);
688 Click.byId(Constants.AuditInfoModal.CANCEL_BUTTON);
691 private String convertUITextCapitalizeAndFormatPipe(String text) {
692 return text.toUpperCase().replace("-", "_");
695 private boolean isDateValid(String dateToValidate, String dateFromat) {
697 if (dateToValidate == null) {
700 SimpleDateFormat sdf = new SimpleDateFormat(dateFromat);
701 sdf.setLenient(false);
703 //if not valid, it will throw ParseException
704 Date date = sdf.parse(dateToValidate);
706 } catch (ParseException e) {
713 private void verifyDeleteJob(String serviceInstanceName) {
714 boolean[] deleteEnabled = {false, false, true};
715 String[] statuses = {COMPLETED, IN_PROGRESS, PENDING};
716 verifyDeleteOrHideOperation(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_REMOVE, statuses, deleteEnabled, "deleted");
719 private void verifyHideJob(String serviceInstanceName) {
720 boolean[] hideEnabled = {true, false};
721 String[] statuses = {COMPLETED, IN_PROGRESS};
722 verifyDeleteOrHideOperation(serviceInstanceName, Constants.InstantiationStatus.CONTEXT_MENU_HIDE, statuses, hideEnabled, "hidden");
725 private void verifyDeleteOrHideOperation(String serviceInstanceName, String contextMenuItem, String[] statuses, boolean[] operationEnabled, String operationName) {
726 for (int i = 0; i < statuses.length; i++) {
727 String actualInstanceName = getActualInstanceName(serviceInstanceName, i, statuses[i]);
728 InstantiationStatusPage.checkMenuItem(actualInstanceName, contextMenuItem, operationEnabled[i], contextMenuDelete -> {
729 Click.byTestId(contextMenuDelete);
730 GeneralUIUtils.ultimateWait();
731 assertNull(actualInstanceName + " should be " + operationName,
732 InstantiationStatusPage.getInstantiationStatusRow(actualInstanceName));
735 vidBasePage.screenshotDeployDialog(serviceInstanceName);
738 private ImmutableMap<String, String> expectedRowFields(String actualInstanceName) {
739 return ImmutableMap.<String, String>builder()
740 .put("userId", getUserCredentials().getUserId())
741 .put("serviceModelName", "action-data")
742 .put("serviceInstanceName", actualInstanceName)
743 .put("serviceModelVersion", "1.0")
744 .put("subscriberName", "SILVIA ROBBINS")
745 .put("serviceType", "TYLER SILVIA")
746 .put("regionId", "hvf6")
747 .put("tenantName", "AIN Web Tool-15-D-testalexandria")
748 .put("aicZoneName", "NFTJSSSS-NFT1")
749 .put("project", "WATKINS")
750 .put("owningEntityName", "WayneHolland")
751 .put("pause", "false")
755 private ImmutableMap<String, String> expectedALaCarteRowFields(String actualInstanceName) {
756 return ImmutableMap.<String, String>builder()
757 .put("userId", getUserCredentials().getUserId())
758 .put("serviceModelName", "Grouping Service for Test")
759 .put("serviceInstanceName", actualInstanceName)
760 .put("serviceModelVersion", "1.0")
761 .put("subscriberName", "SILVIA ROBBINS")
762 .put("serviceType", "TYLER SILVIA")
763 .put("project", "WATKINS")
764 .put("owningEntityName", "WayneHolland")
765 .put("pause", "false")
769 private String createSriovService(ServiceData serviceData, boolean tryCancelsAndReentries) {
770 return createSriovService(serviceData, tryCancelsAndReentries, randomAlphabetic(5));
773 private String createSriovService(ServiceData serviceData, boolean tryCancelsAndReentries, String randomAlphabetic) {
774 BrowseASDCPage browseASDCPage = new BrowseASDCPage();
775 User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
777 // simulate typing with spaces, but expected is without spaces
778 String serviceInstanceNameWithSpaces = randomAlphabetic + " instance name";
779 String serviceInstanceName = cleanSeparators(serviceInstanceNameWithSpaces);
781 List<String> cycles = tryCancelsAndReentries ? ImmutableList.of("WILL_CANCEL", "AFTER_CANCEL") : ImmutableList.of("SINGLE_SHOT");
782 cycles.forEach(cycle -> {
783 if ("AFTER_CANCEL".equals(cycle)) {
784 loadServicePopupOnBrowseASDCPage(serviceData.modelUuid);
786 loadServicePopup(serviceData.modelUuid);
789 WebElement instanceName = Get.byId("instanceName");
790 boolean isRequired = isElementByIdRequired("instanceName-label");
791 if (serviceData.isGeneratedNaming) {
792 Assert.assertNotNull(instanceName, "instance name input should be visible when serviceEcompNaming == true.");
793 Assert.assertFalse(isRequired,"instance name input should be optional when ecompNaming == true.");
796 Assert.assertTrue(isRequired,"instance name input should be required when serviceEcompNaming == false.");
797 instanceName.sendKeys(serviceInstanceName);
800 //serviceType should be dependent on subscriber selection
801 assertElementDisabled("serviceType-select");
802 Wait.waitByClassAndText(Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS, "SILVIA ROBBINS", 30);
803 GeneralUIUtils.ultimateWait();
804 Click.byTestId(Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID);
805 if (Features.FLAG_RESTRICTED_SELECT.isActive())
806 assertElementExistAccordingTagNameAndTestId("select", Constants.SUBSCRIBER_SELECT_ID);
808 assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
811 VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
812 //lcpRegion should be dependent on serviceType selection
813 assertElementDisabled("lcpRegion-select");
815 String serviceType = "TYLER SILVIA";
816 Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30);
817 browseASDCPage.selectServiceTypeByName(serviceType);
819 //tenant should be dependent on lcpRegion selection
820 assertElementDisabled("tenant-select");
822 String lcpRegion = "hvf6";
823 Wait.waitByClassAndText("lcpRegionOption", lcpRegion, 30);
824 viewEditPage.selectLcpRegion(lcpRegion, AIC);
826 GeneralUIUtils.ultimateWait();
827 browseASDCPage.selectTenant("bae71557c5bb4d5aac6743a4e5f1d054");
829 String setButtonTestId = "form-set";
830 assertSetButtonDisabled(setButtonTestId);
832 SelectOption.byTestIdAndVisibleText("WayneHolland", (Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID));
833 assertSetButtonDisabled(setButtonTestId);
835 SelectOption.byTestIdAndVisibleText("ERICA", Constants.ViewEdit.PRODUCT_FAMILY_SELECT_TESTS_ID);
836 assertSetButtonEnabled(setButtonTestId);
838 browseASDCPage.selectProductFamily("e433710f-9217-458d-a79d-1c7aff376d89");
840 browseASDCPage.selectAicZone("NFT1");
842 SelectOption.byTestIdAndVisibleText("WATKINS", Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
844 assertNotificationAreaVisibilityBehaviour();
846 assertPauseOnPausePointsVisibility(serviceData.multiStageDesign);
848 validateDynamicFields(serviceData.dynamicFields);
850 vidBasePage.screenshotDeployDialog("createSriovService-" + serviceInstanceName);
852 if ("WILL_CANCEL".equals(cycle)) {
853 Click.byTestId(Constants.CANCEL_BUTTON_TEST_ID);
855 Click.byTestId(setButtonTestId);
858 VidBasePage.goOutFromIframe();
860 browseASDCPage.goToIframe();
863 return serviceInstanceName;
866 private String createALaCarteService(ServiceData serviceData, String randomAlphabetic) {
867 BrowseASDCPage browseASDCPage = new BrowseASDCPage();
868 User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
870 // simulate typing with spaces, but expected is without spaces
871 String serviceInstanceNameWithSpaces = randomAlphabetic + " instance name";
872 String serviceInstanceName = cleanSeparators(serviceInstanceNameWithSpaces);
874 loadServicePopup(serviceData.modelUuid);
876 WebElement instanceName = Get.byId("instanceName");
877 if (serviceData.isGeneratedNaming) {
878 Assert.assertNull(instanceName, "instance name input should be invisible when serviceEcompNaming == true.");
880 instanceName.sendKeys(serviceInstanceName);
883 //serviceType should be dependent on subscriber selection
884 assertElementDisabled("serviceType-select");
885 Wait.waitByClassAndText(Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS, "SILVIA ROBBINS", 30);
886 GeneralUIUtils.ultimateWait();
887 Click.byTestId(Constants.SUBSCRIBER_NAME_SELECT_TESTS_ID);
888 if (Features.FLAG_RESTRICTED_SELECT.isActive())
889 assertElementExistAccordingTagNameAndTestId("select", Constants.SUBSCRIBER_SELECT_ID);
891 assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
894 VidBasePage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
896 String serviceType = "TYLER SILVIA";
897 Wait.waitByClassAndText(Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS, serviceType, 30);
898 browseASDCPage.selectServiceTypeByName(serviceType);
900 String setButtonTestId = "form-set";
901 assertSetButtonDisabled(setButtonTestId);
903 SelectOption.byTestIdAndVisibleText("WayneHolland", (Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID));
905 SelectOption.byTestIdAndVisibleText("WATKINS", Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
907 validateDynamicFields(serviceData.dynamicFields);
909 vidBasePage.screenshotDeployDialog("createALaCarteService-" + serviceInstanceName);
911 Click.byTestId(setButtonTestId);
913 VidBasePage.goOutFromIframe();
915 browseASDCPage.goToIframe();
917 return serviceInstanceName;
920 private void assertElementExistAccordingTagNameAndTestId(String tag, String testId) {
921 WebElement webElement = Get.byId(testId);
922 Assert.assertEquals(webElement.getTagName(), tag);
925 private void createVnf(ServiceData serviceData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName) {
926 createVnf(serviceData.vnfData, tryCancelsAndReentries, addedByDefault, serviceInstanceName);
929 private void createNetwork(VnfData vnfData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName) {
930 createVnf(vnfData, tryCancelsAndReentries, addedByDefault, serviceInstanceName, true);
933 private void createVnf(VnfData vnfData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName) {
934 createVnf(vnfData, tryCancelsAndReentries, addedByDefault, serviceInstanceName, false);
937 private void createVnf(VnfData vnfData, boolean tryCancelsAndReentries, boolean addedByDefault, String serviceInstanceName, boolean isNetwork) {
938 BrowseASDCPage browseASDCPage = new BrowseASDCPage();
940 String nodeToEdit = extractNodeToEdit(vnfData);
941 if (addedByDefault && Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) {
942 hoverAndClickEditButton(nodeToEdit);
944 drawingBoardPage.clickAddButtonByNodeName(vnfData.vnfName);
947 GeneralUIUtils.ultimateWait();
949 if (vnfData.isGeneratedNaming) {
950 Assert.assertFalse(isElementByIdRequired("instanceName-label") ,"instance name input should be optional when EcompNaming == true, and required when false.");
952 Input.text(vnfData.vnfInstanceName, "instanceName");
956 //tenant should be dependent on lcpRegion selection
957 assertElementDisabled("tenant-select");
959 WebElement legacyRegion = Get.byTestId("lcpRegionText");
960 Assert.assertNull(legacyRegion, "legacy region shouldn't be visible when lcp region isn't JANET25,olson3 or olson5a.");
962 browseASDCPage.selectLcpRegion("JANET25");
964 legacyRegion = Get.byTestId("lcpRegionText");
965 Assert.assertNotNull(legacyRegion, "legacy region should be visible when lcp region is JANET25,olson3 or olson5a.");
967 browseASDCPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86");
969 assertSetButtonDisabled(VNF_SET_BUTTON_TEST_ID);
971 browseASDCPage.selectPlatform("platform");
973 assertSetButtonEnabled(VNF_SET_BUTTON_TEST_ID);
975 browseASDCPage.setLegacyRegion("some legacy region");
976 browseASDCPage.selectLineOfBusiness("ONAP");
978 Wait.waitByTestId("model-item-value-subscriberName", 10);
979 Assert.assertEquals(Get.byTestId("model-item-value-subscriberName").getText(), "SILVIA ROBBINS", "Subscriber name should be shown in vf module");
980 Assert.assertEquals(Get.byTestId("model-item-value-min"), null, "Min value should not be shown in VNF popup");
981 Assert.assertEquals(Get.byTestId("model-item-value-max"), null, "Max value should not be show in VNF popup");
982 if (!vnfData.isGeneratedNaming) {
983 Assert.assertEquals(Get.byTestId("model-item-value-serviceName").getText(), serviceInstanceName, "Subscriber name should be shown in vf module");
986 vidBasePage.screenshotDeployDialog("createVnf-" + serviceInstanceName);
987 Click.byTestId(VNF_SET_BUTTON_TEST_ID);
991 if (tryCancelsAndReentries) {
992 hoverAndClickEditButton(nodeToEdit);
994 Wait.byText("TYLER SILVIA");
995 GeneralUIUtils.ultimateWait();
996 assertThat(Get.selectedOptionText(Constants.ViewEdit.LCP_REGION_SELECT_TESTS_ID), startsWith("JANET25"));
997 Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.TENANT_SELECT_TESTS_ID), "USP-SIP-IC-24335-T-01");
998 Assert.assertEquals(Get.selectedOptionText(Constants.ViewEdit.LINE_OF_BUSINESS_SELECT_TESTS_ID), "ONAP");
999 Assert.assertEquals(Get.selectedOptionText(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID), "platform");
1000 Click.byTestId(Constants.CANCEL_BUTTON_TEST_ID);
1001 GeneralUIUtils.ultimateWait();
1003 toggleItemInTree(Constants.DrawingBoard.AVAILABLE_MODELS_TREE);
1005 Click.byTestId("node-" + nodeToEdit);
1008 private String extractNodeToEdit(VnfData vnfData) {
1009 return vnfData.vnfUuid + "-" + vnfData.vnfName;
1013 private void toggleItemInTree(String tree) {
1014 Click.byXpath("//tree-root[@data-tests-id='" + tree + "']//span[@class='" + Constants.DrawingBoard.TOGGLE_CHILDREN + "']");
1017 private void hoverAndClickEditButton(String nodeToEdit) {
1018 hoverAndClickButton(nodeToEdit, Constants.DrawingBoard.CONTEXT_MENU_EDIT);
1021 private void hoverAndClickDeleteButton(String nodeToEdit) {
1022 hoverAndClickButton(nodeToEdit, Constants.InstantiationStatus.CONTEXT_MENU_REMOVE);
1025 private void hoverAndClickDuplicateButton(String nodeToEdit) {
1026 hoverAndClickButton(nodeToEdit, Constants.InstantiationStatus.CONTEXT_MENU_DUPLICATE);
1028 private void hoverAndClickButton(String nodeToEdit, String contextMenuItem) {
1029 String nodeOfEdit = Constants.DrawingBoard.NODE_PREFIX + nodeToEdit;
1030 String buttonOfEdit = nodeOfEdit + Constants.DrawingBoard.CONTEXT_MENU_BUTTON;
1031 GeneralUIUtils.hoverOnAreaByTestId(buttonOfEdit);
1032 Click.byTestId(buttonOfEdit);
1033 Click.byTestId(contextMenuItem);
1036 private void uploadSupplementaryFile(String inputFileName, boolean isValid, BrowseASDCPage browseASDCPage, String setButtonTestId) {
1037 if (Features.FLAG_SUPPLEMENTARY_FILE.isActive()) {
1038 GeneralUIUtils.ultimateWait();
1039 Input.file("supplementaryFiles/" + inputFileName, "supplementaryFile");
1040 GeneralUIUtils.ultimateWait();
1041 WebElement fileName = Get.byTestId("file-name");
1042 Assert.assertEquals(fileName.getText(),inputFileName);
1043 browseASDCPage.assertButtonState(setButtonTestId, isValid);
1047 private void deleteSupplementaryFile() {
1048 if (Features.FLAG_SUPPLEMENTARY_FILE.isActive()) {
1049 Click.byTestId("remove-uploaded-file");
1050 GeneralUIUtils.ultimateWait();
1051 WebElement fileName = Get.byTestId("file-name");
1052 Assert.assertEquals(fileName.getText(),"Choose file");
1056 private void createVfModule(ServiceData serviceData, String serviceInstanceName, boolean addedByDefault, boolean addOpensPopup) {
1057 clickAddVfModule(serviceData, addedByDefault);
1058 if (!addOpensPopup) {
1059 clickEditVfModule(serviceData);
1061 fillAndSetVfModulePopup(serviceData, serviceInstanceName);
1064 private void fillAndSetVfModulePopup(ServiceData serviceData, String serviceInstanceName) {
1065 String setButtonTestId = "form-set";
1066 BrowseASDCPage browseASDCPage = new BrowseASDCPage();
1068 Assert.assertEquals(isElementByIdRequired("instanceName-label"), !serviceData.vnfData.isGeneratedNaming,"instance name input should be optional when EcompNaming == true, and required when false.");
1070 if (!serviceData.vnfData.isGeneratedNaming) {
1071 Input.text("VF instance name", "instanceName");
1074 if (serviceData.vfData.vgEnabled) {
1075 browseASDCPage.setInputText("volumeGroupName", "_abc");
1076 Assert.assertEquals(isElementByIdRequired("volumeGroupName-label"), false, "volume Group name input should be always optional");
1078 Assert.assertNull(Get.byTestId("volumeGroupName"), "volumeGroupName input should be invisible when vgEnabled == false");
1080 Wait.waitByTestId("model-item-value-subscriberName", 10);
1081 Assert.assertEquals(Get.byTestId("model-item-value-subscriberName").getText(), "SILVIA ROBBINS", "Subscriber name should be shown in vf module");
1082 Assert.assertEquals(Get.byTestId("model-item-value-min").getText(), Integer.toString(serviceData.vfData.vfMin), "Min should be shown");
1083 Assert.assertEquals(Get.byTestId("model-item-value-max").getText(), Integer.toString(serviceData.vfData.vfMax), "Max should be shown");
1084 if (!serviceData.vnfData.isGeneratedNaming) {
1085 Wait.byText(serviceInstanceName);
1086 Assert.assertEquals(Get.byTestId("model-item-value-serviceName").getText(), serviceInstanceName, "Service name should be shown in vf module");
1088 validateDynamicFields(serviceData.vfData.dynamicFields);
1090 uploadSupplementaryFile("invalid-file.json", false, browseASDCPage, setButtonTestId);
1091 deleteSupplementaryFile();
1092 uploadSupplementaryFile("sample.json", true, browseASDCPage, setButtonTestId);
1094 browseASDCPage.screenshotDeployDialog("createVfModule-" + serviceInstanceName);
1095 Click.byTestId(setButtonTestId);
1098 private void clickEditVfModule(ServiceData serviceData) {
1099 if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) {
1100 hoverAndClickEditButton(serviceData.vfData.uuid + "-" + serviceData.vfData.vfName);
1104 private void clickAddVfModule(ServiceData serviceData, boolean addedByDefault) {
1105 if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive() && addedByDefault) {
1108 System.out.println("VFModule should be added 'manually'");
1110 final WebElement vfModuleNode = Get.byTestId(Constants.DrawingBoard.NODE_PREFIX + serviceData.vfData.vfName);
1112 if (vfModuleNode == null || !vfModuleNode.isDisplayed()) {
1114 drawingBoardPage.clickNode(serviceData.vnfData.vnfName);
1116 drawingBoardPage.clickAddButtonByNodeName(serviceData.vfData.vfName);
1119 private void clickRemoveVfModule(String vfModuleId, String vfModuleName) {
1120 if (Features.FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD.isActive()) {
1121 System.out.println("will remove " + vfModule0Name);
1122 hoverAndClickDeleteButton(vfModuleId + "-" + vfModuleName);
1126 private void assertPauseOnPausePointsVisibility(boolean visibility) {
1127 WebElement pauseElem = Get.byId("Pause");
1128 final String assertionMessage = "pause on pause points visibility should be " + visibility;
1130 Assert.assertNotNull(pauseElem, assertionMessage);
1132 Assert.assertNull(pauseElem, assertionMessage);
1136 private void assertNotificationAreaVisibilityBehaviour() {
1137 WebElement webElement = Get.byId("notification-area");
1138 Assert.assertNull(webElement, "notification area should be invisible if only 1 qty.");
1140 SelectOption.byIdAndVisibleText("quantity-select", "3");
1142 webElement = Get.byId("notification-area");
1143 Assert.assertNotNull(webElement, "notification area should be visible if more then 1 qty.");
1146 private void prepareServicePreset(ModelInfo modelInfo, boolean deploy) {
1147 String subscriberId = "e433710f-9217-458d-a79d-1c7aff376d89";
1150 registerExpectationForServiceDeployment(
1153 PASQUALEVmxVpeBvService488Annotations
1155 subscriberId, null);
1157 registerExpectationForServiceBrowseAndDesign(ImmutableList.of(modelInfo), subscriberId);
1161 private class ServiceData {
1162 ServiceData(String modelUuid, List<String> dynamicFields, boolean isServiceGeneratedNaming, boolean isVnfGeneratedNaming, boolean isVgEnabled, boolean multiStageDesign, String vnfName, String vfName, int vfMin, int vfMax, List<String> vfModuleDynamicFields, String vfVersionId) {
1163 this.modelUuid = modelUuid;
1164 this.dynamicFields = dynamicFields;
1165 this.isGeneratedNaming = isServiceGeneratedNaming;
1166 this.multiStageDesign = multiStageDesign;
1167 this.vnfData = new VnfData(vnfName, "69e09f68-8b63-4cc9-b9ff-860960b5db09", "VNF instance name", isVnfGeneratedNaming);
1168 this.vfData = new VfData(vfName, isVgEnabled, vfMin, vfMax, vfModuleDynamicFields, vfVersionId);
1171 final String modelUuid;
1172 final List<String> dynamicFields;
1173 final boolean isGeneratedNaming;
1174 final boolean multiStageDesign;
1175 final VnfData vnfData;
1176 final VfData vfData;
1179 private class VnfData {
1180 VnfData(String vnfName, String vnfUuid, String vnfInstanceName, boolean isGeneratedNaming) {
1181 this.vnfName = vnfName;
1182 this.vnfUuid = vnfUuid;
1183 this.vnfInstanceName = vnfInstanceName;
1184 this.isGeneratedNaming = isGeneratedNaming;
1187 final String vnfName;
1188 final String vnfUuid;
1189 final String vnfInstanceName;
1190 final boolean isGeneratedNaming;
1194 private class VfData {
1195 VfData(String vfName, boolean vgEnabled, int vfMin, int vfMax, List<String> dynamicFields, String uuid) {
1196 this.vfName = vfName;
1197 this.vgEnabled = vgEnabled;
1200 this.dynamicFields = dynamicFields;
1207 final String vfName;
1208 final boolean vgEnabled;
1209 final List<String> dynamicFields;