org.onap migration
[vid.git] / vid-automation / src / main / java / vid / automation / test / test / BrowseASDCTest.java
1 package vid.automation.test.test;
2
3 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
4 import org.testng.annotations.Test;
5 import vid.automation.test.Constants;
6 import vid.automation.test.infra.Click;
7 import vid.automation.test.model.*;
8 import vid.automation.test.sections.BrowseASDCPage;
9 import vid.automation.test.sections.SideMenu;
10 import vid.automation.test.sections.ViewEditPage;
11 import vid.automation.test.services.ServicesService;
12 import vid.automation.test.services.UsersService;
13
14 import java.io.IOException;
15
16 public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
17     private UsersService usersService = new UsersService();
18     private ServicesService servicesService = new ServicesService();
19
20     public BrowseASDCTest() throws IOException {
21     }
22
23     @Test
24     public void testPNFOnCreatePopup() throws Exception {
25         Service service = servicesService.getService("f39389e4-2a9c-4085-8ac3-04aea9c651be");
26         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
27         SideMenu.navigateToBrowseASDCPage();
28         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
29         assertThatServiceCreationDialogIsVisible();
30         validatePNFCreationDialog(service, "Mobility", "pnf");
31     }
32
33     private void validatePNFCreationDialog(Service service, String serviceType, String serviceRole) {
34         assertServiceMetadata(serviceType, Constants.SERVICE_TYPE);
35         assertServiceMetadata(serviceRole, Constants.SERVICE_ROLE);
36         validateServiceCreationDialog(service);
37     }
38
39     @Test
40     private void testPNFMacroInstantation() throws Exception {
41         User user = usersService.getUser(Constants.Users.MOBILITY_MOBILITY);
42         relogin(user.credentials);
43
44         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
45         SideMenu.navigateToBrowseASDCPage();
46         browseASDCPage.clickDeployServiceButtonByServiceUUID("f39389e4-2a9c-4085-8ac3-04aea9c651be");
47         assertThatServiceCreationDialogIsVisible();
48         assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
49         browseASDCPage.selectSubscriberById("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
50         browseASDCPage.selectProductFamily("ebc3bc3d-62fd-4a3f-a037-f619df4ff034");
51         GeneralUIUtils.ultimateWait();
52
53         browseASDCPage.selectServiceTypeByName("Mobility");
54         GeneralUIUtils.ultimateWait();
55         browseASDCPage.selectLcpRegion("mtn16");
56
57         browseASDCPage.selectTenant("a259ae7b7c3f493cb3d91f95a7c18149");
58         assertAllIsPermitted(Constants.BrowseASDC.AIC_OPTION_CLASS);
59         browseASDCPage.selectAicZone("NFT1");
60
61         Click.onFirstSelectOptionById(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
62         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
63
64         browseASDCPage.clickConfirmButton();
65
66         assertSuccessfulServiceInstanceCreation();
67
68         browseASDCPage.clickCloseButton();
69
70         ViewEditPage viewEditPage = new ViewEditPage();
71         viewEditPage.clickActivateButton();
72     }
73
74     @Test
75     private void testServiceInstantation() throws Exception {
76         User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
77         relogin(user.credentials);
78
79         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
80         SideMenu.navigateToBrowseASDCPage();
81
82         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
83
84         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
85         validateServiceCreationDialog(service);
86
87         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
88
89         assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
90         browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
91
92         String serviceType = "VIRTUAL USP";
93         GeneralUIUtils.findAndWaitByText(serviceType, 30);
94
95         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
96         browseASDCPage.selectServiceTypeByName(serviceType);
97
98         Click.onFirstSelectOptionById(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
99         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
100
101         browseASDCPage.selectSuppressRollback("false");
102
103         browseASDCPage.clickConfirmButton();
104
105         assertSuccessfulServiceInstanceCreation();
106
107         browseASDCPage.clickCloseButton();
108         GeneralUIUtils.ultimateWait();
109
110         addVNF("VID-PCRF-05-15-17 0", "AAIAIC25", "092eb9e8e4b7412e8787dd091bc58e86",
111                 "false", "some legacy region", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", user.tenants);
112         addVolumeGroup("VidPcrf051517..pcrf_nimbus_pcm..module-4", "AAIAIC25",
113                 "092eb9e8e4b7412e8787dd091bc58e86", "false", "some legacy region", user.tenants);
114         addVFModule("VidPcrf051517..pcrf_nimbus_psm..module-1", "AAIAIC25",
115                 "092eb9e8e4b7412e8787dd091bc58e86", "false", "some legacy region", user.tenants);
116     }
117
118     @Test
119     private void testCategoryParamsDropdownsExistsInCreationDialog() throws Exception {
120         User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
121         relogin(user.credentials);
122
123         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
124         SideMenu.navigateToBrowseASDCPage();
125
126         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
127
128         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
129         assertThatServiceCreationDialogIsVisible();
130
131         GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
132         GeneralUIUtils.clickOnElementByTestId(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
133     }
134
135     @Test
136     private void testOwningEntityRequiredAndProjectOptional() throws Exception {
137         User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
138         relogin(user.credentials);
139
140         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
141         SideMenu.navigateToBrowseASDCPage();
142
143         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
144
145         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
146         validateServiceCreationDialog(service);
147
148         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
149
150         assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
151         browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
152
153         String serviceType = "VIRTUAL USP";
154         GeneralUIUtils.findAndWaitByText(serviceType, 30);
155
156         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
157         browseASDCPage.selectServiceTypeByName(serviceType);
158
159         browseASDCPage.clickConfirmButton();
160
161         GeneralUIUtils.findAndWaitByText("Missing data", 5);
162
163         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
164
165         browseASDCPage.clickConfirmButton();
166         assertSuccessfulServiceInstanceCreation();
167     }
168
169     @Test
170     protected void testLineOfBusinessOptionalAndPlatformRequired() throws Exception {
171
172         User user = usersService.getUser(Constants.Users.USP_VOICE_VIRTUAL_USP);
173         relogin(user.credentials);
174
175         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
176         SideMenu.navigateToBrowseASDCPage();
177
178         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
179
180         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
181         validateServiceCreationDialog(service);
182
183         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
184
185         assertDropdownPermittedItemsByValue(user.subscribers, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
186         browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
187
188         String serviceType = "VIRTUAL USP";
189         GeneralUIUtils.findAndWaitByText(serviceType, 30);
190
191         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
192         browseASDCPage.selectServiceTypeByName(serviceType);
193
194         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
195
196         browseASDCPage.clickConfirmButton();
197         assertSuccessfulServiceInstanceCreation();
198
199         browseASDCPage.clickCloseButton();
200         GeneralUIUtils.ultimateWait();
201
202         //now add the VNF
203         ViewEditPage viewEditPage = new ViewEditPage();
204
205         viewEditPage.selectNodeInstanceToAdd("VID-PCRF-05-15-17 0");
206         viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
207         viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
208         viewEditPage.selectLCPRegion("AAIAIC25");
209         viewEditPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86");
210         viewEditPage.setLegacyRegion("llkjhlkjhlkjh");
211
212         browseASDCPage.clickConfirmButton();
213
214         GeneralUIUtils.findAndWaitByText("Missing data", 5);
215
216         Click.onFirstSelectOptionById(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);
217
218         viewEditPage.clickConfirmButton();
219         assertSuccessfulVNFCreation();
220     }
221 }