summaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Import.java
blob: c5017a4f3441bfc85bb47ca73a4c5ab514645591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.sdc.ci.tests.execute.sanity;

import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;

import java.util.List;
import java.util.function.Supplier;

import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
import org.openecomp.sdc.ci.tests.datatypes.BreadCrumbsButtonsEnum;
import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifacts;
import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
import org.openecomp.sdc.ci.tests.utilities.FileHandling;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openqa.selenium.ElementNotVisibleException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;

public class Import extends SetupCDTest {

	@Test
	public void importResource() throws Exception {

		String filePath = FileHandling.getResourcesFilesPath();
		String fileName = "CPWithAttributes.yml";

		// import Resource
		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser());
		ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());

	}

	@Test
	public void certifyVFC() throws Exception {
		String filePath = FileHandling.getResourcesFilesPath();
		String fileName = "CPWithAttributes.yml";
		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
				ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
		ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
		ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
		quitAndReLogin(UserRoleEnum.TESTER);
		GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
		TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());

		quitAndReLogin(UserRoleEnum.DESIGNER);
		// GeneralUIUtils.clickBreadCrumbs(BreadCrumbsButtonsEnum.CATALOG);
		String cpVersion = GeneralUIUtils.getComponentVersion(atomicResourceMetaData.getName());
		assertTrue("V 1.0".equals(cpVersion));
	}

	@Test
	public void uploadAllInformationalArtifactPlaceholdersInVFC() throws Exception {
		String filePath = FileHandling.getResourcesFilesPath();
		String fileName = "CPWithAttributes.yml";
		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
				ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());

		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();

		for (InformationalArtifacts infoArtifact : InformationalArtifacts.values()) {
			ArtifactUIUtils.fillPlaceHolderInformationalArtifact(infoArtifact, filePath, "Heat-File 1.yaml",
					infoArtifact.name());
		}

		assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifacts.values().length,
				() -> InformationalArtifactPage.getElemenetsFromTable()));

		InformationalArtifactPage.clickAddNewArtifact();
		Select artifactLabelList = InformationalArtifactPage.artifactPopup().defineArtifactLabel("");
		assertEquals(1, artifactLabelList.getAllSelectedOptions().size());

	}

	@Test(expectedExceptions = ElementNotVisibleException.class)
	public void uploadInformationaArtifactMetdataTest() throws Exception {
		String filePath = FileHandling.getResourcesFilesPath();
		String fileName = "CPWithAttributes.yml";
		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
				ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());

		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
		assertTrue(InformationalArtifactPage.checkElementsCountInTable(0,
				() -> InformationalArtifactPage.getElemenetsFromTable()));

		ArtifactInfo artifactInfo = new ArtifactInfo(filePath, "Heat-File 1.yaml", "new artifact", "artifact1",
				"OTHER");
		InformationalArtifactPage.clickAddNewArtifact();
		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifactInfo);

		assertTrue(InformationalArtifactPage.checkElementsCountInTable(1,
				() -> InformationalArtifactPage.getElemenetsFromTable()));

		String actulaArtifactDescription = InformationalArtifactPage
				.getArtifactDescription(artifactInfo.getArtifactLabel());
		assertTrue(artifactInfo.getDescription().equals(actulaArtifactDescription));

		InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel());
		InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2");
	}

	// @Test()
	// public void updateInformationalArtifact(){
	// ArtifactInfo artifactInfo = new ArtifactInfo("", "", "new artifact",
	// "artifact1", "");
	// InformationalArtifactPage.clickEditArtifact("artifact1");
	// String newDesc = "newDesc";
	// InformationalArtifactPage.artifactPopup().insertDescription(newDesc);
	// InformationalArtifactPage.artifactPopup().clickUpdateButton();
	// String actulaArtifactDescription =
	// InformationalArtifactPage.getArtifactDescription(artifactInfo.getArtifactLabel());
	// assertTrue(newDesc.equals(actulaArtifactDescription));
	// InformationalArtifactPage.clickEditArtifact(artifactInfo.getArtifactLabel());
	// InformationalArtifactPage.artifactPopup().defineArtifactLabel("artifact2");
	// InformationalArtifactPage.artifactPopup().selectArtifactType(artifactInfo.getArtifactType());
	// }

	@Test
	public void verifyTwoToscaArtifacts() throws Exception {
		String filePath = FileHandling.getResourcesFilesPath();
		String fileName = "CPWithAttributes.yml";
		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(
				ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());

		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();

		// List<WebElement> elemenetsFromTable =
		// GeneralPageElements.getElemenetsFromTable();
		// Supplier<List<WebElement>> supplier = () -> elemenetsFromTable;
		// assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2,
		// supplier));
		assertTrue(ToscaArtifactsPage.checkElementsCountInTable(2));
	}

	@Override
	protected UserRoleEnum getRole() {
		return UserRoleEnum.DESIGNER;
	}

}
alar l-Scalar-Plain">string description: CPS Cluman Cinder Volume port_pcm_port_1_ip_requirements: type: list required: true entry_schema: type: org.openecomp.datatypes.network.IpRequirements port_pcm_port_0_mac_requirements: type: org.openecomp.datatypes.network.MacRequirements required: true cps_net_name: label: CPS network name hidden: false immutable: false type: string description: CPS network name oam_net_ip: label: OAM network ip hidden: false immutable: false type: string description: OAM network ip oam_net_mask: label: CPS network mask hidden: false immutable: false type: string description: CPS network mask port_pcm_port_1_order: type: integer required: true node_templates: pcm_port_1: type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: ip_requirements: get_input: port_pcm_port_1_ip_requirements security_groups: - get_input: security_group_name network_role: get_input: port_pcm_port_1_network_role fixed_ips: - ip_address: get_input: oam_net_ip subnetpoolid: get_input: port_pcm_port_1_subnetpoolid mac_requirements: get_input: port_pcm_port_1_mac_requirements subinterface_indicator: false exCP_naming: get_input: port_pcm_port_1_exCP_naming vlan_requirements: get_input: port_pcm_port_1_vlan_requirements network_role_tag: get_input: port_pcm_port_1_network_role_tag network: get_input: oam_net_name order: get_input: port_pcm_port_1_order requirements: - binding: capability: tosca.capabilities.network.Bindable node: server_pcm relationship: tosca.relationships.network.BindsTo server_pcm: type: org.openecomp.resource.vfc.compute.nodes.heat.pcm_server properties: flavor: get_input: pcm_flavor_name availability_zone: get_input: availabilityzone_name image: get_input: pcm_image_name config_drive: true user_data_format: RAW name: get_input: pcm_server_name pcm_port_0: type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: ip_requirements: get_input: port_pcm_port_0_ip_requirements security_groups: - get_input: security_group_name network_role: get_input: port_pcm_port_0_network_role fixed_ips: - ip_address: get_input: cps_net_ip subnetpoolid: get_input: port_pcm_port_0_subnetpoolid mac_requirements: get_input: port_pcm_port_0_mac_requirements subinterface_indicator: false exCP_naming: get_input: port_pcm_port_0_exCP_naming vlan_requirements: get_input: port_pcm_port_0_vlan_requirements network_role_tag: get_input: port_pcm_port_0_network_role_tag network: get_input: cps_net_name order: get_input: port_pcm_port_0_order requirements: - binding: capability: tosca.capabilities.network.Bindable node: server_pcm relationship: tosca.relationships.network.BindsTo groups: nested-pcm_v0.1_group: type: org.openecomp.groups.heat.HeatStack properties: heat_file: ../Artifacts/nested-pcm_v0.1.yaml description: heat template that creates PCRF Cluman stack members: - pcm_port_1 - server_pcm - pcm_port_0 outputs: server_pcm_id: description: the pcm nova service id value: server_pcm substitution_mappings: node_type: org.openecomp.resource.abstract.nodes.heat.pcm_server capabilities: network.incoming.packets.rate_pcm_port_0: - pcm_port_0 - network.incoming.packets.rate cpu_server_pcm: - server_pcm - cpu network.incoming.packets.rate_pcm_port_1: - pcm_port_1 - network.incoming.packets.rate network.outpoing.packets_pcm_port_1: - pcm_port_1 - network.outpoing.packets memory_server_pcm: - server_pcm - memory disk.write.requests_server_pcm: - server_pcm - disk.write.requests network.outpoing.packets_pcm_port_0: - pcm_port_0 - network.outpoing.packets disk.device.iops_server_pcm: - server_pcm - disk.device.iops memory.resident_server_pcm: - server_pcm - memory.resident disk.device.write.requests_server_pcm: - server_pcm - disk.device.write.requests disk.device.usage_server_pcm: - server_pcm - disk.device.usage disk.allocation_server_pcm: - server_pcm - disk.allocation disk.usage_server_pcm: - server_pcm - disk.usage disk.device.write.bytes_server_pcm: - server_pcm - disk.device.write.bytes disk.root.size_server_pcm: - server_pcm - disk.root.size disk.ephemeral.size_server_pcm: - server_pcm - disk.ephemeral.size disk.device.latency_server_pcm: - server_pcm - disk.device.latency network.incoming.bytes_pcm_port_0: - pcm_port_0 - network.incoming.bytes network.incoming.bytes_pcm_port_1: - pcm_port_1 - network.incoming.bytes binding_pcm_port_0: - pcm_port_0 - binding binding_pcm_port_1: - pcm_port_1 - binding memory.usage_server_pcm: - server_pcm - memory.usage disk.read.requests_server_pcm: - server_pcm - disk.read.requests disk.capacity_server_pcm: - server_pcm - disk.capacity os_server_pcm: - server_pcm - os disk.read.bytes_server_pcm: - server_pcm - disk.read.bytes network.outgoing.packets.rate_pcm_port_0: - pcm_port_0 - network.outgoing.packets.rate network.outgoing.packets.rate_pcm_port_1: - pcm_port_1 - network.outgoing.packets.rate feature_pcm_port_1: - pcm_port_1 - feature network.outgoing.bytes_pcm_port_0: - pcm_port_0 - network.outgoing.bytes disk.device.read.bytes_server_pcm: - server_pcm - disk.device.read.bytes feature_pcm_port_0: - pcm_port_0 - feature network.outgoing.bytes_pcm_port_1: - pcm_port_1 - network.outgoing.bytes attachment_pcm_port_0: - pcm_port_0 - attachment attachment_pcm_port_1: - pcm_port_1 - attachment endpoint_server_pcm: - server_pcm - endpoint disk.device.read.requests.rate_server_pcm: - server_pcm - disk.device.read.requests.rate vcpus_server_pcm: - server_pcm - vcpus disk.write.bytes_server_pcm: - server_pcm - disk.write.bytes disk.iops_server_pcm: - server_pcm - disk.iops forwarder_pcm_port_0: - pcm_port_0 - forwarder forwarder_pcm_port_1: - pcm_port_1 - forwarder disk.read.bytes.rate_server_pcm: - server_pcm - disk.read.bytes.rate disk.device.allocation_server_pcm: - server_pcm - disk.device.allocation scalable_server_pcm: - server_pcm - scalable disk.device.read.bytes.rate_server_pcm: - server_pcm - disk.device.read.bytes.rate cpu_util_server_pcm: - server_pcm - cpu_util disk.write.requests.rate_server_pcm: - server_pcm - disk.write.requests.rate disk.device.write.bytes.rate_server_pcm: - server_pcm - disk.device.write.bytes.rate host_server_pcm: - server_pcm - host cpu.delta_server_pcm: - server_pcm - cpu.delta network.outgoing.bytes.rate_pcm_port_1: - pcm_port_1 - network.outgoing.bytes.rate network.incoming.packets_pcm_port_0: - pcm_port_0 - network.incoming.packets binding_server_pcm: - server_pcm - binding network.outgoing.bytes.rate_pcm_port_0: - pcm_port_0 - network.outgoing.bytes.rate disk.device.capacity_server_pcm: - server_pcm - disk.device.capacity network.incoming.packets_pcm_port_1: - pcm_port_1 - network.incoming.packets instance_server_pcm: - server_pcm - instance disk.device.write.requests.rate_server_pcm: - server_pcm - disk.device.write.requests.rate disk.latency_server_pcm: - server_pcm - disk.latency disk.device.read.requests_server_pcm: - server_pcm - disk.device.read.requests feature_server_pcm: - server_pcm - feature network.incoming.bytes.rate_pcm_port_0: - pcm_port_0 - network.incoming.bytes.rate disk.write.bytes.rate_server_pcm: - server_pcm - disk.write.bytes.rate network.incoming.bytes.rate_pcm_port_1: - pcm_port_1 - network.incoming.bytes.rate requirements: link_pcm_port_0: - pcm_port_0 - link link_pcm_port_1: - pcm_port_1 - link local_storage_server_pcm: - server_pcm - local_storage dependency_pcm_port_0: - pcm_port_0 - dependency dependency_server_pcm: - server_pcm - dependency dependency_pcm_port_1: - pcm_port_1 - dependency