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