summaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src/test/java/org
diff options
context:
space:
mode:
authorliboNet <libo.zhu@intel.com>2018-11-10 05:32:42 +0800
committerliboNet <libo.zhu@intel.com>2018-11-13 02:02:07 +0800
commit370acda1a09a6fa4dc910869d7fb21f44626fe78 (patch)
treea1f1ce314c75d2cb910d4c8dfe81e267d6b0e7e3 /plugins/reception-plugins/src/test/java/org
parent789f09f2430440d6be44a5fad26715d002aff757 (diff)
Fix virtual_binding error under VDU requirements
virtual_binding will bind CP to a VDU but virtual_link use the node name instead of the name of node's propertiy add new test case to cover s3p the picvendorId's path has been changed based on demo repo Change-Id: I0ca400eab4d16284f14cb568fe3da5b409dd9222 Issue-ID: POLICY-1254 Signed-off-by: liboNet <libo.zhu@intel.com>
Diffstat (limited to 'plugins/reception-plugins/src/test/java/org')
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java42
1 files changed, 38 insertions, 4 deletions
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 de148520..3826ec92 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
@@ -82,7 +82,7 @@ public class TestPolicyDecoderCsarPdpx {
assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
assertTrue(policy.getConfigBody().contains("\"policyType\":\"Optimization\""));
- assertTrue(policy.getConfigBody().contains("\"id\":\"vdu_vnf_1\""));
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vnf_1\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.node.nfv.Vdu.Compute\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
assertTrue(policy.getConfigBody().contains("\"hpa-feature\":\"BasicCapabilities\""));
@@ -111,7 +111,7 @@ public class TestPolicyDecoderCsarPdpx {
assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
assertTrue(policy.getConfigBody().contains("\"policyType\":\"Optimization\""));
- assertTrue(policy.getConfigBody().contains("\"id\":\"vdu_vnf_1\""));
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vnf_1\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.node.nfv.Vdu.Compute\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
@@ -152,7 +152,7 @@ public class TestPolicyDecoderCsarPdpx {
assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
assertTrue(policy.getConfigBody().contains("\"policyType\":\"Optimization\""));
- assertTrue(policy.getConfigBody().contains("\"id\":\"vdu_vnf_1\""));
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vnf_1\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.node.nfv.Vdu.Compute\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
@@ -195,7 +195,7 @@ public class TestPolicyDecoderCsarPdpx {
assertTrue(policy.getConfigBody().contains("\"version\":\"1.0\""));
assertTrue(policy.getConfigBody().contains("\"policyType\":\"Optimization\""));
- assertTrue(policy.getConfigBody().contains("\"id\":\"vdu_vnf_1\""));
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vnf_1\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.node.nfv.Vdu.Compute\""));
assertTrue(policy.getConfigBody().contains("\"type\":\"flavor_directives\""));
assertTrue(policy.getConfigBody().contains("\"attribute_name\":\"flavorName\""));
@@ -209,4 +209,38 @@ public class TestPolicyDecoderCsarPdpx {
assertTrue(policy.getConfigBody().contains("\"operator\":\"\""));
assertTrue(policy.getConfigBody().contains("\"unit\":\"MB\""));
}
+
+ @Test
+ public void testS3p0PciVendorId() throws IOException, PolicyDecodingException {
+ final Csar csar = new Csar("src/test/resources/s3p_0_pciVendorId.csar");
+ final PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
+ policyDecoderCsarPdpx.configure(CSAR_TO_OPTIMIZATION_POLICY_CONFIGURATION);
+
+ final Collection<OptimizationPolicy> policies = policyDecoderCsarPdpx.decode(csar);
+ assertEquals(1, policies.size());
+ final OptimizationPolicy policy = (OptimizationPolicy) policies.toArray()[0];
+
+ assertEquals("onapName", policy.getOnapName());
+ assertTrue(policy.getPolicyName().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\":\"Optimization\""));
+
+ assertTrue(policy.getConfigBody().contains("\"id\":\"VDU_vgw_0\""));
+ assertTrue(policy.getConfigBody().contains("\"type\":\"tosca.node.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\":\"\""));
+
+ }
}