summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-automation/pom.xml2
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java1
-rw-r--r--vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java62
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java2
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java73
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json110
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateBulkOfMacro__template_info.json45
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts62
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json80
9 files changed, 385 insertions, 52 deletions
diff --git a/vid-automation/pom.xml b/vid-automation/pom.xml
index 697e1a910..16a756c3d 100644
--- a/vid-automation/pom.xml
+++ b/vid-automation/pom.xml
@@ -11,7 +11,7 @@
<jackson.version>2.9.9</jackson.version>
<jackson.databind.version>2.9.9.3</jackson.databind.version>
<aspectj.version>1.8.10</aspectj.version>
- <selenium.version>3.6.0</selenium.version>
+ <selenium.version>3.141.59</selenium.version>
<log4j.version>2.12.0</log4j.version>
<apachehttp.version>4.4.1</apachehttp.version>
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java
index bded65be8..97938c741 100644
--- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/EcompPortalUtilities.java
@@ -9,7 +9,6 @@ public class EcompPortalUtilities {
WebElement appImage = GeneralUIUtils.getClickableButtonBy(by, 3 * 60);
appImage.click();
GeneralUIUtils.getDriver().switchTo().frame(1);
- GeneralUIUtils.waitForBackLoader();
GeneralUIUtils.waitForAngular();
GeneralUIUtils.getWebElementByClassName("applicationWindow");
}
diff --git a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java
index e834c15ac..c2c93e734 100644
--- a/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java
+++ b/vid-automation/src/main/java/org/onap/sdc/ci/tests/utilities/GeneralUIUtils.java
@@ -21,33 +21,45 @@
package org.onap.sdc.ci.tests.utilities;
//import com.automation.common.report_portal_integration.annotations.Step;
+
+import static org.hamcrest.Matchers.is;
+
import com.aventstack.extentreports.Status;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum;
import org.onap.sdc.ci.tests.datatypes.DataTestIdEnum.DashboardCardEnum;
import org.onap.sdc.ci.tests.execute.setup.DriverFactory;
import org.onap.sdc.ci.tests.execute.setup.SetupCDTest;
-import org.openqa.selenium.*;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.TimeoutException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
-import org.openqa.selenium.support.ui.*;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.FluentWait;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.awt.*;
-import java.awt.event.KeyEvent;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Supplier;
-
-import static org.hamcrest.Matchers.is;
-
public final class GeneralUIUtils {
@@ -131,6 +143,13 @@ public final class GeneralUIUtils {
return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
}
+ public static WebElement getWebElementByTestID(String dataTestId, String text, int timeout) {
+ WebElement webElementByTestID = getWebElementByTestID(dataTestId, timeout);
+
+ newWait(timeout).until(ExpectedConditions.textToBePresentInElement(webElementByTestID, text));
+ return webElementByTestID;
+ }
+
public static boolean isWebElementExistByTestId(String dataTestId) {
if(getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).size() == 0) {
return false;
@@ -355,8 +374,7 @@ public final class GeneralUIUtils {
}
public static void waitForLoader(int timeOut) {
- sleep(1);
- waitForElementInVisibilityBy(By.className("tlv-loader"), timeOut);
+ newWait(timeOut).until(ExpectedConditions.invisibilityOfElementLocated(By.className("sdc-loader-background")));
}
public static void findComponentAndClick(String resourceName) throws Exception {
@@ -630,6 +648,7 @@ public final class GeneralUIUtils {
} catch (TimeoutException | org.openqa.selenium.ScriptTimeoutException e) {
logger.info("Ignoring TimeoutException while waiting for angular2: {}", e, e);
}
+ waitForLoader(10);
}
public static Object getAllElementAttributes(WebElement element) {
@@ -807,13 +826,4 @@ public final class GeneralUIUtils {
ultimateWait();
}
- public static void waitForBackLoader() {
- waitForBackLoader(timeOut);
- }
-
- public static void waitForBackLoader(int timeOut) {
- sleep(1);
- waitForElementInVisibilityBy(By.className("tlv-loader-back"), timeOut);
- }
-
}
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java b/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java
index 747f4ebde..dd605ff7c 100644
--- a/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java
+++ b/vid-automation/src/main/java/vid/automation/test/sections/deploy/DeployModernUIBase.java
@@ -19,7 +19,7 @@ public abstract class DeployModernUIBase extends DeployDialogBase {
String dialogTitle = "Set a new service instance";
public void assertTitle(){
- WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, 30);
+ WebElement modalTitle = GeneralUIUtils.getWebElementByTestID(Constants.CREATE_MODAL_TITLE_ID, dialogTitle, 30);
assertThat(modalTitle.getText(), containsString(dialogTitle));
}
diff --git a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java
index bc47ad834..cf3d508e8 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java
@@ -2,7 +2,10 @@ package org.onap.vid.api;
import static java.util.Arrays.stream;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_VALUES;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.arrayWithSize;
import static org.hamcrest.Matchers.greaterThan;
import static org.onap.vid.api.TestUtils.convertRequest;
@@ -16,6 +19,7 @@ import java.util.Map.Entry;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.apache.commons.lang3.exception.ExceptionUtils;
import org.onap.sdc.ci.tests.datatypes.UserCredentials;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
import org.onap.vid.model.mso.MsoResponseWrapper2;
@@ -24,6 +28,7 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import vid.automation.test.Constants.Users;
import vid.automation.test.infra.FeatureTogglingTest;
@@ -84,21 +89,33 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase {
return uri.toASCIIString() + "/instantiationTemplates/templateTopology/" + jobId;
}
- @Test
- public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent() throws IOException {
+ @DataProvider
+ public static Object[][] deployFromCypressE2EFilenames() {
+ return new Object[][]{
+ {"asyncInstantiation/templates__instance_template.json"},
+ {"asyncInstantiation/templates__instance_template_network.json"},
+ };
+ }
+
+ @Test(dataProvider = "deployFromCypressE2EFilenames")
+ public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent(String fileName) {
templateTopology_givenDeploy_templateTopologyIsEquivalentToBody(
- fileAsJsonNode("asyncInstantiation/templates__instance_template.json"));
+ fileAsJsonNode(fileName));
}
@Test
- public void templateTopology_givenDeployFromEditedTemplateCypressE2E_getTemplateTopologyDataIsEquivalentToOriginalTemplate() throws IOException {
+ public void templateTopology_givenDeployFromEditedTemplateCypressE2E_getTemplateTopologyDataIsEquivalentToOriginalTemplate() {
templateTopology_givenDeploy_templateTopologyIsEquivalent(
fileAsJsonNode("asyncInstantiation/templates__instance_from_template__set_without_modify1.json"),
fileAsJsonNode("asyncInstantiation/templates__instance_template.json"));
}
+ private ObjectNode templateInfoFromFile() {
+ return fileAsJsonNode("asyncInstantiation/vidRequestCreateBulkOfMacro__template_info.json");
+ }
+
@Test
- public void templateTopology_givenDeploy_OriginalTemplateNotChanged() throws IOException {
+ public void templateTopology_givenDeploy_OriginalTemplateNotChanged() {
String uuidOriginTemplate = postAsyncInstanceRequest(fileAsJsonNode("asyncInstantiation/templates__instance_template.json"));
JsonNode originTemplateBeforeDeploy = restTemplate.getForObject(templateTopologyUri(uuidOriginTemplate), JsonNode.class);
@@ -113,35 +130,61 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase {
@Test
@FeatureTogglingTest(Features.FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE)
- public void templateTopology_givenDeploy_getServiceInfoHoldsRequestSummary() throws IOException {
+ public void templateTopology_givenDeploy_getServiceInfoHoldsRequestSummary() {
ObjectNode request =
fileAsJsonNode(CREATE_BULK_OF_MACRO_REQUEST)
.put("bulkSize", 1)
.put("pause", false);
- postAsyncInstanceRequest(request);
+ String jobId = postAsyncInstanceRequest(request);
- assertThat(fetchRequestSummary(request.at("/modelInfo/modelVersionId").asText()),
- jsonEquals(ImmutableMap.of(
+ assertThat(fetchRecentTemplateInfo(request.at("/modelInfo/modelVersionId").asText()), allOf(
+ jsonPartEquals("jobId", jobId),
+ jsonPartEquals("requestSummary", ImmutableMap.of(
"vnf", 1L,
"vfModule", 2L,
"volumeGroup", 1L
+ ))));
+ }
+
+ @Test
+ @FeatureTogglingTest(Features.FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE)
+ public void templateTopology_givenDeploy_getServiceInfoReturnsCypressE2EFile() {
+ ObjectNode request =
+ fileAsJsonNode(CREATE_BULK_OF_MACRO_REQUEST)
+ .put("bulkSize", 1)
+ .put("pause", false);
+
+ String jobId = postAsyncInstanceRequest(request);
+
+ assertThat(fetchRecentTemplateInfo(request.at("/modelInfo/modelVersionId").asText()), allOf(
+ jsonPartEquals("jobId", jobId),
+ jsonEquals(templateInfoFromFile()).when(IGNORING_VALUES), // Assert only field types
+ jsonEquals(templateInfoFromFile()).whenIgnoringPaths(
+ // Ignore the fields where values are always changing
+ "id", "templateId", "jobId",
+ "created", "createdBulkDate",
+ "modified", "statusModifiedDate",
+ "jobStatus"
)));
}
- private JsonNode fetchRequestSummary(String serviceModelId) {
+ private JsonNode fetchRecentTemplateInfo(String serviceModelId) {
return stream(restTemplate.getForObject(getTemplateInfoUrl(serviceModelId), JsonNode[].class))
- .map(it -> it.at("/requestSummary"))
.findFirst()
.orElseGet(() -> {
throw new AssertionError(getTemplateInfoUrl(serviceModelId) + " returned zero results");
});
}
- private ObjectNode fileAsJsonNode(String fileName) throws IOException {
- return objectMapper.readValue(
- convertRequest(objectMapper, fileName),
- ObjectNode.class);
+ private ObjectNode fileAsJsonNode(String fileName) {
+ try {
+ return objectMapper.readValue(
+ convertRequest(objectMapper, fileName),
+ ObjectNode.class);
+ } catch (IOException e) {
+ return ExceptionUtils.rethrow(e);
+ }
}
public void templateTopology_givenDeploy_templateTopologyIsEquivalentToBody(JsonNode body) {
diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json
new file mode 100644
index 000000000..5669ee285
--- /dev/null
+++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template_network.json
@@ -0,0 +1,110 @@
+{
+ "modelInfo": {
+ "modelInvariantId": "ce23786e-b2b1-4258-b561-f77ef93ada9c",
+ "modelVersionId": "a1a14610-ee40-4049-8007-0608a20dd1fa",
+ "modelName": "int_pktmirror_net NC SRIOV network",
+ "modelType": "service",
+ "modelVersion": "3.0"
+ },
+ "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
+ "owningEntityName": "WayneHolland",
+ "projectName": "WATKINS",
+ "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriberName": "SILVIA ROBBINS",
+ "productFamilyId": null,
+ "instanceName": "SDN_int_pktmirror_net_svc",
+ "subscriptionServiceType": "TYLER SILVIA",
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "tenantName": null,
+ "aicZoneId": null,
+ "aicZoneName": null,
+ "existingVNFCounterMap": {},
+ "existingVRFCounterMap": {},
+ "existingVnfGroupCounterMap": {},
+ "existingNetworksCounterMap": {
+ "f6b6d141-0d4c-427d-ad35-797f3d1abe71": 1,
+ "e01e26b2-aa26-4e11-9243-105d4589ff08": 1
+ },
+ "existingNames": {
+ },
+ "vnfs": {},
+ "networks": {
+ "SR-IOV Provider 2-1": {
+ "modelInfo": {
+ "modelCustomizationName": "SR-IOV Provider 2-1",
+ "modelCustomizationId": "f6b6d141-0d4c-427d-ad35-797f3d1abe71",
+ "modelInvariantId": "ffb9e45c-e674-4289-aad3-00040ad746e4",
+ "modelVersionId": "01f4c475-3f89-4f00-a2f4-39a873dba0ae",
+ "modelName": "NETWORK_CLOUD_PROVIDER_NETWORK",
+ "modelType": "network",
+ "modelVersion": "1.0"
+ },
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "instanceName": "SDN_int_pktmirror_net_1",
+ "action": "Create",
+ "platformName": "xxx1",
+ "lcpCloudRegionId": "hvf6",
+ "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77",
+ "instanceParams": [
+ {}
+ ],
+ "rollbackOnFailure": true,
+ "instanceId": null,
+ "trackById": "2e8455cb-4c28-4aa7-929d-f1e1881aaaa1",
+ "isFailed": false,
+ "statusMessage": null,
+ "position": null,
+ "lineOfBusiness": "zzz1"
+ },
+ "SR-IOV Provider 2-2": {
+ "modelInfo": {
+ "modelCustomizationName": "SR-IOV Provider 2-2",
+ "modelCustomizationId": "e01e26b2-aa26-4e11-9243-105d4589ff08",
+ "modelInvariantId": "ffb9e45c-e674-4289-aad3-00040ad746e4",
+ "modelVersionId": "01f4c475-3f89-4f00-a2f4-39a873dba0ae",
+ "modelName": "NETWORK_CLOUD_PROVIDER_NETWORK",
+ "modelType": "network",
+ "modelVersion": "1.0"
+ },
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "instanceName": "SDN_int_pktmirror_net_2",
+ "action": "Create",
+ "platformName": "xxx1",
+ "lcpCloudRegionId": "hvf6",
+ "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77",
+ "instanceParams": [
+ {}
+ ],
+ "rollbackOnFailure": true,
+ "instanceId": null,
+ "trackById": "e43ffa05-ea78-4c34-a0c8-02449851d827",
+ "isFailed": false,
+ "statusMessage": null,
+ "position": null,
+ "lineOfBusiness": "zzz1"
+ }
+ },
+ "vnfGroups": {},
+ "vrfs": {},
+ "instanceParams": [
+ {}
+ ],
+ "pause": false,
+ "bulkSize": 1,
+ "rollbackOnFailure": "true",
+ "isALaCarte": true,
+ "testApi": "GR_API",
+ "instanceId": null,
+ "action": "Create",
+ "trackById": "4157dcfb-fa22-435d-8df9-659628137177",
+ "isFailed": false,
+ "statusMessage": null,
+ "vidNotions": {
+ "instantiationUI": "networkWithPropertyNetworkTechnologyEqualsStandardSriovOrOvs",
+ "modelCategory": "5G Provider Network",
+ "viewEditUI": "legacy",
+ "instantiationType": "ALaCarte"
+ },
+ "position": null
+}
diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateBulkOfMacro__template_info.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateBulkOfMacro__template_info.json
new file mode 100644
index 000000000..0770025aa
--- /dev/null
+++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateBulkOfMacro__template_info.json
@@ -0,0 +1,45 @@
+{
+ "id": 56,
+ "created": 1577354225000,
+ "modified": 1577354325000,
+ "createdId": null,
+ "modifiedId": null,
+ "rowNum": null,
+ "auditUserId": null,
+ "auditTrail": null,
+ "jobId": "ef3430f8-6350-454c-a7c2-89ba301522c1",
+ "templateId": "a313b887-ccfd-4d85-a232-5ec9d4d94013",
+ "userId": "us16807000",
+ "msoRequestId": null,
+ "jobStatus": "IN_PROGRESS",
+ "statusModifiedDate": 1577354226000,
+ "hidden": false,
+ "pause": false,
+ "deletedAt": null,
+ "owningEntityId": "someID",
+ "owningEntityName": "someName",
+ "project": "myProject",
+ "aicZoneId": "NFT1",
+ "aicZoneName": "NFTJSSSS-NFT1",
+ "tenantId": "greatTenant",
+ "tenantName": "greatTenant",
+ "regionId": "hvf3",
+ "regionName": null,
+ "serviceType": "mySubType",
+ "subscriberName": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "subscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "serviceInstanceId": null,
+ "serviceInstanceName": "SERVICE_NAME",
+ "serviceModelId": "5c9e863f-2716-467b-8799-4a67f378dcaa",
+ "serviceModelName": "AIM_TRANSPORT_00004",
+ "serviceModelVersion": "1.0",
+ "createdBulkDate": 1577354225000,
+ "action": "INSTANTIATE",
+ "isRetryEnabled": false,
+ "aLaCarte": false,
+ "requestSummary": {
+ "vnf": 1,
+ "vfModule": 2,
+ "volumeGroup": 1
+ }
+} \ No newline at end of file
diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
index 1e9727ec3..e481c3e8b 100644
--- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
@@ -155,7 +155,7 @@ describe('Drawing Board: Instantiation Templates', function () {
...vnfPath, "vfModules", module1CustomizationId,
];
- let serviceInstanceElementOnRedux = state.service.serviceInstance[serviceModelId];
+ let serviceInstanceElementOnRedux = state.service.serviceInstance[(templateWithVnfSetup.serviceModelId)];
let latestVfModule_1Path = findPathOfLatestVfModule(serviceInstanceElementOnRedux, vfModules_1Path);
// This is a funny merge, as values are already there, but that way ensures
@@ -251,34 +251,72 @@ describe('Drawing Board: Instantiation Templates', function () {
});
+ it(`Given a stored template of Network - - it is loaded`, () => {
+
+ loadDrawingBoardWithRecreateModeNetwork();
+
+ // Then...
+ cy.getElementByDataTestsId("node-SR-IOV Provider 2-1").should('be.visible');
+ cy.getElementByDataTestsId("node-SR-IOV Provider 2-2").should('be.visible');
+ assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network();
+ });
+
+
});
});
});
-const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38';
+let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/';
+
+const templateWithVnfSetup = {
+ serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38',
+ instanceTemplateFile: apiTestResources + 'templates__instance_template.json',
+ instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json',
+ serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json',
+};
+
+const templateWithNetworkSetup = {
+ serviceModelId: 'a1a14610-ee40-4049-8007-0608a20dd1fa',
+ instanceTemplateFile: apiTestResources + 'templates__instance_template_network.json',
+ serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json',
+};
const vnfPath = [
"vnfs", "vProbe_NC_VNF 0"
];
function loadDrawingBoardWithRecreateMode() {
+ loadDrawingBoardWithRecreateModeInternal(
+ '../../' + templateWithVnfSetup.instanceTemplateFile,
+ templateWithVnfSetup.serviceModelId,
+ templateWithVnfSetup.serviceModelFile);
+}
+
+function loadDrawingBoardWithRecreateModeNetwork() {
+ loadDrawingBoardWithRecreateModeInternal(
+ '../../' + templateWithNetworkSetup.instanceTemplateFile,
+ templateWithNetworkSetup.serviceModelId,
+ templateWithNetworkSetup.serviceModelFile);
+}
+
+function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) {
const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b";
const drawingBoardAction = `RECREATE`;
const templateTopologyEndpoint = "templateTopology";
- cy.route(`**/rest/models/services/${serviceModelId}`,
- 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json')
+ cy.route(`**/rest/models/services/${serviceModelIdToLoad}`,
+ 'fixture:' + serviceModel)
.as('serviceModel');
cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`,
- 'fixture:../../../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json')
+ 'fixture:' + instanceTemplate)
.as('templateTopology');
// When...
cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
`?jobId=${templateUuid}` +
- `&serviceModelId=${serviceModelId}`);
+ `&serviceModelId=${serviceModelIdToLoad}`);
cy.wait('@serviceModel');
cy.wait('@templateTopology');
@@ -303,9 +341,17 @@ function removeVNFWithVFModules(dataTestId: string) {
}
function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(deviationFromExpected: { path: PropertyPath, value: any }[] = []) {
+ assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithVnfSetup.instanceTemplateFile, deviationFromExpected);
+}
+
+function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(deviationFromExpected: { path: PropertyPath, value: any }[] = []) {
+ assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithNetworkSetup.instanceTemplateFile, deviationFromExpected);
+}
+
+function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(filePathOfExpected: string, deviationFromExpected: { path: PropertyPath; value: any }[]) {
cy.getDrawingBoardDeployBtn().click();
cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
- cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json').then((expectedResult) => {
+ cy.readFile(filePathOfExpected).then((expectedResult) => {
convertRollbackOnFailureValueFromStringToBoolean(expectedResult);
let xhrBodyWithoutIsDirtyField = removeIsDirtyFieldFromXhrRequestBody(xhr);
@@ -320,7 +366,7 @@ function assertThatBodyFromDeployRequestEqualsToFile(deviationFromExpected: { pa
cy.getDrawingBoardDeployBtn().click();
cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
- cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json').then((expectedResult) => {
+ cy.readFile(templateWithVnfSetup.instanceTemplateSetWithoutModifyFile).then((expectedResult) => {
setDeviationInExpected(expectedResult, deviationFromExpected);
cy.deepCompare(xhr.request.body, expectedResult);
});
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json
new file mode 100644
index 000000000..08597a918
--- /dev/null
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json
@@ -0,0 +1,80 @@
+{
+ "service": {
+ "uuid": "a1a14610-ee40-4049-8007-0608a20dd1fa",
+ "invariantUuid": "ce23786e-b2b1-4258-b561-f77ef93ada9c",
+ "name": "int_pktmirror_net NC SRIOV network",
+ "version": "3.0",
+ "toscaModelURL": null,
+ "category": "Network Service",
+ "serviceType": "INFRASTRUCTURE",
+ "serviceRole": "PROVIDER-NETWORK",
+ "description": "SRIOV network model for NC 1.0, VLAN ID 187 and 188.",
+ "serviceEcompNaming": "false",
+ "instantiationType": "A-La-Carte",
+ "inputs": {},
+ "vidNotions": {
+ "instantiationUI": "anyAlacarteWhichNotExcluded",
+ "modelCategory": "5G Provider Network",
+ "viewEditUI": "legacy",
+ "instantiationType": "ALaCarte"
+ }
+ },
+ "vnfs": {},
+ "networks": {
+ "SR-IOV Provider 2-1": {
+ "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae",
+ "invariantUuid": "ffb9e45c-e674-4289-aad3-00040ad746e4",
+ "description": "NETWORK_CLOUD_PROVIDER_NETWORK",
+ "name": "NETWORK_CLOUD_PROVIDER_NETWORK",
+ "version": "1.0",
+ "customizationUuid": "f6b6d141-0d4c-427d-ad35-797f3d1abe71",
+ "inputs": {},
+ "commands": {},
+ "properties": {
+ "network_role": "int_pktmirror_net_1",
+ "exVL_naming": "{ecomp_generated_naming=false}",
+ "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}",
+ "network_scope": "GLOBAL",
+ "ecomp_generated_naming": "false",
+ "network_type": "SR-IOV-PROVIDER2-1",
+ "provider_network": "{physical_network_name=sriovnet1, is_provider_network=true}",
+ "network_technology": "STANDARD-SR-IOV",
+ "network_homing": "{ecomp_selected_instance_node_target=false}"
+ },
+ "type": "VL",
+ "modelCustomizationName": "SR-IOV Provider 2-1"
+ },
+ "SR-IOV Provider 2-2": {
+ "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae",
+ "invariantUuid": "ffb9e45c-e674-4289-aad3-00040ad746e4",
+ "description": "NETWORK_CLOUD_PROVIDER_NETWORK",
+ "name": "NETWORK_CLOUD_PROVIDER_NETWORK",
+ "version": "1.0",
+ "customizationUuid": "e01e26b2-aa26-4e11-9243-105d4589ff08",
+ "inputs": {},
+ "commands": {},
+ "properties": {
+ "network_role": "int_pktmirror_net_2",
+ "exVL_naming": "{ecomp_generated_naming=false}",
+ "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}",
+ "network_scope": "GLOBAL",
+ "ecomp_generated_naming": "false",
+ "network_type": "SR-IOV-PROVIDER2-2",
+ "provider_network": "{physical_network_name=sriovnet2, is_provider_network=true}",
+ "network_technology": "STANDARD-SR-IOV",
+ "network_homing": "{ecomp_selected_instance_node_target=false}"
+ },
+ "type": "VL",
+ "modelCustomizationName": "SR-IOV Provider 2-2"
+ }
+ },
+ "collectionResources": {},
+ "configurations": {},
+ "fabricConfigurations": {},
+ "serviceProxies": {},
+ "vfModules": {},
+ "volumeGroups": {},
+ "pnfs": {},
+ "vnfGroups": {},
+ "vrfs": {}
+}