1 package vid.automation.test.test;
3 import com.google.common.collect.ImmutableList;
4 import com.google.common.collect.ImmutableMap;
5 import org.junit.Assert;
6 import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
7 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
8 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleOldViewEdit;
9 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteOldViewEdit;
10 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVolumeGroupOldViewEdit;
11 import org.onap.sdc.ci.tests.datatypes.UserCredentials;
12 import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
13 import org.openqa.selenium.WebElement;
14 import org.testng.annotations.BeforeClass;
15 import org.testng.annotations.DataProvider;
16 import org.testng.annotations.Test;
17 import vid.automation.test.Constants;
18 import vid.automation.test.infra.Get;
19 import vid.automation.test.model.ServiceModel;
20 import vid.automation.test.model.User;
21 import vid.automation.test.sections.SideMenu;
22 import vid.automation.test.sections.VidBasePage;
23 import vid.automation.test.sections.ViewEditPage;
24 import vid.automation.test.services.ServicesService;
25 import vid.automation.test.services.SimulatorApi;
27 import java.util.List;
28 import java.util.stream.Collectors;
30 import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.*;
31 import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
34 public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
35 static final String SUBSCRIBER = "Emanuel";
36 static final String SERVICE_NAME = "ggghhh";
37 static final String SERVICE_ID = "537d3eb0-b7ab-4fe8-a438-6166ab6af49b";
38 static final String VNF_ID = "0eb38f69-d96b-4d5e-b8c9-3736c292f0f7";
39 static final String DEFAULT_TEST_API_VALUE = "VNF_API";
40 public static final String SERVICE_INSTANCE_ID = "SERVICE_INSTANCE_ID";
41 public static final String A_LACARTE_FLOW_GET_ORCHESTRATION = "aLacarteFlow/get_orchestration_request_status.json";
42 public static final String ORCHESTRATION_REQUEST_ID = "orchestrationRequestId";
43 public static final String STATUS_MESSAGE = "status_message";
44 public static final String REQUEST_TYPE = "REQUEST-TYPE";
45 public static final String CREATE = "Create";
46 public static final String AAIAIC_25 = "AAIAIC25";
47 public static final String AIC = "AIC";
48 public static final String TENANT = "092eb9e8e4b7412e8787dd091bc58e86";
49 public static final String FALSE = "false";
50 public static final String NODE_INSTANCE = "VSP1710PID298109_vWINIFRED 0";
51 public static final String MODEL = "959a7ba0-89ee-4984-9af6-65d5bdda4b0e";
52 private static final String CREATE_VNF_REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873dfbd";
56 protected void registerToSimulator() {
57 SimulatorApi.clearAll();
58 SimulatorApi.registerExpectation(APPEND,
59 "ecompportal_getSessionSlotCheckInterval.json",
60 "search_for_service_instance/aai_get_services.json"
61 , "create_configuration/aai_get_tenants.json"
62 , "sanity/get_aai_sub_details.json"
63 , "aLacarteFlow/get_aai_search_named_query.json"
64 , "aLacarteFlow/get_sdc_catalog_services_ggghhh.json"
66 SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.APPEND);
70 @Test(dataProvider = "msoTestApiOptions")
71 private void testAddVfModule(String msoTestApiOption, String msoTestApiValue) {
72 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
73 final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bddd";
74 final String MODEL_UUID = "d205e01d-e5da-4e68-8c52-f95cb0607959";
76 String vfModuleName = viewEditPage.generateInstanceName(Constants.ViewEdit.VF_MODULE_INSTANCE_NAME_PREFIX);
78 SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
79 PRESET_MDT1_TO_ATT_NC,
80 new PresetMSOCreateVfModuleOldViewEdit(
82 BaseMSOPreset.DEFAULT_INSTANCE_ID,
88 SimulatorApi.RegistrationStrategy.APPEND);
91 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION,
92 ImmutableMap.of(ORCHESTRATION_REQUEST_ID, REQUEST_ID, STATUS_MESSAGE, Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT,
93 REQUEST_TYPE, CREATE), APPEND);
94 GeneralUIUtils.ultimateWait();
96 ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID);
97 addVFModule("Vsp1710pid298109Vwinifred..mmsc_mod1_ltm..module-8", vfModuleName, AAIAIC_25, AIC,
98 TENANT, FALSE, MDT_1, getCurrentUser().tenants, serviceInstance);
104 private void testTenant() throws Exception {
105 ViewEditPage viewEditPage = new ViewEditPage();
106 User user = usersService.getUser("Emanuel_with_tenant");
107 relogin(user.credentials);
109 viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE);
110 viewEditPage.setInstanceName("New and fun instance");
111 viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
112 viewEditPage.selectLcpRegion("hvf6", AIC);
113 List<WebElement> tenantOptions = Get.byClass(Constants.ViewEdit.TENANT_OPTION_CLASS);
114 List<WebElement> enabledTenantOption = tenantOptions.stream().filter(webElement -> webElement.isEnabled()).collect(Collectors.toList());
115 Assert.assertTrue(enabledTenantOption.size() == 1);
116 Assert.assertTrue(enabledTenantOption.get(0).getText().equals("test-hvf6-09"));
118 // SimulatorApi.registerExpectation("aLacarteFlow/get_sdc_catalog_services_ggghhh.json",APPEND);
121 @Test(dataProvider = "msoTestApiOptions")
122 private void testAddVnf(String msoTestApiOption, String msoTestApiValue) {
123 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
124 final String MODEL_UUID = MODEL;
125 String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
126 SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
127 PRESET_SOME_LEGACY_REGION_TO_ATT_AIC,
128 new PresetMSOCreateVnfALaCarteOldViewEdit(
129 CREATE_VNF_REQUEST_ID,
134 SimulatorApi.RegistrationStrategy.APPEND);
135 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION,
136 ImmutableMap.of(ORCHESTRATION_REQUEST_ID, "dbe54591-c8ed-46d3-abc7-d3a24873dfbd", STATUS_MESSAGE, Constants.ViewEdit.VNF_CREATED_SUCCESSFULLY_TEXT,
137 REQUEST_TYPE, CREATE), APPEND);
138 GeneralUIUtils.ultimateWait();
140 ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID);
141 addVNF(NODE_INSTANCE, AAIAIC_25, AIC, TENANT,
142 FALSE, SOME_LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, "ONAP", serviceInstance, instanceName);
146 @Test(dataProvider = "msoTestApiOptions")
147 private void requiredLineOfBussiness_confirmVnfWithNoLob(String msoTestApiOption, String msoTestApiValue) throws Exception {
148 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
150 String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
151 SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
152 PRESET_SOME_LEGACY_REGION_TO_ATT_AIC,
153 new PresetMSOCreateVnfALaCarteOldViewEdit(
154 CREATE_VNF_REQUEST_ID,
159 SimulatorApi.RegistrationStrategy.APPEND);
160 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION, ImmutableMap.of(
161 ORCHESTRATION_REQUEST_ID, "dbe54591-c8ed-46d3-abc7-d3a24873dfbd",
162 STATUS_MESSAGE, Constants.ViewEdit.VNF_CREATED_SUCCESSFULLY_TEXT,
165 openAndFillVnfPopup(NODE_INSTANCE, AAIAIC_25, AIC, TENANT,
166 FALSE, SOME_LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, null, null, instanceName);
167 assertConfirmShowMissingDataErrorOnCurrentPopup(Constants.ViewEdit.LINE_OF_BUSINESS_TEXT);
172 private void emptyLobAfterReopenCreateVnfDialog() throws Exception {
173 final String lobToSelect = "ONAP";
175 ViewEditPage viewEditPage = new ViewEditPage();
176 viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE);
177 GeneralUIUtils.ultimateWait();
178 viewEditPage.selectLineOfBusiness(lobToSelect);
179 viewEditPage.clickCancelButtonByTestID();
180 viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE);
181 GeneralUIUtils.ultimateWait();
182 viewEditPage.selectLineOfBusiness(lobToSelect);
183 viewEditPage.clickCancelButtonByTestID();
186 @Test(dataProvider = "msoTestApiOptions")
187 private void testAddVolumeGroup(String msoTestApiOption, String msoTestApiValue) throws Exception {
188 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
189 final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bdaa";
190 final String MODEL_UUID = "13f022c4-651e-4326-b8e1-61e9a8c7a7ad";
191 String vgName = viewEditPage.generateInstanceName(Constants.ViewEdit.VOLUME_GROUP_INSTANCE_NAME_PREFIX);
192 SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
193 PRESET_SOME_LEGACY_REGION_TO_ATT_AIC,
194 new PresetMSOCreateVolumeGroupOldViewEdit(
196 BaseMSOPreset.DEFAULT_INSTANCE_ID,
201 SimulatorApi.RegistrationStrategy.APPEND);
202 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION,
203 ImmutableMap.of(ORCHESTRATION_REQUEST_ID, REQUEST_ID, STATUS_MESSAGE, Constants.ViewEdit.VOLUME_GROUP_CREATED_SUCCESSFULLY_TEXT,
204 REQUEST_TYPE, CREATE), SimulatorApi.RegistrationStrategy.APPEND);
205 GeneralUIUtils.ultimateWait();
207 ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID);
208 addVolumeGroup("Vsp1710pid298109Vwinifred..mmsc_mod6_eca_oam..module-3", vgName, AAIAIC_25, AIC, TENANT,
209 FALSE, SOME_LEGACY_REGION, getCurrentUser().tenants, serviceInstance);
213 private User getCurrentUser() {
214 return usersService.getUser(Constants.Users.EMANUEL_vWINIFRED);
217 private void goToInstance() {
218 SideMenu.navigateToSearchExistingPage();
219 goToExistingInstanceBySubscriber(SUBSCRIBER, SERVICE_NAME, SERVICE_ID);
224 protected UserCredentials getUserCredentials() {
225 User user = getCurrentUser();
226 return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.EMANUEL_vWINIFRED, "", "");
230 public static Object[][] msoTestApiOptions() {
231 return new Object[][]{
232 {"VNF_API (old)", DEFAULT_TEST_API_VALUE}
233 , {"GR_API (new)", "GR_API"}
237 private void withMsoTestApiConfiguration(String msoTestApiOption, String msoTestApiValue, Runnable test) {
238 if (msoTestApiValue.equals(DEFAULT_TEST_API_VALUE)) {
242 selectMsoTestApiOption(msoTestApiOption);
246 selectMsoTestApiOption("VNF_API (old)");