diff options
Diffstat (limited to 'ui-ci-dev/src')
77 files changed, 9216 insertions, 0 deletions
diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/scripts/CreateVfsFromOnboarding.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/scripts/CreateVfsFromOnboarding.java new file mode 100644 index 0000000000..b11f8d19ef --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/scripts/CreateVfsFromOnboarding.java @@ -0,0 +1,67 @@ +package org.openecomp.sdc.uici.scripts; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.openecomp.sdc.uici.tests.datatypes.CleanTypeEnum; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.OnboardUtility; + +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; +import com.google.gson.GsonBuilder; + +/** + * This Class functions to load mass zip files to vfs through onboarding.<br> + * It uses both BE & UI APIs + * + * @author mshitrit + * + */ +public class CreateVfsFromOnboarding extends SetupCDTest { + public static void main(String[] args) { + CreateVfsFromOnboarding manager = new CreateVfsFromOnboarding(); + + FunctionalInterfaces.swallowException(() -> manager.setEnvParameters(CleanTypeEnum.NONE.name())); + // String folderPath = args[0]; + String folderPath = "C:\\onboardingTest\\onBoardingZips"; + File folder = new File(folderPath); + File[] listOfFiles = folder.listFiles(); + List<String> zipFileNames = Arrays.asList(listOfFiles).stream().map(file -> file.getName()) + .filter(fileName -> fileName.endsWith(".zip")).collect(Collectors.toList()); + Map<String, String> filesSuccessMap = new HashMap<>(); + for (String fileName : zipFileNames) { + try { + // Before + manager.beforeState(null); + manager.setBrowserBeforeTest(); + createSingleVfFromOnboarding(folderPath, fileName); + filesSuccessMap.put(fileName, "SUCCESS"); + + } catch (Exception e) { + filesSuccessMap.put(fileName, "FAIL"); + } finally { + FunctionalInterfaces.swallowException(() -> manager.afterState(null)); + manager.quitAfterTest(); + } + } + Path file = Paths.get("RunResults.txt"); + String stringDataModel = new GsonBuilder().setPrettyPrinting().create().toJson(filesSuccessMap); + FunctionalInterfaces.swallowException(() -> Files.write(file, stringDataModel.getBytes())); + } + + private static void createSingleVfFromOnboarding(String filePath, String zipFileName) { + String userId = UserRoleEnum.DESIGNER.getUserId(); + OnboardUtility.createVfFromOnboarding(userId, zipFileName, filePath); + GeneralUIUtils.submitForTestingElement("Vf From Onboarding"); + + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CanvasElement.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CanvasElement.java new file mode 100644 index 0000000000..c23d05ab23 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CanvasElement.java @@ -0,0 +1,33 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +import org.apache.commons.lang3.tuple.ImmutablePair; + +public final class CanvasElement { + private final String uniqueId; + private ImmutablePair<Integer, Integer> location; + private String elementName; + + public String getElementName() { + return elementName; + } + + public CanvasElement(String uniqueId, String elementName, ImmutablePair<Integer, Integer> location) { + super(); + this.uniqueId = uniqueId; + this.location = location; + this.elementName = elementName; + } + + public String getUniqueId() { + return uniqueId; + } + + public ImmutablePair<Integer, Integer> getLocation() { + return location; + } + + public void setLocation(ImmutablePair<Integer, Integer> location) { + this.location = location; + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CanvasManager.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CanvasManager.java new file mode 100644 index 0000000000..5ef8c7a56a --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CanvasManager.java @@ -0,0 +1,206 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +public final class CanvasManager { + private Map<String, CanvasElement> canvasElements; + private Actions actions; + private WebElement canvas; + private int reduceCanvasWidthFactor; + // Offsets Are used to find upper right corner of canvas element in order to + // connect links + private static final int CANVAS_ELEMENT_Y_OFFSET = 40; + private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27 + + private CanvasManager() { + canvasElements = new HashMap<>(); + actions = new Actions(GeneralUIUtils.getDriver()); + canvas = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue()); + try { + WebElement webElement = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue()); + reduceCanvasWidthFactor = webElement.getSize().width; + } catch (Exception e) { + reduceCanvasWidthFactor = 0; + } + } + + public static CanvasManager getCanvasManager() { + return new CanvasManager(); + } + + public List<CanvasElement> getCanvasElements() { + return canvasElements.values().stream().collect(Collectors.toList()); + } + + private void addCanvasElement(CanvasElement element) { + canvasElements.put(element.getUniqueId(), element); + } + + private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation) { + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.sleep(500); + actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); + actions.clickAndHold(); + actions.moveToElement(canvas, newLocation.left, newLocation.right); + actions.release(); + actions.perform(); + canvasElement.setLocation(newLocation); + GeneralUIUtils.waitForLoader(); + + } + + public void moveElementOnCanvas(CanvasElement canvasElement) { + moveElementOnCanvas(canvasElement, getFreePosition()); + } + + public void deleteElementFromCanvas(CanvasElement canvasElement) { + GeneralUIUtils.waitForLoader(); + actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); + actions.click(); + actions.perform(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue()) + .click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + canvasElements.remove(canvasElement.getUniqueId()); + GeneralUIUtils.waitForLoader(); + } + + public void selectElementFromCanvas(CanvasElement canvasElement) { + GeneralUIUtils.waitForLoader(); + actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right); + actions.click(); + actions.perform(); + GeneralUIUtils.waitForLoader(); + } + + public CanvasElement createElementOnCanvas(LeftPanelCanvasItems canvasItem) { + return createElementOnCanvas(canvasItem.getValue(), false); + } + + /** + * Creates Element on the Canvas - use the element name. + * + * @param elementName + * @return + */ + public CanvasElement createElementOnCanvas(String elementName) { + return createElementOnCanvas(elementName, true); + } + + private CanvasElement createElementOnCanvas(String elementName, boolean addPrefix) { + if (addPrefix) { + elementName = DataTestIdEnum.LEFT_PANEL_PREFIX + elementName; + } + GeneralUIUtils.waitForLoader(); + WebElement element = GeneralUIUtils.getWebElementWaitForVisible(elementName); + ImmutablePair<Integer, Integer> freePosition = getFreePosition(); + actions.moveToElement(element, 0, 0); + actions.clickAndHold(); + actions.moveToElement(canvas, freePosition.left, freePosition.right); + actions.release(); + actions.perform(); + + String uniqueId = elementName + "_" + UUID.randomUUID().toString(); + CanvasElement canvasElement = new CanvasElement(uniqueId, elementName, freePosition); + addCanvasElement(canvasElement); + GeneralUIUtils.waitForLoader(); + return canvasElement; + } + + public CanvasElement createUniqueVFOnCanvas(LeftPanelCanvasItems canvasItem) { + GeneralUIUtils.waitForLoader(); + WebElement element = GeneralUIUtils.getWebElementWaitForVisible(canvasItem.getValue()); + ImmutablePair<Integer, Integer> freePosition = getFreePosition(); + actions.moveToElement(element, 0, 0); + actions.clickAndHold(); + actions.moveToElement(canvas, freePosition.left, freePosition.right); + actions.release(); + actions.perform(); + + String uniqueId = canvasItem.name() + "_" + UUID.randomUUID().toString(); + CanvasElement canvasElement = new CanvasElement(uniqueId, canvasItem.getValue(), freePosition); + addCanvasElement(canvasElement); + GeneralUIUtils.waitForLoader(); + return canvasElement; + } + + private ImmutablePair<Integer, Integer> getFreePosition() { + // TODO ui-ci use better method + ImmutablePair<Integer, Integer> randomPosition = null; + boolean freePosition = false; + int minSpace = 150; + while (!freePosition) { + ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition(); + freePosition = !canvasElements.values().stream().map(e -> e.getLocation()) + .filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace + && Math.abs(e.right - tempRandomPosition.right) < minSpace) + .findAny().isPresent(); + randomPosition = tempRandomPosition; + } + return randomPosition; + } + + private ImmutablePair<Integer, Integer> getRandomPosition() { + int edgeBuffer = 50; + Random random = new Random(); + int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer; + int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer; + return new ImmutablePair<Integer, Integer>(xElement, yElement); + } + + /** + * Links two elements on canvas.<br> + * Currently Supports Only elements in the default size.<br> + * Will not work for container type or smaller elements (cp, vl etc...)<br> + * + * @param firstElement + * @param secondElement + */ + public void linkElements(CanvasElement firstElement, CanvasElement secondElement) { + GeneralUIUtils.waitForLoader(); + drawSimpleLink(firstElement, secondElement); + selectReqAndCapAndConnect(); + + GeneralUIUtils.waitForLoader(); + + } + + private void selectReqAndCapAndConnect() { + // Select First Cap + GeneralUIUtils.getWebElementsListWaitForVisible(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0) + .click(); + // Select First Req + GeneralUIUtils.getWebElementsListWaitForVisible(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0) + .click(); + // Connect + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click(); + + } + + private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) { + + int yOffset = CANVAS_ELEMENT_Y_OFFSET; + int xOffset = CANVAS_ELEMENT_X_OFFSET; + actions.moveToElement(canvas, firstElement.getLocation().left + xOffset, + firstElement.getLocation().right - yOffset); + + actions.clickAndHold(); + actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, + secondElement.getLocation().right - yOffset); + actions.release(); + actions.perform(); + GeneralUIUtils.waitForLoader(); + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CleanTypeEnum.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CleanTypeEnum.java new file mode 100644 index 0000000000..f0691b89fc --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CleanTypeEnum.java @@ -0,0 +1,28 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +import java.util.Arrays; +import java.util.Optional; + +/** + * enum that represents possible methods to clean DB before and after tests. + * + * @author mshitrit + * + */ +public enum CleanTypeEnum { + FULL, + /** Unreliable should be only used in dev **/ + PARTIAL, NONE; + + /** + * Returns CleanType enum by it name + * + * @param cleanType + * @return + */ + public static CleanTypeEnum findByName(String cleanType) { + final Optional<CleanTypeEnum> findAny = Arrays.asList(CleanTypeEnum.values()).stream() + .filter(e -> e.name().equals(cleanType)).findAny(); + return findAny.get(); + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CreateAndImportButtonsEnum.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CreateAndImportButtonsEnum.java new file mode 100644 index 0000000000..382584a48d --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CreateAndImportButtonsEnum.java @@ -0,0 +1,7 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +public enum CreateAndImportButtonsEnum { + + IMPORT_VF, IMPORT_VFC, IMPORT_CP, IMPORT_VL, CREATE_VF, CREATE_SERVICE, CREATE_PRODUCT; + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CreateAndUpdateStepsEnum.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CreateAndUpdateStepsEnum.java new file mode 100644 index 0000000000..ad0281dd74 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/CreateAndUpdateStepsEnum.java @@ -0,0 +1,25 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +public enum CreateAndUpdateStepsEnum { + GENERAL("Generalstep"), + ICON("Iconstep"), + DEPLOYMENT_ARTIFACT("Deployment Artifactstep"), + INFORMATION_ARTIFACT("Information Artifactstep"), + PROPERTIES("Propertiesstep"), + ATTRIBUTES("Attributesstep"), + COMPOSITION("Compositionstep"), + DEPLOYMENT("Deploymentstep"), + REQUIREMENTS_AND_CAPABILITIES("Req. & Capabilitiesstep"), + INPUTS("Inputsstep"); + + private String value; + + public String getValue() { + return value; + } + + private CreateAndUpdateStepsEnum(String value) { + this.value = value; + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/DataTestIdEnum.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/DataTestIdEnum.java new file mode 100644 index 0000000000..64db12a422 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/DataTestIdEnum.java @@ -0,0 +1,428 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +public final class DataTestIdEnum { + private DataTestIdEnum() { + }; + + public enum Dashboard { + IMPORT_AREA("importButtonsArea"), + BUTTON_ADD_VF("createResourceButton"), + BUTTON_ADD_SERVICE("createServiceButton"), + IMPORT_VFC("importVFCbutton"), + IMPORT_VF("importVFbutton"), + IMPORT_VFC_FILE("file-importVFCbutton"), + IMPORT_VF_FILE("file-importVFbutton"); + + private String value; + + public String getValue() { + return value; + } + + private Dashboard(String value) { + this.value = value; + } + } + + public enum LifeCyleChangeButtons { + CREATE("create/save"), + CHECK_IN("check_in"), + SUBMIT_FOR_TESTING("submit_for_testing"), + START_TESTING("start_testing"), + ACCEPT("accept"), + APPROVE("approve"), + DISTRIBUTE("distribute"); + + private String value; + + public String getValue() { + return value; + } + + private LifeCyleChangeButtons(String value) { + this.value = value; + } + } + + /** + * Artifacts Related Elements + * + * @author mshitrit + * + */ + public enum Artifatcs { + ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"), + SELECT_ARTIFACT_DROPDOWN("selectArtifact"), + ARTIFACT_TYPE_DROPDOWN("artifacttype"), + ARTIFACT_DESCRIPTION("description"), + ARTIFACT_LABEL("artifactLabel"), + BROWSE_BUTTON("browseButton"), + ADD_BUTTON("Add"); + + private String value; + + public String getValue() { + return value; + } + + private Artifatcs(String value) { + this.value = value; + } + + } + + public enum InformationalArtifatcs { + CLOUD_QUESTIONNAIRE("Cloud Questionnaire (completed)"), + FEATURES("Features"), + VENDOR_TEST_RESULT("Vendor Test Result"), + TEST_SCRIPTS("Test Scripts"), + HEAT_TEMPLATE_FROM_VENDOR("HEAT Template from Vendor"), + CAPACITY("Capacity"); + + private String value; + + public String getValue() { + return value; + } + + private InformationalArtifatcs(String value) { + this.value = value; + } + + } + + public enum ArtifactModal { + LABEL("artifact-label"), TYPE("artifacttype"),; + + private String value; + + public String getValue() { + return value; + } + + private ArtifactModal(String value) { + this.value = value; + } + } + + public enum ModalItems { + BROWSE_BUTTON("browseButton"), + ADD("Add"), + DESCRIPTION("description"), + SUMBIT_FOR_TESTING_MESSAGE("changeLifeCycleMessage"), + OK("OK"), + CANCEL("Cancel"), + ACCEP_TESTING_MESSAGE("checkindialog"), + MESSAGE_TEXT("message"), + DONE("Done"); + + private String value; + + public String getValue() { + return value; + } + + private ModalItems(String value) { + this.value = value; + } + } + + public static final String LEFT_PANEL_PREFIX = "leftbar-section-content-item-"; + + public enum LeftPanelCanvasItems { + BLOCK_STORAGE(LEFT_PANEL_PREFIX + "BlockStorage"), + CINDER_VOLUME(LEFT_PANEL_PREFIX + "CinderVolume"), + COMPUTE(LEFT_PANEL_PREFIX + "Compute"), + LOAD_BALANCER(LEFT_PANEL_PREFIX + "LoadBalancer"), + NOVA_SERVER(LEFT_PANEL_PREFIX + "NovaServer"), + OBJECT_STORAGE(LEFT_PANEL_PREFIX + "ObjectStorage"), + // NEUTRON_PORT(LEFT_PANEL_PREFIX + "-NeutronPort"), + // PORT(LEFT_PANEL_PREFIX + "-Port"), + DATABASE(LEFT_PANEL_PREFIX + "-Database"), + VMMC(LEFT_PANEL_PREFIX + "vmmc_work"); + + private String value; + + public String getValue() { + return value; + } + + private LeftPanelCanvasItems(String value) { + this.value = value; + } + } + + public enum RightBar { + PROPERTIES_AND_ATTRIBUTES("properties-and-attributes-tab"), + DEPLOYMENT_ARTIFACTS("deployment-artifact-tab"), + ARTIFACT_NAME("artifactName"), + ADD_ARTIFACT_BUTTON("add_Artifact_Button"), + DELETE_ARTIFACT_BUTTON("delete"), + MYATTR_ATTR_FROM_LIST("my_attr-attr"), + MYATTR_ATTR_VALUE_FROM_LIST("value-of-my_attr"),; + + private String value; + + public String getValue() { + return value; + } + + private RightBar(String value) { + this.value = value; + } + } + + // for now we use index to work with the breadcrumbs + // any change in the breadcrumbs position will require an update here also + public enum BreadcrumbsButtonsEnum { + HOME("breadcrumbs-button-0"), + COMPONENT("breadcrumbs-button-1"); + + private String value; + + public String getValue() { + return value; + } + + private BreadcrumbsButtonsEnum(String value) { + this.value = value; + } + } + + public enum InputsEnum { + VF_INSTANCE("inputs-vf-instance-0"), + FIRST_INPUT_CHECKBOX("inputs-checkbox-0"), + SECOND_INPUT_CHECKBOX("inputs-checkbox-1"), + ADD_INPUTS_BUTTON("add-inputs-to-service-button"), + SERVICE_INPUT("service-input-0"), + DELETE_INPUT("delete-input-0"); + + private String value; + + public String getValue() { + return value; + } + + private InputsEnum(String value) { + this.value = value; + } + + } + + public enum TabsBar { + HIERARCHY_TAB("hierarchy-tab"), + SELECTED_TAB("selected-tab"), + TAB_HEADER("tab-header"), + TAB_SUB_HEADER("tab-sub-header"), + HIERARCHY_MODULE("hierarchy-module-0"), + HIERARCHY_MODULE_TITLE("hierarchy-module-0-title"), + HIERARCHY_SELECTED_MODULE_DATA("selected-module-data"), + HIERARCHY_SELECTED_MODULE_NAME("selected-module-name"), + HIERARCHY_SELECTED_MODULE_UUID("selected-module-group-uuid"), + HIERARCHY_SELECTED_MODULE_VERSION("selected-module-version"), + HIERARCHY_SELECTED_MODULE_IS_BASE("selected-module-is-base"), + HIERARCHY_SELECTED_MODULE_ARTIFACT_NAME("selected-module-artifact-name"), + HIERARCHY_SELECTED_MODULE_ARTIFACT_UUID("selected-module-artifact-uuid"), + HIERARCHY_SELECTED_MODULE_ARTIFACT_VERSION("selected-module-artifact-version"); + + private String value; + + public String getValue() { + return value; + } + + private TabsBar(String value) { + this.value = value; + } + } + + public enum UpdateNamePopover { + OPEN_POPOVER_ICON("edit-name-popover-icon"), + POPOVER_FORM("popover-form"), + POPOVER_SAVE_BUTTON("popover-save-button"), + POPOVER_INSTANCE_NAME("popover-vfinstance-name"), + POPOVER_HEAT_NAME("popover-heat-name"), + POPOVER_MODULE_NAME("popover-module-name"), + POPOVER_CLOSE_BUTTON("popover-close-button"), + POPOVER_X_BUTTON("popover-x-button"); + + private String value; + + public String getValue() { + return value; + } + + private UpdateNamePopover(String value) { + this.value = value; + } + } + + public enum LinkMenuItems { + CANCEL_BUTTON("link-menu-button-cancel"), + CONNECT_BUTTON("link-menu-button-connect"), + LINK_ITEM_CAP("link-item-capabilities"), + LINK_ITEM_REQ("link-item-requirements"), + LINK_MENU("link-menu-open"); + + private String value; + + public String getValue() { + return value; + } + + private LinkMenuItems(String value) { + this.value = value; + } + } + + public enum GeneralCanvasItems { + CANVAS("canvas"), + CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"), + DELETE_INSTANCE_BUTTON("e-sdc-small-icon-delete"); + + private String value; + + public String getValue() { + return value; + } + + private GeneralCanvasItems(String value) { + this.value = value; + } + } + + public enum AttributesSection { + TABLE_ROWS("attributes-table-row"), + EDIT_BUTTON_FOR_NETWORK_ATTR("edit_networks"), + DELETE_BUTTON_FOR_NETWORK_ATTR("delete_networks"), + ADD_BUTTON("add-attribute-button"); + + private String value; + + public String getValue() { + return value; + } + + private AttributesSection(String value) { + this.value = value; + } + } + + public enum AttributeForm { + NAME_FIELD("attributeName"), + DESCRIPTION_FIELD("description"), + TYPE_FIELD("type-field"), + DEFAULT_VAL_FIELD("defaultvalue"), + BOOL_DEFAULT_VAL_FIELD("booleantype"), + SCHEMA_FIELD("schema"), + BOOL_VALUE_FIELD("boolean-type-value"), + HIDDEN_FIELD("hidden"), + UPDATE_BUTTON("Update"), + DONE_BUTTON("Done"), + ADD_BUTTON("Add"); + + private String value; + + public String getValue() { + return value; + } + + private AttributeForm(String value) { + this.value = value; + } + } + + public enum PropertiesSection { + ADD_BUTTON("addGrey"),; + + private String value; + + public String getValue() { + return value; + } + + private PropertiesSection(String value) { + this.value = value; + } + } + + public enum PropertyForm { + FORM_CONTAINER("sdc-edit-property-container"), + NAME_FIELD("propertyName"), + DESCRIPTION_FIELD("description"), + TYPE_FIELD("propertyType"), + SCHEMA_FIELD("schema-type"), + SIMPLE_TYPE_DEFAULT_VAL_FIELD("defaultvalue"), + SIMPLE_TYPE_BOOL_DEFAULT_VAL_FIELD("booleantype"), + LIST_TYPE_DEFAULT_VAL_FIELD("listNewItem-1"), + MAP_TYPE_DEFAULT_VAL_KEY_FIELD_FOR_FIRST_ITEM("mapKey-10"), + MAP_TYPE_DEFAULT_VAL_VALUE_FIELD_FOR_FIRST_ITEM("mapValue-10"), + MAP_TYPE_DEFAULT_VAL_KEY_FIELD_FOR_SECOND_ITEM("mapKey-11"), + MAP_TYPE_DEFAULT_VAL_VALUE_FIELD_FOR_SECOND_ITEM("mapValue-11"), + ADD_ITEM_TO_LIST_BUTTON("add-list-item-1"), + ADD_ITEM_TO_MAP_BUTTON("add-map-item"), + DELETE_FIRST_ITEM_FROM_MAP_BUTTON("delete-map-item-10"), + START_PORT_FIELD_FOR_PORT_PAIRS_DT("-1start_port"), + SAVE_BUTTON("Save"); + + private String value; + + public String getValue() { + return value; + } + + private PropertyForm(String value) { + this.value = value; + } + } + + public enum GeneralSection { + BROWSE_BUTTON("browseButton"), FILE_NAME("filename"), NAME("name"), LOADER("tlv-loader"); + + private String value; + + public String getValue() { + return value; + } + + private GeneralSection(String value) { + this.value = value; + } + } + + public enum ReqAndCapabilitiesSection { + SEARCH_BOX("search-box"), CAP_TAB("cap-tab"), REQ_TAB("req-tab"); + + private String value; + + public String getValue() { + return value; + } + + private ReqAndCapabilitiesSection(String value) { + this.value = value; + } + } + + public enum OnBoardingTable { + OPEN_MODAL_BUTTON("repository-icon"), + VENDOR_HEADER_COL("Vendor"), + NAME_HEADER_COL("Name"), + CATEGORY_HEADER_COL("Category"), + VERSION_HEADER_COL("Version"), + IMPORT_ICON("import-csar"), + UPDATE_ICON("update-csar"), + CSAR_ROW("csar-row"), + ONBOARDING_SEARCH("onboarding-search"); + + private String value; + + public String getValue() { + return value; + } + + private OnBoardingTable(String value) { + this.value = value; + } + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/MenuOptionsEnum.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/MenuOptionsEnum.java new file mode 100644 index 0000000000..4c45858de0 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/MenuOptionsEnum.java @@ -0,0 +1,17 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +public enum MenuOptionsEnum { + + EDIT("Edit"), CHECK_IN("Check in"), CHECK_OUT("Check out"), VIEW("View"), SUBMIT_FOR_TEST("Submit For Test"), ACCEPT("Accept"), REJECT("Reject"), START_TEST("Start test"), DISTREBUTE("Distribute"); + + private String value; + + public String getValue() { + return value; + } + + private MenuOptionsEnum(String value) { + this.value = value; + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/UserCredentials.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/UserCredentials.java new file mode 100644 index 0000000000..0d94529b89 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/datatypes/UserCredentials.java @@ -0,0 +1,29 @@ +package org.openecomp.sdc.uici.tests.datatypes; + +import org.openecomp.sdc.be.model.User; + +public class UserCredentials extends User { + + private String password; + + public UserCredentials(String userId, String password, String firstname, String lastname) { + super(); + setUserId(userId); + this.password = password; + setFirstName(firstname); + setLastName(lastname); + } + + public UserCredentials() { + super(); + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/base/SetupCDTest.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/base/SetupCDTest.java new file mode 100644 index 0000000000..42e9f137ec --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/base/SetupCDTest.java @@ -0,0 +1,408 @@ +package org.openecomp.sdc.uici.tests.execute.base; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.commons.lang.NotImplementedException; +import org.apache.log4j.Logger; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.junit.rules.TestName; +import org.openecomp.sdc.uici.tests.datatypes.CleanTypeEnum; +import org.openecomp.sdc.uici.tests.datatypes.UserCredentials; +import org.openecomp.sdc.uici.tests.utilities.FileHandling; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.testng.AssertJUnit; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Optional; +import org.testng.annotations.Parameters; + +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.api.ComponentBaseTest; +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.run.StartTest; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; +import com.google.common.collect.Lists; +import com.thinkaurelius.titan.core.TitanGraph; + +public abstract class SetupCDTest extends ComponentBaseTest { + + private TitanSnapshot snapshot; + private static CleanTypeEnum cleanType; + + public SetupCDTest() { + super(new TestName(), SetupCDTest.class.getName()); + } + + public SetupCDTest(TestName name, String className) { + super(name, className); + } + + public static Logger logger = Logger.getLogger(SetupCDTest.class.getName()); + + /**************** CONSTANTS ****************/ + private static final String CREDENTIALS_FILE = "src/main/resources/ci/conf/credentials.yaml"; + public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub"; + + /**************** PRIVATES ****************/ + public static Config config; + private Map<?, ?> credentialsYamlFileMap; + + private static String devUrl, cdUrl; + + /**************** + * BEFORE + * + * @throws FileNotFoundException + ****************/ + + @BeforeSuite(alwaysRun = true) + @Parameters({ "clean-type" }) + public void setEnvParameters(@Optional("PARTIAL") String cleanType) throws FileNotFoundException { + this.cleanType = CleanTypeEnum.findByName(cleanType); + System.out.println("setup before class"); + config = Utils.getConfig(); + loadCredentialsFile(); + setUrl(); + } + + @BeforeMethod(alwaysRun = true) + public void setBrowserBeforeTest() { + setBrowserBeforeTest(getRole()); + } + + /**************** AFTER ****************/ + @AfterMethod(alwaysRun = true) + public void quitAfterTest() { + System.out.println("closing browser"); + GeneralUIUtils.getDriver().quit(); + } + + @BeforeMethod(alwaysRun = true) + public void beforeState() throws Exception { + CleanTypeEnum cleanType = getCleanMode(); + switch (cleanType) { + case FULL: { + super.beforeState(null); + break; + } + case PARTIAL: { + takeTitanSnapshot(); + break; + } + case NONE: { + // No Clean Up + break; + } + default: { + throw new NotImplementedException("Enum Value:" + cleanType.name() + " Is not handled"); + } + } + + } + + @AfterMethod(alwaysRun = true) + public void afterState() throws Exception { + CleanTypeEnum cleanType = getCleanMode(); + switch (cleanType) { + case FULL: { + super.afterState(null); + break; + } + case PARTIAL: { + resetToOriginalSnapshot(); + break; + } + case NONE: { + // No Clean Up + break; + } + default: { + throw new NotImplementedException("Enum Value:" + cleanType.name() + " Is not handled"); + } + } + + } + + private void takeTitanSnapshot() { + List<Edge> edgeList = Lists.newArrayList(getTitanGraph().edges(null)); + List<Vertex> verList = Lists.newArrayList(getTitanGraph().vertices(null)); + setSnapshot(new TitanSnapshot(edgeList, verList)); + + } + + private static class TitanSnapshot { + List<Edge> edges; + List<Vertex> vertices; + + public List<Edge> getEdges() { + return edges; + } + + public List<Vertex> getVertices() { + return vertices; + } + + private TitanSnapshot(List<Edge> edges, List<Vertex> vertices) { + super(); + this.edges = edges; + this.vertices = vertices; + } + } + + private void resetToOriginalSnapshot() { + + List<Edge> joinedEdges = new ArrayList<>(); + List<Vertex> joinedVertices = new ArrayList<>(); + TitanSnapshot original = getSnapshot(); + takeTitanSnapshot(); + TitanSnapshot current = getSnapshot(); + + original.getEdges().stream().forEach(e -> addIfIdInList(e, current.getEdges(), joinedEdges, e2 -> e2.id())); + original.getVertices().stream() + .forEach(e -> addIfIdInList(e, current.getVertices(), joinedVertices, e2 -> e2.id())); + + List<Edge> edgesToRemove = removeFromList(current.getEdges(), joinedEdges, e2 -> e2.id()); + List<Vertex> verticesToRemove = removeFromList(current.getVertices(), joinedVertices, e2 -> e2.id()); + + List<Edge> edgesToAdd = removeFromList(original.getEdges(), joinedEdges, e2 -> e2.id()); + List<Vertex> verticesToAdd = removeFromList(original.getVertices(), joinedVertices, e2 -> e2.id()); + + if (edgesToAdd.isEmpty() && verticesToAdd.isEmpty()) { + edgesToRemove.stream().forEach(e -> e.remove()); + verticesToRemove.stream().forEach(v -> v.remove()); + } + + } + + private <Element, ID> List<Element> removeFromList(List<Element> listToRemoveFrom, List<Element> elementsToRemove, + Function<Element, ID> idGetter) { + Set<ID> idSet = new HashSet<>(); + // Fill The Set + elementsToRemove.stream().map(e -> idGetter.apply(e)).forEach(e2 -> idSet.add(e2)); + return listToRemoveFrom.stream().filter(p -> !idSet.contains(idGetter.apply(p))).collect(Collectors.toList()); + + } + + private <Element, ID> void addIfIdInList(Element e, List<Element> listToCheck, List<Element> listToAddTo, + Function<Element, ID> idGetter) { + Stream<Element> matchingElements = listToCheck.stream() + .filter(p -> idGetter.apply(e).equals(idGetter.apply(p))); + listToAddTo.addAll(matchingElements.collect(Collectors.toList())); + } + + /**************** MAIN ****************/ + public static void main(String[] args) { + System.out.println("---------------------"); + System.out.println("running test from CLI"); + System.out.println("---------------------"); + args = new String[] { "ui-ci.xml" }; + StartTest.main(args); + } + + /***********************************************************************************/ + + protected void setBrowserBeforeTest(UserRoleEnum role) { + System.out.println("setup before test"); + GeneralUIUtils.initDriver(); + setDevUrl(role); + loginWithUser(role); + } + + protected void setUrl() { + cdUrl = config.getUrl(); + setDevUrl(getRole()); + } + + private Map<String, String> loadCredentialsFile() { + final String credintialsFile = (System.getProperty("credentials.file") != null) + ? System.getProperty("credentials.file") : CREDENTIALS_FILE; + System.out.println("credentials file is : " + credintialsFile); + FunctionalInterfaces.swallowException( + () -> credentialsYamlFileMap = (Map<String, String>) FileHandling.parseYamlFile(credintialsFile)); + System.out.println(credentialsYamlFileMap.toString()); + return (Map<String, String>) credentialsYamlFileMap; + } + + protected UserCredentials getUserCredentialsFromFile(String userRole) throws Exception { + Map<String, String> credentialsMap = (Map<String, String>) credentialsYamlFileMap.get(userRole); + String user = (String) credentialsMap.get("username"); + String password = (String) credentialsMap.get("password"); + String firstname = (String) credentialsMap.get("firstname"); + String lastname = (String) credentialsMap.get("lastname"); + + return new UserCredentials(user, password, firstname, lastname); + } + + public void navigateToUrl(String url) throws InterruptedException { + WebDriver driver = GeneralUIUtils.getDriver(); + System.out.println("navigating to URL :" + url); + driver.navigate().to(url); + driver.manage().window().maximize(); + driver.manage().deleteAllCookies(); + } + + protected void loginToSystem(UserCredentials credentials) throws Exception { + + sendUserAndPasswordKeys(credentials); + WebElement submitButton = GeneralUIUtils.getDriver().findElement(By.name("btnSubmit")); + submitButton.click(); + WebElement buttonOK = GeneralUIUtils.getDriver().findElement(By.name("successOK")); + AssertJUnit.assertTrue(buttonOK.isDisplayed()); + buttonOK.click(); + System.out.println("Entering to design studio"); + Thread.sleep(2000); + WebElement enterToUserWorkspaceButton = GeneralUIUtils.getDriver() + .findElement(By.xpath("//button[@data-tests-id='Design Studio']")); + enterToUserWorkspaceButton.click(); + } + + private void sendUserAndPasswordKeys(UserCredentials userId) { + System.out.println("Login to system with user : " + userId.getUserId()); + WebElement userNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("userid")); + userNameTextbox.sendKeys(userId.getUserId()); + WebElement passwordTextbox = GeneralUIUtils.getDriver().findElement(By.name("password")); + passwordTextbox.sendKeys(userId.getPassword()); + } + + public String getUrl() { + String url; + final CleanTypeEnum workMode = getCleanMode(); + switch (workMode) { + case FULL: { + url = devUrl; + break; + } + case PARTIAL: { + url = devUrl; + break; + } + case NONE: { + url = cdUrl; + break; + } + default: { + throw new NotImplementedException(workMode.name()); + } + + } + return url; + } + + public static void setDevUrl(UserRoleEnum role) { + String url = SetupCDTest.devUrl; + switch (role) { + case ADMIN: { + url = "http://localhost:8181/sdc1/proxy-admin1#/dashboard"; + break; + } + case DESIGNER: { + url = "http://localhost:8181/sdc1/proxy-designer1#/dashboard"; + // url = "http://localhost:9000/#/dashboard"; + break; + } + case GOVERNOR: { + url = "http://localhost:8181/sdc1/proxy-governor1#/dashboard"; + break; + } + case OPS: { + url = "http://localhost:8181/sdc1/proxy-ops1#/dashboard"; + break; + } + case TESTER: { + url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard"; + break; + } + default: { + break; + } + } + SetupCDTest.devUrl = url; + } + + public static Config getConfig() { + return config; + } + + private User user; + + public void loginWithUser(UserRoleEnum role) { + + setUser(role); + String url = getUrl(); + System.out.println("URL is : " + url); + try { + navigateToUrl(url); + if (url.contains("https://www.e-access")) { + System.out.println("going to update designer user to mechIDs form..."); + UserCredentials credentials = getUserCredentialsFromFile(role.name().toLowerCase()); + loginToSystem(credentials); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void setUser(UserRoleEnum role) { + user = new User(); + user.setUserId(role.getUserId()); + user.setFirstName(role.getFirstName()); + user.setRole(role.name()); + } + + /** + * Current User Role + * + * @return + */ + public UserRoleEnum getRole() { + return UserRoleEnum.DESIGNER; + } + + /** + * To change clean type update configuration.<br> + * Do not override this method. + * + * @return + */ + protected final CleanTypeEnum getCleanMode() { + return cleanType; + } + + public User getUser() { + return user; + } + + protected void quitAndReLogin(UserRoleEnum role) { + quitAfterTest(); + setBrowserBeforeTest(role); + GeneralUIUtils.waitForLoader(30); + } + + public TitanSnapshot getSnapshot() { + return snapshot; + } + + public void setSnapshot(TitanSnapshot snapshot) { + this.snapshot = snapshot; + } + + public static TitanGraph getTitanGraph() { + return titanGraph; + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceBasicTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceBasicTests.java new file mode 100644 index 0000000000..e42de862b7 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceBasicTests.java @@ -0,0 +1,147 @@ +package org.openecomp.sdc.uici.tests.execute.service; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.Arrays; + +import org.apache.http.HttpStatus; +import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; +import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.uici.tests.utilities.FileHandling; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; +import org.openecomp.sdc.uici.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.uici.tests.verificator.ServiceVerificator; +import org.openecomp.sdc.uici.tests.verificator.VfVerificator; +import org.openqa.selenium.WebElement; +import org.testng.annotations.Test; + +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; + +public class ServiceBasicTests extends SetupCDTest { + + @Test + public void testCreateService() { + ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); + ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); + } + + @Test + public void testLinkTwoRI() { + + // create 1st VF + ResourceReqDetails resourceOne = ResourceUIUtils.createResourceInUI(getUser()); + assertTrue(RestCDUtils.getResource(resourceOne).getErrorCode() == HttpStatus.SC_OK); + // add LoadBalancer to resource + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + canvasManager.createElementOnCanvas(LeftPanelCanvasItems.OBJECT_STORAGE); + GeneralUIUtils.checkIn(); + + // create 2nd VF + ResourceReqDetails resourceTwo = ResourceUIUtils.createResourceInUI(getUser()); + assertTrue(RestCDUtils.getResource(resourceTwo).getErrorCode() == HttpStatus.SC_OK); + // add ObjectStorage to resource + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + canvasManager = CanvasManager.getCanvasManager(); + canvasManager.createElementOnCanvas(LeftPanelCanvasItems.LOAD_BALANCER); + GeneralUIUtils.checkIn(); + + // create service + ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); + // Verify Service is Created + ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); + + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + canvasManager = CanvasManager.getCanvasManager(); + + // adding two resource instances + CanvasElement vfOne = canvasManager.createElementOnCanvas(resourceOne.getName()); + + CanvasElement vfTwo = canvasManager.createElementOnCanvas(resourceTwo.getName()); + // link elements + canvasManager.linkElements(vfOne, vfTwo); + + // check results + ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); + ServiceVerificator.verifyLinkCreated(createServiceInUI, getUser()); + + } + + /** + * This method tests the following: <br> + * 1. Import of VF <br> + * 2. Certification Of Vf <br> + * 3. Adding deployment artifact to VF <br> + * 4. Creation of Service <br> + * 5. Adding Vf instance to Service <br> + * 6. Service Certification <br> + * 7. Approving Service to distribution by Governor <br> + * 8. Making sure service is ready to distribute by ops <br> + */ + @Test + public void testBuildServiceForDistribution() { + ResourceReqDetails importedVf = ResourceUIUtils.importVfInUI(getUser(), FileHandling.getResourcesFilesPath(), + "valid_vf.csar"); + GeneralUIUtils.waitForLoader(20); + // Verify Import + VfVerificator.verifyResourceIsCreated(importedVf); + + // Create Deployment Artifact + ArtifactUIUtils.createDeploymentArtifactOnVf(FileHandling.getResourcesFilesPath() + "myYang.xml", + ArtifactTypeEnum.YANG_XML); + VfVerificator.verifyResourceContainsDeploymentArtifacts(importedVf, + Arrays.asList(new ArtifactTypeEnum[] { ArtifactTypeEnum.YANG_XML })); + + // Submit For Testing Process VF + GeneralUIUtils.submitForTestingElement(importedVf.getName()); + + // Certify The VF + quitAndReLogin(UserRoleEnum.TESTER); + ResourceUIUtils.testAndAcceptElement(importedVf); + + // Verify Certification + GeneralUIUtils.waitForLoader(); + VfVerificator.verifyResourceIsCertified(importedVf); + + // Create Service + quitAndReLogin(UserRoleEnum.DESIGNER); + ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); + ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); + + // Drag the VF To the Service + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + canvasManager.createElementOnCanvas(importedVf.getName()); + + // Submit For Testing Process Service + GeneralUIUtils.submitForTestingElement(null); + + // Certify The Service + quitAndReLogin(UserRoleEnum.TESTER); + ResourceUIUtils.testAndAcceptElement(createServiceInUI); + ServiceVerificator.verifyServiceCertified(createServiceInUI, getUser()); + + // Approve with governor + quitAndReLogin(UserRoleEnum.GOVERNOR); + ServiceUIUtils.approveServiceForDistribution(createServiceInUI); + + // Log in with Ops and verify that can distribute + quitAndReLogin(UserRoleEnum.OPS); + GeneralUIUtils.getWebElementWaitForVisible(createServiceInUI.getName()).click(); + WebElement distributeWebElement = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.DISTRIBUTE.getValue()); + assertTrue(distributeWebElement != null); + + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceInputsTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceInputsTests.java new file mode 100644 index 0000000000..b3e8e023ca --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/service/ServiceInputsTests.java @@ -0,0 +1,124 @@ +package org.openecomp.sdc.uici.tests.execute.service; + +import static org.testng.AssertJUnit.assertTrue; +import static org.testng.AssertJUnit.assertFalse; + +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; +import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.BreadcrumbsButtonsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.InputsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.ModalItems; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.FileHandling; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.uici.tests.utilities.ServiceUIUtils; +import org.openecomp.sdc.uici.tests.verificator.ServiceVerificator; +import org.testng.annotations.Test; + +public class ServiceInputsTests extends SetupCDTest { + + public String serviceName = ""; + + @Test + private void testSelectingInputAndAddingItToTheService() { + ServiceInputsTestsSetUp(); + + assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + assertTrue(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); + } + + @Test + private void testDeletingAnInputFromTheService() { + ServiceInputsTestsSetUp(); + + // clicking on the delete input button and accepting the delete + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.DELETE_INPUT.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(ModalItems.OK.getValue()).click(); + + assertFalse(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + assertFalse(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); + } + + @Test + private void testCheckingInTheServiceAndButtonsAreDisabled() throws Exception { + ServiceInputsTestsSetUp(); + + // Checking in the service and accessing it again in the home + GeneralUIUtils.checkIn(); + GeneralUIUtils.closeNotificatin(); + GeneralUIUtils.findComponentAndClick(serviceName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INPUTS); + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.VF_INSTANCE.getValue()).click(); + + assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.SECOND_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.DELETE_INPUT.getValue()).getAttribute("class").contains("disabled")); + } + + @Test + private void testInputsSanity() throws Exception { + ServiceInputsTestsSetUp(); + + assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + assertTrue(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); + + // clicking on the delete input button and accepting the delete + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.DELETE_INPUT.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(ModalItems.OK.getValue()).click(); + + assertFalse(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + assertFalse(GeneralUIUtils.isElementPresent(InputsEnum.SERVICE_INPUT.getValue())); + + // adding the input to the service again + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.ADD_INPUTS_BUTTON.getValue()).click(); + + // Checking in the service and accessing it again in the home + GeneralUIUtils.checkIn(); + GeneralUIUtils.closeNotificatin(); + GeneralUIUtils.findComponentAndClick(serviceName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INPUTS); + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.VF_INSTANCE.getValue()).click(); + + assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + assertTrue(GeneralUIUtils.getWebElementWaitForVisible(InputsEnum.SECOND_INPUT_CHECKBOX.getValue()).getAttribute("class").contains("disabled")); + } + + private void ServiceInputsTestsSetUp() { + // create vf + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "service_with_inputs.csar"; + ResourceReqDetails importVfREsourceInUI = ResourceUIUtils.importVfInUIWithoutCheckin(getUser(), filePath, fileName); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.closeNotificatin(); + GeneralUIUtils.checkIn(); + GeneralUIUtils.closeNotificatin(); + + // create service + ServiceReqDetails createServiceInUI = ServiceUIUtils.createServiceInUI(getUser()); + ServiceVerificator.verifyServiceCreated(createServiceInUI, getUser()); + serviceName = createServiceInUI.getName(); + + // go to composition + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + + // drag vf into canvas + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement canvasElement = canvasManager.createElementOnCanvas(importVfREsourceInUI.getName()); + canvasManager.selectElementFromCanvas(canvasElement); + GeneralUIUtils.waitForLoader(); + + // moving to inputs view + GeneralUIUtils.getWebElementWaitForClickable(BreadcrumbsButtonsEnum.COMPONENT.getValue()).click(); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INPUTS); + + // adding the input to the service + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.VF_INSTANCE.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.FIRST_INPUT_CHECKBOX.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(InputsEnum.ADD_INPUTS_BUTTON.getValue()).click(); + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfBasicTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfBasicTests.java new file mode 100644 index 0000000000..918ac934c6 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfBasicTests.java @@ -0,0 +1,234 @@ +package org.openecomp.sdc.uici.tests.execute.vf; + +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnException; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; + +import java.io.IOException; +import java.util.Map; + +import org.apache.http.HttpStatus; +import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; +import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.ArtifactUIUtils; +import org.openecomp.sdc.uici.tests.utilities.FileHandling; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; +import org.openecomp.sdc.uici.tests.verificator.VfVerificator; +import org.testng.annotations.Test; + +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ResourceRespJavaObject; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.general.Convertor; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; + +public class VfBasicTests extends SetupCDTest { + + @Test + public void testImportVfTableColumns() { + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.OPEN_MODAL_BUTTON.getValue()).click(); + + assertTrue(GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.VENDOR_HEADER_COL.getValue()) != null); + assertTrue(GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.NAME_HEADER_COL.getValue()) != null); + assertTrue(GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.CATEGORY_HEADER_COL.getValue()) != null); + + assertTrue(GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.VERSION_HEADER_COL.getValue()) != null); + } + + @Test + public void testUpdateVfCreatedFromCsar() throws Exception { + // create vf + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "Sample_CSAR.csar"; + ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfInUIWithoutCheckin(getUser(), filePath, + fileName); + // update csar + fileName = "Sample_CSAR2.csar"; + ResourceUIUtils.updateVfCsar(filePath, fileName); + VfVerificator.verifyNumOfComponentInstances(importVfResourceInUI, 4); + } + + @Test + public void testImportVf() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "Sample_CSAR.csar"; + ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfInUI(getUser(), filePath, fileName); + GeneralUIUtils.waitForLoader(); + assertTrue(RestCDUtils.getResource(importVfResourceInUI).getErrorCode() == HttpStatus.SC_OK); + } + + @Test + public void testCreateVf() { + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + assertTrue(RestCDUtils.getResource(createResourceInUI).getErrorCode() == HttpStatus.SC_OK); + } + + @Test + public void testDeleteInstanceFromCanvas() { + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + + canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); + CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 2); + canvasManager.deleteElementFromCanvas(computeElement); + VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 1); + + } + + @Test + public void testUpdateInstanceAttributeValue() { + // creare vfc with attrs + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.checkIn(); + // create vf + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + // add vfc to canvas + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement canvasElement = canvasManager.createElementOnCanvas(importVfcResourceInUI.getName()); + canvasManager.selectElementFromCanvas(canvasElement); + // edit value of vfc attr + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.RightBar.PROPERTIES_AND_ATTRIBUTES.getValue()) + .click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.RightBar.MYATTR_ATTR_FROM_LIST.getValue()).click(); + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DEFAULT_VAL_FIELD.getValue()) + .sendKeys("2"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DONE_BUTTON.getValue()).click(); + String newValue = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.RightBar.MYATTR_ATTR_VALUE_FROM_LIST.getValue()).getText(); + assertEquals("2", newValue); + } + + @Test(enabled = false) + public void testAddInfomratinalArtifact() throws Exception { + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.INFORMATION_ARTIFACT); + + ArtifactReqDetails informationalArtifact = ElementFactory.getDefaultArtifact(); + final String FILE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\Files\\"; + final String FILE_NAME = "Valid_tosca_Mycompute.yml"; + + ArtifactUIUtils.addInformationArtifact(informationalArtifact, FILE_PATH + FILE_NAME, + DataTestIdEnum.InformationalArtifatcs.FEATURES); + ArtifactUIUtils.addInformationArtifact(informationalArtifact, FILE_PATH + FILE_NAME, + DataTestIdEnum.InformationalArtifatcs.CAPACITY); + + RestResponse getResourceResponse = RestCDUtils.getResource(createResourceInUI); + assertEquals("Did not succeed to get resource after create", HttpStatus.SC_OK, + getResourceResponse.getErrorCode().intValue()); + + Map<String, Map<String, Object>> artifactsListFromResponse = ArtifactUIUtils + .getArtifactsListFromResponse(getResourceResponse.getResponse(), "artifacts"); + Map<String, Object> map = artifactsListFromResponse.get("Features"); + + assertTrue(artifactsListFromResponse.size() >= 2); + + } + + @Test + public void testVfCertification() throws IOException { + // Create VF + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + assertTrue(RestCDUtils.getResource(createResourceInUI).getErrorCode() == HttpStatus.SC_OK); + + // Submit For Testing Process + GeneralUIUtils.submitForTestingElement(createResourceInUI.getName()); + + // Tester + quitAndReLogin(UserRoleEnum.TESTER); + ResourceUIUtils.testAndAcceptElement(createResourceInUI); + + // Verification + GeneralUIUtils.waitForLoader(); + VfVerificator.verifyResourceIsCertified(createResourceInUI); + + } + + @Test + public void testDeploymentArtifactForVFi() { + User user = getUser(); + // create vf + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(user); + GeneralUIUtils.checkIn(); + GeneralUIUtils.waitForLoader(); + // create service + GeneralUIUtils.clickOnCreateEntityFromDashboard(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()); + ResourceUIUtils.defineResourceName("serv"); + GeneralUIUtils.defineDescription("description"); + GeneralUIUtils.waitForLoader(); + ResourceUIUtils.defineResourceCategory("Mobility", "selectGeneralCategory"); + ResourceUIUtils.defineProjectCode("012345"); + GeneralUIUtils.clickSaveButton(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + GeneralUIUtils.waitForLoader(); + // add vf to canvas + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement canvasElement = canvasManager.createElementOnCanvas(createResourceInUI.getName()); + canvasManager.selectElementFromCanvas(canvasElement); + GeneralUIUtils.waitForLoader(); + // add artifact + GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.RightBar.DEPLOYMENT_ARTIFACTS.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.RightBar.ADD_ARTIFACT_BUTTON.getValue()).click(); + String newArtifactLabel = "newArtifact"; + ArtifactReqDetails details = new ArtifactReqDetails("new_atifact", "DCAE_INVENTORY_EVENT", "desc", "", + newArtifactLabel); + ResourceUIUtils.fillinDeploymentArtifactFormAndClickDone(details, + FileHandling.getResourcesFilesPath() + "yamlSample.yml"); + assertTrue(GeneralUIUtils.isElementPresent("artifact_Display_Name-" + newArtifactLabel)); + // edit artifact + GeneralUIUtils.getWebElementWaitForClickable("artifact_Display_Name-" + newArtifactLabel).click(); + String newFileName = "yamlSample2.yml"; + retryMethodOnException( + () -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.GeneralSection.BROWSE_BUTTON.getValue()) + .sendKeys(FileHandling.getResourcesFilesPath() + newFileName)); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DONE.getValue()).click(); + GeneralUIUtils.waitForLoader(); + assertEquals(newFileName, + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.RightBar.ARTIFACT_NAME.getValue()).getText()); + // delete artifact + GeneralUIUtils.moveToHTMLElementByDataTestId("artifact_Display_Name-" + newArtifactLabel); + GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.RightBar.DELETE_ARTIFACT_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.waitForLoader(); + assertTrue(!GeneralUIUtils.isElementPresent("artifact_Display_Name-" + newArtifactLabel)); + } + + protected ArtifactReqDetails defineInformationalArtifact() throws IOException, Exception { + return ElementFactory.getDefaultArtifact(); + } + + protected ResourceRespJavaObject buildResourceJavaObject(ResourceReqDetails resource, RestResponse restResponse, + User user) { + ResourceRespJavaObject resourceObject = new ResourceRespJavaObject(); + resourceObject = Convertor.constructFieldsForRespValidation(resource, resource.getVersion(), user); + resourceObject.setLifecycleState((LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT).toString()); + resourceObject.setAbstractt("false"); + resourceObject.setIcon(resource.getIcon().replace(" ", "")); + resourceObject.setUniqueId(ResponseParser.getUniqueIdFromResponse(restResponse)); + return resourceObject; + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfCanvasTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfCanvasTests.java new file mode 100644 index 0000000000..73b09666ae --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfCanvasTests.java @@ -0,0 +1,80 @@ +package org.openecomp.sdc.uici.tests.execute.vf; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.uici.tests.datatypes.CanvasElement; +import org.openecomp.sdc.uici.tests.datatypes.CanvasManager; +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.uici.tests.verificator.VfVerificator; +import org.testng.annotations.Test; + +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; + +public class VfCanvasTests extends SetupCDTest { + + @Test + public void testCanvasDrag() { + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement createElementOnCanvas = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); + + ImmutablePair<String, String> preMovePos = ResourceUIUtils.getRIPosition(createResourceInUI, getUser()); + + canvasManager.moveElementOnCanvas(createElementOnCanvas); + + VfVerificator.verifyRILocationChanged(createResourceInUI, preMovePos, getUser()); + + } + + @Test + public void testCanvasConnectComponents() { + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + CanvasElement bsElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); + CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + + canvasManager.linkElements(bsElement, computeElement); + + VfVerificator.verifyLinkCreated(createResourceInUI); + + } + + @Test + public void testCanvasVFSanity() { + ResourceReqDetails createResourceInUI = ResourceUIUtils.createResourceInUI(getUser()); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.COMPOSITION); + CanvasManager canvasManager = CanvasManager.getCanvasManager(); + + CanvasElement bsElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); + CanvasElement compElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE); + + ImmutablePair<String, String> preMovePos = ResourceUIUtils.getRIPosition(createResourceInUI, getUser()); + canvasManager.moveElementOnCanvas(bsElement); + canvasManager.moveElementOnCanvas(compElement); + + VfVerificator.verifyRILocationChanged(createResourceInUI, preMovePos, getUser()); + + CanvasElement bsElement2 = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.BLOCK_STORAGE); + + canvasManager.linkElements(bsElement2, compElement); + + VfVerificator.verifyLinkCreated(createResourceInUI); + + VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 3); + + canvasManager.moveElementOnCanvas(compElement); + + canvasManager.deleteElementFromCanvas(bsElement); + + VfVerificator.verifyNumOfComponentInstances(createResourceInUI, 2); + + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfDeploymentTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfDeploymentTests.java new file mode 100644 index 0000000000..47344b7c68 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfDeploymentTests.java @@ -0,0 +1,340 @@ +package org.openecomp.sdc.uici.tests.execute.vf; + +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertTrue; + +import java.io.IOException; +import java.util.regex.Pattern; + +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.FileHandling; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; +import org.openqa.selenium.WebElement; +import org.testng.annotations.Test; + +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; + +public class VfDeploymentTests extends SetupCDTest { + + // *****************************EditNamePopoverTests*****************************// + @Test + public void ClickingOnEditNamePopoverIconShouldOpenTheEditNamePopoverForm() { + EditNamePopoverTestsSetUp(); + + assertTrue(GeneralUIUtils.isElementPresent(DataTestIdEnum.UpdateNamePopover.POPOVER_FORM.getValue())); + } + + @Test + public void ModuleDataShouldBeDisplayedInTheEditNameForm() { + EditNamePopoverTestsSetUp(); + + WebElement instanceName = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_INSTANCE_NAME.getValue()); + WebElement heatName = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()); + WebElement moduleName = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_MODULE_NAME.getValue()); + + String moduleNameToDivide = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); + + String[] dividedModuleName = moduleNameToDivide.split(Pattern.quote("..")); + + assertEquals(dividedModuleName[0], instanceName.getText()); + assertEquals(dividedModuleName[1], heatName.getAttribute("value")); + assertEquals(dividedModuleName[2], moduleName.getText()); + + } + + @Test + public void CloseButtonShouldCloseThePopover() { + EditNamePopoverTestsSetUp(); + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_CLOSE_BUTTON.getValue()) + .click(); + + assertFalse(GeneralUIUtils.isElementPresent(DataTestIdEnum.UpdateNamePopover.POPOVER_FORM.getValue())); + } + + @Test + public void XButtonShouldCloseThePopover() { + EditNamePopoverTestsSetUp(); + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_X_BUTTON.getValue()) + .click(); + + assertFalse(GeneralUIUtils.isElementPresent(DataTestIdEnum.UpdateNamePopover.POPOVER_FORM.getValue())); + } + + @Test + public void SaveButtonShouldBeDisabledWhileTheNameHasNotBeenChanged() { + EditNamePopoverTestsSetUp(); + + WebElement popoverSaveButton = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_SAVE_BUTTON.getValue()); + + assertTrue(popoverSaveButton.getAttribute("class").contains("disabled")); + } + + @Test + public void ClickingOnTheSaveButtonShouldUpdateTheModuleName() { + EditNamePopoverTestsSetUp(); + + String newName = "testName"; + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()) + .clear(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()) + .sendKeys(newName); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_SAVE_BUTTON.getValue()) + .click(); + + GeneralUIUtils.waitForLoader(); + + String moduleName = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); + + String[] dividedModuleName = moduleName.split(Pattern.quote("..")); + + assertEquals(dividedModuleName[1], newName); + } + + @Test + public void testUpdateModuleNameSanity() { + EditNamePopoverTestsSetUp(); + + String newName = "testName"; + + WebElement instanceName = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_INSTANCE_NAME.getValue()); + WebElement heatName = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_HEAT_NAME.getValue()); + WebElement moduleName = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_MODULE_NAME.getValue()); + + String moduleNameToDivide = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); + + String[] dividedModuleName = moduleNameToDivide.split(Pattern.quote("..")); + + assertEquals(dividedModuleName[0], instanceName.getText()); + assertEquals(dividedModuleName[1], heatName.getAttribute("value")); + assertEquals(dividedModuleName[2], moduleName.getText()); + + WebElement popoverSaveButton = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.POPOVER_SAVE_BUTTON.getValue()); + + assertTrue(popoverSaveButton.getAttribute("class").contains("disabled")); + + heatName.clear(); + heatName.sendKeys(newName); + + popoverSaveButton.click(); + + GeneralUIUtils.waitForLoader(); + + moduleNameToDivide = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).getText(); + dividedModuleName = moduleNameToDivide.split(Pattern.quote("..")); + + assertEquals(dividedModuleName[1], newName); + } + + // *****************************DeploymentTabsTests*****************************// + + @Test + public void testTabIsBeingDisplayedAtDeploymentView() { + DeploymentTestsSetUp(); + + assertTrue(GeneralUIUtils.isElementPresent(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue())); + } + + @Test + public void testClickingOnTabSetsItAsSelected() { + DeploymentTestsSetUp(); + + WebElement hierarchyTab = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()); + hierarchyTab.click(); + + assertTrue(hierarchyTab.getAttribute("class").contains("selected")); + } + + @Test + public void testTabNameIsBeingDisplayedInTheSelectedTabHeader() { + DeploymentTestsSetUp(); + + // select the hierarchy tab and check the header + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); + WebElement tabHeader = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.TAB_HEADER.getValue()); + + assertEquals(tabHeader.getText(), "HIERARCHY"); + } + + @Test + public void testSelectingModuleNameInTheHierarchyTabShouldSelectIt() { + DeploymentTestsSetUp(); + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); + WebElement hierarchyModule = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE_TITLE.getValue()); + + hierarchyModule.click(); + + assertTrue(hierarchyModule.getAttribute("class").contains("selected")); + } + + @Test + public void testSelectingModuleNameInTheHierarchyTabShouldExpandIt() { + DeploymentTestsSetUp(); + + // select hierarchy tab + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); + WebElement hierarchyModule = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); + + hierarchyModule.click(); + + assertTrue(hierarchyModule.getAttribute("class").contains("expanded")); + } + + @Test + public void testSelectingModuleNameInTheHierarchyTabShouldDisplayItsData() { + DeploymentTestsSetUp(); + + // select hierarchy tab + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).click(); + + assertTrue(GeneralUIUtils.isElementPresent(DataTestIdEnum.TabsBar.HIERARCHY_SELECTED_MODULE_DATA.getValue())); + } + + @Test(enabled = false) + public void testResourceNameIsBeingDisplayedInTheSelectedTabSubHeader() { + DeploymentTestsSetUp(); + + // select the hierarchy tab and check the header + // WebElement tabSubHeader = + // getWebElement(DataTestIdEnum.TabsBar.TAB_SUB_HEADER.getValue()); + + // assertEquals(tabSubHeader.getText(), vmmcCsar.getName()); + } + + @Test(enabled = false) + public void testSelectingModuleNameInTheHierarchyTabShouldDisplayItsInformation() throws IOException { + DeploymentTestsSetUp(); + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); + WebElement hierarchyModule = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); + + // get the module + // String component = RestCDUtils.getResource(vmmcCsar).getResponse(); + // TODO idana fix test + /* + * GroupDefinitionInfo module = getModuleById(component, + * hierarchyModule.getText()); + * + * hierarchyModule.click(); + * + * assertModuleDetails(module, hierarchyModule); + */ + + } + + @Test(enabled = false) + public void testSelectingModuleNameInTheHierarchyTabShouldDisplayItsArtifacts() throws IOException { + DeploymentTestsSetUp(); + + GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); + WebElement hierarchyModule = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); + + // TODO idana fix test + // Get the artifact from the module + /* + * String component = RestCDUtils.getResource(vmmcCsar, + * getUser()).getResponse(); GroupDefinitionInfo module = + * getModuleById(component, hierarchyModule.getText()); + * ArtifactDefinitionInfo artifact = module.getArtifacts().get(0); + * + * hierarchyModule.click(); + * + * assertModuleArtifactDetails(artifact); + */ + } + + @Test + public void testTabsViewSanity() throws IOException { + DeploymentTestsSetUp(); + + WebElement hierarchyTab = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()); + + assertTrue(hierarchyTab != null); + + hierarchyTab.click(); + + assertTrue(hierarchyTab.getAttribute("class").contains("selected")); + + WebElement tabHeader = GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.TAB_HEADER.getValue()); + WebElement tabSubHeader = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.TAB_SUB_HEADER.getValue()); + + assertEquals(tabHeader.getText(), "HIERARCHY"); + // assertEquals(tabSubHeader.getText(), vmmcCsar.getName()); + + WebElement hierarchyModule = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()); + WebElement hierarchyModuleTitle = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE_TITLE.getValue()); + hierarchyModule.click(); + WebElement selectedModuleData = GeneralUIUtils + .getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_SELECTED_MODULE_DATA.getValue()); + + assertTrue(hierarchyModuleTitle.getAttribute("class").contains("selected")); + assertTrue(hierarchyModule.getAttribute("class").contains("expanded")); + assertTrue(selectedModuleData.getAttribute("ng-if") != null); + // TODO idana fix test + /* + * String component = RestCDUtils.getResource(vmmcCsar, + * getUser()).getResponse(); GroupDefinitionInfo module = + * getModuleById(component, hierarchyModule.getText()); + * ArtifactDefinitionInfo artifact = module.getArtifacts().get(0); + * + * assertModuleDetails(module, hierarchyModule); + * + * assertModuleArtifactDetails(artifact); + */ + + } + + // ************************DeploymentTestsSetUpFunction************************// + + private void EditNamePopoverTestsSetUp() { + DeploymentTestsSetUp(); + + // clicking on a module and opening the edit name popover + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_TAB.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.TabsBar.HIERARCHY_MODULE.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.UpdateNamePopover.OPEN_POPOVER_ICON.getValue()) + .click(); + } + + private void DeploymentTestsSetUp() { + // import csar + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "vf_with_groups.csar"; + ResourceUIUtils.importVfInUI(getUser(), filePath, fileName); + + GeneralUIUtils.waitForLoader(20); + + // moving to deployment view + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.DEPLOYMENT); + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfOnboardingTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfOnboardingTests.java new file mode 100644 index 0000000000..a81d854630 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vf/VfOnboardingTests.java @@ -0,0 +1,63 @@ +package org.openecomp.sdc.uici.tests.execute.vf; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.OnboardUtility; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.testng.annotations.Test; + +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import com.google.gson.GsonBuilder; + +public class VfOnboardingTests extends SetupCDTest { + + @Test + public void testUpdateVfCreatedOnBoarding() { + // create vf + ResourceReqDetails importVfResourceInUI = ResourceUIUtils.importVfFromOnBoardingModalWithoutCheckin(getUser(), + "mock_vf"); + // update vf + ResourceUIUtils.updateVfCsarFromOnBoarding(); + } + + @Test + public void createVfsFromOnboarding() throws IOException { + String folderPath = "C:\\onboardingTest\\onBoardingZips"; + File folder = new File(folderPath); + File[] listOfFiles = folder.listFiles(); + List<String> zipFileNames = Arrays.asList(listOfFiles).stream().map(file -> file.getName()) + .filter(fileName -> fileName.endsWith(".zip")).collect(Collectors.toList()); + Map<String, String> filesSuccessMap = new HashMap<>(); + for (String fileName : zipFileNames) { + try { + createSingleVfFromOnboarding(folderPath, fileName); + filesSuccessMap.put(fileName, "SUCCESS"); + } catch (Exception e) { + filesSuccessMap.put(fileName, "FAIL"); + } + } + Path file = Paths.get("RunResults.txt"); + String stringDataModel = new GsonBuilder().setPrettyPrinting().create().toJson(filesSuccessMap); + Files.write(file, stringDataModel.getBytes()); + } + + private static void createSingleVfFromOnboarding(String filePath, String zipFileName) { + String userId = UserRoleEnum.DESIGNER.getUserId(); + OnboardUtility.createVfFromOnboarding(userId, zipFileName, filePath); + GeneralUIUtils.submitForTestingElement("Vf From Onboarding"); + + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vfc/VfcBasicTests.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vfc/VfcBasicTests.java new file mode 100644 index 0000000000..ef21e40c61 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/execute/vfc/VfcBasicTests.java @@ -0,0 +1,219 @@ +package org.openecomp.sdc.uici.tests.execute.vfc; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.List; +import java.util.function.Function; +import java.util.function.Supplier; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.http.HttpStatus; +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openecomp.sdc.uici.tests.utilities.FileHandling; +import org.openecomp.sdc.uici.tests.utilities.GeneralUIUtils; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; +import org.openecomp.sdc.uici.tests.verificator.VfVerificator; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.Select; +import org.testng.annotations.Test; + +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +public class VfcBasicTests extends SetupCDTest { + + @Test + public void testRequirementsAndCapabilitiesSectionOfVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "mycompute.yml"; + ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.REQUIREMENTS_AND_CAPABILITIES); + // all expected requirements + assertTrue("Not all expected requirements are displayed.", GeneralUIUtils.isElementPresent("dependency") && GeneralUIUtils.isElementPresent("local_storage")); + // filter requirements + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ReqAndCapabilitiesSection.SEARCH_BOX.getValue()).sendKeys("root"); + Supplier<Boolean> supplier = () -> !GeneralUIUtils.isElementPresent("local_storage"); + Function<Boolean, Boolean> resultVerifier = isNotPresent -> isNotPresent; + Boolean isFilteredRowNotPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); + assertTrue("The new property was not inserted to the properties table.", isFilteredRowNotPresent); + assertTrue("Filter problem.", GeneralUIUtils.isElementPresent("dependency") && isFilteredRowNotPresent); + // move to cap tab + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ReqAndCapabilitiesSection.CAP_TAB.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible("endpoint").click(); + GeneralUIUtils.getWebElementWaitForVisible("initiator").click(); + supplier = () -> GeneralUIUtils.isElementPresent(DataTestIdEnum.PropertyForm.FORM_CONTAINER.getValue()); + resultVerifier = isPresent -> isPresent; + Boolean isPopupOpen = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); + assertTrue("The update property popup was not opened.", isPopupOpen); + } + + @Test + public void testCreatePropertyTypeListForVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.PROPERTIES); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertiesSection.ADD_BUTTON.getValue()).click(); + // fill in fields + String newPropName = "listProperty"; + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.NAME_FIELD.getValue()).sendKeys(newPropName); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DESCRIPTION_FIELD.getValue()).sendKeys("desc"); + Select typeField = new Select(GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.TYPE_FIELD.getValue())); + typeField.selectByVisibleText("list"); + Select schemaTypeField = new Select(GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SCHEMA_FIELD.getValue())); + schemaTypeField.selectByVisibleText("string"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.LIST_TYPE_DEFAULT_VAL_FIELD.getValue()).sendKeys("first"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.ADD_ITEM_TO_LIST_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.LIST_TYPE_DEFAULT_VAL_FIELD.getValue()).sendKeys("second"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.ADD_ITEM_TO_LIST_BUTTON.getValue()).click(); + // save + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SAVE_BUTTON.getValue()).click(); + Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newPropName); + Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; + Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); + assertTrue("The new property was not inserted to the properties table.", isPresent); + } + + @Test + public void testCreatePropertyTypeMapForVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.PROPERTIES); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertiesSection.ADD_BUTTON.getValue()).click(); + // fill in fields + String newPropName = "mapProperty"; + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.NAME_FIELD.getValue()).sendKeys(newPropName); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DESCRIPTION_FIELD.getValue()).sendKeys("desc"); + Select typeField = new Select(GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.TYPE_FIELD.getValue())); + typeField.selectByVisibleText("map"); + Select schemaTypeField = new Select(GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SCHEMA_FIELD.getValue())); + schemaTypeField.selectByVisibleText("string"); + // insert item to map + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_KEY_FIELD_FOR_FIRST_ITEM.getValue()).sendKeys("key1"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_VALUE_FIELD_FOR_FIRST_ITEM.getValue()).sendKeys("val1"); + // insert item to map + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.ADD_ITEM_TO_MAP_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_KEY_FIELD_FOR_SECOND_ITEM.getValue()).sendKeys("key2"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.MAP_TYPE_DEFAULT_VAL_VALUE_FIELD_FOR_SECOND_ITEM.getValue()).sendKeys("val2"); + // delete item from map + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DELETE_FIRST_ITEM_FROM_MAP_BUTTON.getValue()).click(); + // save + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SAVE_BUTTON.getValue()).click(); + Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newPropName); + Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; + Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); + assertTrue("The new property was not inserted to the properties table.", isPresent); + } + + @Test + public void testCreatePropertyTypeDTForVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.PROPERTIES); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertiesSection.ADD_BUTTON.getValue()).click(); + // fill in fields + String newPropName = "dt"; + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.NAME_FIELD.getValue()).sendKeys(newPropName); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.DESCRIPTION_FIELD.getValue()).sendKeys("desc"); + Select typeField = new Select(GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.TYPE_FIELD.getValue())); + typeField.selectByValue("org.openecomp.datatypes.heat.contrail.network.rule.PortPairs"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.START_PORT_FIELD_FOR_PORT_PAIRS_DT.getValue()).sendKeys("first"); + // save + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.PropertyForm.SAVE_BUTTON.getValue()).click(); + Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newPropName); + Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; + Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); + assertTrue("The new property was not inserted to the properties table.", isPresent); + } + + @Test + public void testViewAttributesTabForVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); + + List<WebElement> attributesRows = GeneralUIUtils.getWebElementsListWaitForVisible(DataTestIdEnum.AttributesSection.TABLE_ROWS.getValue()); + assertTrue("There is not any row in the table.", !CollectionUtils.isEmpty(attributesRows)); + // display editable buttons + assertTrue("The Add button is not dispaly.", GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.ADD_BUTTON.getValue())); + assertTrue("The Edit button is not dispaly for 'network' attribute.", GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.EDIT_BUTTON_FOR_NETWORK_ATTR.getValue())); + assertTrue("The Remove button is not dispaly for 'network' attribute.", GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.DELETE_BUTTON_FOR_NETWORK_ATTR.getValue())); + // click checkin + GeneralUIUtils.checkIn(); + // enter again + GeneralUIUtils.getWebElementWaitForVisible(importVfcResourceInUI.getName()).click(); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); + // the editable buttons disappear + assertTrue("The Add button is not dispaly.", !GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.ADD_BUTTON.getValue())); + assertTrue("The Edit button is not dispaly for 'network' attribute.", !GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.EDIT_BUTTON_FOR_NETWORK_ATTR.getValue())); + assertTrue("The Remove button is not dispaly for 'network' attribute.", !GeneralUIUtils.isElementPresent(DataTestIdEnum.AttributesSection.DELETE_BUTTON_FOR_NETWORK_ATTR.getValue())); + } + + @Test + public void testCreateAttributeForVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributesSection.ADD_BUTTON.getValue()).click(); + // fill in fields + String newAttrName = "attr"; + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.NAME_FIELD.getValue()).sendKeys(newAttrName); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DESCRIPTION_FIELD.getValue()).sendKeys("desc"); + Select typeField = new Select(GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.TYPE_FIELD.getValue())); + typeField.selectByVisibleText("integer"); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DEFAULT_VAL_FIELD.getValue()).sendKeys("2"); + // click ok + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DONE_BUTTON.getValue()).click(); + Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent(newAttrName); + Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; + Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); + assertTrue("The new attribute was not inserted to the attributes table.", isPresent); + } + + @Test + public void testUpdateTypeForAttributeOfVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + VfVerificator.verifyResourceIsCreated(importVfcResourceInUI); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributesSection.EDIT_BUTTON_FOR_NETWORK_ATTR.getValue()).click(); + // fill in fields + Select typeField = new Select(GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.TYPE_FIELD.getValue())); + typeField.selectByVisibleText("float"); + // click ok + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributeForm.DONE_BUTTON.getValue()).click(); + Supplier<Boolean> supplier = () -> GeneralUIUtils.isElementPresent("float"); + Function<Boolean, Boolean> resultVerifier = isPresent -> isPresent; + Boolean isPresent = FunctionalInterfaces.retryMethodOnResult(supplier, resultVerifier); + assertTrue("The attribute type was not updated.", isPresent); + } + + @Test + public void testDeleteAttributeForVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "VFCWithAttributes.yml"; + ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.ATTRIBUTES); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.AttributesSection.DELETE_BUTTON_FOR_NETWORK_ATTR.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.waitForLoader(); + Boolean retryResult = FunctionalInterfaces.retryMethodOnResult(() -> !GeneralUIUtils.isElementPresent("networks"), boolResult -> boolResult); + assertTrue("The attribute is shown in the attributes table.", retryResult); + } + + @Test + public void testImportVfc() { + String filePath = FileHandling.getResourcesFilesPath(); + String fileName = "CP.yml"; + ResourceReqDetails importVfcResourceInUI = ResourceUIUtils.importVfcInUI(getUser(), filePath, fileName); + assertTrue(RestCDUtils.getResource(importVfcResourceInUI).getErrorCode() == HttpStatus.SC_OK); + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/run/StartTest.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/run/StartTest.java new file mode 100644 index 0000000000..8232738660 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/run/StartTest.java @@ -0,0 +1,394 @@ +package org.openecomp.sdc.uici.tests.run; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; +import org.testng.TestNG; + +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.utils.Utils; + +public class StartTest { + + public static long timeOfTest = 0; + + public static boolean debug = false; + + public static AtomicBoolean loggerInitialized = new AtomicBoolean(false); + + protected static Logger logger = null; + + public static void main(String[] args) { + // TODO ui-ci add jar building + String debugEnabled = System.getProperty("debug"); + if (debugEnabled != null && debugEnabled.equalsIgnoreCase("true")) { + debug = true; + } + System.out.println("Debug mode is " + (debug ? "enabled" : "disabled")); + + enableLogger(); + + Config config = null; + try { + config = Utils.getConfig(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if (config == null) { + logger.error("Failed to configuration file of ci tests."); + System.exit(1); + } + + TestNG testng = new TestNG(); + + List<String> suites = new ArrayList<String>(); + suites.add("testSuites/" + args[0]); + testng.setTestSuites(suites); + // testng.setUseDefaultListeners(true); + testng.setOutputDirectory("target/"); + + testng.run(); + + } + + public StartTest() { + logger = Logger.getLogger(StartTest.class.getName()); + } + + public static void enableLogger() { + + if (false == loggerInitialized.get()) { + + loggerInitialized.set(true); + + String log4jPropsFile = System.getProperty("log4j.configuration"); + if (System.getProperty("os.name").contains("Windows")) { + String logProps = "src/main/resources/ci/conf/log4j.properties"; + if (log4jPropsFile == null) { + System.setProperty("targetlog", "target/"); + log4jPropsFile = logProps; + } + + } + PropertyConfigurator.configureAndWatch(log4jPropsFile); + + } + } + + // public void start(List<String> packages, boolean exitOnFailure) { + // + // boolean success = true; + // StringBuilder results = new StringBuilder(); + //// Result result; + // + // if (packages == null) { + // return; + // } + // + //// for (String packageName : packages) { + //// //List<Class> classesForPackage = + // getClassesForPackage("org.openecomp.sdc.ci.tests.execute"); + //// List<Class> classesForPackage = getClassesForPackage(packageName); + //// if (classesForPackage != null && false == classesForPackage.isEmpty()) + // { + //// for (Class testUnit : classesForPackage) { + //// testClasses.add(testUnit); + //// } + //// } + //// } + //// + //// System.out.println(testClasses); + // + // // tsetClasses.add(LogValidatorTest.class); + // // tsetClasses.add(AttNorthboundTest.class); + // + //// results.append("<Html><head><style>th{background-color: gray;color: + // white;height: 30px;}td {color: black;height: 30px;}.fail + // {background-color: #FF5555;width: 100px;text-align: center;}.success + // {background-color: #00FF00;width: 100px;text-align: center;}.name {width: + // 200px;background-color: #F0F0F0;}.message {width: 300px;background-color: + // #F0F0F0;}</style></head><body>"); + // + // Calendar calendar = Calendar.getInstance(); + // timeOfTest = calendar.getTimeInMillis(); + // SimpleDateFormat date_format = new SimpleDateFormat( + // "MMM dd yyyy HH:mm:ss"); + // results.append("<br/><h2> This report generated on " + // + date_format.format(calendar.getTime()) + "</h2><br/>"); + // + // results.append("<table>"); + // addTableHead(results); + // + //// int size = testClasses.size(); + // int index = 0; + // + // int totalRunTests = 0; + // int totalFailureTests = 0; + // int totalIgnoreTests = 0; + // int numOfFailureClasses = 0; + // for (Class<? extends AttSdcTest> testClass : testClasses) { + // + // index ++; + // + // StringBuilder builder = new StringBuilder(); + // String str = + // "***************************************************************************"; + // builder.append(str + "\n"); + // String current = "class " + index + "/" + size + " failure(" + // + numOfFailureClasses + ") + RUNS(" + totalRunTests + ")" + // + " FAILURES(" + totalFailureTests + ") IGNORED(" + // + totalIgnoreTests + ")"; + // int interval = ((str.length() - current.length() - 2)/ 2); + // String substring = str.substring(0, interval); + // builder.append(substring + " " + current + " " + substring + "\n"); + // builder.append(str + "\n"); + // + // System.out.println(builder.toString()); + // + // logger.debug(builder.toString()); + // logger.debug("Going to run test class " + testClass.getName()); + // + // result = JUnitCore.runClasses(testClass); + // if (result.wasSuccessful() == false) { + // numOfFailureClasses++; + // } + // logger.debug("Test class " + testClass.getName() + " finished " + + // (result.wasSuccessful() ? "OK." : " WITH ERROR.")); + // List<Failure> failures = result.getFailures(); + // if (failures != null) { + // for (Failure failure : failures) { + // logger.error("Test class " + testClass.getName() + " failure test " + + // failure.getTestHeader() + "-" + failure.getTrace()); + // } + // } + // int runsPerClass = result.getRunCount(); + // int failuresPerClass = result.getFailureCount(); + // int ignoredPerClass = result.getIgnoreCount(); + // + // totalRunTests += runsPerClass; + // totalFailureTests += failuresPerClass; + // totalIgnoreTests += ignoredPerClass; + // + // logger.debug("class " + testClass.getName() + " Failed tests " + + // (failuresPerClass * 1.0) / runsPerClass * 100 + " %"); + // logger.debug("class " + testClass.getName() + " Ignored tests " + + // (ignoredPerClass * 1.0) / runsPerClass * 100 + " %"); + // + // + //// List<Failure> failures = result.getFailures(); + //// if (failures != null) { + //// for (Failure failure : failures) { + //// System.err.println("9999999999" + failure.getTestHeader()); + //// } + //// } + // + // addUnitTestResult(results, testClass, result); + // success &= result.wasSuccessful(); + // + // if (numOfFailureClasses > 0) { + // //if (exitOnFailure) { + // if (exitOnFailure) { + // break; + // } + // } + // } + // + // results.append("</table>"); + // results.append("<br/><h2> Tests Summary: </h2><br/>"); + // results.append("Total Runs : " + totalRunTests + "<br/>"); + // results.append("Total Failure : " + totalFailureTests + "<br/>"); + // results.append("Total: " + totalFailureTests + "/" + totalRunTests + + // "<br/>"); + // results.append("</html>"); + // + // FileUtils.writeToFile(Config.instance().getOutputFolder() + // + File.separator + Config.instance().getReportName(), + // results.toString()); + // + // if (!success) { + // System.out.println("FAILURE"); + // logger.error("Failure tests : " + ((totalFailureTests + totalIgnoreTests) + // * 1.0)/ (totalRunTests + totalIgnoreTests) + " %"); + // logger.error("Ignored tests : " + (totalIgnoreTests * 1.0)/ + // (totalRunTests + totalIgnoreTests) + " %"); + // System.exit(1); + // } + // + // System.out.println("SUCCESS"); + // } + + private List<Class> getClassesForPackage(String pkgname) { + + List<Class> classes = new ArrayList<Class>(); + + // Get a File object for the package + File directory = null; + String fullPath; + String relPath = pkgname.replace('.', '/'); + + // System.out.println("ClassDiscovery: Package: " + pkgname + + // " becomes Path:" + relPath); + + URL resource = ClassLoader.getSystemClassLoader().getResource(relPath); + + // System.out.println("ClassDiscovery: Resource = " + resource); + if (resource == null) { + throw new RuntimeException("No resource for " + relPath); + } + fullPath = resource.getFile(); + // System.out.println("ClassDiscovery: FullPath = " + resource); + + if (debug) { + System.out.println("fullPath is " + fullPath); + } + + try { + directory = new File(resource.toURI()); + } catch (URISyntaxException e) { + throw new RuntimeException( + pkgname + " (" + resource + + ") does not appear to be a valid URL / URI. Strange, since we got it from the system...", + e); + } catch (IllegalArgumentException e) { + directory = null; + } + // System.out.println("ClassDiscovery: Directory = " + directory); + + if (directory != null && directory.exists()) { + + // Get the list of the files contained in the package + String[] files = directory.list(); + for (int i = 0; i < files.length; i++) { + + // we are only interested in .class files + if (files[i].endsWith(".class") && false == files[i].contains("$")) { + + // removes the .class extension + String className = pkgname + '.' + files[i].substring(0, files[i].length() - 6); + + // System.out.println("ClassDiscovery: className = " + + // className); + + if (debug) { + System.out.println("ClassDiscovery: className = " + className); + } + + try { + Class clas = Class.forName(className); + boolean isAddToRun = false; + Method[] methods = clas.getMethods(); + for (Method method : methods) { + Annotation[] anns = method.getAnnotations(); + for (Annotation an : anns) { + if (an.annotationType().getSimpleName().equalsIgnoreCase("Test")) { + isAddToRun = true; + break; + } + } + } + if (isAddToRun) + classes.add(clas); + } catch (ClassNotFoundException e) { + throw new RuntimeException("ClassNotFoundException loading " + className); + } + } + } + } else { + try { + String jarPath = fullPath.replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", ""); + + if (debug) { + System.out.println("jarPath is " + jarPath); + } + + JarFile jarFile = new JarFile(jarPath); + Enumeration<JarEntry> entries = jarFile.entries(); + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + String entryName = entry.getName(); + if (entryName.startsWith(relPath) && entryName.length() > (relPath.length() + "/".length())) { + + // System.out.println("ClassDiscovery: JarEntry: " + + // entryName); + String className = entryName.replace('/', '.').replace('\\', '.').replace(".class", ""); + + // System.out.println("ClassDiscovery: className = " + + // className); + + if (false == className.contains("$")) { + + if (debug) { + System.out.println("ClassDiscovery: className = " + className); + } + + try { + Class clas = Class.forName(className); + boolean isAddToRun = false; + Method[] methods = clas.getMethods(); + for (Method method : methods) { + Annotation[] anns = method.getAnnotations(); + for (Annotation an : anns) { + if (an.annotationType().getSimpleName().equalsIgnoreCase("Test")) { + isAddToRun = true; + break; + } + } + } + if (isAddToRun) + classes.add(clas); + } catch (ClassNotFoundException e) { + throw new RuntimeException("ClassNotFoundException loading " + className); + } + } + } + } + jarFile.close(); + + } catch (IOException e) { + throw new RuntimeException(pkgname + " (" + directory + ") does not appear to be a valid package", e); + } + } + return classes; + } + + private void addTableHead(StringBuilder results) { + results.append("<tr>"); + results.append("<th>").append("Unit Test").append("</th>"); + results.append("<th>").append("Result").append("</th>"); + results.append("</tr>"); + } + + // private void addUnitTestResult(StringBuilder results, + // Class<? extends AttSdcTest> testClass, Result unitTestResult) { + // + // boolean isSuccess = unitTestResult.wasSuccessful(); + // + // String result = (isSuccess) ? "success" : "fail"; + // String fileName = FileUtils.getFileName(testClass.getName()); + // results.append("<tr>"); + // // + // results.append("<td>").append(FileUtils.getFileName(testClass.getName())).append("</td>"); + // results.append("<td class=\"name\">") + // .append("<a href=\"" + fileName + timeOfTest + ".html\">" + // + fileName + "</a>").append("</td>"); + // results.append("<td class=\"" + result + "\">").append(result) + // .append("</td>"); + // results.append("</tr>"); + // } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ArtifactUIUtils.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ArtifactUIUtils.java new file mode 100644 index 0000000000..91c9c07da8 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ArtifactUIUtils.java @@ -0,0 +1,70 @@ +package org.openecomp.sdc.uici.tests.utilities; + +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnException; + +import java.util.Map; + +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.Artifatcs; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.InformationalArtifatcs; +import org.openqa.selenium.WebElement; + +import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +public final class ArtifactUIUtils { + + private ArtifactUIUtils() { + throw new UnsupportedOperationException(); + } + + public static void addInformationArtifact(ArtifactReqDetails artifact, String filePath, + final InformationalArtifatcs dataTestEnum) { + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.sleep(2000); + GeneralUIUtils.getWebElementWaitForVisible(dataTestEnum.getValue()).click(); + + final WebElement browseWebElement = FunctionalInterfaces.retryMethodOnException( + () -> GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue())); + browseWebElement.sendKeys(filePath); + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DESCRIPTION.getValue()) + .sendKeys(artifact.getDescription()); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DONE.getValue()).click(); + + } + + public static Map<String, Map<String, Object>> getArtifactsListFromResponse(String jsonResponse, + String fieldOfArtifactList) { + JSONObject object = (JSONObject) JSONValue.parse(jsonResponse); + Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object.get(fieldOfArtifactList); + return map; + } + + /** + * Creates a deployment artifact on the vf. <br> + * Moves automatically to DeploymentArtifact Section + * + * @param artifactPayloadPath + * @param artifactType + */ + public static void createDeploymentArtifactOnVf(final String artifactPayloadPath, + final ArtifactTypeEnum artifactType) { + GeneralUIUtils.moveToStep(CreateAndUpdateStepsEnum.DEPLOYMENT_ARTIFACT); + GeneralUIUtils.getWebElementWaitForClickable(Artifatcs.ADD_DEPLOYMENT_ARTIFACT.getValue()).click(); + GeneralUIUtils.getSelectList("Create New Artifact", Artifatcs.SELECT_ARTIFACT_DROPDOWN.getValue()); + GeneralUIUtils.getSelectList(artifactType.getType(), Artifatcs.ARTIFACT_TYPE_DROPDOWN.getValue()); + GeneralUIUtils.getWebElementWaitForVisible(Artifatcs.ARTIFACT_DESCRIPTION.getValue()) + .sendKeys("Artifact Description"); + GeneralUIUtils.getWebElementWaitForVisible(Artifatcs.ARTIFACT_LABEL.getValue()).sendKeys("MyArtifactLabel"); + retryMethodOnException(() -> GeneralUIUtils.getWebElementByDataTestId(Artifatcs.BROWSE_BUTTON.getValue()) + .sendKeys(artifactPayloadPath)); + GeneralUIUtils.getWebElementWaitForVisible(Artifatcs.ADD_BUTTON.getValue()).click(); + GeneralUIUtils.waitForLoader(); + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/FileHandling.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/FileHandling.java new file mode 100644 index 0000000000..b1549741ed --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/FileHandling.java @@ -0,0 +1,30 @@ +package org.openecomp.sdc.uici.tests.utilities; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.Map; + +import org.yaml.snakeyaml.Yaml; + +public class FileHandling { + + public static Map<?, ?> parseYamlFile(String filePath) throws FileNotFoundException { + Yaml yaml = new Yaml(); + File file = new File(filePath); + InputStream inputStream = new FileInputStream(file); + Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream); + return map; + } + + public static String getBasePath() { + return System.getProperty("user.dir"); + } + + public static String getResourcesFilesPath() { + return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources" + + File.separator + "Files" + File.separator; + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/GeneralUIUtils.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/GeneralUIUtils.java new file mode 100644 index 0000000000..4414499f69 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/GeneralUIUtils.java @@ -0,0 +1,346 @@ +package org.openecomp.sdc.uici.tests.utilities; + +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnException; +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnResult; +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.swallowException; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.function.Function; +import java.util.function.Supplier; + +import org.openecomp.sdc.uici.tests.datatypes.CreateAndUpdateStepsEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.Dashboard; +import org.openecomp.sdc.uici.tests.execute.base.SetupCDTest; +import org.openqa.selenium.By; +import org.openqa.selenium.Platform; +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.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.Select; +import org.openqa.selenium.support.ui.WebDriverWait; +import org.testng.Assert; + +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +public final class GeneralUIUtils { + + private static final int DEFAULT_WAIT_TIME_IN_SECONDS = 10; + /**************** DRIVERS ****************/ + private static WebDriver driver; + + private GeneralUIUtils() { + throw new UnsupportedOperationException(); + } + + /** + * Finding a component in the home screen by name and clicks on it + * Uses the search + * + * @param componentName + * @throws Exception + */ + public static void findComponentAndClick(String componentName) throws Exception { + getWebElementWaitForVisible("main-menu-input-search").sendKeys(componentName); + try { + getWebElementWaitForClickable(componentName).click(); + GeneralUIUtils.waitForLoader(); + getWebElementWaitForVisible("formlifecyclestate"); + } catch (Exception e) { + String msg = String.format("DID NOT FIND A COMPONENT NAMED %s", componentName); + System.out.println(msg); + Assert.fail(msg); + } + } + + public static WebElement getWebElementWaitForVisible(String dataTestId) { + return getWebElementWaitForVisible(dataTestId, DEFAULT_WAIT_TIME_IN_SECONDS); + } + + public static WebElement getWebElementWaitForVisible(String dataTestId, int time) { + WebDriverWait wait = new WebDriverWait(getDriver(), time); + ExpectedCondition<WebElement> visibilityOfElementLocated = ExpectedConditions + .visibilityOfElementLocated(builDataTestIdLocator(dataTestId)); + WebElement webElement = wait.until(visibilityOfElementLocated); + return webElement; + } + + public static WebElement getWebElementWaitForClickable(String dataTestId) { + WebDriverWait wait = new WebDriverWait(getDriver(), DEFAULT_WAIT_TIME_IN_SECONDS); + ExpectedCondition<WebElement> condition = ExpectedConditions + .elementToBeClickable(builDataTestIdLocator(dataTestId)); + WebElement webElement = wait.until(condition); + return webElement; + } + + private static By builDataTestIdLocator(String dataTestId) { + return By.xpath("//*[@data-tests-id='" + dataTestId + "']"); + + } + + /** + * Returns A list of Web Elements When they are all visible + * + * @param dataTestId + * @return + */ + public static List<WebElement> getWebElementsListWaitForVisible(String dataTestId) { + WebDriverWait wait = new WebDriverWait(getDriver(), DEFAULT_WAIT_TIME_IN_SECONDS); + ExpectedCondition<List<WebElement>> visibilityOfAllElementsLocatedBy = ExpectedConditions + .visibilityOfAllElementsLocatedBy(builDataTestIdLocator(dataTestId)); + return wait.until(visibilityOfAllElementsLocatedBy); + } + + /** + * @deprecated Do not use. use {@link #getWebElementWaitForVisible(String)} + * @param dataTestId + * @return + */ + public static WebElement getWebElementByDataTestId(String dataTestId) { + return driver.findElement(builDataTestIdLocator(dataTestId)); + } + + /** + * Checks if element is present with given dataTestsId + * + * @param dataTestId + * @return + */ + public static boolean isElementPresent(String dataTestId) { + final boolean isPresent = !driver.findElements(builDataTestIdLocator(dataTestId)).isEmpty(); + return isPresent; + } + + public static void clickOnCreateEntityFromDashboard(String buttonId) { + Supplier<WebElement> addVfButtonSipplier = () -> { + // TODO ui-ci replace with data-test-id + GeneralUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new"); + return GeneralUIUtils.getWebElementByDataTestId(buttonId); + }; + WebElement addVfButton = FunctionalInterfaces.retryMethodOnException(addVfButtonSipplier); + addVfButton.click(); + } + + // this function located select list by the data-test-id value and the item + // to be selected.. + public static Select getSelectList(String item, String dataTestId) { + Select selectlist = new Select(driver.findElement(builDataTestIdLocator(dataTestId))); + if (item != null) { + selectlist.selectByVisibleText(item); + } + return selectlist; + } + + // Define description area . + public static String defineDescription(String descriptionText) { + + WebElement resourceDescriptionTextbox = GeneralUIUtils.getWebElementWaitForVisible("description"); + resourceDescriptionTextbox.clear(); + resourceDescriptionTextbox.sendKeys(descriptionText); + + return descriptionText; + } + + /** + * Clicks on the create button waits for the create to finish and the check + * in button to appear + */ + public static void clickCreateButton() { + GeneralUIUtils.waitForLoader(); + getWebElementWaitForClickable(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()).click(); + GeneralUIUtils.waitForLoader(); + WebElement successNotification = driver.findElement(By.className("ui-notification")); + if (successNotification != null) { + successNotification.click(); + } + getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue()); + } + + public static void clickSaveButton() { + WebElement createButton = getWebElementWaitForClickable(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()); + createButton.click(); + } + + public static void closeNotificatin() { + WebElement notification = driver.findElement(By.className("ui-notification")); + if (notification != null) { + notification.click(); + } + } + public static void checkIn() { + waitForLoader(); + getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.CHECK_IN.getValue()).click(); + getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys("Check in !"); + getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + waitForLoader(); + } + + public static void moveToStep(CreateAndUpdateStepsEnum Stepname) { + waitForLoader(); + getWebElementWaitForClickable(Stepname.getValue()).click(); + waitForLoader(); + } + + public static void sleep(int duration) { + swallowException(() -> Thread.sleep(duration)); + } + + public static WebDriver getDriver() { + return driver; + } + + public static void initDriver() { + try { + System.out.println("opening browser"); + WebDriver webDriver; + boolean remoteTesting = SetupCDTest.config.isRemoteTesting(); + if (!remoteTesting) { + webDriver = new FirefoxDriver(); + } else { + String remoteEnvIP = SetupCDTest.config.getRemoteTestingMachineIP(); + String remoteEnvPort = SetupCDTest.config.getRemoteTestingMachinePort(); + DesiredCapabilities cap = new DesiredCapabilities(); + cap = DesiredCapabilities.firefox(); + cap.setPlatform(Platform.WINDOWS); + cap.setBrowserName("firefox"); + + String remoteNodeUrl = String.format(SetupCDTest.SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort); + webDriver = new RemoteWebDriver(new URL(remoteNodeUrl), cap); + + } + driver = webDriver; + + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + + } + + /** + * waits until either loader finishes or 10 seconds has passed.<br> + * If 10 seconds has passed and loader didn't finish throws + * LoaderStuckException.<br> + */ + public static void waitForLoader() { + waitForLoader(10); + } + + /** + * waits until either loader finishes or maxWaitTimeInSeconds has + * passed.<br> + * If maxWaitTimeInSeconds has passed and loader didn't finish throws + * LoaderStuckException.<br> + * + * @param maxWaitTimeInSeconds + */ + public static void waitForLoader(int maxWaitTimeInSeconds) { + long maxWaitTimeMS = maxWaitTimeInSeconds * 1000L; + Boolean loaderIsRunning = retryMethodOnResult( + () -> isElementPresent(DataTestIdEnum.GeneralSection.LOADER.getValue()), + isLoaderPresent -> !isLoaderPresent, maxWaitTimeMS, 50); + if (loaderIsRunning) { + throw new LoaderStuckException( + "UI Loader is stuck, max wait time of " + maxWaitTimeInSeconds + " seconds has passed."); + } + + } + + private static class LoaderStuckException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private LoaderStuckException(String message) { + super(message); + } + } + + /** + * Move to HTML element by class name. When moving to the HTML element, it + * will raise hover event. + * + * @param className + */ + public static void moveToHTMLElementByClassName(String className) { + Actions actions = new Actions(getDriver()); + final WebElement createButtonsArea = getDriver().findElement(By.className(className)); + actions.moveToElement(createButtonsArea).perform(); + } + + /** + * Move to HTML element by element id. When moving to the HTML element, it + * will raise hover event. + * + * @param className + */ + public static void moveToHTMLElementByDataTestId(String dataTestId) { + Actions actions = new Actions(getDriver()); + final WebElement createButtonsArea = getWebElementByDataTestId(dataTestId); + actions.moveToElement(createButtonsArea).perform(); + } + + public static void defineVendorName(String resourceVendorName) { + // TODO ui-ci replace with Enum + WebElement resourceVendorNameTextbox = getWebElementWaitForVisible("vendorName"); + resourceVendorNameTextbox.clear(); + resourceVendorNameTextbox.sendKeys(resourceVendorName); + } + + public static String defineUserId(String userId) { + // TODO ui-ci replace with Enum + WebElement resourceTagsTextbox = getWebElementWaitForVisible("userId"); + resourceTagsTextbox.clear(); + resourceTagsTextbox.sendKeys(userId); + return userId; + } + + public static void clickAddComponent(Dashboard componentType) { + Runnable clickAddTask = () -> { + // TODO ui-ci replace with data-test-id + moveToHTMLElementByClassName("w-sdc-dashboard-card-new"); + WebElement addVfButton = getWebElementByDataTestId(componentType.getValue()); + addVfButton.click(); + }; + retryMethodOnException(clickAddTask); + } + + /** + * This method perform submit for testing process for existing service or + * resource.<br> + * It assumes it is activated when in the resource screen and the Submit For + * Testing button is available. + * + * @param componentNameForMessage + * TODO + */ + public static void submitForTestingElement(String componentNameForMessage) { + waitForLoader(); + getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.SUBMIT_FOR_TESTING.getValue()).click(); + waitForLoader(); + getWebElementWaitForVisible(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue()) + .sendKeys("Submit for testing for " + componentNameForMessage); + waitForLoader(); + getWebElementWaitForClickable(DataTestIdEnum.ModalItems.OK.getValue()).click(); + waitForLoader(); + waitForElementToDisappear(DataTestIdEnum.ModalItems.OK.getValue()); + + } + + /** + * Waits Until elements disappears or until 10 seconds pass + * + * @param dataTestId + */ + public static void waitForElementToDisappear(String dataTestId) { + Supplier<Boolean> elementPresenseChecker = () -> GeneralUIUtils.isElementPresent(dataTestId); + Function<Boolean, Boolean> verifier = isElementPresent -> !isElementPresent; + FunctionalInterfaces.retryMethodOnResult(elementPresenseChecker, verifier); + + } + +}
\ No newline at end of file diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/MethodManipulationUtils.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/MethodManipulationUtils.java new file mode 100644 index 0000000000..28b39e86f3 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/MethodManipulationUtils.java @@ -0,0 +1,15 @@ +package org.openecomp.sdc.uici.tests.utilities; + +/** + * Class For manipulations on method + * + * @author mshitrit + * + */ +public final class MethodManipulationUtils { + + private MethodManipulationUtils() { + throw new IllegalAccessError(); + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/OnboardUtility.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/OnboardUtility.java new file mode 100644 index 0000000000..3d21539e86 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/OnboardUtility.java @@ -0,0 +1,477 @@ +package org.openecomp.sdc.uici.tests.utilities; + +import static org.testng.AssertJUnit.assertTrue; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.file.FileSystems; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; + +import javax.validation.constraints.AssertTrue; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.FileBody; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.json.JSONObject; +import org.junit.Test; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; + +import org.openecomp.sdc.ci.tests.config.Config; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.Utils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +/** + * Utility Class For Onboarding + * + * @author mshitrit + * + */ +public final class OnboardUtility { + + private OnboardUtility() { + throw new UnsupportedOperationException(); + } + + private static final class Constants { + private static final String VENDOR_SOFTWARE_PRODUCTS = "vendor-software-products"; + private static final String VENDOR_LICENSE_MODELS = "vendor-license-models"; + + private static final String VSP_ID = "vspId"; + private static final String VALUE = "value"; + + enum Actions { + CHECK_IN("Checkin"), SUBMIT("Submit"), CREATE_PACKAGE("Create_Package"); + + private String value; + + private Actions(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + }; + } + + /** + * @param heatFileName + * @param filepath + * @param userId + * @param vld + * @return + * @throws Exception + */ + public static void createVendorSoftwareProduct(String heatFileName, String filepath, String userId, + VendorLicenseDetails vld) { + RestResponse createNewVendorSoftwareProduct = FunctionalInterfaces + .swallowException(() -> createNewVendorSoftwareProduct(vld, userId)); + assertTrue(createNewVendorSoftwareProduct.getErrorCode() == HttpStatus.SC_OK); + String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), + Constants.VSP_ID); + + RestResponse response = FunctionalInterfaces + .swallowException(() -> uploadHeatPackage(filepath, heatFileName, vspid, userId)); + assertTrue(response.getErrorCode() == HttpStatus.SC_OK); + + response = actionOnComponent(vspid, Constants.Actions.CHECK_IN.getValue(), Constants.VENDOR_SOFTWARE_PRODUCTS, + userId); + assertTrue(response.getErrorCode() == HttpStatus.SC_OK); + + response = actionOnComponent(vspid, Constants.Actions.SUBMIT.getValue(), Constants.VENDOR_SOFTWARE_PRODUCTS, + userId); + assertTrue(response.getErrorCode() == HttpStatus.SC_OK); + + response = actionOnComponent(vspid, Constants.Actions.CREATE_PACKAGE.getValue(), + Constants.VENDOR_SOFTWARE_PRODUCTS, userId); + assertTrue(response.getErrorCode() == HttpStatus.SC_OK); + + } + + /** + * Contains Details Relevant to Vendor License + * + * @author mshitrit + * + */ + public static final class VendorLicenseDetails { + private final String vendorId; + private final String vendorLicenseName; + private final String vendorLicenseAgreementId; + private final String featureGroupId; + private final String vendorSoftwareProduct; + + private VendorLicenseDetails(String vendorId, String vendorLicenseName, String vendorLicenseAgreementId, + String featureGroupId) { + super(); + this.vendorId = vendorId; + this.vendorLicenseName = vendorLicenseName; + this.vendorLicenseAgreementId = vendorLicenseAgreementId; + this.featureGroupId = featureGroupId; + vendorSoftwareProduct = UUID.randomUUID().toString().split("-")[0]; + } + + public String getVendorId() { + return vendorId; + } + + public String getVendorLicenseName() { + return vendorLicenseName; + } + + public String getVendorLicenseAgreementId() { + return vendorLicenseAgreementId; + } + + public String getFeatureGroupId() { + return featureGroupId; + } + + public String getVendorSoftwareProduct() { + return vendorSoftwareProduct; + } + + } + + /** + * Creates Vendor License + * + * @param userId + * @return + * @throws Exception + */ + public static VendorLicenseDetails createVendorLicense(String userId) { + final String fieldNameValue = Constants.VALUE; + String vendorLicenseName = UUID.randomUUID().toString().split("-")[0]; + RestResponse vendorLicenseResponse = FunctionalInterfaces + .swallowException(() -> createVendorLicenseModels(vendorLicenseName, userId)); + assertTrue(vendorLicenseResponse.getErrorCode() == HttpStatus.SC_OK); + + String vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), fieldNameValue); + + RestResponse vendorKeyGroupsResponse = FunctionalInterfaces + .swallowException(() -> createVendorKeyGroups(vendorId, userId)); + assertTrue(vendorKeyGroupsResponse.getErrorCode() == HttpStatus.SC_OK); + String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), + fieldNameValue); + + RestResponse vendorEntitlementPool = FunctionalInterfaces + .swallowException(() -> createVendorEntitlementPool(vendorId, userId)); + assertTrue(vendorEntitlementPool.getErrorCode() == HttpStatus.SC_OK); + String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(), + fieldNameValue); + + RestResponse vendorLicenseFeatureGroups = FunctionalInterfaces.swallowException( + () -> createVendorLicenseFeatureGroups(vendorId, keyGroupId, entitlementPoolId, userId)); + assertTrue(vendorLicenseFeatureGroups.getErrorCode() == HttpStatus.SC_OK); + String featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), + fieldNameValue); + + RestResponse vendorLicenseAgreement = FunctionalInterfaces + .swallowException(() -> createVendorLicenseAgreement(vendorId, featureGroupId, userId)); + assertTrue(vendorLicenseAgreement.getErrorCode() == HttpStatus.SC_OK); + String vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(), + fieldNameValue); + + RestResponse actionOnComponent = actionOnComponent(vendorId, Constants.Actions.CHECK_IN.getValue(), + Constants.VENDOR_LICENSE_MODELS, userId); + assertTrue(actionOnComponent.getErrorCode() == HttpStatus.SC_OK); + + actionOnComponent = actionOnComponent(vendorId, Constants.Actions.SUBMIT.getValue(), + Constants.VENDOR_LICENSE_MODELS, userId); + assertTrue(actionOnComponent.getErrorCode() == HttpStatus.SC_OK); + + return new VendorLicenseDetails(vendorId, vendorLicenseName, vendorLicenseAgreementId, featureGroupId); + } + + private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, String userId) { + Config config = FunctionalInterfaces.swallowException(() -> Utils.getConfig()); + String url = String.format("http://%s:%s/onboarding-api/v1.0/%s/%s/actions", config.getCatalogBeHost(), + config.getCatalogBePort(), onboardComponent, vspid); + + JSONObject jObject = new JSONObject(); + FunctionalInterfaces.swallowException(() -> jObject.put("action", action)); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = FunctionalInterfaces + .swallowException(() -> http.httpSendPut(url, jObject.toString(), headersMap)); + return response; + } + + private static RestResponse createVendorLicenseModels(String name, String userId) throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(), + config.getCatalogBePort()); + + JSONObject jObject = new JSONObject(); + jObject.put("vendorName", name); + jObject.put("description", "new vendor license model"); + jObject.put("iconRef", "icon"); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); + return response; + + } + + private static RestResponse createVendorLicenseAgreement(String vspid, String featureGroupId, String userId) + throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/license-agreements", + config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + + JSONObject licenseTermpObject = new JSONObject(); + licenseTermpObject.put("choice", "Fixed_Term"); + licenseTermpObject.put("other", ""); + + JSONObject jObjectBody = new JSONObject(); + jObjectBody.put("name", "abc"); + jObjectBody.put("description", "new vendor license agreement"); + jObjectBody.put("requirementsAndConstrains", "abc"); + jObjectBody.put("licenseTerm", licenseTermpObject); + jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray()); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); + return response; + } + + private static RestResponse createVendorLicenseFeatureGroups(String vspid, String licenseKeyGroupId, + String entitlementPoolId, String userId) throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/feature-groups", + config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + + JSONObject jObject = new JSONObject(); + jObject.put("name", "xyz"); + jObject.put("description", "new vendor license feature groups"); + jObject.put("partNumber", "123abc456"); + jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray()); + jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray()); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); + return response; + + } + + private static RestResponse createVendorEntitlementPool(String vspid, String userId) throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/entitlement-pools", + config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + + JSONObject jEntitlementMetricObject = new JSONObject(); + jEntitlementMetricObject.put("choice", "CPU"); + jEntitlementMetricObject.put("other", ""); + + JSONObject jAggregationFunctionObject = new JSONObject(); + jAggregationFunctionObject.put("choice", "Peak"); + jAggregationFunctionObject.put("other", ""); + + JSONObject jOperationalScope = new JSONObject(); + jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray()); + jOperationalScope.put("other", ""); + + JSONObject jTimeObject = new JSONObject(); + jTimeObject.put("choice", "Hour"); + jTimeObject.put("other", ""); + + JSONObject jObjectBody = new JSONObject(); + jObjectBody.put("name", "def"); + jObjectBody.put("description", "new vendor license entitlement pool"); + jObjectBody.put("thresholdValue", "23"); + jObjectBody.put("thresholdUnits", "Absolute"); + jObjectBody.put("entitlementMetric", jEntitlementMetricObject); + jObjectBody.put("increments", "abcd"); + jObjectBody.put("aggregationFunction", jAggregationFunctionObject); + jObjectBody.put("operationalScope", jOperationalScope); + jObjectBody.put("time", jTimeObject); + jObjectBody.put("manufacturerReferenceNumber", "123aaa"); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); + return response; + } + + private static RestResponse createVendorKeyGroups(String vspid, String userId) throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/license-key-groups", + config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + + JSONObject jOperationalScope = new JSONObject(); + jOperationalScope.put("choices", Arrays.asList("Tenant").toArray()); + jOperationalScope.put("other", ""); + + JSONObject jObjectBody = new JSONObject(); + jObjectBody.put("name", "keyGroup"); + jObjectBody.put("description", "new vendor license key group"); + jObjectBody.put("operationalScope", jOperationalScope); + jObjectBody.put("type", "Universal"); + + Map<String, String> headersMap = prepareHeadersMap(userId); + + HttpRequest http = new HttpRequest(); + RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap); + return response; + } + + private static RestResponse createNewVendorSoftwareProduct(VendorLicenseDetails vld, String userId) + throws Exception { + Config config = Utils.getConfig(); + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products", + config.getCatalogBeHost(), config.getCatalogBePort()); + + JSONObject jlicensingDataObj = new JSONObject(); + jlicensingDataObj.put("licenseAgreement", vld.getVendorLicenseAgreementId()); + jlicensingDataObj.put("featureGroups", Arrays.asList(vld.getFeatureGroupId()).toArray()); + + JSONObject jObject = new JSONObject(); + jObject.put("name", vld.getVendorSoftwareProduct()); + jObject.put("description", "new VSP description"); + jObject.put("category", "resourceNewCategory.generic"); + jObject.put("subCategory", "resourceNewCategory.generic.database"); + jObject.put("licensingVersion", "1.0"); + jObject.put("vendorName", vld.getVendorLicenseName()); + jObject.put("vendorId", vld.getVendorId()); + jObject.put("icon", "icon"); + jObject.put("licensingData", jlicensingDataObj); + + Map<String, String> headersMap = prepareHeadersMap(userId); + HttpRequest http = new HttpRequest(); + + RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap); + + return response; + } + + private static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, String userId) + throws Exception { + Config config = Utils.getConfig(); + CloseableHttpResponse response = null; + + MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create(); + mpBuilder.addPart("resourceZip", new FileBody(getTestZipFile(filepath, filename))); + + String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/upload", + config.getCatalogBeHost(), config.getCatalogBePort(), vspid); + + Map<String, String> headersMap = prepareHeadersMap(userId); + headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data"); + + CloseableHttpClient client = HttpClients.createDefault(); + try { + HttpPost httpPost = new HttpPost(url); + RestResponse restResponse = new RestResponse(); + + Iterator<String> iterator = headersMap.keySet().iterator(); + while (iterator.hasNext()) { + String key = iterator.next(); + String value = headersMap.get(key); + httpPost.addHeader(key, value); + } + httpPost.setEntity(mpBuilder.build()); + response = client.execute(httpPost); + HttpEntity entity = response.getEntity(); + String responseBody = null; + if (entity != null) { + InputStream instream = entity.getContent(); + StringWriter writer = new StringWriter(); + IOUtils.copy(instream, writer); + responseBody = writer.toString(); + try { + + } finally { + instream.close(); + } + } + + restResponse.setErrorCode(response.getStatusLine().getStatusCode()); + restResponse.setResponse(responseBody); + + return restResponse; + + } finally { + closeResponse(response); + closeHttpClient(client); + + } + } + + private static void closeResponse(CloseableHttpResponse response) { + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + System.out.println(String.format("failed to close client or response: %s", e.getMessage())); + } + } + + private static void closeHttpClient(CloseableHttpClient client) { + try { + if (client != null) { + client.close(); + } + } catch (IOException e) { + System.out.println(String.format("failed to close client or response: %s", e.getMessage())); + } + } + + private static File getTestZipFile(String filepath, String filename) throws IOException { + Config config = Utils.getConfig(); + String sourceDir = config.getImportResourceTestsConfigDir(); + java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename); + return filePath.toFile(); + } + + protected static Map<String, String> prepareHeadersMap(String userId) { + Map<String, String> headersMap = new HashMap<String, String>(); + headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json"); + headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json"); + headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId); + return headersMap; + } + + public static void createVfFromOnboarding(String userID, String zipFile, String filepath) { + VendorLicenseDetails vld = createVendorLicense(userID); + createVendorSoftwareProduct(zipFile, filepath, userID, vld); + + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.OPEN_MODAL_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.ONBOARDING_SEARCH.getValue()) + .sendKeys(vld.getVendorSoftwareProduct()); + + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.sleep(1000); + GeneralUIUtils.getWebElementWaitForClickable(vld.getVendorSoftwareProduct()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.IMPORT_ICON.getValue()).click(); + GeneralUIUtils.getWebElementWaitForClickable(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()).click(); + GeneralUIUtils.waitForLoader(300); + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ResourceUIUtils.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ResourceUIUtils.java new file mode 100644 index 0000000000..477cc0c3bb --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ResourceUIUtils.java @@ -0,0 +1,299 @@ +package org.openecomp.sdc.uici.tests.utilities; + +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnException; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.Function; +import java.util.function.Supplier; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.Dashboard; +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum; +import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +public final class ResourceUIUtils { + public static final String RESOURCE_NAME_PREFIX = "ResourceCDTest-"; + protected static final boolean IS_BEFORE_TEST = true; + public static final String INITIAL_VERSION = "0.1"; + public static final String ICON_RESOURCE_NAME = "call_controll"; + protected static final String UPDATED_RESOURCE_ICON_NAME = "objectStorage"; + + private ResourceUIUtils() { + } + + public static void defineResourceName(String resourceName) { + + WebElement resourceNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("componentName")); + resourceNameTextbox.clear(); + resourceNameTextbox.sendKeys(resourceName); + } + + public static void defineResourceCategory(String category, String datatestsid) { + + GeneralUIUtils.getSelectList(category, datatestsid); + } + + public static void importFileWithSendKeyBrowse(String FilePath, String FileName) throws Exception { + WebElement browsebutton = GeneralUIUtils.getWebElementWaitForVisible("browseButton"); + browsebutton.sendKeys(FilePath + FileName); + } + + public static void defineTagsList(ResourceReqDetails resource, String[] resourceTags) { + List<String> taglist = new ArrayList<String>(); + ; + WebElement resourceTagsTextbox = GeneralUIUtils.getWebElementWaitForVisible("i-sdc-tag-input"); + for (String tag : resourceTags) { + resourceTagsTextbox.clear(); + resourceTagsTextbox.sendKeys(tag); + resourceTagsTextbox.sendKeys(Keys.ENTER); + taglist.add(tag); + } + resource.setTags(taglist); + } + + public static void defineVendorRelease(String resourceVendorRelease) { + + WebElement resourceVendorReleaseTextbox = GeneralUIUtils.getWebElementWaitForVisible("vendorRelease"); + resourceVendorReleaseTextbox.clear(); + resourceVendorReleaseTextbox.sendKeys(resourceVendorRelease); + } + + public static void defineProjectCode(String projectCode) { + + WebElement resourceNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("projectCode")); + resourceNameTextbox.clear(); + resourceNameTextbox.sendKeys(projectCode); + } + + public static void clickButton(String selectButton) { + + WebElement clickButton = GeneralUIUtils.getDriver() + .findElement(By.xpath("//*[@data-tests-id='" + selectButton + "']")); + clickButton.click(); + } + + public static WebElement Waitfunctionforbuttons(String element, int timeout) { + WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout); + return wait.until(ExpectedConditions.elementToBeClickable(By.xpath(element))); + } + + // coded by teddy + public static void fillGeneralInformationPage(ResourceReqDetails resource, User user) { + try { + resource.setContactId(user.getUserId()); + resource.setCreatorUserId(user.getUserId()); + resource.setCreatorFullName(user.getFullName()); + defineResourceName(resource.getName()); + defineResourceCategory(resource.getCategories().get(0).getSubcategories().get(0).getName(), + "selectGeneralCategory"); + GeneralUIUtils.defineDescription(resource.getDescription()); + GeneralUIUtils.defineVendorName(resource.getVendorName()); + defineVendorRelease(resource.getVendorRelease()); + defineTagsList(resource, new String[] { resource.getName() }); + GeneralUIUtils.defineUserId(resource.getCreatorUserId()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static ResourceReqDetails createResourceInUI(User user) { + ResourceReqDetails defineResourceDetails = defineResourceDetails(); + GeneralUIUtils.clickAddComponent(DataTestIdEnum.Dashboard.BUTTON_ADD_VF); + + GeneralUIUtils.waitForLoader(); + fillGeneralInformationPage(defineResourceDetails, user); + GeneralUIUtils.clickCreateButton(); + return defineResourceDetails; + + } + + @SuppressWarnings("deprecation") + private static void openImportWithFile(String filePath, String fileName, Dashboard elementType) { + Runnable openImportTask = () -> { + GeneralUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue()); + WebElement imoprtVFButton = GeneralUIUtils.getWebElementByDataTestId(elementType.getValue()); + imoprtVFButton.sendKeys(filePath + fileName); + }; + retryMethodOnException(openImportTask); + + } + + public static ResourceReqDetails importVfcInUI(User user, String filePath, String fileName) { + ResourceReqDetails defineResourceDetails = defineResourceDetails(); + openImportWithFile(filePath, fileName, DataTestIdEnum.Dashboard.IMPORT_VFC_FILE); + // Fill the general page fields. + GeneralUIUtils.waitForLoader(); + fillGeneralInformationPage(defineResourceDetails, user); + GeneralUIUtils.clickCreateButton(); + return defineResourceDetails; + } + + /** + * Import VF + * + * @param user + * @param filePath + * @param fileName + * @return + */ + public static ResourceReqDetails importVfInUI(User user, String filePath, String fileName) { + ResourceReqDetails defineResourceDetails = defineResourceDetails(); + openImportWithFile(filePath, fileName, DataTestIdEnum.Dashboard.IMPORT_VF_FILE); + // Fill the general page fields. + GeneralUIUtils.waitForLoader(); + fillGeneralInformationPage(defineResourceDetails, user); + + GeneralUIUtils.clickSaveButton(); + + return defineResourceDetails; + } + + public static ResourceReqDetails importVfInUIWithoutCheckin(User user, String filePath, String fileName) { + ResourceReqDetails defineResourceDetails = defineResourceDetails(); + openImportWithFile(filePath, fileName, DataTestIdEnum.Dashboard.IMPORT_VF_FILE); + // Fill the general page fields. + GeneralUIUtils.waitForLoader(); + fillGeneralInformationPage(defineResourceDetails, user); + GeneralUIUtils.clickSaveButton(); + GeneralUIUtils.waitForLoader(); + // String okButtonId=DataTestIdEnum.ModalItems.OK.getValue(); + // ResourceUIUtils.clickButton(okButtonId); + // ResourceUIUtils.Waitfunctionforbuttons("//*[@data-tests-id='"+okButtonId+"']",10); + // ResourceUIUtils.clickButton(okButtonId); + return defineResourceDetails; + } + + public static ResourceReqDetails importVfFromOnBoardingModalWithoutCheckin(User user, String fileName) { + ResourceReqDetails defineResourceDetails = defineResourceDetails(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.OPEN_MODAL_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementWaitForVisible(fileName).click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.IMPORT_ICON.getValue()).click(); + + // Fill the general page fields. + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.clickSaveButton(); + GeneralUIUtils.waitForLoader(); + return defineResourceDetails; + } + + @SuppressWarnings("deprecation") + public static void updateVfCsar(String filePath, String fileName) { + retryMethodOnException( + () -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.GeneralSection.BROWSE_BUTTON.getValue()) + .sendKeys(filePath + fileName)); + GeneralUIUtils.clickSaveButton(); + GeneralUIUtils.waitForLoader(); + } + + public static void updateVfCsarFromOnBoarding() { + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.GeneralSection.BROWSE_BUTTON.getValue()).click(); + GeneralUIUtils.getWebElementsListWaitForVisible(DataTestIdEnum.OnBoardingTable.CSAR_ROW.getValue()).get(0) + .click(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.OnBoardingTable.UPDATE_ICON.getValue()).click(); + GeneralUIUtils.clickSaveButton(); + GeneralUIUtils.waitForLoader(); + } + + public static ResourceReqDetails defineResourceDetails() { + ResourceReqDetails resource = new ResourceReqDetails(); + resource = ElementFactory.getDefaultResource(NormativeTypesEnum.ROOT, + ResourceCategoryEnum.GENERIC_NETWORK_ELEMENTS); + resource.setVersion(INITIAL_VERSION); + resource.setIcon(ICON_RESOURCE_NAME); + resource.setResourceType(ResourceTypeEnum.VF.toString()); + resource.setName(getRandomComponentName(RESOURCE_NAME_PREFIX)); + + return resource; + } + + protected static String getRandomComponentName(String prefix) { + return prefix + new Random().nextInt(10000); + } + + public static ImmutablePair<String, String> getRIPosition(ResourceReqDetails createResourceInUI, User user) { + GeneralUIUtils.sleep(1000); + String responseAfterDrag = RestCDUtils.getResource(createResourceInUI).getResponse(); + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + String xPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0)) + .get("posX"); + String yPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0)) + .get("posY"); + return new ImmutablePair<String, String>(xPosPostDrag, yPosPostDrag); + + } + + public static void fillinDeploymentArtifactFormAndClickDone( + org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails details, String filePath) { + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ArtifactModal.LABEL.getValue()) + .sendKeys(details.getArtifactLabel()); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DESCRIPTION.getValue()) + .sendKeys(details.getDescription()); + GeneralUIUtils.getSelectList(details.getArtifactType(), DataTestIdEnum.ArtifactModal.TYPE.getValue()); + retryMethodOnException(() -> GeneralUIUtils + .getWebElementByDataTestId(DataTestIdEnum.GeneralSection.BROWSE_BUTTON.getValue()).sendKeys(filePath)); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.DONE.getValue()).click(); + GeneralUIUtils.waitForLoader(); + } + + /** + * Tests and Accept resource or service + * + * @param createResourceInUI + */ + public static void testAndAcceptElement(ComponentReqDetails createResourceInUI) { + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(createResourceInUI.getName()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue()) + .click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()) + .sendKeys("resource " + createResourceInUI.getName() + " tested successfuly"); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.waitForElementToDisappear(DataTestIdEnum.ModalItems.OK.getValue()); + } + + /** + * Waits Until resource changed to requested lifeCycle State + * + * @param createResourceInUI + * @param requestedLifeCycleState + * @return + */ + public static Resource waitForState(ResourceReqDetails createResourceInUI, + LifecycleStateEnum requestedLifeCycleState) { + Supplier<Resource> resourceGetter = () -> { + String resourceString = RestCDUtils.getResource(createResourceInUI).getResponse(); + return ResponseParser.convertResourceResponseToJavaObject(resourceString); + }; + Function<Resource, Boolean> verifier = res -> res.getLifecycleState() == requestedLifeCycleState; + return FunctionalInterfaces.retryMethodOnResult(resourceGetter, verifier); + + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/RestCDUtils.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/RestCDUtils.java new file mode 100644 index 0000000000..8b602e305d --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/RestCDUtils.java @@ -0,0 +1,167 @@ +package org.openecomp.sdc.uici.tests.utilities; + +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.retryMethodOnResult; +import static org.openecomp.sdc.common.datastructure.FunctionalInterfaces.swallowException; +import static org.testng.AssertJUnit.assertTrue; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; + +import org.apache.http.HttpStatus; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jettison.json.JSONArray; +import org.codehaus.jettison.json.JSONObject; + +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; + +public class RestCDUtils { + + private static void setResourceUniqueIdAndUUID(ComponentReqDetails element, RestResponse getResourceResponse) { + element.setUniqueId(ResponseParser.getUniqueIdFromResponse(getResourceResponse)); + element.setUUID(ResponseParser.getUuidFromResponse(getResourceResponse)); + } + + public static RestResponse getResourceByNameAndVersionRetryOnFail(String userId, String resourceName, + String resourceVersion) { + Supplier<RestResponse> resourceGetter = () -> swallowException( + () -> ResourceRestUtils.getResourceByNameAndVersion(userId, resourceName, resourceVersion)); + Function<RestResponse, Boolean> validator = restRes -> restRes.getErrorCode() == HttpStatus.SC_OK; + return retryMethodOnResult(resourceGetter, validator); + } + + public static RestResponse getResource(ResourceReqDetails resource) { + try { + System.out.println("trying to get resource"); + RestResponse getResourceResponse = null; + String reourceUniqueId = resource.getUniqueId(); + + if (reourceUniqueId != null) { + GeneralUIUtils.sleep(1000); + getResourceResponse = ResourceRestUtils.getResource(reourceUniqueId); + if (getResourceResponse.getErrorCode().intValue() == HttpStatus.SC_OK) { + System.out.println("succeeded to get resource"); + } + return getResourceResponse; + } + JSONObject getResourceJSONObject = null; + getResourceResponse = getResourceByNameAndVersionRetryOnFail(UserRoleEnum.ADMIN.getUserId(), + resource.getName(), resource.getVersion()); + if (getResourceResponse.getErrorCode().intValue() == HttpStatus.SC_OK) { + JSONArray jArray = new JSONArray(getResourceResponse.getResponse()); + for (int i = 0; i < jArray.length(); i++) { + getResourceJSONObject = jArray.getJSONObject(i); + String resourceType = ResponseParser.getValueFromJsonResponse(getResourceJSONObject.toString(), + "resourceType"); + if (resourceType.equals(resource.getResourceType())) { + getResourceResponse.setResponse(getResourceJSONObject.toString()); + setResourceUniqueIdAndUUID(resource, getResourceResponse); + System.out.println("succeeded to get resource"); + return getResourceResponse; + } + } + } + + return getResourceResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static RestResponse getService(ServiceReqDetails service, User user) { + Supplier<RestResponse> serviceFetcher = () -> swallowException( + () -> ServiceRestUtils.getServiceByNameAndVersion(user, service.getName(), service.getVersion())); + Function<RestResponse, Boolean> verifier = restResponse -> restResponse.getErrorCode() + .intValue() == HttpStatus.SC_OK; + RestResponse getServiceResponse = retryMethodOnResult(serviceFetcher, verifier); + + if (getServiceResponse.getErrorCode().intValue() == HttpStatus.SC_OK) { + setResourceUniqueIdAndUUID(service, getServiceResponse); + } + return getServiceResponse; + } + + public static RestResponse getProduct(ProductReqDetails product, User user) throws Exception { + Thread.sleep(3500); + RestResponse getProductResponse = ProductRestUtils.getProductByNameAndVersion(product.getName(), + product.getVersion(), user.getUserId()); + if (getProductResponse.getErrorCode().intValue() == 200) { + setResourceUniqueIdAndUUID(product, getProductResponse); + } + return getProductResponse; + } + + public static Map<String, String> getAllElementVersionsFromResponse(RestResponse getResource) throws Exception { + Map<String, String> versionsMap = new HashMap<String, String>(); + try { + ObjectMapper mapper = new ObjectMapper(); + + JSONObject object = new JSONObject(getResource.getResponse()); + versionsMap = mapper.readValue(object.get("allVersions").toString(), Map.class); + + } catch (Exception e) { + e.printStackTrace(); + return versionsMap; + + } + + return versionsMap; + } + + public static void deleteElementVersions(Map<String, String> elementVersions, boolean isBeforeTest, Object clazz, + User user) throws Exception { + Iterator<String> iterator = elementVersions.keySet().iterator(); + while (iterator.hasNext()) { + String singleVersion = iterator.next(); + String uniqueId = elementVersions.get(singleVersion); + RestResponse deleteResponse = null; + if (clazz instanceof ServiceReqDetails) { + deleteResponse = ServiceRestUtils.deleteServiceById(uniqueId, user.getUserId()); + } else if (clazz instanceof ResourceReqDetails) { + deleteResponse = ResourceRestUtils.deleteResource(uniqueId, user.getUserId()); + } else if (clazz instanceof ProductReqDetails) { + deleteResponse = ProductRestUtils.deleteProduct(uniqueId, user.getUserId()); + } + + if (isBeforeTest) { + assertTrue(deleteResponse.getErrorCode().intValue() == 204 + || deleteResponse.getErrorCode().intValue() == 404); + } else { + assertTrue(deleteResponse.getErrorCode().intValue() == 204); + } + } + } + + public static void deleteAllResourceVersionsAfterTest(ComponentReqDetails componentDetails, + RestResponse getObjectResponse, User user) throws Exception { + deleteAllComponentVersion(false, componentDetails, getObjectResponse, user); + } + + public static void deleteAllResourceVersionsBeforeTest(ComponentReqDetails componentDetails, + RestResponse getObjectResponse, User user) throws Exception { + deleteAllComponentVersion(true, componentDetails, getObjectResponse, user); + } + + public static void deleteAllComponentVersion(boolean isBeforeTest, ComponentReqDetails componentDetails, + RestResponse getObjectResponse, User user) throws Exception { + if (getObjectResponse.getErrorCode().intValue() == 404) + return; + Map<String, String> componentVersionsMap = getAllElementVersionsFromResponse(getObjectResponse); + System.out.println("deleting..."); + deleteElementVersions(componentVersionsMap, isBeforeTest, componentDetails, user); + componentDetails.setUniqueId(null); + } + +}
\ No newline at end of file diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ServiceUIUtils.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ServiceUIUtils.java new file mode 100644 index 0000000000..abcc3b3ade --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/utilities/ServiceUIUtils.java @@ -0,0 +1,147 @@ +package org.openecomp.sdc.uici.tests.utilities; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.function.Function; +import java.util.function.Supplier; + +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum; +import org.openecomp.sdc.uici.tests.datatypes.DataTestIdEnum.GeneralSection; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.Select; + +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum; +import org.openecomp.sdc.ci.tests.utils.general.ElementFactory; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +public final class ServiceUIUtils { + + public static final String SERVICE_NAME_PREFIX = "ServiceCDTest-"; + public static final String INITIAL_VERSION = "0.1"; + public static final String ICON_SERVICE_NAME = "mobility"; + + private ServiceUIUtils() { + throw new UnsupportedOperationException(); + } + + public static String defineServiceName(String serviceName) { + WebElement serviceNameElement = GeneralUIUtils.getWebElementWaitForVisible(GeneralSection.NAME.getValue()); + serviceNameElement.clear(); + serviceNameElement.sendKeys(serviceName); + return serviceName; + } + + public static void defineTagsList(ServiceReqDetails service, String[] serviceTags) { + List<String> taglist = new ArrayList<String>(); + ; + WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementWaitForVisible("i-sdc-tag-input"); + for (String tag : serviceTags) { + serviceTagsTextbox.clear(); + serviceTagsTextbox.sendKeys(tag); + serviceTagsTextbox.sendKeys(Keys.ENTER); + taglist.add(tag); + } + taglist.add(0, service.getName()); + service.setTags(taglist); + } + + public static Select defineServiceCategory(String category) { + + return GeneralUIUtils.getSelectList(category, "selectGeneralCategory"); + } + + private static void defineServiceProjectCode(String projectCode) { + WebElement projectCodeTextbox = GeneralUIUtils.getWebElementWaitForVisible("projectCode"); + projectCodeTextbox.clear(); + projectCodeTextbox.sendKeys(projectCode); + } + + private static void fillServiceGeneralPage(ServiceReqDetails service, User user) { + service.setContactId(user.getUserId()); + service.setCreatorUserId(user.getUserId()); + service.setCreatorFullName(user.getFullName()); + defineServiceName(service.getName()); + defineServiceCategory(service.getCategories().get(0).getName()); + GeneralUIUtils.defineDescription(service.getDescription()); + defineTagsList(service, + new String[] { service.getName(), "This-is-tag", "another-tag", "Test-automation-tag" }); + GeneralUIUtils.defineUserId(service.getCreatorUserId()); + defineServiceProjectCode(service.getProjectCode()); + + } + + public static ServiceReqDetails createServiceInUI(User user) { + + ServiceReqDetails defineServiceetails = defineServiceDetails(user); + GeneralUIUtils.clickAddComponent(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE); + + GeneralUIUtils.waitForLoader(); + fillServiceGeneralPage(defineServiceetails, user); + + GeneralUIUtils.clickCreateButton(); + + return defineServiceetails; + + } + + public static ServiceReqDetails defineServiceDetails(User user) { + ServiceReqDetails service = new ServiceReqDetails(); + service = ElementFactory.getDefaultService(ServiceCategoriesEnum.MOBILITY, user); + service.setVersion(INITIAL_VERSION); + service.setIcon(ICON_SERVICE_NAME); + service.setName(getRandomComponentName(SERVICE_NAME_PREFIX)); + + return service; + } + + protected static String getRandomComponentName(String prefix) { + return prefix + new Random().nextInt(10000); + } + + /** + * Waits Until service changed to requested lifeCycle State + * + * @param createServiceInUI + * @param requestedLifeCycleState + * @param user + * @return + */ + public static Service waitForState(ServiceReqDetails createServiceInUI, LifecycleStateEnum requestedLifeCycleState, + User user) { + Supplier<Service> serviceGetter = () -> { + String resourceString = RestCDUtils.getService(createServiceInUI, user).getResponse(); + return ResponseParser.convertServiceResponseToJavaObject(resourceString); + }; + Function<Service, Boolean> verifier = res -> res.getLifecycleState() == requestedLifeCycleState; + return FunctionalInterfaces.retryMethodOnResult(serviceGetter, verifier); + + } + + /** + * This Method Approves service for distribution<br> + * It assumes governor role is already logged in + * + * @param createServiceInUI + */ + public static void approveServiceForDistribution(ServiceReqDetails createServiceInUI) { + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(createServiceInUI.getName()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.LifeCyleChangeButtons.APPROVE.getValue()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()) + .sendKeys("Service " + createServiceInUI.getName() + " Approved For Distribution"); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.getWebElementWaitForVisible(DataTestIdEnum.ModalItems.OK.getValue()).click(); + GeneralUIUtils.waitForLoader(); + GeneralUIUtils.waitForElementToDisappear(DataTestIdEnum.ModalItems.OK.getValue()); + } + +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/ServiceVerificator.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/ServiceVerificator.java new file mode 100644 index 0000000000..0306df0638 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/ServiceVerificator.java @@ -0,0 +1,55 @@ +package org.openecomp.sdc.uici.tests.verificator; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.function.Function; +import java.util.function.Supplier; + +import org.apache.http.HttpStatus; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; +import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; + +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +public class ServiceVerificator { + public static void verifyNumOfComponentInstances(ServiceReqDetails createServiceInUI, int numOfVFC, User user) { + String responseAfterDrag = RestCDUtils.getService(createServiceInUI, user).getResponse(); + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + int size = ((JSONArray) jsonResource.get("componentInstances")).size(); + assertTrue(size == numOfVFC); + } + + public static void verifyLinkCreated(ServiceReqDetails createServiceInUI, User user) { + String responseAfterDrag = RestCDUtils.getService(createServiceInUI, user).getResponse(); + JSONObject jsonService = (JSONObject) JSONValue.parse(responseAfterDrag); + assertTrue(((JSONArray) jsonService.get("componentInstancesRelations")).size() == 1); + + } + + public static void verifyServiceCreated(ServiceReqDetails createServiceInUI, User user) { + assertTrue(RestCDUtils.getService(createServiceInUI, user).getErrorCode() == HttpStatus.SC_OK); + + } + + /** + * Verifies service is certified with version 1.0 + * + * @param createServiceInUI + * @param user + */ + public static void verifyServiceCertified(ServiceReqDetails createServiceInUI, User user) { + Supplier<RestResponse> serviceGetter = () -> FunctionalInterfaces.swallowException( + () -> ServiceRestUtils.getServiceByNameAndVersion(user, createServiceInUI.getName(), "1.0")); + Function<RestResponse, Boolean> serviceVerificator = restResp -> restResp.getErrorCode() == HttpStatus.SC_OK; + RestResponse certifiedResourceResopnse = FunctionalInterfaces.retryMethodOnResult(serviceGetter, + serviceVerificator); + assertTrue(certifiedResourceResopnse.getErrorCode() == HttpStatus.SC_OK); + + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/VerificatorUtil.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/VerificatorUtil.java new file mode 100644 index 0000000000..9e983b44d3 --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/VerificatorUtil.java @@ -0,0 +1,27 @@ +package org.openecomp.sdc.uici.tests.verificator; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.function.Function; +import java.util.function.Supplier; + +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +/** + * Util Class For Verificators + * + * @author mshitrit + * + */ +public final class VerificatorUtil { + + private VerificatorUtil() { + throw new IllegalAccessError(); + } + + public static void verifyWithRetry(Supplier<Boolean> verificator) { + Function<Boolean, Boolean> retryVerificationLogic = isVerified -> isVerified; + Boolean isVerifiedAfterRetries = FunctionalInterfaces.retryMethodOnResult(verificator, retryVerificationLogic); + assertTrue(isVerifiedAfterRetries); + } +} diff --git a/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/VfVerificator.java b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/VfVerificator.java new file mode 100644 index 0000000000..a1c7ca002b --- /dev/null +++ b/ui-ci-dev/src/main/java/org/openecomp/sdc/uici/tests/verificator/VfVerificator.java @@ -0,0 +1,143 @@ +package org.openecomp.sdc.uici.tests.verificator; + +import static org.testng.AssertJUnit.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.http.HttpStatus; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; +import org.openecomp.sdc.uici.tests.utilities.ResourceUIUtils; +import org.openecomp.sdc.uici.tests.utilities.RestCDUtils; + +import org.openecomp.sdc.be.model.LifecycleStateEnum; +import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser; +import org.openecomp.sdc.common.api.ArtifactTypeEnum; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces; + +/** + * Class to hold Test Verifications relevant for VF + * + * @author mshitrit + * + */ +public final class VfVerificator { + private VfVerificator() { + throw new UnsupportedOperationException(); + } + + /** + * Verifies that the resource contains a certain number of component + * instances + * + * @param createResourceInUI + * @param numOfVFC + */ + public static void verifyNumOfComponentInstances(ResourceReqDetails createResourceInUI, int numOfVFC) { + Supplier<Boolean> verificator = () -> { + String responseAfterDrag = RestCDUtils.getResource(createResourceInUI).getResponse(); + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + int size = ((JSONArray) jsonResource.get("componentInstances")).size(); + return size == numOfVFC; + }; + VerificatorUtil.verifyWithRetry(verificator); + } + + /** + * Verifies That the createResourceInUI is different that prevRIPos. + * + * @param createResourceInUI + * @param prevRIPos + * @param user + */ + public static void verifyRILocationChanged(ResourceReqDetails createResourceInUI, + ImmutablePair<String, String> prevRIPos, User user) { + Supplier<Boolean> verificator = () -> { + ImmutablePair<String, String> currRIPos = ResourceUIUtils.getRIPosition(createResourceInUI, user); + final boolean isXLocationChanged = !prevRIPos.left.equals(currRIPos.left); + final boolean isYLocationChange = !prevRIPos.right.equals(currRIPos.right); + return isXLocationChanged || isYLocationChange; + }; + VerificatorUtil.verifyWithRetry(verificator); + } + + /** + * Verifies That resource contains two connected instances + * + * @param createResourceInUI + */ + public static void verifyLinkCreated(ResourceReqDetails createResourceInUI) { + Supplier<Boolean> verificator = () -> { + String responseAfterDrag = RestCDUtils.getResource(createResourceInUI).getResponse(); + JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag); + return ((JSONArray) jsonResource.get("componentInstancesRelations")).size() == 1; + }; + VerificatorUtil.verifyWithRetry(verificator); + + } + + /** + * Verifies That the VF is certified to version 1.0 + * + * @param vfToVerify + */ + public static void verifyResourceIsCertified(ResourceReqDetails vfToVerify) { + RestResponse certifiedResourceResopnse = RestCDUtils + .getResourceByNameAndVersionRetryOnFail(UserRoleEnum.ADMIN.getUserId(), vfToVerify.getName(), "1.0"); + assertTrue(certifiedResourceResopnse.getErrorCode().equals(HttpStatus.SC_OK)); + + } + + /** + * Verifies That the VF exist + * + * @param vfToVerify + */ + public static void verifyResourceIsCreated(ResourceReqDetails vfToVerify) { + assertTrue(RestCDUtils.getResource(vfToVerify).getErrorCode() == HttpStatus.SC_OK); + } + + /** + * Verify the resource contains the deployment artifacts in the list + * + * @param vfToVerify + * @param artifactTypeEnums + */ + public static void verifyResourceContainsDeploymentArtifacts(ResourceReqDetails vfToVerify, + List<ArtifactTypeEnum> artifactTypeEnums) { + String resourceString = RestCDUtils.getResource(vfToVerify).getResponse(); + Resource resource = ResponseParser.convertResourceResponseToJavaObject(resourceString); + List<String> foundArtifacts = new ArrayList<>(); + if (resource.getDeploymentArtifacts() != null) { + foundArtifacts = resource.getDeploymentArtifacts().values().stream() + .map(artifact -> artifact.getArtifactType()).collect(Collectors.toList()); + } + List<String> excpectedArtifacts = artifactTypeEnums.stream().map(e -> e.getType()).collect(Collectors.toList()); + assertTrue(foundArtifacts.containsAll(excpectedArtifacts)); + + } + + /** + * Verifies The life cycle State of the resource + * + * @param createResourceInUI + * @param requestedLifeCycleState + */ + public static void verifyState(ResourceReqDetails createResourceInUI, LifecycleStateEnum requestedLifeCycleState) { + Resource resource = ResourceUIUtils.waitForState(createResourceInUI, requestedLifeCycleState); + assertTrue(resource.getLifecycleState() == requestedLifeCycleState); + + } + +} diff --git a/ui-ci-dev/src/main/resources/Files/CP.yml b/ui-ci-dev/src/main/resources/Files/CP.yml new file mode 100644 index 0000000000..48b592265f --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/CP.yml @@ -0,0 +1,65 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.cp.CP: + derived_from: tosca.nodes.Root + properties: + att-ucpe-part-number: + type: string + vendor-name: + type: string + required: true + vendor-model: + type: string + required: true + total-vcpu: + type: integer + description: number of vCPUs + total-memory: + type: integer + description: GB + total-disk: + type: integer + description: GB + base-system-image-file-name: + type: string + linux-host-vendor: + type: string + linux-host-os-version: + type: version + base-system-software: + type: string + jdm-vcpu: + type: integer + jdm-memory: + type: integer + description: GB + jdm-disk: + type: integer + description: GB + jdm-version: + type: string + jcp-vcpu: + type: integer + jcp-memory: + type: integer + description: GB + jcp-disk: + type: integer + description: GB + jcp-version: + type: version + capabilities: + vnf_hosting: + type: tosca.capabilities.Container + description: Provides hosting capability for VNFs + WAN_connectivity: + type: tosca.capabilities.network.Bindable + valid_source_types: [org.openecomp.cp.Wan] + description: external WAN1 n/w interface + occurrences: [1,2] + LAN_connectivity: + type: tosca.capabilities.network.Bindable + valid_source_types: [org.openecomp.cp.Lan] + description: external LAN n/w interface + occurrences: [1,8]
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/CP_LAN - Copy.yml b/ui-ci-dev/src/main/resources/Files/CP_LAN - Copy.yml new file mode 100644 index 0000000000..224d61f2c9 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/CP_LAN - Copy.yml @@ -0,0 +1,13 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vfc.uCPE: + derived_from: tosca.nodes.Root + properties: + type: + type: string + required: false + requirements: + - virtualLink: + capability: tosca.capabilities.network.Linkable + relationship: tosca.relationships.network.LinksTo diff --git a/ui-ci-dev/src/main/resources/Files/CP_LAN.yml b/ui-ci-dev/src/main/resources/Files/CP_LAN.yml new file mode 100644 index 0000000000..a96084ba34 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/CP_LAN.yml @@ -0,0 +1,19 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.cp.LAN: + derived_from: org.openecomp.resource.cp.CP + properties: + type: + type: string + required: false + requirements: + - virtualLink_in: + capability: tosca.capabilities.network.Linkable + relationship: tosca.relationships.network.LinksTo + - virtualLink_out: + capability: tosca.capabilities.network.Linkable + relationship: tosca.relationships.network.LinksTo + - virtualbinding: + capability: tosca.capabilities.network.Bindable + relationship: tosca.relationships.network.BindsTo
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/CP_WAN.yml b/ui-ci-dev/src/main/resources/Files/CP_WAN.yml new file mode 100644 index 0000000000..1bce457d43 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/CP_WAN.yml @@ -0,0 +1,19 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.cp.WAN: + derived_from: org.openecomp.resource.cp.CP + properties: + type: + type: string + required: false + requirements: + - virtualLink_in: + capability: tosca.capabilities.network.Linkable + relationship: tosca.relationships.network.LinksTo + - virtualLink_out: + capability: tosca.capabilities.network.Linkable + relationship: tosca.relationships.network.LinksTo + - virtualbinding: + capability: tosca.capabilities.network.Bindable + relationship: tosca.relationships.network.BindsTo
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/Heat-File 1.yaml b/ui-ci-dev/src/main/resources/Files/Heat-File 1.yaml new file mode 100644 index 0000000000..d332078d35 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Heat-File 1.yaml @@ -0,0 +1,791 @@ +heat_template_version: 2013-05-23 +################################# +# +# Changes in v0.2: +# - Unique availability zone for each VM +# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram +# - 2 DB VMs added +# - Images corrected +# - VM start-up order: SMP->DB->BE->FE (no error handling yet) +# - Provisioning scripts placeholders +# +################################# + +description: ASC Template + +parameters: +# availability_zone_smp0: +# type: string +# default: nova +# availability_zone_smp1: +# type: string +# default: nova +# availability_zone_fe0: +# type: string +# default: nova +# availability_zone_fe1: +# type: string +# default: nova +# availability_zone_db0: +# type: string +# default: nova +# availability_zone_db1: +# type: string +# default: nova +# availability_zone_be0: +# type: string +# default: nova +# availability_zone_be1: +# type: string +# default: nova +# availability_zone_be2: +# type: string +# default: nova +# availability_zone_be3: +# type: string +# default: nova +# availability_zone_be4: +# type: string +# default: nova + + vnf_name: + type: string + description: Unique name for this VNF instance + default: This_is_the_SCP_name + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_ths_SCP_id + + flavor_scp_be_id: + type: string + description: flavor type + default: a1.Small + flavor_scp_fe_id: + type: string + description: flavor type + default: a1.Small + flavor_smp_id: + type: string + description: flavor type + default: a1.Small + flavor_db_id: + type: string + description: flavor type + default: a1.Small + image_scp_be_id: + type: string + description: Image use to boot a server + default: asc_base_image_be + image_scp_fe_id: + type: string + description: Image use to boot a server + default: asc_base_image_fe + image_smp_id: + type: string + description: Image use to boot a server + default: asc_base_image_smp + image_db_id: + type: string + description: Image use to boot a server + default: asc_base_image_db + + int_vscp_fe_cluster_net_id: + type: string + description: LAN2 FE Cluster/KA + int_vscp_fe_cluster_cidr: + type: string + description: Private Network2 Address (CIDR notation) + int_vscp_cluster_net_id: + type: string + description: LAN3 Cluster + int_vscp_cluster_cidr: + type: string + description: Private Network3 Address (CIDR notation) + int_vscp_db_network_net_id: + type: string + description: LAN4 DB + int_vscp_db_network_cidr: + type: string + description: Private Network4 Address (CIDR notation) + SIGNET_vrf_A1_direct_net_id: + type: string + description: Network name for SIGTRAN_A + SIGNET_vrf_B1_direct_net_id: + type: string + description: Network name for SIGTRAN_B + Cricket_OCS_protected_net_id: + type: string + description: Network name for CRICKET_OCS + OAM_direct_net_id: + type: string + description: Network name for OAM + be0_Cricket_OCS_protected_ips: + type: string + label: be0 port 5 OAM ip address + description: be0 port 5 OAM ip address + be1_Cricket_OCS_protected_ips: + type: string + label: be1 port 5 OAM ip address + description: be1 port 5 OAM ip address + be2_Cricket_OCS_protected_ips: + type: string + label: be2 port 5 OAM ip address + description: be2 port 5 OAM ip address + be3_Cricket_OCS_protected_ips: + type: string + label: be3 port 5 OAM ip address + description: be3 port 5 OAM ip address + be4_Cricket_OCS_protected_ips: + type: string + label: be4 port 5 OAM ip address + description: be4 port 5 OAM ip address + be0_OAM_direct_ips: + type: string + label: be0 port 7 OAM ip address + description: be0 port 7 OAM ip address + be1_OAM_direct_ips: + type: string + label: be1 port 7 OAM ip address + description: be1 port 7 OAM ip address + be2_OAM_direct_ips: + type: string + label: be2 port 7 OAM ip address + description: be2 port 7 OAM ip address + be3_OAM_direct_ips: + type: string + label: be3 port 7 OAM ip address + description: be3 port 7 OAM ip address + be4_OAM_direct_ips: + type: string + label: be4 port 7 OAM ip address + description: be4 port 7 OAM ip address + fe0_SIGNET_vrf_A1_direct_ips: + type: string + label: fe0 port 0 SIGTRAN ip address + description: fe0 port 0 SIGTRAN ip address + fe0_OAM_direct_ips: + type: string + label: fe0 port 7 OAM ip address + description: fe0 port 7 OAM ip address + fe1_SIGNET_vrf_B1_direct_ips: + type: string + label: fe1 port 1 SIGTRAN ip address + description: fe1 port 1 SIGTRAN ip address + fe1_OAM_direct_ips: + type: string + label: fe1 port 7 OAM ip address + description: fe1 port 7 OAM ip address + smp0_OAM_direct_ips: + type: string + label: smp0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + smp1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: smp1 port 7 OAM ip address + db0_OAM_direct_ips: + type: string + label: db0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + db1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: db1 port 7 OAM ip address + vm_scp_be0_name: + type: string + default: vSCP_BE0 + description: name of VM + vm_scp_be1_name: + type: string + default: vSCP_BE1 + description: name of VM + vm_scp_be2_name: + type: string + default: vSCP_BE2 + description: name of VM + vm_scp_be3_name: + type: string + default: vSCP_BE3 + description: name of VM + vm_scp_be4_name: + type: string + default: vSCP_BE4 + description: name of VM + vm_scp_fe0_name: + type: string + default: vSCP_FE0 + description: name of VM + vm_scp_fe1_name: + type: string + default: vSCP_FE1 + description: name of VM + vm_smp0_name: + type: string + default: vSMP0 + description: name of VM + vm_smp1_name: + type: string + default: vSMP1 + description: name of VM + vm_db0_name: + type: string + default: vDB0 + description: name of VM + vm_db1_name: + type: string + default: vDB1 + description: name of VM + +resources: +# scp_be_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_be_wait_handle } +# count: 5 +# timeout: 300 +# scp_be_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# scp_fe_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_fe_wait_handle } +# count: 2 +# timeout: 300 +# scp_fe_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# smp_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: smp_wait_handle } +# count: 2 +# timeout: 300 +# smp_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# db_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: db_wait_handle } +# count: 2 +# timeout: 300 +# db_wait_handle: +# type: OS::Heat::WaitConditionHandle + + FE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + BE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + SMP_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + DB_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + + FE_Clustering_KA: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_fe_cluster_net_id } + + FE_Clustering_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: FE_Clustering_KA } + cidr: { get_param: int_vscp_fe_cluster_cidr } + + Clustering_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_cluster_net_id } + + Clustering_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: Clustering_Network } + cidr: { get_param: int_vscp_cluster_cidr } + + DB_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_db_network_net_id } + + DB_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: DB_Network } + cidr: { get_param: int_vscp_db_network_cidr } + + server_scp_be0: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be0_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be0 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be0_port_3 } + - port: { get_resource: be0_port_4 } + - port: { get_resource: be0_port_5 } + - port: { get_resource: be0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be0_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + be0_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be0_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] + + be0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] + + server_scp_be1: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be1_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be1 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be1_port_3 } + - port: { get_resource: be1_port_4 } + - port: { get_resource: be1_port_5 } + - port: { get_resource: be1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be1_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be1_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] + + be1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] + + server_scp_be2: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be2_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be2 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be2_port_3 } + - port: { get_resource: be2_port_4 } + - port: { get_resource: be2_port_5 } + - port: { get_resource: be2_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be2_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be2_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be2_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be2_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] + + be2_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] + + server_scp_be3: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be3_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be3 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be3_port_3 } + - port: { get_resource: be3_port_4 } + - port: { get_resource: be3_port_5 } + - port: { get_resource: be3_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be3_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be3_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be3_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be3_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] + + be3_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] + + server_scp_be4: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be4_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be4 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be4_port_3 } + - port: { get_resource: be4_port_4 } + - port: { get_resource: be4_port_5 } + - port: { get_resource: be4_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be4_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be4_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be4_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be4_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] + + be4_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] + + server_scp_fe0: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe0_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe0 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe0_port_0 } + - port: { get_resource: fe0_port_2 } + - port: { get_resource: fe0_port_3 } + - port: { get_resource: fe0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe0_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe0_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_A1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] + + fe0_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] + + server_scp_fe1: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe1_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe1 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe1_port_1 } + - port: { get_resource: fe1_port_2 } + - port: { get_resource: fe1_port_3 } + - port: { get_resource: fe1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe1_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe1_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_B1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] + + fe1_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] + + server_smp0: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp0_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp0 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp0_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] + + server_smp1: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp1_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp1 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp1_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] + + server_db0: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db0_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db0 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db0_port_4 } + - port: { get_resource: db0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db0_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] + + server_db1: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db1_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db1 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db1_port_4 } + - port: { get_resource: db1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db1_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/Heat-File 2.yaml b/ui-ci-dev/src/main/resources/Files/Heat-File 2.yaml new file mode 100644 index 0000000000..d332078d35 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Heat-File 2.yaml @@ -0,0 +1,791 @@ +heat_template_version: 2013-05-23 +################################# +# +# Changes in v0.2: +# - Unique availability zone for each VM +# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram +# - 2 DB VMs added +# - Images corrected +# - VM start-up order: SMP->DB->BE->FE (no error handling yet) +# - Provisioning scripts placeholders +# +################################# + +description: ASC Template + +parameters: +# availability_zone_smp0: +# type: string +# default: nova +# availability_zone_smp1: +# type: string +# default: nova +# availability_zone_fe0: +# type: string +# default: nova +# availability_zone_fe1: +# type: string +# default: nova +# availability_zone_db0: +# type: string +# default: nova +# availability_zone_db1: +# type: string +# default: nova +# availability_zone_be0: +# type: string +# default: nova +# availability_zone_be1: +# type: string +# default: nova +# availability_zone_be2: +# type: string +# default: nova +# availability_zone_be3: +# type: string +# default: nova +# availability_zone_be4: +# type: string +# default: nova + + vnf_name: + type: string + description: Unique name for this VNF instance + default: This_is_the_SCP_name + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_ths_SCP_id + + flavor_scp_be_id: + type: string + description: flavor type + default: a1.Small + flavor_scp_fe_id: + type: string + description: flavor type + default: a1.Small + flavor_smp_id: + type: string + description: flavor type + default: a1.Small + flavor_db_id: + type: string + description: flavor type + default: a1.Small + image_scp_be_id: + type: string + description: Image use to boot a server + default: asc_base_image_be + image_scp_fe_id: + type: string + description: Image use to boot a server + default: asc_base_image_fe + image_smp_id: + type: string + description: Image use to boot a server + default: asc_base_image_smp + image_db_id: + type: string + description: Image use to boot a server + default: asc_base_image_db + + int_vscp_fe_cluster_net_id: + type: string + description: LAN2 FE Cluster/KA + int_vscp_fe_cluster_cidr: + type: string + description: Private Network2 Address (CIDR notation) + int_vscp_cluster_net_id: + type: string + description: LAN3 Cluster + int_vscp_cluster_cidr: + type: string + description: Private Network3 Address (CIDR notation) + int_vscp_db_network_net_id: + type: string + description: LAN4 DB + int_vscp_db_network_cidr: + type: string + description: Private Network4 Address (CIDR notation) + SIGNET_vrf_A1_direct_net_id: + type: string + description: Network name for SIGTRAN_A + SIGNET_vrf_B1_direct_net_id: + type: string + description: Network name for SIGTRAN_B + Cricket_OCS_protected_net_id: + type: string + description: Network name for CRICKET_OCS + OAM_direct_net_id: + type: string + description: Network name for OAM + be0_Cricket_OCS_protected_ips: + type: string + label: be0 port 5 OAM ip address + description: be0 port 5 OAM ip address + be1_Cricket_OCS_protected_ips: + type: string + label: be1 port 5 OAM ip address + description: be1 port 5 OAM ip address + be2_Cricket_OCS_protected_ips: + type: string + label: be2 port 5 OAM ip address + description: be2 port 5 OAM ip address + be3_Cricket_OCS_protected_ips: + type: string + label: be3 port 5 OAM ip address + description: be3 port 5 OAM ip address + be4_Cricket_OCS_protected_ips: + type: string + label: be4 port 5 OAM ip address + description: be4 port 5 OAM ip address + be0_OAM_direct_ips: + type: string + label: be0 port 7 OAM ip address + description: be0 port 7 OAM ip address + be1_OAM_direct_ips: + type: string + label: be1 port 7 OAM ip address + description: be1 port 7 OAM ip address + be2_OAM_direct_ips: + type: string + label: be2 port 7 OAM ip address + description: be2 port 7 OAM ip address + be3_OAM_direct_ips: + type: string + label: be3 port 7 OAM ip address + description: be3 port 7 OAM ip address + be4_OAM_direct_ips: + type: string + label: be4 port 7 OAM ip address + description: be4 port 7 OAM ip address + fe0_SIGNET_vrf_A1_direct_ips: + type: string + label: fe0 port 0 SIGTRAN ip address + description: fe0 port 0 SIGTRAN ip address + fe0_OAM_direct_ips: + type: string + label: fe0 port 7 OAM ip address + description: fe0 port 7 OAM ip address + fe1_SIGNET_vrf_B1_direct_ips: + type: string + label: fe1 port 1 SIGTRAN ip address + description: fe1 port 1 SIGTRAN ip address + fe1_OAM_direct_ips: + type: string + label: fe1 port 7 OAM ip address + description: fe1 port 7 OAM ip address + smp0_OAM_direct_ips: + type: string + label: smp0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + smp1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: smp1 port 7 OAM ip address + db0_OAM_direct_ips: + type: string + label: db0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + db1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: db1 port 7 OAM ip address + vm_scp_be0_name: + type: string + default: vSCP_BE0 + description: name of VM + vm_scp_be1_name: + type: string + default: vSCP_BE1 + description: name of VM + vm_scp_be2_name: + type: string + default: vSCP_BE2 + description: name of VM + vm_scp_be3_name: + type: string + default: vSCP_BE3 + description: name of VM + vm_scp_be4_name: + type: string + default: vSCP_BE4 + description: name of VM + vm_scp_fe0_name: + type: string + default: vSCP_FE0 + description: name of VM + vm_scp_fe1_name: + type: string + default: vSCP_FE1 + description: name of VM + vm_smp0_name: + type: string + default: vSMP0 + description: name of VM + vm_smp1_name: + type: string + default: vSMP1 + description: name of VM + vm_db0_name: + type: string + default: vDB0 + description: name of VM + vm_db1_name: + type: string + default: vDB1 + description: name of VM + +resources: +# scp_be_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_be_wait_handle } +# count: 5 +# timeout: 300 +# scp_be_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# scp_fe_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_fe_wait_handle } +# count: 2 +# timeout: 300 +# scp_fe_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# smp_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: smp_wait_handle } +# count: 2 +# timeout: 300 +# smp_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# db_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: db_wait_handle } +# count: 2 +# timeout: 300 +# db_wait_handle: +# type: OS::Heat::WaitConditionHandle + + FE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + BE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + SMP_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + DB_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + + FE_Clustering_KA: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_fe_cluster_net_id } + + FE_Clustering_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: FE_Clustering_KA } + cidr: { get_param: int_vscp_fe_cluster_cidr } + + Clustering_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_cluster_net_id } + + Clustering_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: Clustering_Network } + cidr: { get_param: int_vscp_cluster_cidr } + + DB_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_db_network_net_id } + + DB_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: DB_Network } + cidr: { get_param: int_vscp_db_network_cidr } + + server_scp_be0: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be0_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be0 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be0_port_3 } + - port: { get_resource: be0_port_4 } + - port: { get_resource: be0_port_5 } + - port: { get_resource: be0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be0_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + be0_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be0_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] + + be0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] + + server_scp_be1: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be1_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be1 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be1_port_3 } + - port: { get_resource: be1_port_4 } + - port: { get_resource: be1_port_5 } + - port: { get_resource: be1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be1_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be1_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] + + be1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] + + server_scp_be2: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be2_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be2 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be2_port_3 } + - port: { get_resource: be2_port_4 } + - port: { get_resource: be2_port_5 } + - port: { get_resource: be2_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be2_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be2_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be2_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be2_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] + + be2_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] + + server_scp_be3: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be3_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be3 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be3_port_3 } + - port: { get_resource: be3_port_4 } + - port: { get_resource: be3_port_5 } + - port: { get_resource: be3_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be3_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be3_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be3_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be3_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] + + be3_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] + + server_scp_be4: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be4_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be4 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be4_port_3 } + - port: { get_resource: be4_port_4 } + - port: { get_resource: be4_port_5 } + - port: { get_resource: be4_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be4_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be4_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be4_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be4_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] + + be4_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] + + server_scp_fe0: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe0_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe0 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe0_port_0 } + - port: { get_resource: fe0_port_2 } + - port: { get_resource: fe0_port_3 } + - port: { get_resource: fe0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe0_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe0_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_A1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] + + fe0_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] + + server_scp_fe1: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe1_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe1 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe1_port_1 } + - port: { get_resource: fe1_port_2 } + - port: { get_resource: fe1_port_3 } + - port: { get_resource: fe1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe1_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe1_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_B1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] + + fe1_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] + + server_smp0: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp0_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp0 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp0_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] + + server_smp1: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp1_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp1 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp1_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] + + server_db0: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db0_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db0 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db0_port_4 } + - port: { get_resource: db0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db0_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] + + server_db1: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db1_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db1 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db1_port_4 } + - port: { get_resource: db1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db1_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/Heat-File.yaml b/ui-ci-dev/src/main/resources/Files/Heat-File.yaml new file mode 100644 index 0000000000..d332078d35 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Heat-File.yaml @@ -0,0 +1,791 @@ +heat_template_version: 2013-05-23 +################################# +# +# Changes in v0.2: +# - Unique availability zone for each VM +# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram +# - 2 DB VMs added +# - Images corrected +# - VM start-up order: SMP->DB->BE->FE (no error handling yet) +# - Provisioning scripts placeholders +# +################################# + +description: ASC Template + +parameters: +# availability_zone_smp0: +# type: string +# default: nova +# availability_zone_smp1: +# type: string +# default: nova +# availability_zone_fe0: +# type: string +# default: nova +# availability_zone_fe1: +# type: string +# default: nova +# availability_zone_db0: +# type: string +# default: nova +# availability_zone_db1: +# type: string +# default: nova +# availability_zone_be0: +# type: string +# default: nova +# availability_zone_be1: +# type: string +# default: nova +# availability_zone_be2: +# type: string +# default: nova +# availability_zone_be3: +# type: string +# default: nova +# availability_zone_be4: +# type: string +# default: nova + + vnf_name: + type: string + description: Unique name for this VNF instance + default: This_is_the_SCP_name + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_ths_SCP_id + + flavor_scp_be_id: + type: string + description: flavor type + default: a1.Small + flavor_scp_fe_id: + type: string + description: flavor type + default: a1.Small + flavor_smp_id: + type: string + description: flavor type + default: a1.Small + flavor_db_id: + type: string + description: flavor type + default: a1.Small + image_scp_be_id: + type: string + description: Image use to boot a server + default: asc_base_image_be + image_scp_fe_id: + type: string + description: Image use to boot a server + default: asc_base_image_fe + image_smp_id: + type: string + description: Image use to boot a server + default: asc_base_image_smp + image_db_id: + type: string + description: Image use to boot a server + default: asc_base_image_db + + int_vscp_fe_cluster_net_id: + type: string + description: LAN2 FE Cluster/KA + int_vscp_fe_cluster_cidr: + type: string + description: Private Network2 Address (CIDR notation) + int_vscp_cluster_net_id: + type: string + description: LAN3 Cluster + int_vscp_cluster_cidr: + type: string + description: Private Network3 Address (CIDR notation) + int_vscp_db_network_net_id: + type: string + description: LAN4 DB + int_vscp_db_network_cidr: + type: string + description: Private Network4 Address (CIDR notation) + SIGNET_vrf_A1_direct_net_id: + type: string + description: Network name for SIGTRAN_A + SIGNET_vrf_B1_direct_net_id: + type: string + description: Network name for SIGTRAN_B + Cricket_OCS_protected_net_id: + type: string + description: Network name for CRICKET_OCS + OAM_direct_net_id: + type: string + description: Network name for OAM + be0_Cricket_OCS_protected_ips: + type: string + label: be0 port 5 OAM ip address + description: be0 port 5 OAM ip address + be1_Cricket_OCS_protected_ips: + type: string + label: be1 port 5 OAM ip address + description: be1 port 5 OAM ip address + be2_Cricket_OCS_protected_ips: + type: string + label: be2 port 5 OAM ip address + description: be2 port 5 OAM ip address + be3_Cricket_OCS_protected_ips: + type: string + label: be3 port 5 OAM ip address + description: be3 port 5 OAM ip address + be4_Cricket_OCS_protected_ips: + type: string + label: be4 port 5 OAM ip address + description: be4 port 5 OAM ip address + be0_OAM_direct_ips: + type: string + label: be0 port 7 OAM ip address + description: be0 port 7 OAM ip address + be1_OAM_direct_ips: + type: string + label: be1 port 7 OAM ip address + description: be1 port 7 OAM ip address + be2_OAM_direct_ips: + type: string + label: be2 port 7 OAM ip address + description: be2 port 7 OAM ip address + be3_OAM_direct_ips: + type: string + label: be3 port 7 OAM ip address + description: be3 port 7 OAM ip address + be4_OAM_direct_ips: + type: string + label: be4 port 7 OAM ip address + description: be4 port 7 OAM ip address + fe0_SIGNET_vrf_A1_direct_ips: + type: string + label: fe0 port 0 SIGTRAN ip address + description: fe0 port 0 SIGTRAN ip address + fe0_OAM_direct_ips: + type: string + label: fe0 port 7 OAM ip address + description: fe0 port 7 OAM ip address + fe1_SIGNET_vrf_B1_direct_ips: + type: string + label: fe1 port 1 SIGTRAN ip address + description: fe1 port 1 SIGTRAN ip address + fe1_OAM_direct_ips: + type: string + label: fe1 port 7 OAM ip address + description: fe1 port 7 OAM ip address + smp0_OAM_direct_ips: + type: string + label: smp0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + smp1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: smp1 port 7 OAM ip address + db0_OAM_direct_ips: + type: string + label: db0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + db1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: db1 port 7 OAM ip address + vm_scp_be0_name: + type: string + default: vSCP_BE0 + description: name of VM + vm_scp_be1_name: + type: string + default: vSCP_BE1 + description: name of VM + vm_scp_be2_name: + type: string + default: vSCP_BE2 + description: name of VM + vm_scp_be3_name: + type: string + default: vSCP_BE3 + description: name of VM + vm_scp_be4_name: + type: string + default: vSCP_BE4 + description: name of VM + vm_scp_fe0_name: + type: string + default: vSCP_FE0 + description: name of VM + vm_scp_fe1_name: + type: string + default: vSCP_FE1 + description: name of VM + vm_smp0_name: + type: string + default: vSMP0 + description: name of VM + vm_smp1_name: + type: string + default: vSMP1 + description: name of VM + vm_db0_name: + type: string + default: vDB0 + description: name of VM + vm_db1_name: + type: string + default: vDB1 + description: name of VM + +resources: +# scp_be_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_be_wait_handle } +# count: 5 +# timeout: 300 +# scp_be_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# scp_fe_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_fe_wait_handle } +# count: 2 +# timeout: 300 +# scp_fe_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# smp_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: smp_wait_handle } +# count: 2 +# timeout: 300 +# smp_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# db_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: db_wait_handle } +# count: 2 +# timeout: 300 +# db_wait_handle: +# type: OS::Heat::WaitConditionHandle + + FE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + BE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + SMP_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + DB_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + + FE_Clustering_KA: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_fe_cluster_net_id } + + FE_Clustering_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: FE_Clustering_KA } + cidr: { get_param: int_vscp_fe_cluster_cidr } + + Clustering_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_cluster_net_id } + + Clustering_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: Clustering_Network } + cidr: { get_param: int_vscp_cluster_cidr } + + DB_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_db_network_net_id } + + DB_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: DB_Network } + cidr: { get_param: int_vscp_db_network_cidr } + + server_scp_be0: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be0_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be0 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be0_port_3 } + - port: { get_resource: be0_port_4 } + - port: { get_resource: be0_port_5 } + - port: { get_resource: be0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be0_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + be0_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be0_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] + + be0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] + + server_scp_be1: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be1_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be1 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be1_port_3 } + - port: { get_resource: be1_port_4 } + - port: { get_resource: be1_port_5 } + - port: { get_resource: be1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be1_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be1_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] + + be1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] + + server_scp_be2: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be2_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be2 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be2_port_3 } + - port: { get_resource: be2_port_4 } + - port: { get_resource: be2_port_5 } + - port: { get_resource: be2_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be2_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be2_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be2_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be2_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] + + be2_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] + + server_scp_be3: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be3_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be3 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be3_port_3 } + - port: { get_resource: be3_port_4 } + - port: { get_resource: be3_port_5 } + - port: { get_resource: be3_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be3_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be3_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be3_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be3_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] + + be3_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] + + server_scp_be4: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be4_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be4 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be4_port_3 } + - port: { get_resource: be4_port_4 } + - port: { get_resource: be4_port_5 } + - port: { get_resource: be4_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be4_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be4_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be4_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be4_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] + + be4_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] + + server_scp_fe0: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe0_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe0 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe0_port_0 } + - port: { get_resource: fe0_port_2 } + - port: { get_resource: fe0_port_3 } + - port: { get_resource: fe0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe0_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe0_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_A1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] + + fe0_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] + + server_scp_fe1: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe1_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe1 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe1_port_1 } + - port: { get_resource: fe1_port_2 } + - port: { get_resource: fe1_port_3 } + - port: { get_resource: fe1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe1_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe1_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_B1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] + + fe1_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] + + server_smp0: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp0_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp0 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp0_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] + + server_smp1: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp1_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp1 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp1_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] + + server_db0: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db0_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db0 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db0_port_4 } + - port: { get_resource: db0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db0_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] + + server_db1: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db1_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db1 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db1_port_4 } + - port: { get_resource: db1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db1_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/InValid_tosca_File .yml b/ui-ci-dev/src/main/resources/Files/InValid_tosca_File .yml new file mode 100644 index 0000000000..4eea0a15ac --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/InValid_tosca_File .yml @@ -0,0 +1,34 @@ +node_types: + org.openecomp.resource.MyCompute: + derived_from: tosca.nodes.Root + attributes: + private_address: + type: string + public_address: + type: string + networks: + type: map + entry_schema: + type: tosca.datatypes.network.NetworkInfo + ports: + type: map + entry_schema: + type: tosca.datatypes.network.PortInfo + requirements: + - local_storage: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: [0, UNBOUNDED] + capabilities: + host: + type: tosca.capabilities.Container + valid_source_types: [tosca.nodes.SoftwareComponent] + endpoint : + type: tosca.capabilities.Endpoint.Admin + os: + type: tosca.capabilities.OperatingSystem + scalable: + type: tosca.capabilities.Scalable + binding: + type: tosca.capabilities.network.Bindable diff --git a/ui-ci-dev/src/main/resources/Files/JDM_vf.yml b/ui-ci-dev/src/main/resources/Files/JDM_vf.yml new file mode 100644 index 0000000000..5a7edd4aaf --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/JDM_vf.yml @@ -0,0 +1,57 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vf.JDM: + derived_from: tosca.nodes.Root + properties: + att-part-number: + type: string + vendor-name: + type: string + vendor-part-number: + type: string + vendor-model: + type: string + vendor-model-description: + type: string + vcpu-default: + type: integer + vcpu-min: + type: integer + vcpu-max: + type: integer + vmemory-default: + type: integer + vmemory-units: + type: string + default: "GB" + vmemory-min: + type: integer + vmemory-max: + type: integer + vdisk-default: + type: integer + vdisk-units: + type: string + default: "GB" + vdisk-min: + type: integer + vdisk-max: + type: integer + vnf-type: + type: string + software-version: + type: string + software-version-state: + type: integer + software-file-name: + type: string + vnf-feature: + type: string + requirements: + - host: + capability: tosca.capabilities.Container + relationship: tosca.relationships.HostedOn + capabilities: + binding: + type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/JDM_vfc.yml b/ui-ci-dev/src/main/resources/Files/JDM_vfc.yml new file mode 100644 index 0000000000..b9c9ca0c4a --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/JDM_vfc.yml @@ -0,0 +1,57 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vfc.JDM: + derived_from: tosca.nodes.Root + properties: + att-part-number: + type: string + vendor-name: + type: string + vendor-part-number: + type: string + vendor-model: + type: string + vendor-model-description: + type: string + vcpu-default: + type: integer + vcpu-min: + type: integer + vcpu-max: + type: integer + vmemory-default: + type: integer + vmemory-units: + type: string + default: "GB" + vmemory-min: + type: integer + vmemory-max: + type: integer + vdisk-default: + type: integer + vdisk-units: + type: string + default: "GB" + vdisk-min: + type: integer + vdisk-max: + type: integer + vnf-type: + type: string + software-version: + type: string + software-version-state: + type: integer + software-file-name: + type: string + vnf-feature: + type: string + requirements: + - host: + capability: tosca.capabilities.Container + relationship: tosca.relationships.HostedOn + capabilities: + binding: + type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/Sample_CSAR.csar b/ui-ci-dev/src/main/resources/Files/Sample_CSAR.csar Binary files differnew file mode 100644 index 0000000000..fe95e79473 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Sample_CSAR.csar diff --git a/ui-ci-dev/src/main/resources/Files/Sample_CSAR2.csar b/ui-ci-dev/src/main/resources/Files/Sample_CSAR2.csar Binary files differnew file mode 100644 index 0000000000..3001fe8222 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Sample_CSAR2.csar diff --git a/ui-ci-dev/src/main/resources/Files/UCPE_VFC.yml b/ui-ci-dev/src/main/resources/Files/UCPE_VFC.yml new file mode 100644 index 0000000000..ef3966b68f --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/UCPE_VFC.yml @@ -0,0 +1,65 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vfc.uCPE: + derived_from: tosca.nodes.Root + properties: + att-ucpe-part-number: + type: string + vendor-name: + type: string + required: true + vendor-model: + type: string + required: true + total-vcpu: + type: integer + description: number of vCPUs + total-memory: + type: integer + description: GB + total-disk: + type: integer + description: GB + base-system-image-file-name: + type: string + linux-host-vendor: + type: string + linux-host-os-version: + type: version + base-system-software: + type: string + jdm-vcpu: + type: integer + jdm-memory: + type: integer + description: GB + jdm-disk: + type: integer + description: GB + jdm-version: + type: string + jcp-vcpu: + type: integer + jcp-memory: + type: integer + description: GB + jcp-disk: + type: integer + description: GB + jcp-version: + type: version + capabilities: + vnf_hosting: + type: tosca.capabilities.Container + description: Provides hosting capability for VNFs + WAN_connectivity: + type: tosca.capabilities.network.Bindable + valid_source_types: [org.openecomp.cp.Wan] + description: external WAN1 n/w interface + occurrences: [1,2] + LAN_connectivity: + type: tosca.capabilities.network.Bindable + valid_source_types: [org.openecomp.cp.Lan] + description: external LAN n/w interface + occurrences: [1,8]
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/VF.yml b/ui-ci-dev/src/main/resources/Files/VF.yml new file mode 100644 index 0000000000..ec089900ad --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/VF.yml @@ -0,0 +1,17 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vf.VFF: + derived_from: tosca.nodes.Root + properties: + vendor: + type: string + required: false + vl_name: + type: string + required: false + capabilities: + virtual_linkable: + type: tosca.capabilities.network.Linkable + +
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/VFC.yml b/ui-ci-dev/src/main/resources/Files/VFC.yml new file mode 100644 index 0000000000..853ed35374 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/VFC.yml @@ -0,0 +1,77 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vfc.vRouter: + derived_from: tosca.nodes.Root + properties: + att-part-number: + type: string + vendor-name: + type: string + vendor-part-number: + type: string + vendor-model: + type: string + vendor-model-description: + type: string + vcpu-default: + type: integer + vcpu-min: + type: integer + vcpu-max: + type: integer + vmemory-default: + type: integer + vmemory-units: + type: string + default: "GB" + vmemory-min: + type: integer + vmemory-max: + type: integer + vdisk-default: + type: integer + vdisk-units: + type: string + default: "GB" + vdisk-min: + type: integer + vdisk-max: + type: integer + vnf-type: + type: string + software-version: + type: string + software-version-state: + type: integer + software-file-name: + type: string + vnf-feature: + type: string + management-v6-address: + type: string + nm-lan-v6-address: + type: string + nm-lan-v6-prefix-length: + type: string + management-v4-address: + type: string + nm-lan-v4-address: + type: string + nm-lan-v4-prefix-length: + type: string + routing-instance-name: + type: string + routing-instances: + type: map + entry_schema: + type: string + requirements: + - host: + capability: tosca.capabilities.Container + relationship: tosca.relationships.HostedOn + capabilities: + binding: + type: tosca.capabilities.network.Bindable + occurrences: [1,UNBOUNDED] +
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/VFCWithAttributes.yml b/ui-ci-dev/src/main/resources/Files/VFCWithAttributes.yml new file mode 100644 index 0000000000..133fd02cef --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/VFCWithAttributes.yml @@ -0,0 +1,43 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vfc.VFC: + derived_from: tosca.nodes.Root + properties: + jcp-memory: + type: integer + description: GB + jcp-disk: + type: integer + description: GB + jcp-version: + type: version + attributes: + my_attr: + type: integer + private_address: + type: string + public_address: + type: string + networks: + type: map + entry_schema: + type: tosca.datatypes.network.NetworkInfo + ports: + type: map + entry_schema: + type: tosca.datatypes.network.PortInfo + capabilities: + vnf_hosting: + type: tosca.capabilities.Container + description: Provides hosting capability for VNFs + WAN_connectivity: + type: tosca.capabilities.network.Bindable + valid_source_types: [org.openecomp.cp.Wan] + description: external WAN1 n/w interface + occurrences: [1,2] + LAN_connectivity: + type: tosca.capabilities.network.Bindable + valid_source_types: [org.openecomp.cp.Lan] + description: external LAN n/w interface + occurrences: [1,8]
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/VL.yml b/ui-ci-dev/src/main/resources/Files/VL.yml new file mode 100644 index 0000000000..74a2405af2 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/VL.yml @@ -0,0 +1,17 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.vl.VL1we23: + derived_from: tosca.nodes.Root + properties: + vendor: + type: string + required: false + vl_name: + type: string + required: false + capabilities: + virtual_linkable: + type: tosca.capabilities.network.Linkable + +
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/Valid xml.xml b/ui-ci-dev/src/main/resources/Files/Valid xml.xml new file mode 100644 index 0000000000..0d67e48340 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Valid xml.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<dirs> +<entry loc="C:\Program Files\Java\jdk1.7.0_79" stamp="1449076618518"/> +</dirs> diff --git a/ui-ci-dev/src/main/resources/Files/Valid_tosca_Mycompute.yml b/ui-ci-dev/src/main/resources/Files/Valid_tosca_Mycompute.yml new file mode 100644 index 0000000000..8fac5e16a8 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Valid_tosca_Mycompute.yml @@ -0,0 +1,35 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.vf.Database: + derived_from: tosca.nodes.Root + attributes: + private_address: + type: string + public_address: + type: string + networks: + type: map + entry_schema: + type: tosca.datatypes.network.NetworkInfo + ports: + type: map + entry_schema: + type: tosca.datatypes.network.PortInfo + requirements: + - local_storage: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: [0, UNBOUNDED] + capabilities: + host: + type: tosca.capabilities.Container + valid_source_types: [tosca.nodes.SoftwareComponent] + endpoint : + type: tosca.capabilities.Endpoint.Admin + os: + type: tosca.capabilities.OperatingSystem + scalable: + type: tosca.capabilities.Scalable + binding: + type: tosca.capabilities.network.Bindable diff --git a/ui-ci-dev/src/main/resources/Files/Valid_tosca_ReplaceTest.yml b/ui-ci-dev/src/main/resources/Files/Valid_tosca_ReplaceTest.yml new file mode 100644 index 0000000000..90e771dab1 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/Valid_tosca_ReplaceTest.yml @@ -0,0 +1,35 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.VF.MyCompute: + derived_from: tosca.nodes.Root + attributes: + private_address: + type: string + public_address: + type: string + networks: + type: map + entry_schema: + type: tosca.datatypes.network.NetworkInfo + ports: + type: map + entry_schema: + type: tosca.datatypes.network.PortInfo + requirements: + - local_storage: + capability: tosca.capabilities.Attachment + node: tosca.nodes.BlockStorage + relationship: tosca.relationships.AttachesTo + occurrences: [0, UNBOUNDED] + capabilities: + host: + type: tosca.capabilities.Container + valid_source_types: [tosca.nodes.SoftwareComponent] + endpoint : + type: tosca.capabilities.Endpoint.Admin + os: + type: tosca.capabilities.OperatingSystem + scalable: + type: tosca.capabilities.Scalable + binding: + type: tosca.capabilities.network.Bindable diff --git a/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam-volumes_v0.3.env b/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam-volumes_v0.3.env new file mode 100644 index 0000000000..b494d8c270 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam-volumes_v0.3.env @@ -0,0 +1,6 @@ +parameters: + pcrf_oam_vol_size: 500 + pcrf_oam_volume_silver-1: Silver + pcrf_oam_volume_silver-2: Silver + pcrf_oam_vol_name_1: sde1-pcrfx01-oam001-vol-1 + pcrf_oam_vol_name_2: sde1-pcrfx01-oam001-vol-2
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam_v0.6.env b/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam_v0.6.env new file mode 100644 index 0000000000..cf7cf710ce --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam_v0.6.env @@ -0,0 +1,18 @@ +parameters: + pcrf_oam_server_names: ZRDM1PCRF01OAM001,ZRDM1PCRF01OAM002 + pcrf_oam_image_name: PCRF_8.995-ATTM1.0.3.qcow2 + pcrf_oam_flavor_name: lc.4xlarge4 + availabilityzone_name: nova + pcrf_cps_net_name: int_pcrf_net_0 + pcrf_cps_net_ips: 172.26.16.111,172.26.16.112 + pcrf_arbiter_vip: 172.26.16.115 + pcrf_cps_net_mask: 255.255.255.0 + pcrf_oam_net_name: oam_protected_net_0 + pcrf_oam_net_ips: 107.239.64.117,107.239.64.118 + pcrf_oam_net_gw: 107.239.64.1 + pcrf_oam_net_mask: 255.255.248.0 + pcrf_oam_volume_id_1: a4aa05fb-fcdc-457b-8077-6845fdfc3257 + pcrf_oam_volume_id_2: 93d8fc1f-f1c3-4933-86b2-039881ee910f + pcrf_security_group_name: nimbus_security_group + pcrf_vnf_id: 730797234b4a40aa99335157b02871cd + diff --git a/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam_v0.6.yaml b/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam_v0.6.yaml new file mode 100644 index 0000000000..6636eba210 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/hot-nimbus-oam_v0.6.yaml @@ -0,0 +1,108 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates multiple PCRF OAM nodes stack + +parameters: + pcrf_oam_server_names: + type: comma_delimited_list + label: PCRF OAM server names + description: name of the PCRF OAM instance + pcrf_oam_image_name: + type: string + label: PCRF OAM image name + description: PCRF OAM image name + pcrf_oam_flavor_name: + type: string + label: PCRF OAM flavor name + description: flavor name of PCRF OAM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_arbiter_vip: + type: string + label: OAM Arbiter LB VIP + description: OAM Arbiter LB VIP + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ips: + type: comma_delimited_list + label: OAM network ips + description: OAM network ips + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_oam_volume_id_1: + type: string + label: CPS OAM 001 Cinder Volume + description: CPS OAM 001 Cinder Volumes + pcrf_oam_volume_id_2: + type: string + label: CPS OAM 002 Cinder Volume + description: CPS OAM 002 Cinder Volumes + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + server_pcrf_oam_001: + type: nested-oam_v0.2.yaml + properties: + pcrf_oam_server_name: { get_param: [pcrf_oam_server_names, 0] } + pcrf_oam_image_name: { get_param: pcrf_oam_image_name } + pcrf_oam_flavor_name: { get_param: pcrf_oam_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_oam_volume_id: { get_param: pcrf_oam_volume_id_1 } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 0] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_arbiter_vip: { get_param: pcrf_arbiter_vip } + pcrf_vnf_id: {get_param: pcrf_vnf_id} + + server_pcrf_oam_002: + type: nested-oam_v0.2.yaml + properties: + pcrf_oam_server_name: { get_param: [pcrf_oam_server_names, 1] } + pcrf_oam_image_name: { get_param: pcrf_oam_image_name } + pcrf_oam_flavor_name: { get_param: pcrf_oam_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_oam_volume_id: { get_param: pcrf_oam_volume_id_2 } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 1] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 1] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_arbiter_vip: { get_param: pcrf_arbiter_vip } + pcrf_vnf_id: {get_param: pcrf_vnf_id} diff --git a/ui-ci-dev/src/main/resources/Files/hot-nimbus-pcm_v0.6.yaml b/ui-ci-dev/src/main/resources/Files/hot-nimbus-pcm_v0.6.yaml new file mode 100644 index 0000000000..564104174a --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/hot-nimbus-pcm_v0.6.yaml @@ -0,0 +1,80 @@ +heat_template_version: 2013-05-23 + +description: heat template that creates PCRF Cluman stack + +parameters: + pcrf_pcm_server_names: + type: comma_delimited_list + label: PCRF CM server names + description: name of the PCRF CM instance + pcrf_pcm_image_name: + type: string + label: PCRF CM image name + description: PCRF CM image name + pcrf_pcm_flavor_name: + type: string + label: PCRF CM flavor name + description: flavor name of PCRF CM instance + availabilityzone_name: + type: string + label: availabilityzone name + description: availabilityzone name + pcrf_cps_net_name: + type: string + label: CPS network name + description: CPS network name + pcrf_cps_net_ips: + type: comma_delimited_list + label: CPS network ips + description: CPS network ips + pcrf_cps_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_oam_net_name: + type: string + label: OAM network name + description: OAM network name + pcrf_oam_net_ips: + type: comma_delimited_list + label: OAM network ips + description: OAM network ips + pcrf_oam_net_gw: + type: string + label: CPS network gateway + description: CPS network gateway + pcrf_oam_net_mask: + type: string + label: CPS network mask + description: CPS network mask + pcrf_pcm_volume_id_1: + type: string + label: CPS Cluman Cinder Volume + description: CPS Cluman Cinder Volume + pcrf_security_group_name: + type: string + label: security group name + description: the name of security group + pcrf_vnf_id: + type: string + label: PCRF VNF Id + description: PCRF VNF Id + +resources: + server_pcrf_pcm_001: + type: nested-pcm_v0.2.yaml + properties: + pcrf_pcm_server_name: { get_param: [pcrf_pcm_server_names, 0] } + pcrf_pcm_image_name: { get_param: pcrf_pcm_image_name } + pcrf_pcm_flavor_name: { get_param: pcrf_pcm_flavor_name } + availabilityzone_name: { get_param: availabilityzone_name } + pcrf_security_group_name: { get_param: pcrf_security_group_name } + pcrf_pcm_volume_id: { get_param: pcrf_pcm_volume_id_1 } + pcrf_cps_net_name: { get_param: pcrf_cps_net_name } + pcrf_cps_net_ip: { get_param: [pcrf_cps_net_ips, 0] } + pcrf_cps_net_mask: { get_param: pcrf_cps_net_mask } + pcrf_oam_net_name: { get_param: pcrf_oam_net_name } + pcrf_oam_net_ip: { get_param: [pcrf_oam_net_ips, 0] } + pcrf_oam_net_mask: { get_param: pcrf_oam_net_mask } + pcrf_oam_net_gw: { get_param: pcrf_oam_net_gw } + pcrf_vnf_id: {get_param: pcrf_vnf_id} diff --git a/ui-ci-dev/src/main/resources/Files/myYang.xml b/ui-ci-dev/src/main/resources/Files/myYang.xml new file mode 100644 index 0000000000..0d86d213e6 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/myYang.xml @@ -0,0 +1,8 @@ +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> + + <bean id="muranoLogic" class="org.openecomp.sdc.impl.MuranoLogic"> </bean> + +</beans>
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/mycompute.yml b/ui-ci-dev/src/main/resources/Files/mycompute.yml new file mode 100644 index 0000000000..c8a0c03384 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/mycompute.yml @@ -0,0 +1,18 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.vfc.mycompute: + derived_from: tosca.nodes.Compute + capabilities: + scalable: + type: tosca.capabilities.Scalable + properties: + propertyForTest: + type: string + description: test + required: true + default: success + # min_instances property should override property from tosca.capabilities.Scalable + min_instances: + type: integer + default: 3 + diff --git a/ui-ci-dev/src/main/resources/Files/service_with_inputs.csar b/ui-ci-dev/src/main/resources/Files/service_with_inputs.csar Binary files differnew file mode 100644 index 0000000000..c4d4881fec --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/service_with_inputs.csar diff --git a/ui-ci-dev/src/main/resources/Files/vADTRAN.zip b/ui-ci-dev/src/main/resources/Files/vADTRAN.zip Binary files differnew file mode 100644 index 0000000000..3ecde2c7ec --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/vADTRAN.zip diff --git a/ui-ci-dev/src/main/resources/Files/vCDN.zip b/ui-ci-dev/src/main/resources/Files/vCDN.zip Binary files differnew file mode 100644 index 0000000000..51e654a841 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/vCDN.zip diff --git a/ui-ci-dev/src/main/resources/Files/vFW_VF.yml b/ui-ci-dev/src/main/resources/Files/vFW_VF.yml new file mode 100644 index 0000000000..100883e399 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/vFW_VF.yml @@ -0,0 +1,58 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + + org.openecomp.resource.vf.vFW: + derived_from: tosca.nodes.Root + properties: + att-part-number: + type: string + vendor-name: + type: string + vendor-part-number: + type: string + vendor-model: + type: string + vendor-model-description: + type: string + vcpu-default: + type: integer + vcpu-min: + type: integer + vcpu-max: + type: integer + vmemory-default: + type: integer + vmemory-units: + type: string + default: "GB" + vmemory-min: + type: integer + vmemory-max: + type: integer + vdisk-default: + type: integer + vdisk-units: + type: string + default: "GB" + vdisk-min: + type: integer + vdisk-max: + type: integer + vnf-type: + type: string + software-version: + type: version + software-version-state: + type: integer + software-file-name: + type: string + vnf-feature: + type: string + requirements: + - host: + capability: tosca.capabilities.Container + relationship: tosca.relationships.HostedOn + capabilities: + binding: + type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/vFW_VFC.yml b/ui-ci-dev/src/main/resources/Files/vFW_VFC.yml new file mode 100644 index 0000000000..d0814c43aa --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/vFW_VFC.yml @@ -0,0 +1,58 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + + org.openecomp.resource.vfc.vFW: + derived_from: tosca.nodes.Root + properties: + att-part-number: + type: string + vendor-name: + type: string + vendor-part-number: + type: string + vendor-model: + type: string + vendor-model-description: + type: string + vcpu-default: + type: integer + vcpu-min: + type: integer + vcpu-max: + type: integer + vmemory-default: + type: integer + vmemory-units: + type: string + default: "GB" + vmemory-min: + type: integer + vmemory-max: + type: integer + vdisk-default: + type: integer + vdisk-units: + type: string + default: "GB" + vdisk-min: + type: integer + vdisk-max: + type: integer + vnf-type: + type: string + software-version: + type: version + software-version-state: + type: integer + software-file-name: + type: string + vnf-feature: + type: string + requirements: + - host: + capability: tosca.capabilities.Container + relationship: tosca.relationships.HostedOn + capabilities: + binding: + type: tosca.capabilities.network.Bindable
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/vRouter_vfc.yml b/ui-ci-dev/src/main/resources/Files/vRouter_vfc.yml new file mode 100644 index 0000000000..95ffe959de --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/vRouter_vfc.yml @@ -0,0 +1,78 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + + +node_types: + org.openecomp.resource.vfc.vRouter: + derived_from: tosca.nodes.Root + properties: + att-part-number: + type: string + vendor-name: + type: string + vendor-part-number: + type: string + vendor-model: + type: string + vendor-model-description: + type: string + vcpu-default: + type: integer + vcpu-min: + type: integer + vcpu-max: + type: integer + vmemory-default: + type: integer + vmemory-units: + type: string + default: "GB" + vmemory-min: + type: integer + vmemory-max: + type: integer + vdisk-default: + type: integer + vdisk-units: + type: string + default: "GB" + vdisk-min: + type: integer + vdisk-max: + type: integer + vnf-type: + type: string + software-version: + type: string + software-version-state: + type: integer + software-file-name: + type: string + vnf-feature: + type: string + management-v6-address: + type: string + nm-lan-v6-address: + type: string + nm-lan-v6-prefix-length: + type: string + management-v4-address: + type: string + nm-lan-v4-address: + type: string + nm-lan-v4-prefix-length: + type: string + routing-instance-name: + type: string + routing-instances: + type: map + entry_schema: + type: string + requirements: + - host: + capability: tosca.capabilities.Container + relationship: tosca.relationships.HostedOn + capabilities: + binding: + type: tosca.capabilities.network.Bindable + occurrences: [1,UNBOUNDED] +
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/valid HEAT_ENV files.env b/ui-ci-dev/src/main/resources/Files/valid HEAT_ENV files.env new file mode 100644 index 0000000000..e576c0f67d --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/valid HEAT_ENV files.env @@ -0,0 +1,54 @@ +parameters: + flavor_scp_be_id: m1.small + flavor_scp_fe_id: m1.small + flavor_smp_id: m1.small + flavor_db_id: m1.small + image_scp_be_id: CCLINUX + image_scp_fe_id: CCLINUX + image_smp_id: CCLINUX + image_db_id: CCLINUX + + int_vscp_fe_cluster_net_id: int_vscp_fe_cluster_net + int_vscp_fe_cluster_cidr: 172.26.2.0/24 + int_vscp_cluster_net_id: int_vscp_cluster_net + int_vscp_cluster_cidr: 172.26.3.0/24 + int_vscp_db_network_net_id: int_vscp_db_network_net + int_vscp_db_network_cidr: 172.26.1.0/24 + + SIGNET_vrf_A1_direct_net_id: SIGNET_vrf_A1_direct_net + SIGNET_vrf_B1_direct_net_id: SIGNET_vrf_B1_direct_net + Cricket_OCS_protected_net_id: Cricket_OCS_protected_net +# OAM_direct_net_id: OAM_net +# OAM_direct_net_id: oam-direct-net + OAM_direct_net_id: Marks_OAM_direct_net + + be0_Cricket_OCS_protected_ips: 107.239.15.17 + be1_Cricket_OCS_protected_ips: 107.239.15.18 + be2_Cricket_OCS_protected_ips: 107.239.15.19 + be3_Cricket_OCS_protected_ips: 107.239.15.20 + be4_Cricket_OCS_protected_ips: 107.239.15.21 + be0_OAM_direct_ips: 10.250.10.33 + be1_OAM_direct_ips: 10.250.10.34 + be2_OAM_direct_ips: 10.250.10.35 + be3_OAM_direct_ips: 10.250.10.36 + be4_OAM_direct_ips: 10.250.10.37 + fe0_SIGNET_vrf_A1_direct_ips: 172.26.4.1 + fe0_OAM_direct_ips: 10.250.10.38 + fe1_SIGNET_vrf_B1_direct_ips: 172.26.4.5 + fe1_OAM_direct_ips: 10.250.10.39 + smp0_OAM_direct_ips: 10.250.10.40 + smp1_OAM_direct_ips: 10.250.10.41 + db0_OAM_direct_ips: 10.250.10.42 + db1_OAM_direct_ips: 10.250.10.43 + + vm_scp_be0_name: vSCP_BE0 + vm_scp_be1_name: vSCP_BE1 + vm_scp_be2_name: vSCP_BE2 + vm_scp_be3_name: vSCP_BE3 + vm_scp_be4_name: vSCP_BE4 + vm_scp_fe0_name: vSCP_FE0 + vm_scp_fe1_name: vSCP_FE1 + vm_smp0_name: vSMP0 + vm_smp1_name: vSMP1 + vm_db0_name: vDB0 + vm_db1_name: vDB1 diff --git a/ui-ci-dev/src/main/resources/Files/validHEATfiles.yaml b/ui-ci-dev/src/main/resources/Files/validHEATfiles.yaml new file mode 100644 index 0000000000..6835485ca1 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/validHEATfiles.yaml @@ -0,0 +1,787 @@ +heat_template_version: 2013-05-23 +################################# +# +# Changes in v0.2: +# - Unique availability zone for each VM +# - LAN8 and SLAN networks removed according to latest Prod/Type I diagram +# - 2 DB VMs added +# - Images corrected +# - VM start-up order: SMP->DB->BE->FE (no error handling yet) +# - Provisioning scripts placeholders +# +################################# + +description: ASC Template + +parameters: +# availability_zone_smp0: +# type: string +# default: nova +# availability_zone_smp1: +# type: string +# default: nova +# availability_zone_fe0: +# type: string +# default: nova +# availability_zone_fe1: +# type: string +# default: nova +# availability_zone_db0: +# type: string +# default: nova +# availability_zone_db1: +# type: string +# default: nova +# availability_zone_be0: +# type: string +# default: nova +# availability_zone_be1: +# type: string +# default: nova +# availability_zone_be2: +# type: string +# default: nova +# availability_zone_be3: +# type: string +# default: nova +# availability_zone_be4: +# type: string +# default: nova + + vnf_name: + type: string + description: Unique name for this VNF instance + default: This_is_the_SCP_name + vnf_id: + type: string + description: Unique ID for this VNF instance + default: This_is_ths_SCP_id + + flavor_scp_be_id: + type: string + description: flavor type + default: a1.Small + flavor_scp_fe_id: + type: string + description: flavor type + default: a1.Small + flavor_smp_id: + type: string + description: flavor type + default: a1.Small + flavor_db_id: + type: string + description: flavor type + default: a1.Small + image_scp_be_id: + type: string + description: Image use to boot a server + default: asc_base_image_be + image_scp_fe_id: + type: string + description: Image use to boot a server + default: asc_base_image_fe + image_smp_id: + type: string + description: Image use to boot a server + default: asc_base_image_smp + image_db_id: + type: string + description: Image use to boot a server + default: asc_base_image_db + + int_vscp_fe_cluster_net_id: + type: string + description: LAN2 FE Cluster/KA + int_vscp_fe_cluster_cidr: + type: string + description: Private Network2 Address (CIDR notation) + int_vscp_cluster_net_id: + type: string + description: LAN3 Cluster + int_vscp_cluster_cidr: + type: string + description: Private Network3 Address (CIDR notation) + int_vscp_db_network_net_id: + type: string + description: LAN4 DB + int_vscp_db_network_cidr: + type: string + description: Private Network4 Address (CIDR notation) + SIGNET_vrf_A1_direct_net_id: + type: string + description: Network name for SIGTRAN_A + SIGNET_vrf_B1_direct_net_id: + type: string + description: Network name for SIGTRAN_B + Cricket_OCS_protected_net_id: + type: string + description: Network name for CRICKET_OCS + OAM_direct_net_id: + type: string + description: Network name for OAM + be0_Cricket_OCS_protected_ips: + type: string + label: be0 port 5 OAM ip address + description: be0 port 5 OAM ip address + be1_Cricket_OCS_protected_ips: + type: string + label: be1 port 5 OAM ip address + description: be1 port 5 OAM ip address + be2_Cricket_OCS_protected_ips: + type: string + label: be2 port 5 OAM ip address + description: be2 port 5 OAM ip address + be3_Cricket_OCS_protected_ips: + type: string + label: be3 port 5 OAM ip address + description: be3 port 5 OAM ip address + be4_Cricket_OCS_protected_ips: + type: string + label: be4 port 5 OAM ip address + description: be4 port 5 OAM ip address + be0_OAM_direct_ips: + type: string + label: be0 port 7 OAM ip address + description: be0 port 7 OAM ip address + be1_OAM_direct_ips: + type: string + label: be1 port 7 OAM ip address + description: be1 port 7 OAM ip address + be2_OAM_direct_ips: + type: string + label: be2 port 7 OAM ip address + description: be2 port 7 OAM ip address + be3_OAM_direct_ips: + type: string + label: be3 port 7 OAM ip address + description: be3 port 7 OAM ip address + be4_OAM_direct_ips: + type: string + label: be4 port 7 OAM ip address + description: be4 port 7 OAM ip address + fe0_SIGNET_vrf_A1_direct_ips: + type: string + label: fe0 port 0 SIGTRAN ip address + description: fe0 port 0 SIGTRAN ip address + fe0_OAM_direct_ips: + type: string + label: fe0 port 7 OAM ip address + description: fe0 port 7 OAM ip address + fe1_SIGNET_vrf_B1_direct_ips: + type: string + label: fe1 port 1 SIGTRAN ip address + description: fe1 port 1 SIGTRAN ip address + fe1_OAM_direct_ips: + type: string + label: fe1 port 7 OAM ip address + description: fe1 port 7 OAM ip address + smp0_OAM_direct_ips: + type: string + label: smp0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + smp1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: smp1 port 7 OAM ip address + db0_OAM_direct_ips: + type: string + label: db0 port 7 OAM ip address + description: smp0 port 7 OAM ip address + db1_OAM_direct_ips: + type: string + label: smp1 port 7 OAM ip address + description: db1 port 7 OAM ip address + vm_scp_be0_name: + type: string + default: vSCP_BE0 + description: name of VM + vm_scp_be1_name: + type: string + default: vSCP_BE1 + description: name of VM + vm_scp_be2_name: + type: string + default: vSCP_BE2 + description: name of VM + vm_scp_be3_name: + type: string + default: vSCP_BE3 + description: name of VM + vm_scp_be4_name: + type: string + default: vSCP_BE4 + description: name of VM + vm_scp_fe0_name: + type: string + default: vSCP_FE0 + description: name of VM + vm_scp_fe1_name: + type: string + default: vSCP_FE1 + description: name of VM + vm_smp0_name: + type: string + default: vSMP0 + description: name of VM + vm_smp1_name: + type: string + default: vSMP1 + description: name of VM + vm_db0_name: + type: string + default: vDB0 + description: name of VM + vm_db1_name: + type: string + default: vDB1 + description: name of VM + +resources: +# scp_be_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_be_wait_handle } +# count: 5 +# timeout: 300 +# scp_be_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# scp_fe_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: scp_fe_wait_handle } +# count: 2 +# timeout: 300 +# scp_fe_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# smp_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: smp_wait_handle } +# count: 2 +# timeout: 300 +# smp_wait_handle: +# type: OS::Heat::WaitConditionHandle +# +# db_wait_condition: +# type: OS::Heat::WaitCondition +# properties: +# handle: { get_resource: db_wait_handle } +# count: 2 +# timeout: 300 +# db_wait_handle: +# type: OS::Heat::WaitConditionHandle + + FE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + BE_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + SMP_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + DB_Affinity: + type: OS::Nova::ServerGroup + properties: + policies: ["anti-affinity"] + + FE_Clustering_KA: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_fe_cluster_net_id } + + FE_Clustering_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: FE_Clustering_KA } + cidr: { get_param: int_vscp_fe_cluster_cidr } + + Clustering_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_cluster_net_id } + + Clustering_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: Clustering_Network } + cidr: { get_param: int_vscp_cluster_cidr } + + DB_Network: + type: OS::Contrail::VirtualNetwork + properties: + name: { get_param: int_vscp_db_network_net_id } + + DB_Network_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: DB_Network } + cidr: { get_param: int_vscp_db_network_cidr } + + server_scp_be0: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be0_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be0 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be0_port_3 } + - port: { get_resource: be0_port_4 } + - port: { get_resource: be0_port_5 } + - port: { get_resource: be0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be0_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be0_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be0_Cricket_OCS_protected_ips}}] + + be0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be0_OAM_direct_ips}}] + + server_scp_be1: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be1_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be1 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be1_port_3 } + - port: { get_resource: be1_port_4 } + - port: { get_resource: be1_port_5 } + - port: { get_resource: be1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be1_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be1_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be1_Cricket_OCS_protected_ips}}] + + be1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be1_OAM_direct_ips}}] + + server_scp_be2: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be2_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be2 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be2_port_3 } + - port: { get_resource: be2_port_4 } + - port: { get_resource: be2_port_5 } + - port: { get_resource: be2_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be2_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be2_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be2_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be2_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be2_Cricket_OCS_protected_ips}}] + + be2_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be2_OAM_direct_ips}}] + + server_scp_be3: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be3_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be3 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be3_port_3 } + - port: { get_resource: be3_port_4 } + - port: { get_resource: be3_port_5 } + - port: { get_resource: be3_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be3_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be3_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be3_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be3_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be3_Cricket_OCS_protected_ips}}] + + be3_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be3_OAM_direct_ips}}] + + server_scp_be4: + type: OS::Nova::Server +# depends on: db_wait_condition + properties: + name: { get_param: vm_scp_be4_name } + image: { get_param: image_scp_be_id } +# availability_zone: { get_param: availability_zone_be4 } + flavor: { get_param: flavor_scp_be_id } + scheduler_hints: { group: { get_resource: BE_Affinity } } + networks: + - port: { get_resource: be4_port_3 } + - port: { get_resource: be4_port_4 } + - port: { get_resource: be4_port_5 } + - port: { get_resource: be4_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_be4_name} +# wc_notify: { get_attr: ['scp_be_wait_handle', 'curl_cli'] } + + be4_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + be4_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + be4_port_5: + type: OS::Neutron::Port + properties: + network: { get_param: Cricket_OCS_protected_net_id } + fixed_ips: [{"ip_address": {get_param: be4_Cricket_OCS_protected_ips}}] + + be4_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: be4_OAM_direct_ips}}] + + server_scp_fe0: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe0_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe0 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe0_port_0 } + - port: { get_resource: fe0_port_2 } + - port: { get_resource: fe0_port_3 } + - port: { get_resource: fe0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe0_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe0_port_0: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_A1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_SIGNET_vrf_A1_direct_ips}}] + + fe0_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe0_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe0_OAM_direct_ips}}] + + server_scp_fe1: + type: OS::Nova::Server +# depends on: scp_be_wait_condition + properties: + name: { get_param: vm_scp_fe1_name } + image: { get_param: image_scp_fe_id } +# availability_zone: { get_param: availability_zone_fe1 } + flavor: { get_param: flavor_scp_fe_id } + scheduler_hints: { group: { get_resource: FE_Affinity } } + networks: + - port: { get_resource: fe1_port_1 } + - port: { get_resource: fe1_port_2 } + - port: { get_resource: fe1_port_3 } + - port: { get_resource: fe1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_scp_fe1_name} +# wc_notify: { get_attr: ['scp_fe_wait_handle', 'curl_cli'] } + + fe1_port_1: + type: OS::Neutron::Port + properties: + network: { get_param: SIGNET_vrf_B1_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_SIGNET_vrf_B1_direct_ips}}] + + fe1_port_2: + type: OS::Neutron::Port + properties: + network_id: { get_resource: FE_Clustering_KA } + + fe1_port_3: + type: OS::Neutron::Port + properties: + network_id: { get_resource: Clustering_Network } + + fe1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: fe1_OAM_direct_ips}}] + + server_smp0: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp0_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp0 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp0_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp0_OAM_direct_ips}}] + + server_smp1: + type: OS::Nova::Server + properties: + name: { get_param: vm_smp1_name } + image: { get_param: image_smp_id } +# availability_zone: { get_param: availability_zone_smp1 } + flavor: { get_param: flavor_smp_id } + scheduler_hints: { group: { get_resource: SMP_Affinity } } + networks: + - port: { get_resource: smp1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_smp1_name} +# wc_notify: { get_attr: ['smp_wait_handle', 'curl_cli'] } + + smp1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: smp1_OAM_direct_ips}}] + + server_db0: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db0_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db0 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db0_port_4 } + - port: { get_resource: db0_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db0_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db0_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db0_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db0_OAM_direct_ips}}] + + server_db1: + type: OS::Nova::Server +# depends_on: smp_wait_condition + properties: + name: { get_param: vm_db1_name } + image: { get_param: image_db_id } +# availability_zone: { get_param: availability_zone_db1 } + flavor: { get_param: flavor_db_id } + scheduler_hints: { group: { get_resource: DB_Affinity } } + networks: + - port: { get_resource: db1_port_4 } + - port: { get_resource: db1_port_7 } + metadata: + vnf_id: { get_param: vnf_id } + user_data: + str_replace: + template: | + #!/bin/bash + #todo: provision $vm_name + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + $vm_name: {get_param: vm_db1_name} +# wc_notify: { get_attr: ['db_wait_handle', 'curl_cli'] } + + db1_port_4: + type: OS::Neutron::Port + properties: + network_id: { get_resource: DB_Network } + + db1_port_7: + type: OS::Neutron::Port + properties: + network: { get_param: OAM_direct_net_id } + fixed_ips: [{"ip_address": {get_param: db1_OAM_direct_ips}}]
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/valid_vf.csar b/ui-ci-dev/src/main/resources/Files/valid_vf.csar Binary files differnew file mode 100644 index 0000000000..01bf159071 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/valid_vf.csar diff --git a/ui-ci-dev/src/main/resources/Files/vf_with_groups.csar b/ui-ci-dev/src/main/resources/Files/vf_with_groups.csar Binary files differnew file mode 100644 index 0000000000..61ea8cee20 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/vf_with_groups.csar diff --git a/ui-ci-dev/src/main/resources/Files/yamlSample.yml b/ui-ci-dev/src/main/resources/Files/yamlSample.yml new file mode 100644 index 0000000000..10ccf71d51 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/yamlSample.yml @@ -0,0 +1,5 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.cp.CP: + derived_from: org.openecomp.resource.cp.root
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/Files/yamlSample2.yml b/ui-ci-dev/src/main/resources/Files/yamlSample2.yml new file mode 100644 index 0000000000..10ccf71d51 --- /dev/null +++ b/ui-ci-dev/src/main/resources/Files/yamlSample2.yml @@ -0,0 +1,5 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 + +node_types: + org.openecomp.resource.cp.CP: + derived_from: org.openecomp.resource.cp.root
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/ci/conf/credentials.yaml b/ui-ci-dev/src/main/resources/ci/conf/credentials.yaml new file mode 100644 index 0000000000..63a4280264 --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/conf/credentials.yaml @@ -0,0 +1,48 @@ + designer: { + username: m99121, + password: 66-Percent, + firstname: ASDC, + lastname: KASPIN + } + admin: { + username: m99122, + password: 98-Degrees, + firstname: ASDC, + lastname: KASPIN + } + ops: { + username: m99123, + password: 17-Diameter, + firstname: ASDC, + lastname: KASPIN + } + tester: { + username: m99124, + password: 802-NotaGroup, + firstname: ASDC, + lastname: KASPIN + } + governor: { + username: m99125, + password: 142-Officiant, + firstname: ASDC, + lastname: KASPIN + } + product_strategist: { + username: m99126, + password: 1910-FruitGum, + firstname: ASDC, + lastname: KASPIN + } + product_manager: { + username: m99127, + password: 747-Airplane, + firstname: ASDC, + lastname: KASPIN + } + product_local: { + username: pm0001, + password: 123123a, + firstname: ASDC, + lastname: KASPIN + }
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/ci/conf/log4j.properties b/ui-ci-dev/src/main/resources/ci/conf/log4j.properties new file mode 100644 index 0000000000..3e159ec8df --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/conf/log4j.properties @@ -0,0 +1,34 @@ +# Define the root logger with appender file +log4j.rootLogger = DEBUG, FILE, stdout + +# Define the file appender +log4j.appender.FILE=org.apache.log4j.RollingFileAppender +log4j.appender.FILE.File=${targetlog}logs/ci-log.out + +# Define the layout for file appender +log4j.appender.FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n + +# Set the maximum file size before rollover +log4j.appender.FILE.maxFileSize=5MB + +# Set the the backup index +log4j.appender.FILE.maxBackupIndex=10 + + +############################################################# + +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n + +log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG +log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout + +log4j.logger.org.openecomp.sdc.ci.tests.utils=TRACE, FILE, stdout +log4j.additivity.org.openecomp.sdc.ci.tests.utils=false + + diff --git a/ui-ci-dev/src/main/resources/ci/conf/sdc-packages.yaml b/ui-ci-dev/src/main/resources/ci/conf/sdc-packages.yaml new file mode 100644 index 0000000000..dcb78eefc1 --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/conf/sdc-packages.yaml @@ -0,0 +1,2 @@ +packages: + - org.openecomp.sdc.ci.tests.execute.resourceui
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/ci/conf/sdc.yaml b/ui-ci-dev/src/main/resources/ci/conf/sdc.yaml new file mode 100644 index 0000000000..bdca2ab972 --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/conf/sdc.yaml @@ -0,0 +1,80 @@ +outputFolder: target +reportName: index.html +catalogBeHost: behost +catalogFeHost: fehost +esHost: eshost +disributionClientHost: disClient +catalogFePort: 8181 +catalogBePort: 8080 +disributionClientPort: 8181 +esPort: 9200 +neoHost: neoHost +neoPort: 7474 +neoDBusername: neo4j +neoDBpassword: 123456 +#url: http://localhost:9000/#/dashboard +url: http://localhost:8181/sdc1/proxy-designer1#/dashboard + +webSealSimulatorUrl: http://localhost:8285/sdc1 +remoteTestingMachineIP: 1.2.3.4 +remoteTestingMachinePort: 5555 +remoteTesting: false + +resourceConfigDir: src/test/resources/CI/tests +componentsConfigDir: src/test/resources/CI/components +importResourceConfigDir: ../catalog-be/src/main/resources/import/tosca/capability-types +importResourceTestsConfigDir: src/test/resources/CI/importResourceTests +errorConfigurationFile: ../catalog-be/src/main/resources/config/error-configuration.yaml +configurationFile: ../catalog-be/src/main/resources/config/configuration.yaml +importTypesConfigDir: src/test/resources/CI/importTypesTest + + +titanPropertiesFile: src/main/resources/ci/conf/titan.properties +cassandraHost: 127.0.0.1 +cassandraAuthenticate: false +cassandraUsername: koko +cassandraPassword: bobo +cassandraSsl: false +cassandraTruststorePath : /path/path +cassandraTruststorePassword : 123123 +cassandraAuditKeySpace: sdcAudit +cassandraArtifactKeySpace: sdcArtifact + +stopOnClassFailure: false + +#List of non-abstract resources to keep during titan cleanup between tests +#Only 1.0 version will be kept +resourcesNotToDelete: + - Compute + - Database + - ObjectStorage + - BlockStorage + - LoadBalancer + - Port + - Network + - Root + - ContainerApplication + - ContainerRuntime + - DBMS + - SoftwareComponent + - WebApplication + - WebServer + - CinderVolume + - ContrailVirtualNetwork + - NeutronNet + - NeutronPort + - NovaServer +#Resource categories to keep (including all their subcategories) +resourceCategoriesNotToDelete: + - Generic + - Network L2-3 + - Network L4+ + - Application L4+ + - Network Connectivity + +#Service categories to keep +serviceCategoriesNotToDelete: + - Mobility + - Network L1-3 + - Network L4 + - VoIP Call Control
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/ci/conf/titan.properties b/ui-ci-dev/src/main/resources/ci/conf/titan.properties new file mode 100644 index 0000000000..94d12cfba0 --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/conf/titan.properties @@ -0,0 +1,7 @@ +storage.backend=cassandra +storage.hostname=cassandrahost +storage.port=9160 + +cache.db-cache-clean-wait = 20 +cache.db-cache-time = 180000 +cache.db-cache-size = 0.5
\ No newline at end of file diff --git a/ui-ci-dev/src/main/resources/ci/scripts/startTest.sh b/ui-ci-dev/src/main/resources/ci/scripts/startTest.sh new file mode 100644 index 0000000000..27933699a5 --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/scripts/startTest.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +TOMCAT_DIR=/home/apache-tomcat-7.0.41/webapps/sdc-ci + +function usage { + echo "Usage: $0 <jar file>" +} + +function exitOnError() { + if [ $1 -ne 0 ] + then + echo "Failed running task $2" + exit 2 + fi +} + +if [ $# -lt 1 ] +then + usage + exit 2 +fi + +CURRENT_DIR=`pwd` +BASEDIR=$(dirname $0) + +if [ ${BASEDIR:0:1} = "/" ] +then + FULL_PATH=$BASEDIR +else + FULL_PATH=$CURRENT_DIR/$BASEDIR +fi + +LOGS_PROP_FILE=file:${FULL_PATH}/../conf/log4j.properties +############################################# +TARGET_DIR=${FULL_PATH}/../target +TARGET_LOG_DIR="${TARGET_DIR}/" +CONF_FILE=${FULL_PATH}/../conf/sdc.yaml +DEBUG=true +MainClass=org.openecomp.sdc.ci.tests.run.StartTest + +JAR_FILE=$1 + +#TARGET_DIR=`echo ${TARGET_DIR} | sed 's/\//\//g'` +#echo $TARGET_DIR + +TESTS_DIR=/opt/app/sdc/ci/resources/tests +COMPONENTS_DIR=/opt/app/sdc/ci/resources/components + + +sed -i 's#\(outputFolder:\).*#\1 '${TARGET_DIR}'#g' $CONF_FILE +sed -i 's#\(resourceConfigDir:\).*#\1 '${TESTS_DIR}'#g' $CONF_FILE +sed -i 's#\(componentsConfigDir:\).*#\1 '${COMPONENTS_DIR}'#g' $CONF_FILE + + + +mkdir -p ${TARGET_DIR} +if [ -d ${TARGET_DIR} ] +then + rm -rf ${TARGET_DIR}/* + exitOnError $? "Failed_to_delete_target_dir" +fi + + +debug_port=8800 +#JAVA_OPTION="-javaagent:/var/tmp/jacoco/lib/jacocoagent.jar=destfile=jacoco-it.exec" +JAVA_OPTION="" +case "$2" in + -debug) echo "Debug mode, Listen on port $debug_port"; JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;; + "") echo "Standard mode";; + *) echo "USAGE: startTest.sh [-debug]";; +esac + +#cmd="java $JAVA_OPTION -Dconfig.resource=attodlit.conf -Dlog4j.configuration=file:./conf/log4j.properties -cp #att-odl-it_0.0.1-SNAPSHOT-jar-with-dependencies.jar org.openecomp.d2.it.StartTest" + +#cmd="java $JAVA_OPTION -Dconfig.resource=attsdc.conf -Ddebug=true -Dlog4j.configuration=file:./conf/log4j.properties -cp uber-ci-1.0.0-SNAPSHOT.jar org.openecomp.sdc.ci.tests.run.StartTest" + + +cmd="java $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass}" + +#echo $cmd +#console=`$cmd` + + + +if [ $DEBUG == "true" ] +then + $cmd +else + $cmd >> /dev/null +fi +status=`echo $?` + +#echo "console=$console" +#echo "status=$status" +#tomcat=`ps -ef | grep tomcat | grep java | wc -l` + +#if [ $tomcat == 0 ]; then +# echo "Bring tomcat up" +# apache-tomcat-7.0.41/bin/startup.sh +#fi + +#`rm -rf ./html/*.html` +#`mv *.html ./html/` + + +if [ -d ${TOMCAT_DIR} ] +then + + cp ${TARGET_DIR}/*.html ${TOMCAT_DIR} + mv ${TOMCAT_DIR}/SDC-testReport.html ${TOMCAT_DIR}/index.html +fi + +#echo "tomcat=$tomcat" +#ip=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p' | grep 172.20` + +#echo "Report url: http://$ip:8090/att-odl-it/" + +echo "##################################################" +echo "################# status is $status " +echo "##################################################" + +exit $status + diff --git a/ui-ci-dev/src/main/resources/ci/testSuites/fullTests.xml b/ui-ci-dev/src/main/resources/ci/testSuites/fullTests.xml new file mode 100644 index 0000000000..9f912e58b8 --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/testSuites/fullTests.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uiFullTests" configfailurepolicy="continue" verbose="2"> + <parameter name="clean-type" value="FULL" /> <!--Valid Values are: PARTIAL, FULL, NONE --> + <test name="Vfc Tests"> + <classes> + <class name="org.openecomp.sdc.uici.tests.execute.vfc.VfcBasicTests"></class> + </classes> + </test> + + <test name="VF Tests"> + <classes> + <class name="org.openecomp.sdc.uici.tests.execute.vf.VfBasicTests" /> + <class name="org.openecomp.sdc.uici.tests.execute.vf.VfCanvasTests" /> + <class name="org.openecomp.sdc.uici.tests.execute.vf.VfOnboardingTests" /> + <class name="org.openecomp.sdc.uici.tests.execute.vf.VfDeploymentTests"/> + </classes> + </test> + + <test name="Service Tests"> + <classes> + <class name="org.openecomp.sdc.uici.tests.execute.service.ServiceBasicTests"></class> + <class name="org.openecomp.sdc.uici.tests.execute.service.ServiceInputsTests"></class> + </classes> + </test> +</suite> diff --git a/ui-ci-dev/src/main/resources/ci/testSuites/sanity.xml b/ui-ci-dev/src/main/resources/ci/testSuites/sanity.xml new file mode 100644 index 0000000000..99e8765038 --- /dev/null +++ b/ui-ci-dev/src/main/resources/ci/testSuites/sanity.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> +<suite name="uiSanity" configfailurepolicy="continue" verbose="2"> + <parameter name="clean-type" value="FULL" /> <!--Valid Values are: PARTIAL, FULL, NONE --> + <test name="Vfc Tests"> + <classes> + <class name="org.openecomp.sdc.uici.tests.execute.vfc.VfcBasicTests"> + <methods> + <include name="testImportVfc" /> + <include name="testUpdateTypeForAttributeOfVfc" /> + </methods> + </class> + </classes> + </test> + + <test name="VF Tests"> + <classes> + <class name="org.openecomp.sdc.uici.tests.execute.vf.VfBasicTests"> + <methods> + <include name="testImportVf" /> + <include name="testUpdateInstanceAttributeValue" /> + <include name="testVfCertification" /> + </methods> + </class> + <class name="org.openecomp.sdc.uici.tests.execute.vf.VfCanvasTests"> + <methods> + <include name="testCanvasVFSanity" /> + </methods> + </class> + <class name="org.openecomp.sdc.uici.tests.execute.vf.VfDeploymentTests"> + <methods> + <include name="testUpdateModuleNameSanity" /> + <include name="testTabsViewSanity"/> + </methods> + </class> + </classes> + </test> + + <test name="Service Tests"> + <classes> + <class name="org.openecomp.sdc.uici.tests.execute.service.ServiceBasicTests"> + <methods> + <include name="testLinkTwoRI" /> + <include name="testBuildServiceForDistribution" /> + </methods> + </class> + <class name="org.openecomp.sdc.uici.tests.execute.service.ServiceInputsTests"> + <methods> + <include name="testInputsSanity" /> + </methods> + </class> + </classes> + </test> + +</suite> diff --git a/ui-ci-dev/src/main/resources/images/gizmorambo.jpg b/ui-ci-dev/src/main/resources/images/gizmorambo.jpg Binary files differnew file mode 100644 index 0000000000..c9a8fe8a64 --- /dev/null +++ b/ui-ci-dev/src/main/resources/images/gizmorambo.jpg diff --git a/ui-ci-dev/src/test/Completetheform.js b/ui-ci-dev/src/test/Completetheform.js new file mode 100644 index 0000000000..7e8b7572cc --- /dev/null +++ b/ui-ci-dev/src/test/Completetheform.js @@ -0,0 +1,3 @@ +/** + * New node file + */ |