1 package vid.automation.test.test;
3 import org.junit.Assert;
4 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
5 import org.openqa.selenium.WebElement;
6 import org.testng.annotations.Test;
7 import vid.automation.test.Constants;
8 import vid.automation.test.infra.Wait;
9 import vid.automation.test.sections.PnfSearchAssociationPage;
10 import vid.automation.test.sections.VidBasePage;
11 import vid.automation.test.sections.ViewEditPage;
12 import vid.automation.test.services.BulkRegistration;
13 import vid.automation.test.services.SimulatorApi;
15 public class AssociatePnfTest extends VidBaseTestCase {
17 private VidBasePage vidBasePage = new VidBasePage();
18 private ViewEditPage viewEditPage = new ViewEditPage();
19 private PnfSearchAssociationPage pnfSearchAssociationPage = new PnfSearchAssociationPage();
20 private String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
21 private String pnfInstanceName = "MX_960-F722";
22 private String pnfModelName = "pnf 0";
25 public void testAssociatePnf() throws Exception {
26 SimulatorApi.clearAll();
27 BulkRegistration.searchExistingServiceInstance();
28 BulkRegistration.associatePnf();
30 goToExistingInstanceById(serviceInstanceId);//vid-test-444
31 addPNF(pnfModelName);//vid-test-444
32 searchPNF(pnfInstanceName);
33 testResultSearchPNF();
35 vidBasePage.assertMsoRequestModal(Constants.ViewEdit.MSO_SUCCESSFULLY_TEXT);
36 vidBasePage.clickCloseButton();
40 public void testRainyAssociatePnf() throws Exception {
41 SimulatorApi.clearAll();
42 BulkRegistration.searchExistingServiceInstance();
43 BulkRegistration.associatePnfError();
45 goToExistingInstanceById(serviceInstanceId);
47 searchPNF(pnfInstanceName);
49 vidBasePage.assertMsoRequestModal("Error");
50 vidBasePage.clickCloseButton();
53 public void testRainyChoosePnf() throws Exception {
54 SimulatorApi.clearAll();
55 BulkRegistration.searchExistingServiceInstance();
56 BulkRegistration.associatePnfError();
58 goToExistingInstanceById(serviceInstanceId);
59 String pnfName= "pnf 1";
60 GeneralUIUtils.clickOnElementByTestId(Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID, 60);
61 String message = String.format(Constants.ViewEdit.OPTION_IN_DROPDOWN_NOT_EXISTS,
62 Constants.ViewEdit.ADD_VNF_BUTTON_TEST_ID,"Add network instance");
63 boolean waitForElementResult = Wait.waitByTestId(Constants.ViewEdit.VNF_OPTION_TEST_ID_PREFIX + pnfName, 60);
64 Assert.assertTrue(message, !waitForElementResult);
67 public void testRainySearchPnfInstance() throws Exception {
68 SimulatorApi.clearAll();
69 BulkRegistration.searchExistingServiceInstance();
70 BulkRegistration.associatePnfError();
72 goToExistingInstanceById(serviceInstanceId);
75 Wait.angularHttpRequestsLoaded();
76 WebElement errorMessageWebElement = GeneralUIUtils.getWebElementByTestID(Constants.PnfAssociation.NOT_FOUND_ERROR_TEST_ID, 60);
77 Assert.assertEquals("not found PNF instance, error message not equals the expected message","The specified PNF instance AAAAA does not exist in A&AI.\n" +
78 "Please note: A&AI is case sensitive",errorMessageWebElement.getText());
79 Assert.assertTrue(Constants.PnfAssociation.NOT_FOUND_ERROR_MESSAGE, errorMessageWebElement!=null);
80 assertAssociateButtonState(false);
83 private void assertAssociateButtonState(boolean shouldBeEnabled) {
84 WebElement associateWebElement = GeneralUIUtils.getWebElementByTestID(Constants.PnfAssociation.ASSOCIATE_PNF_TEST_ID, 60);
85 boolean enabledAssociate=associateWebElement.isEnabled();
88 Assert.assertTrue(Constants.PnfAssociation.PNF_ENABLE_ASSOCIATE_ERROR_MESSAGE, enabledAssociate);
90 Assert.assertTrue(Constants.PnfAssociation.PNF_DISABLE_ASSOCIATE_ERROR_MESSAGE, !enabledAssociate);
92 GeneralUIUtils.ultimateWait();
94 private void associatePNF() throws InterruptedException {
95 pnfSearchAssociationPage.clickAssociateButton();
98 private void addPNF(String name){
99 viewEditPage.selectNodeInstanceToAdd(name);
100 checkServiceModelInfo();
101 assertAssociateButtonState(false);
104 private void searchPNF(String name){
105 pnfSearchAssociationPage.setPnfName(name);
106 pnfSearchAssociationPage.clickSearchButton();
109 private void testResultSearchPNF(){
110 checkPnfProperties();
111 Wait.angularHttpRequestsLoaded();
112 assertAssociateButtonState(true);
114 private void checkServiceModelInfo() {
115 Wait.angularHttpRequestsLoaded();
117 String elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.SERVIICE_NAME_KEY;
118 String infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
119 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"Demo Service 1");
121 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.MODEL_NAME;
122 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
123 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"Test Pnf");
124 //service instance name
125 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.SERVICE_INSTANCE_NAME;
126 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
127 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"vid-test-444");
128 //Model Invariant UUID
129 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.MODEL_INVARIANT_UUID;
130 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
131 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"61eba322-c758-48f6-8942-1a7625aaaffb");
132 //ubscriber NameModel Invariant UUID
133 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.SUBSCRIBER_NAME_KEY;
134 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
135 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"USP VOICE");
137 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.MODEL_VERSION;
138 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
139 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"0.1");
141 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.MODEL_UUID;
142 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
143 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"089b1c03-ff6b-4914-8c20-a7de3d375e8d");
144 //Model Customization UUID
145 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.MODEL_CUSTOMIZATION_UUID;
146 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
147 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,"cabf6d26-c362-4444-ba06-f850e8af2d35");
149 elementTestId = Constants.ServiceModelInfo.INFO_TEST_ID_PREFIX + Constants.ServiceModelInfo.RESOURCE_NAME;
150 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
151 Assert.assertEquals(String.format(Constants.ServiceModelInfo.METADETA_ERROR_MESSAGE,elementTestId),infoItemText,pnfModelName);
154 private void checkPnfProperties() {
155 //Pnf Instance unique name
156 String elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME_TEST_ID;
157 String infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
158 Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,pnfInstanceName);
160 elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME2_TEST_ID;
161 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
162 Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-name-2");
163 //Pnf Instance name2 source
164 elementTestId = Constants.PnfAssociation.PNF_INSTANCE_NAME2_SOURCE_TEST_ID;
165 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
166 Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-name-2-source");
168 elementTestId = Constants.PnfAssociation.PNF_INSTANCE_ID_TEST_ID;
169 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
170 Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"MX_960-F722-id");
171 //Pnf Instance Equipment type
172 elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_TYPE_TEST_ID;
173 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
174 Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"Switch");
175 //Pnf Instance Equipment vendor
176 elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_VENDOR_TEST_ID;
177 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
178 Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"Cisco");
179 //Pnf Instance Equipment model
180 elementTestId = Constants.PnfAssociation.PNF_INSTANCE_EQUIP_MODEL_TEST_ID;
181 infoItemText = GeneralUIUtils.getWebElementByTestID(elementTestId, 60).getText();
182 Assert.assertEquals(String.format(Constants.PnfAssociation.PNF_INSTANCE_ERROR_MESSAGE,elementTestId),infoItemText,"ASR1002-X");