1 package vid.automation.test.test;
3 import com.google.common.collect.ImmutableMap;
4 import org.junit.Assert;
5 import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
6 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
7 import org.openqa.selenium.WebElement;
8 import org.testng.annotations.BeforeClass;
9 import org.testng.annotations.DataProvider;
10 import org.testng.annotations.Test;
11 import vid.automation.test.Constants;
12 import vid.automation.test.infra.Get;
13 import vid.automation.test.infra.SelectOption;
14 import vid.automation.test.model.ServiceModel;
15 import vid.automation.test.model.User;
16 import vid.automation.test.sections.SideMenu;
17 import vid.automation.test.sections.VidBasePage;
18 import vid.automation.test.sections.ViewEditPage;
19 import vid.automation.test.services.ServicesService;
20 import vid.automation.test.services.SimulatorApi;
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.List;
25 import java.util.stream.Collectors;
27 import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
30 public class ALaCarteflowTest extends CreateInstanceDialogBaseTest {
31 static final String SUBSCRIBER = "Mobility";
32 static final String SERVICE_NAME = "ggghhh";
33 static final String SERVICE_ID = "537d3eb0-b7ab-4fe8-a438-6166ab6af49b";
34 static final String VNF_ID = "0eb38f69-d96b-4d5e-b8c9-3736c292f0f7";
35 static final String DEFAULT_TEST_API_VALUE = "GR_API";
36 public static final String SERVICE_INSTANCE_ID = "SERVICE_INSTANCE_ID";
37 public static final String A_LACARTE_FLOW_GET_ORCHESTRATION = "aLacarteFlow/get_orchestration_request_status.json";
38 public static final String ORCHESTRATION_REQUEST_ID = "orchestrationRequestId";
39 public static final String STATUS_MESSAGE = "status_message";
40 public static final String REQUEST_TYPE = "REQUEST-TYPE";
41 public static final String CREATE = "Create";
42 public static final String AAIAIC_25 = "AAIAIC25";
43 public static final String TENANT = "092eb9e8e4b7412e8787dd091bc58e86";
44 public static final String FALSE = "false";
45 public static final String NODE_INSTANCE = "VSP1710PID298109_vMMSC 0";
46 public static final String MODEL = "959a7ba0-89ee-4984-9af6-65d5bdda4b0e";
47 public static final String LEGACY_REGION = "some legacy region";
51 protected void registerToSimulator() {
52 SimulatorApi.clearAll();
53 SimulatorApi.registerExpectation(APPEND,
54 "ecompportal_getSessionSlotCheckInterval.json",
55 "search_for_service_instance/aai_get_services.json"
56 , "create_configuration/aai_get_tenants.json"
57 , "sanity/get_aai_get_subscribers.json"
58 , "sanity/get_aai_sub_details.json"
59 , "aLacarteFlow/get_aai_search_named_query.json"
60 , "aLacarteFlow/get_sdc_catalog_services_ggghhh.json"
66 @Test(dataProvider = "msoTestApiOptions")
67 private void testAddVfModule(String msoTestApiOption, String msoTestApiValue) {
68 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
69 final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bddd";
70 final String MODEL_UUID = "d205e01d-e5da-4e68-8c52-f95cb0607959";
71 SimulatorApi.registerExpectation("aLacarteFlow/mso_create_vf_module.json", ImmutableMap.of(SERVICE_INSTANCE_ID, SERVICE_ID, "VNF_INSTANCE_ID", VNF_ID, "REQUEST_ID", REQUEST_ID, DEFAULT_TEST_API_VALUE, msoTestApiValue), APPEND);
72 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION,
73 ImmutableMap.of(ORCHESTRATION_REQUEST_ID, REQUEST_ID, STATUS_MESSAGE, Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT,
74 REQUEST_TYPE, CREATE), APPEND);
75 GeneralUIUtils.ultimateWait();
77 ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID);
78 addVFModule("Vsp1710pid298109Vmmsc..mmsc_mod1_ltm..module-8", AAIAIC_25,
79 TENANT, FALSE, "mdt1", getCurrentUser().tenants, serviceInstance);
85 private void testTenant() throws Exception {
86 ViewEditPage viewEditPage = new ViewEditPage();
87 User user = usersService.getUser("Mobility_with_tenant");
88 relogin(user.credentials);
90 viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE);
91 viewEditPage.setInstanceName("New and fun instance");
92 viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
93 viewEditPage.selectLCPRegion("mtn6");
94 List<WebElement> tenantOptions = Get.byClass(Constants.ViewEdit.TENANT_OPTION_CLASS);
95 List<WebElement> enabledTenantOption = tenantOptions.stream().filter(webElement -> webElement.isEnabled()).collect(Collectors.toList());
96 Assert.assertTrue(enabledTenantOption.size() == 1);
97 Assert.assertTrue(enabledTenantOption.get(0).getText().equals("test-mtn6-09"));
99 // SimulatorApi.registerExpectation("aLacarteFlow/get_sdc_catalog_services_ggghhh.json",APPEND);
102 @Test(dataProvider = "msoTestApiOptions")
103 private void testAddVnf(String msoTestApiOption, String msoTestApiValue) {
104 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
105 final String MODEL_UUID = MODEL;
106 String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
107 SimulatorApi.registerExpectation("aLacarteFlow/mso_create_vnf.json", ImmutableMap.of(
108 SERVICE_INSTANCE_ID, SERVICE_ID,
110 "INSTANCE_NAME", instanceName,
111 DEFAULT_TEST_API_VALUE, msoTestApiValue
113 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION,
114 ImmutableMap.of(ORCHESTRATION_REQUEST_ID, "dbe54591-c8ed-46d3-abc7-d3a24873dfbd", STATUS_MESSAGE, Constants.ViewEdit.VNF_CREATED_SUCCESSFULLY_TEXT,
115 REQUEST_TYPE, CREATE), APPEND);
116 GeneralUIUtils.ultimateWait();
118 ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID);
119 addVNF(NODE_INSTANCE, AAIAIC_25, TENANT,
120 FALSE, LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, new ArrayList<>(Arrays.asList("ECOMP")), serviceInstance, instanceName);
124 @Test(dataProvider = "msoTestApiOptions")
125 private void requiredLineOfBussiness_confirmVnfWithNoLob(String msoTestApiOption, String msoTestApiValue) throws Exception {
126 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
128 String instanceName = new VidBasePage().generateInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
129 SimulatorApi.registerExpectation("aLacarteFlow/mso_create_vnf.json", ImmutableMap.of(
130 SERVICE_INSTANCE_ID, SERVICE_ID,
132 "INSTANCE_NAME", instanceName,
133 DEFAULT_TEST_API_VALUE, msoTestApiValue
135 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION, ImmutableMap.of(
136 ORCHESTRATION_REQUEST_ID, "dbe54591-c8ed-46d3-abc7-d3a24873dfbd",
137 STATUS_MESSAGE, Constants.ViewEdit.VNF_CREATED_SUCCESSFULLY_TEXT,
140 openAndFillVnfPopup(NODE_INSTANCE, AAIAIC_25, TENANT,
141 FALSE, LEGACY_REGION, "ebc3bc3d-62fd-4a3f-a037-f619df4ff034", "platform", getCurrentUser().tenants, null, null, instanceName);
142 assertConfirmShowMissingDataErrorOnCurrentPopup(Constants.ViewEdit.LINE_OF_BUSINESS_TEXT);
143 successConfirmVnfAndClosePopup();
148 private void emptyLobAfterReopenCreateVnfDialog() throws Exception {
149 final String lobToSelect = "ECOMP";
151 ViewEditPage viewEditPage = new ViewEditPage();
152 viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE);
153 GeneralUIUtils.ultimateWait();
154 SelectOption.selectOptionsFromMultiselectById(Constants.OwningEntity.LOB_SELECT_TEST_ID, new ArrayList<>(Arrays.asList(lobToSelect)));
155 viewEditPage.clickCancelButtonByTestID();
156 viewEditPage.selectNodeInstanceToAdd(NODE_INSTANCE);
157 GeneralUIUtils.ultimateWait();
158 AssertUnselectedOptionInMultiselectById(Constants.OwningEntity.LOB_SELECT_TEST_ID, lobToSelect);
159 viewEditPage.clickCancelButtonByTestID();
162 @Test(dataProvider = "msoTestApiOptions")
163 private void testAddVolumeGroup(String msoTestApiOption, String msoTestApiValue) throws Exception {
164 withMsoTestApiConfiguration(msoTestApiOption, msoTestApiValue, () -> {
165 final String REQUEST_ID = "dbe54591-c8ed-46d3-abc7-d3a24873bdaa";
166 final String MODEL_UUID = "13f022c4-651e-4326-b8e1-61e9a8c7a7ad";
167 SimulatorApi.registerExpectation("aLacarteFlow/mso_create_volume_group.json", ImmutableMap.of(SERVICE_INSTANCE_ID, SERVICE_ID, "VNF_INSTANCE_ID", VNF_ID, "REQUEST_ID", REQUEST_ID, DEFAULT_TEST_API_VALUE, msoTestApiValue), SimulatorApi.RegistrationStrategy.APPEND);
168 SimulatorApi.registerExpectation(A_LACARTE_FLOW_GET_ORCHESTRATION,
169 ImmutableMap.of(ORCHESTRATION_REQUEST_ID, REQUEST_ID, STATUS_MESSAGE, Constants.ViewEdit.VOLUME_GROUP_CREATED_SUCCESSFULLY_TEXT,
170 REQUEST_TYPE, CREATE), SimulatorApi.RegistrationStrategy.APPEND);
171 GeneralUIUtils.ultimateWait();
173 ServiceModel serviceInstance = new ServicesService().getServiceModel(MODEL_UUID);
174 addVolumeGroup("Vsp1710pid298109Vmmsc..mmsc_mod6_eca_oam..module-3", AAIAIC_25, TENANT,
175 FALSE, LEGACY_REGION, getCurrentUser().tenants, serviceInstance);
179 private User getCurrentUser() {
180 return usersService.getUser(Constants.Users.MOBILITY_VMMSC);
183 private void goToInstance() {
184 SideMenu.navigateToSearchExistingPage();
185 goToExistingInstanceBySubscriber(SUBSCRIBER, SERVICE_NAME, SERVICE_ID);
190 protected UserCredentials getUserCredentials() {
191 User user = getCurrentUser();
192 return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.MOBILITY_VMMSC, "", "");
196 public static Object[][] msoTestApiOptions() {
197 return new Object[][]{
198 {"GR_API (new)", DEFAULT_TEST_API_VALUE}
199 , {"VNF_API (old)", "VNF_API"}
203 private void withMsoTestApiConfiguration(String msoTestApiOption, String msoTestApiValue, Runnable test) {
204 if (msoTestApiValue.equals(DEFAULT_TEST_API_VALUE)) {
208 selectMsoTestApiOption(msoTestApiOption);
212 selectMsoTestApiOption("GR_API (new)");