identify macro services without instantiation type in BE by feature flag
[vid.git] / vid-automation / src / main / java / vid / automation / test / test / BrowseASDCTest.java
1 package vid.automation.test.test;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.testng.Assert.assertEquals;
5 import static org.testng.Assert.assertFalse;
6 import static vid.automation.test.infra.Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI;
7 import static vid.automation.test.infra.Features.FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI;
8 import static vid.automation.test.infra.Features.FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND;
9 import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI;
10 import static vid.automation.test.infra.Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION;
11 import static vid.automation.test.infra.Features.FLAG_SHOW_ORCHESTRATION_TYPE;
12 import static vid.automation.test.infra.ModelInfo.aLaCarteForBrowseSdc;
13 import static vid.automation.test.infra.ModelInfo.aLaCarteServiceCreationTest;
14 import static vid.automation.test.infra.ModelInfo.instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID;
15 import static vid.automation.test.infra.ModelInfo.macroForBrowseSdc;
16
17 import com.google.common.collect.ImmutableList;
18 import java.util.List;
19 import org.apache.logging.log4j.LogManager;
20 import org.apache.logging.log4j.Logger;
21 import org.hamcrest.Matchers;
22 import org.jetbrains.annotations.NotNull;
23 import org.onap.sdc.ci.tests.datatypes.UserCredentials;
24 import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
25 import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
26 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet;
27 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
28 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceDesignAndCreationPut;
29 import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet;
30 import org.openqa.selenium.By;
31 import org.openqa.selenium.WebElement;
32 import org.testng.Assert;
33 import org.testng.SkipException;
34 import org.testng.annotations.BeforeClass;
35 import org.testng.annotations.BeforeMethod;
36 import org.testng.annotations.DataProvider;
37 import org.testng.annotations.Test;
38 import vid.automation.test.Constants;
39 import vid.automation.test.infra.Click;
40 import vid.automation.test.infra.Exists;
41 import vid.automation.test.infra.FeatureTogglingTest;
42 import vid.automation.test.infra.Get;
43 import vid.automation.test.infra.ModelInfo;
44 import vid.automation.test.infra.SelectOption;
45 import vid.automation.test.model.Service;
46 import vid.automation.test.model.User;
47 import vid.automation.test.sections.BrowseASDCPage;
48 import vid.automation.test.sections.SideMenu;
49 import vid.automation.test.sections.ViewEditPage;
50 import vid.automation.test.sections.deploy.DeployDialogBase;
51 import vid.automation.test.sections.deploy.DeployModernUIALaCarteDialog;
52 import vid.automation.test.sections.deploy.DeployModernUIMacroDialog;
53 import vid.automation.test.sections.deploy.DeployOldALaCarteDialog;
54 import vid.automation.test.sections.deploy.DeployOldMacroDialog;
55 import vid.automation.test.services.ServicesService;
56 import vid.automation.test.services.SimulatorApi;
57
58
59 public class BrowseASDCTest extends CreateInstanceDialogBaseTest {
60     private final String invariantUUIDAlacarte = aLaCarteForBrowseSdc.modelInvariantId;
61     private final String invariantUUIDMacro = macroForBrowseSdc.modelInvariantId;
62     public static final String modelInvariantUUID1 = "aeababbc-010b-4a60-8df7-e64c07389466";
63     public static final String modelInvariantUUID2 = "aa2f8e9c-9e47-4b15-a95c-4a9385599abc";
64     public static final String modelInvariantUUID3 = "d849c57d-b6fe-4843-8349-4ab8bbb08d71";
65     public static final String modelUuid = "a8dcd72d-d44d-44f2-aa85-53aa9ca99cba";
66
67     private ServicesService servicesService = new ServicesService();
68
69     private final Logger logger = LogManager.getLogger(BrowseASDCTest.class);
70
71     @BeforeClass
72     public void beforeClass() {
73         resetGetServicesCache();
74     }
75
76     @BeforeMethod
77     public void resetSdcModelCaches() {
78         invalidateSdcModelsCache();
79     }
80
81     @Override
82     protected UserCredentials getUserCredentials() {
83         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
84         return new UserCredentials(user.credentials.userId, user.credentials.password, Constants.Users.EMANUEL_EMANUEL, "", "");
85     }
86
87     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
88     public void testPNFOnCreatePopup() {
89         Service service = servicesService.getService("f39389e4-2a9c-4085-8ac3-04aea9c651be");
90         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
91         SideMenu.navigateToBrowseASDCPage();
92         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
93         assertThatServiceCreationDialogIsVisible();
94         validatePNFCreationDialog(service, "Emanuel", "pnf");
95     }
96
97     private void validatePNFCreationDialog(Service service, String serviceType, String serviceRole) {
98         assertServiceMetadata(serviceType, Constants.SERVICE_TYPE);
99         assertServiceMetadata(serviceRole, Constants.SERVICE_ROLE);
100         validateServiceCreationDialog(service);
101     }
102
103
104
105     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
106     private void testPNFMacroInstantation() throws Exception {
107         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
108         relogin(user.credentials);
109
110         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
111         SideMenu.navigateToBrowseASDCPage();
112         browseASDCPage.clickDeployServiceButtonByServiceUUID("f39389e4-2a9c-4085-8ac3-04aea9c651be");
113         assertThatServiceCreationDialogIsVisible();
114         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
115         browseASDCPage.selectSubscriberById("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
116         browseASDCPage.selectProductFamily("ebc3bc3d-62fd-4a3f-a037-f619df4ff034");
117         GeneralUIUtils.ultimateWait();
118
119         browseASDCPage.selectServiceTypeByName("Emanuel");
120         GeneralUIUtils.ultimateWait();
121         browseASDCPage.selectLcpRegion("hvf16");
122
123         browseASDCPage.selectTenant("a259ae7b7c3f493cb3d91f95a7c18149");
124         assertAllIsPermitted(Constants.BrowseASDC.AIC_OPTION_CLASS);
125         browseASDCPage.selectAicZone("NFT1");
126
127         Click.onFirstSelectOptionById(Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
128         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
129
130         browseASDCPage.clickConfirmButton();
131
132         assertSuccessfulServiceInstanceCreation();
133
134         browseASDCPage.clickCloseButton();
135
136         ViewEditPage viewEditPage = new ViewEditPage();
137         viewEditPage.clickActivateButton();
138     }
139
140     @Test
141     private void browseServiceModel_deployServiceALaCarteByBackendInput_creationPopupIsALaCarte()  {
142         // model uuid should be of macro
143         deployServiceAndAssertInstantiationType(
144                 "csar15782222_instantiationTypeAlacarte_invariantUUIDMacro.zip",
145                 invariantUUIDMacro,
146             getAlacarteDialogByFlagValue()
147         );
148     }
149
150     @NotNull
151     public static DeployDialogBase getAlacarteDialogByFlagValue() {
152         return FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() ?
153             new DeployModernUIALaCarteDialog() :
154             new DeployOldALaCarteDialog();
155     }
156
157     @Test
158     @FeatureTogglingTest(FLAG_5G_IN_NEW_INSTANTIATION_UI)
159     private void browseServiceModel_deployServiceALaCarteByBackendInputHintNewUI_creationPopupIsAngular2()  {
160         deployServiceAndAssertInstantiationType(
161                 instantiationTypeAlacarte_vidNotionsInstantiationUIByUUID,
162                 new DeployModernUIALaCarteDialog()
163         );
164     }
165
166     @Test
167     private void browseServiceModel_deployServiceALaCarteBecauseNotOnMACRO_SERVICESConfig_creationPopupIsALaCarte()  {
168         deployServiceAndAssertInstantiationType(
169                 "csar15782222_instantiationTypeEmpty_invariantUUIDAlacarte.zip",
170                 invariantUUIDAlacarte,
171             getAlacarteDialogByFlagValue()
172         );
173     }
174
175     @Test
176     private void browseServiceModel_deployServiceMacroByBackendInput_creationPopupIsMacro()  {
177         deployServiceAndAssertInstantiationType(
178             ModelInfo.serviceWithInstantiationTypeMacro,
179             new DeployModernUIMacroDialog()
180         );
181     }
182
183     @Test
184     private void browseServiceModel_deployServiceMacroByMACRO_SERVICESConfig_creationPopupIsOldMacro()  {
185         if (FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI.isActive() &&
186         ! FLAG_2002_IDENTIFY_INVARIANT_MACRO_UUID_BY_BACKEND.isActive()) {
187             throw new SkipException("some 2002 flags shall come along together");
188         }
189         deployServiceAndAssertInstantiationType(
190                 "csar15782222_invariantUUIDMacro.zip",
191                 invariantUUIDMacro,
192                 new DeployOldMacroDialog()
193         );
194     }
195
196     @Test
197     private void browseServiceModel_deployServiceMacroWithPnf_creationPopupIsOldMacro() {
198         deployServiceAndAssertInstantiationType(
199                 "csar15782222_instantiationTypeMacroWithPnf.zip",
200                 invariantUUIDMacro,
201             new DeployOldMacroDialog()
202         );
203     }
204
205     @Test
206     public void browseServiceModel_deployServiceMacroWithCR_creationPopupIsOldMacro()  {
207         deployServiceAndAssertInstantiationType(
208             ModelInfo.collectionResourceService,
209                 FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI.isActive() ?
210                     new DeployModernUIMacroDialog() :
211                     new DeployOldMacroDialog()
212         );
213     }
214
215     @Test
216     private void browseServiceModel_deployServiceMacroWithNetwork_creationPopupIsMacroByFF()  {
217         deployServiceAndAssertInstantiationType(
218                 "csar15782222_instantiationTypeMacroWithNetwork.zip",
219                 invariantUUIDMacro,
220                 FLAG_NETWORK_TO_ASYNC_INSTANTIATION.isActive() ?
221                 new DeployModernUIMacroDialog() :
222                 new DeployOldMacroDialog()
223         );
224     }
225
226
227     private void deployServiceAndAssertInstantiationType(String modelZipFileName, String modelInvariantId, DeployDialogBase deployDialog)  {
228         deployServiceAndAssertInstantiationType(new ModelInfo("4d71990b-d8ad-4510-ac61-496288d9078e", modelInvariantId, modelZipFileName), deployDialog);
229     }
230
231     private void deployServiceAndAssertInstantiationType(ModelInfo modelInfo, DeployDialogBase deployDialog)  {
232
233         registerExpectationForLegacyServiceDeployment(modelInfo, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
234         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
235         relogin(user.credentials);
236
237         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
238         SideMenu.navigateToBrowseASDCPage();
239
240         GeneralUIUtils.ultimateWait();
241         browseASDCPage.clickDeployServiceButtonByServiceUUID(modelInfo.modelVersionId);
242
243         deployDialog.waitForDialogAssertAndClose();
244     }
245
246     @FeatureTogglingTest(value = FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI, flagActive = false)
247     @Test
248     private void testServiceInstantiationAlaCarte()  {
249         User user = usersService.getUser(Constants.Users.EMANUEL_EMANUEL);
250         relogin(user.credentials);
251
252         registerExpectationForLegacyServiceDeployment(aLaCarteServiceCreationTest, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
253
254         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
255         SideMenu.navigateToBrowseASDCPage();
256
257         Service service = new Service(
258                 "pnf",
259                 aLaCarteServiceCreationTest.modelVersionId,
260                 aLaCarteServiceCreationTest.modelInvariantId,
261                 "action-data",
262                 "1.0",
263                 "Network L1-3",
264                 "PASQUALE vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
265                 null);
266
267
268         logger.info("Expected service model properties: "+service.toString());
269         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
270         validateServiceCreationDialog(service);
271
272         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
273
274         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
275         browseASDCPage.selectSubscriberById("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
276
277         String serviceType = "Emanuel";
278         GeneralUIUtils.findAndWaitByText(serviceType, 30);
279
280         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
281         browseASDCPage.selectServiceTypeByName(serviceType);
282
283         SelectOption.byTestIdAndVisibleText("yyy1", Constants.OwningEntity.PROJECT_SELECT_TEST_ID);
284         SelectOption.byTestIdAndVisibleText("aaa1", Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
285
286         browseASDCPage.selectSuppressRollback("false");
287
288         browseASDCPage.clickConfirmButton();
289
290         assertSuccessfulServiceInstanceCreation();
291     }
292
293     private static final String serviceName = "CONTRAIL30_L2NODHCP";
294     private static final String modelInvariantId = "5b607929-6088-4614-97ef-cac817508e0e";
295     private static final String serviceUuid = "797a6c41-0f80-4d35-a288-3920c4e06baa";
296
297
298     @DataProvider
299     public static Object[][] filterTexts() {
300         return new Object[][]{{serviceName},{modelInvariantId},{serviceUuid}};
301     }
302
303     @Test(dataProvider = "filterTexts")
304     public void testFilterOptionsInBrowseSdc(String filterText){
305         BrowseASDCPage browseAsdcPage = registerSimulatorAndGoToBrowseSDC();
306         GeneralUIUtils.ultimateWait();
307         assertThat(browseAsdcPage.countCurrentRowsInTable(),(Matchers.greaterThan(1)));
308         browseAsdcPage.fillFilterText(filterText);
309         Assert.assertEquals(browseAsdcPage.countCurrentRowsInTable(),1);
310         Assert.assertTrue(Exists.byTestId("deploy-" + serviceUuid));
311         browseAsdcPage.fillFilterText("");
312
313     }
314
315     @Test
316     private void testCategoryParamsDropdownsExistsInCreationDialog() throws Exception {
317         BrowseASDCPage browseASDCPage = registerSimulatorAndGoToBrowseSDC();
318         Service service = servicesService.getService("2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd");
319         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
320         DeployModernUIMacroDialog deployMacroDialog = new DeployModernUIMacroDialog();
321         deployMacroDialog.waitForDialogToLoad();
322         deployMacroDialog.assertDialog();
323         deployMacroDialog.clickProjectSelect();
324         deployMacroDialog.clickOwningEntitySelect();
325     }
326
327     private BrowseASDCPage registerSimulatorAndGoToBrowseSDC() {
328         SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET,
329                 "ecompportal_getSessionSlotCheckInterval.json",
330                 "browseASDC/aai_get_services.json",
331                 "browseASDC/get_sdc_catalog_services_2f80c596.json"
332         );
333         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
334                     new PresetAAIGetSubscribersGet(),
335                     new PresetAAIServiceDesignAndCreationPut()
336                 ),
337                 SimulatorApi.RegistrationStrategy.APPEND);
338         SideMenu.navigateToBrowseASDCPage();
339         return new BrowseASDCPage();
340     }
341
342     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
343     private void testOwningEntityRequiredAndProjectOptional() throws Exception {
344         User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
345         relogin(user.credentials);
346
347         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
348         SideMenu.navigateToBrowseASDCPage();
349
350         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
351
352         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
353         validateServiceCreationDialog(service);
354
355         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
356
357         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
358         browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
359
360         String serviceType = "TYLER SILVIA";
361         GeneralUIUtils.findAndWaitByText(serviceType, 30);
362
363         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
364         browseASDCPage.selectServiceTypeByName(serviceType);
365
366         browseASDCPage.clickConfirmButton();
367
368         GeneralUIUtils.findAndWaitByText("Missing data", 5);
369
370         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
371
372         browseASDCPage.clickConfirmButton();
373         assertSuccessfulServiceInstanceCreation();
374     }
375
376     //@Test(groups = {"shouldBeMigratedToWorkWithSimulator"})
377     protected void testLineOfBusinessOptionalAndPlatformRequired() throws Exception {
378
379         User user = usersService.getUser(Constants.Users.SILVIA_ROBBINS_TYLER_SILVIA);
380         relogin(user.credentials);
381
382         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
383         SideMenu.navigateToBrowseASDCPage();
384
385         Service service = servicesService.getService("c079d859-4d81-4add-a9c3-94551f96e2b0");
386
387         browseASDCPage.clickDeployServiceButtonByServiceUUID(service.uuid);
388         validateServiceCreationDialog(service);
389
390         browseASDCPage.setInstanceName(browseASDCPage.generateInstanceName());
391
392         assertDropdownPermittedItemsByLabel(user.subscriberNames, Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
393         browseASDCPage.selectSubscriberById("e433710f-9217-458d-a79d-1c7aff376d89");
394
395         String serviceType = "TYLER SILVIA";
396         GeneralUIUtils.findAndWaitByText(serviceType, 30);
397
398         assertDropdownPermittedItemsByValue(user.serviceTypes, Constants.CreateNewInstance.SERVICE_TYPE_OPTION_CLASS);
399         browseASDCPage.selectServiceTypeByName(serviceType);
400
401         Click.onFirstSelectOptionById(Constants.OwningEntity.OWNING_ENTITY_SELECT_TEST_ID);
402
403         browseASDCPage.clickConfirmButton();
404         assertSuccessfulServiceInstanceCreation();
405
406         browseASDCPage.clickCloseButton();
407         GeneralUIUtils.ultimateWait();
408
409         //now add the VNF
410         ViewEditPage viewEditPage = new ViewEditPage();
411
412         viewEditPage.selectNodeInstanceToAdd("VID-RODERICK-05-15-17 0");
413         viewEditPage.generateAndSetInstanceName(Constants.ViewEdit.VNF_INSTANCE_NAME_PREFIX);
414         viewEditPage.selectProductFamily("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
415         viewEditPage.selectLcpRegion("AAIAIC25", "AIC");
416         viewEditPage.selectTenant("092eb9e8e4b7412e8787dd091bc58e86");
417         viewEditPage.setLegacyRegion("llkjhlkjhlkjh");
418
419         browseASDCPage.clickConfirmButton();
420
421         GeneralUIUtils.findAndWaitByText("Missing data", 5);
422
423         Click.onFirstSelectOptionById(Constants.OwningEntity.PLATFORM_SELECT_TEST_ID);
424
425         viewEditPage.clickConfirmButton();
426         assertSuccessfulVNFCreation();
427     }
428
429     private void prepareSimulatorWithServiceModelListBeforeBrowseASDCService(){
430         SimulatorApi.clearAll();
431
432         ImmutableList<BasePreset> presets = ImmutableList.of(
433                 new PresetGetSessionSlotCheckIntervalGet(),
434                 new PresetAAIGetSubscribersGet(),
435                 new PresetAAIServiceDesignAndCreationPut(),
436                 new PresetAAIGetServicesGet());
437
438         SimulatorApi.registerExpectationFromPresets(presets, SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
439     }
440
441     @Test
442     private void browseSDCServiceModelListCheckAAIResponse(){
443         prepareSimulatorWithServiceModelListBeforeBrowseASDCService();
444         SideMenu.navigateToBrowseASDCPage();
445         BrowseASDCPage browseASDCPage = new BrowseASDCPage();
446         browseASDCPage.fillFilterText("CheckAAIResponse");
447         GeneralUIUtils.ultimateWait();
448
449         WebElement sdcTableElement = Get.byId("sdcModelsTable");
450         List<WebElement> sdcModelList = sdcTableElement.findElements(By.className("sdcServiceModel"));
451
452         WebElement sdcFirstModel = sdcModelList.get(0);
453         WebElement sdcSecondModel = sdcModelList.get(1);
454         WebElement sdcThirdModel = sdcModelList.get(2);
455
456         //Check uuid
457         By uuid = By.className("uuid");
458         assertEquals(modelUuid, sdcFirstModel.findElement(uuid).getText());
459         assertEquals("1dae721c-a1ef-435f-b811-760c23f467bf" , sdcSecondModel.findElement(uuid).getText());
460         assertEquals("29236d45-e790-4c17-a115-1533cc09b7b1" , sdcThirdModel.findElement(uuid).getText());
461
462         //Check invariantUUID
463         By invariantUUID = By.className("invariantUUID");
464         assertEquals(modelInvariantUUID1, sdcFirstModel.findElement(invariantUUID).getText());
465         assertEquals(modelInvariantUUID2, sdcSecondModel.findElement(invariantUUID).getText());
466         assertEquals(modelInvariantUUID3, sdcThirdModel.findElement(invariantUUID).getText());
467
468         //Check Names
469         By name = By.className("name");
470         assertEquals("CheckAAIResponse_AAAvIRC_mm779p_Service" , sdcFirstModel.findElement(name).getText());
471         assertEquals("CheckAAIResponse_BBBvIRC_mm779p_Service" , sdcSecondModel.findElement(name).getText());
472         assertEquals("CheckAAIResponse_CCCvIRC_mm779p_Service" , sdcThirdModel.findElement(name).getText());
473
474         //Check distribution Status
475         By distributionStatus = By.className("distributionStatus");
476         assertEquals("DISTRIBUTION_COMPLETE_OK" , sdcFirstModel.findElement(distributionStatus).getText());
477         assertEquals("", sdcSecondModel.findElement(distributionStatus).getText());
478         assertEquals("DISTRIBUTION_COMPLETE_ERROR" , sdcThirdModel.findElement(distributionStatus).getText());
479
480         //Check another fields
481         assertEquals("service" , sdcFirstModel.findElement(By.className("category")).getText());
482         assertEquals("1.0" , sdcFirstModel.findElement(By.className("version")).getText());
483     }
484
485     @Test
486     public void browseSdcModel_getEmptyList_noModelsMessageIsShown() {
487         resetGetServicesCache();
488         SimulatorApi.clearAll();
489         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
490                 new PresetAAIServiceDesignAndCreationPut(true),
491                 new PresetAAIGetSubscribersGet()), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
492         SideMenu.navigateToBrowseASDCPage();
493         GeneralUIUtils.ultimateWait();
494         WebElement serviceModelsTbody = Get.byXpath("//table[@data-tests-id='serviceModelsTable']/tbody");
495         assertFalse(Exists.tagNameInAnotherElement(serviceModelsTbody, "tr"), "Table should be empty on empty results");
496         resetGetServicesCache();
497     }
498
499     private static final String[] macroModelsIds = {
500             "f1bde010-cc5f-4765-941f-75f15b24f9fc",
501             "lmoser410-connector-model-version-id",
502             "ipe-resource-id-ps-02",
503             "797a6c41-0f80-4d35-a288-3920c4e06baa",
504     };
505     private static final String[] alacarteModelsIds = {
506             "0903e1c0-8e03-4936-b5c2-260653b96413",
507             "666a06ee-4b57-46df-bacf-908da8f10c3f",
508             "20c4431c-246d-11e7-93ae-92361f002671",
509     };
510
511     @DataProvider
512     public static Object[][] filterOrchestrationType() {
513         return new Object[][]{{"a la carte", 3, alacarteModelsIds},{"macro", 4, macroModelsIds}};
514     }
515
516     @Test(dataProvider = "filterOrchestrationType")
517     @FeatureTogglingTest(FLAG_SHOW_ORCHESTRATION_TYPE)
518     public void browseSdcModel_filterModelsWithOrchestrationType_alacarte(
519             String orchestrationType,int numberOfOccurrence, String[] expectedModelsIds) {
520         resetGetServicesCache();
521         SimulatorApi.clearAll();
522         BrowseASDCPage browseAsdcPage = registerSimulatorAndGoToBrowseSDC();
523         GeneralUIUtils.ultimateWait();
524         assertThat(browseAsdcPage.countCurrentRowsInTable(),(Matchers.greaterThan(numberOfOccurrence)));
525         browseAsdcPage.fillFilterText(orchestrationType);
526         Assert.assertEquals(browseAsdcPage.countCurrentRowsInTable(),numberOfOccurrence);
527         for(String id : expectedModelsIds) {
528             Assert.assertTrue(browseAsdcPage.isModelWithGivenServiceUUIDVisible(id));
529         }
530         browseAsdcPage.fillFilterText("");
531     }
532
533 }