1 package org.openecomp.sdc.validation.impl.validators.heatresource;
3 import org.openecomp.core.validation.types.MessageContainer;
4 import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
5 import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator;
6 import org.openecomp.sdc.validation.util.ValidationTestUtil;
7 import org.testng.Assert;
8 import org.testng.annotations.Test;
10 import java.io.IOException;
14 * Created by TALIO on 2/28/2017.
16 public class ContrailNetworkPolicyResourceValidatorTest {
18 HeatResourceValidator baseValidator = new HeatResourceValidator();
19 ContrailNetworkPolicyResourceValidator resourceValidator = new
20 ContrailNetworkPolicyResourceValidator();
22 private static final String PATH = "/org/openecomp/validation/validators/heat_validator/network_policy_associated_with_attach_policy/";
24 public void testNetworkPolicyAssociatedWithAttachPolicy() throws IOException {
25 Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator
26 , HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE.getHeatResource(),
29 Assert.assertNotNull(messages);
30 Assert.assertEquals(messages.size(), 1);
32 Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1);
34 messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
35 "WARNING: [HNP2]: NetworkPolicy not in use, Resource Id [not_used_server_pcrf_policy]");
39 public void testNonNetworkPolicyResource() throws IOException {
40 Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator
41 , HeatResourcesTypes.CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE.getHeatResource(),
44 Assert.assertNotNull(messages);
45 Assert.assertEquals(messages.size(), 1);
47 Assert.assertEquals(messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().size(), 1);
49 messages.get("hot-nimbus-pps_v1.0.yaml").getErrorMessageList().get(0).getMessage(),
50 "WARNING: [HNP1]: NetworkPolicy not in use, Resource Id [server_pcrf_network]");