diff options
author | ramverma <ram.krishna.verma@est.tech> | 2019-09-04 09:26:53 +0000 |
---|---|---|
committer | ramverma <ram.krishna.verma@est.tech> | 2019-09-04 09:26:53 +0000 |
commit | 53d14240b684df3d4f2fa8f02355effba722e514 (patch) | |
tree | 2e6a5cd13f27a1fca909ede4060a537c4dc8d362 /plugins/reception-plugins/src/test/java | |
parent | a790e5194cd246b286265589ed598270dd5c96fe (diff) |
Bring back the old HPA decoder & model
Bringing back the old HPA policy decoder and its related classes and
tests. The distribution framework will support both the new PAP/API and
the old policy engine in El Alto release.
Issue-ID: POLICY-1871
Change-Id: Iab911b793207a09b02e906ed6913c54bc252f64c
Signed-off-by: ramverma <ram.krishna.verma@est.tech>
Diffstat (limited to 'plugins/reception-plugins/src/test/java')
-rw-r--r-- | plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/pdpx/TestPolicyDecoderCsarPdpx.java | 290 |
1 files changed, 145 insertions, 145 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 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\":\"\"")); } } |