summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java14
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java290
2 files changed, 152 insertions, 152 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java
index 8bbdaffe..842245c0 100644
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java
+++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java
@@ -31,10 +31,10 @@ import java.util.List;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.model.Csar;
+import org.onap.policy.distribution.model.OptimizationPolicy;
import org.onap.policy.distribution.model.PolicyInput;
import org.onap.policy.distribution.reception.decoding.PolicyDecoder;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.onap.sdc.toscaparser.api.NodeTemplate;
@@ -44,15 +44,15 @@ import org.slf4j.LoggerFactory;
/**
* Decodes PDP-X policies from a CSAR file.
*/
-public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, ToscaServiceTemplate> {
+public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, OptimizationPolicy> {
private static final Logger LOGGER = LoggerFactory.getLogger(PolicyDecoderCsarPdpx.class);
private final Gson gson = new GsonBuilder().serializeNulls().disableHtmlEscaping().create();
private PolicyDecoderCsarPdpxConfigurationParameterGroup decoderParameters;
@Override
- public Collection<ToscaServiceTemplate> decode(final Csar csar) throws PolicyDecodingException {
- final List<ToscaServiceTemplate> policies = new ArrayList<>();
+ public Collection<OptimizationPolicy> decode(final Csar csar) throws PolicyDecodingException {
+ final List<OptimizationPolicy> policies = new ArrayList<>();
final ISdcCsarHelper sdcCsarHelper = parseCsar(csar);
final List<NodeTemplate> lnodeVf = sdcCsarHelper.getServiceVfList();
LOGGER.debug("the size of Vf = {}", lnodeVf.size());
@@ -63,9 +63,9 @@ public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, ToscaServiceTe
for (final NodeTemplate node : lnodeVf) {
final Content content = extractFromNode.extractInfo(node);
if (content != null) {
- final ToscaServiceTemplate policy = new ToscaServiceTemplate();
+ final OptimizationPolicy policy = new OptimizationPolicy();
final String policyName = decoderParameters.getPolicyNamePrefix() + "." + content.getIdentity();
- // policy.setOnapName(decoderParameters.getOnapName());
+ policy.setOnapName(decoderParameters.getOnapName());
policy.setName(policyName);
final ConfigBody configBody = new ConfigBody();
configBody.setService("hpaPolicy");
@@ -81,7 +81,7 @@ public class PolicyDecoderCsarPdpx implements PolicyDecoder<Csar, ToscaServiceTe
content.getPolicyScope().add("HPA");
content.getPolicyScope().add(serviceName);
configBody.setContent(content);
- // policy.setConfigBody(gson.toJson(configBody));
+ policy.setConfigBody(gson.toJson(configBody));
policies.add(policy);
}
}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
index 9cfbaf80..0eac8bf6 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
@@ -33,8 +33,8 @@ import org.junit.Test;
import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.model.Csar;
+import org.onap.policy.distribution.model.OptimizationPolicy;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
* Class to perform unit test of {@link PolicyDecoderCsarPdpx}.
@@ -68,29 +68,29 @@ public class TestPolicyDecoderCsarPdpx {
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
- final Collection<ToscaServiceTemplate> ret = policyDecoderCsarPdpx.decode(csar);
+ final Collection<OptimizationPolicy> ret = policyDecoderCsarPdpx.decode(csar);
assertEquals(2, ret.size());
- final ToscaServiceTemplate policy = (ToscaServiceTemplate) ret.toArray()[0];
+ final OptimizationPolicy policy = (OptimizationPolicy) ret.toArray()[0];
- // assertEquals("onapName", policy.getOnapName());
+ assertEquals("onapName", policy.getOnapName());
assertTrue(policy.getName().startsWith("OOF."));
- // assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
- // assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
- // assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
- // assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
- // assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
- //
- // assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"basicCapabilities\""));
- // assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
- // assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"virtualMemSize\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"MB\""));
+ assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
+ assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
+ assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
+ assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
+ assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
+
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"basicCapabilities\""));
+ assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
+ assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"virtualMemSize\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"MB\""));
}
@Test
@@ -99,38 +99,38 @@ public class TestPolicyDecoderCsarPdpx {
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
- final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
- final ToscaServiceTemplate policy = (ToscaServiceTemplate) policies.toArray()[0];
+ final Collection<OptimizationPolicy> policies = policyDecoderCsarPdpx.decode(csar);
+ final OptimizationPolicy policy = (OptimizationPolicy) policies.toArray()[0];
- // assertEquals("onapName", policy.getOnapName());
+ assertEquals("onapName", policy.getOnapName());
assertTrue(policy.getName().startsWith("OOF."));
- // assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
- // assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
- // assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
- // assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
- // assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
- //
- // assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"sriovNICNetwork\""));
- // assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
- // assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciDeviceId\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"5678\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciNumDevices\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
+ assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
+ assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
+ assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
+ assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
+
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"sriovNICNetwork\""));
+ assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
+ assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciDeviceId\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"5678\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciNumDevices\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
}
@Test
@@ -139,39 +139,39 @@ public class TestPolicyDecoderCsarPdpx {
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
- final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
+ final Collection<OptimizationPolicy> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(2, policies.size());
- final ToscaServiceTemplate policy = (ToscaServiceTemplate) policies.toArray()[0];
+ final OptimizationPolicy policy = (OptimizationPolicy) policies.toArray()[0];
- // assertEquals("onapName", policy.getOnapName());
+ assertEquals("onapName", policy.getOnapName());
assertTrue(policy.getName().startsWith("OOF."));
- // assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
- // assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
- // assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
- // assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
- // assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
- //
- // assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"pciePassthrough\""));
- // assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
- // assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciDeviceId\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"5678\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciNumDevices\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
+ assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
+ assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
+ assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
+ assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
+
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"pciePassthrough\""));
+ assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
+ assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciDeviceId\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"5678\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciNumDevices\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
}
@@ -182,31 +182,31 @@ public class TestPolicyDecoderCsarPdpx {
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
- final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
+ final Collection<OptimizationPolicy> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(2, policies.size());
- final ToscaServiceTemplate policy = (ToscaServiceTemplate) policies.toArray()[0];
+ final OptimizationPolicy policy = (OptimizationPolicy) policies.toArray()[0];
- // assertEquals("onapName", policy.getOnapName());
+ assertEquals("onapName", policy.getOnapName());
assertTrue(policy.getName().startsWith("OOF."));
- // assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
- // assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
- // assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
- // assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
- // assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
- //
- // assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"hugePages\""));
- // assertTrue(policy.getConfigBody().contains("\"mandatory\":\"true\""));
- // assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"memoryPageSize\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"2\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"MB\""));
+ assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
+ assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
+ assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
+ assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
+ assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
+
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"hugePages\""));
+ assertTrue(policy.getConfigBody().contains("\"mandatory\":\"true\""));
+ assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"memoryPageSize\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"2\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"MB\""));
}
@Test
@@ -215,31 +215,31 @@ public class TestPolicyDecoderCsarPdpx {
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
- final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
+ final Collection<OptimizationPolicy> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(1, policies.size());
- final ToscaServiceTemplate policy = (ToscaServiceTemplate) policies.toArray()[0];
+ final OptimizationPolicy policy = (OptimizationPolicy) policies.toArray()[0];
- // assertEquals("onapName", policy.getOnapName());
+ assertEquals("onapName", policy.getOnapName());
assertTrue(policy.getName().startsWith("OOF."));
- // assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
- // assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
- // assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
- // assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
- // assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
- //
- // assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"pciePassthrough\""));
- // assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
- // assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
+ assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
+ assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
+ assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
+ assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
+
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"pciePassthrough\""));
+ assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
+ assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
}
@@ -249,30 +249,30 @@ public class TestPolicyDecoderCsarPdpx {
final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
policyDecoderCsarPdpx.configure(PolicyDecoderCsarPdpxConfigurationParameterGroup.class.getSimpleName());
- final Collection<ToscaServiceTemplate> policies = policyDecoderCsarPdpx.decode(csar);
+ final Collection<OptimizationPolicy> policies = policyDecoderCsarPdpx.decode(csar);
assertEquals(5, policies.size());
- final ToscaServiceTemplate policy = (ToscaServiceTemplate) policies.toArray()[0];
+ final OptimizationPolicy policy = (OptimizationPolicy) policies.toArray()[0];
- // assertEquals("onapName", policy.getOnapName());
+ assertEquals("onapName", policy.getOnapName());
assertTrue(policy.getName().startsWith("OOF."));
- // assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
- // assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
- // assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
- // assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
- // assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
- //
- // assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- // assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
- // assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"sriovNICNetwork\""));
- // assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
- // assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
- // assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
- // assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
- // assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"priority\":\"5\""));
+ assertTrue(policy.getConfigBody().contains("\"riskLevel\":\"2\""));
+ assertTrue(policy.getConfigBody().contains("\"riskType\":\"Test\""));
+ assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
+ assertTrue(policy.getConfigBody().contains("\"policyType\":\"hpa\""));
+
+ assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
+ assertTrue(policy.getConfigBody().contains("\"attribute_value\":\"\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"sriovNICNetwork\""));
+ assertTrue(policy.getConfigBody().contains("\"mandatory\":\"True\""));
+ assertTrue(policy.getConfigBody().contains("\"architecture\":\"generic\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-version\":\"v1\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-key\":\"pciVendorId\""));
+ assertTrue(policy.getConfigBody().contains("\"hpa-attribute-value\":\"1234\""));
+ assertTrue(policy.getConfigBody().contains("\"operator\":\"=\""));
+ assertTrue(policy.getConfigBody().contains("\"unit\":\"\""));
}
}