aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-07-21 15:19:48 -0400
committerRam Krishna Verma <ram_krishna.verma@bell.ca>2020-07-21 15:21:04 -0400
commit3e19dab2db3230de597030a28969b5b41135ec92 (patch)
treef2b2992774db3bb8d488a17d4023c0447e76ba1a /plugins/reception-plugins
parent61cd4b9bfd4f110b7da6cface918d724c86577cb (diff)
Remove hpa decoder from policy/distribution
Issue-ID: POLICY-2477 Change-Id: Iff4158e2322724265007d5a90459c3ebf62d3fc2 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'plugins/reception-plugins')
-rw-r--r--plugins/reception-plugins/pom.xml5
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Attribute.java52
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Content.java42
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Directive.java49
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/ExtractFromNode.java363
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorFeature.java61
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorProperty.java83
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/HpaFeatureAttribute.java71
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpa.java129
-rw-r--r--plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpaParameters.java48
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestAttribute.java50
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestContent.java74
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestDirective.java53
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorFeature.java64
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorProperty.java71
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestHpaFeatureAttribute.java57
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpa.java267
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpaParameters.java66
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java2
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java2
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/CommonTestData.java (renamed from plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/CommonTestData.java)2
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java1
-rw-r--r--plugins/reception-plugins/src/test/resources/hpaPolicyPciePassthrough.csarbin93228 -> 0 bytes
-rw-r--r--plugins/reception-plugins/src/test/resources/hpaPolicySriov.csarbin82560 -> 0 bytes
-rw-r--r--plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParameters.json8
-rw-r--r--plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParametersInvalid.json8
-rw-r--r--plugins/reception-plugins/src/test/resources/s3p_0_pciVendorId.csarbin81316 -> 0 bytes
-rw-r--r--plugins/reception-plugins/src/test/resources/sampleTestService.csarbin191755 -> 0 bytes
-rw-r--r--plugins/reception-plugins/src/test/resources/service-TestNs8-csar.csarbin78364 -> 0 bytes
-rw-r--r--plugins/reception-plugins/src/test/resources/service-VcpeWithAll-csar.csarbin168707 -> 0 bytes
30 files changed, 3 insertions, 1625 deletions
diff --git a/plugins/reception-plugins/pom.xml b/plugins/reception-plugins/pom.xml
index 38312b4e..6ae89883 100644
--- a/plugins/reception-plugins/pom.xml
+++ b/plugins/reception-plugins/pom.xml
@@ -37,11 +37,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.sdc.sdc-tosca</groupId>
- <artifactId>sdc-tosca</artifactId>
- <version>1.6.5</version>
- </dependency>
- <dependency>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-distribution-client</artifactId>
<version>1.4.1</version>
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Attribute.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Attribute.java
deleted file mode 100644
index 37f79f6b..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Attribute.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * The attribute acts an abstraction belonging to or characteristic of an directive.
- *
- * @author Libo Zhu (libo.zhu@intel.com)
- */
-class Attribute {
- @SerializedName(value = "attribute_name")
- private String attributeName;
- @SerializedName(value = "attribute_value")
- private String attributeValue;
-
- public void setAttributeName(final String attributeName) {
- this.attributeName = attributeName;
- }
-
- public String getAttributeName() {
- return attributeName;
- }
-
- public void setAttributeValue(final String attributeValue) {
- this.attributeValue = attributeValue;
- }
-
- public String getAttributeValue() {
- return attributeValue;
- }
-}
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Content.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Content.java
deleted file mode 100644
index a6e70bd9..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Content.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import java.util.ArrayList;
-import java.util.List;
-import lombok.Data;
-
-/**
- * The content acts the high level abstraction which to be used by OOF to do Optimization.
- *
- * @author Libo Zhu (libo.zhu@intel.com)
- */
-@Data
-class Content {
- private List<String> scope = new ArrayList<>(); /* keep scope as empty for now */
- private List<String> services = new ArrayList<>();
- private List<String> resources = new ArrayList<>();
- private List<String> geography = new ArrayList<>(); /* keep geography as empty for now */
- private String identity;
- private List<String> policyScope = new ArrayList<>();
- private String policyType = "Optimization";
- private List<FlavorFeature> flavorFeatures = new ArrayList<>();
-}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Directive.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Directive.java
deleted file mode 100644
index 87889cc1..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/Directive.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * The attribute acts an abstraction to indicate OOF which supports two different Models (Heat and TOSCA), two areas are
- * wrapped: in the VNFC level to indicate the flavor, in the hpa_feature level to contains specified information.
- *
- * @author Libo Zhu (libo.zhu@intel.com)
- */
-class Directive {
- private String type;
- private List<Attribute> attributes = new ArrayList<>();
-
- public void setType(final String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
- public List<Attribute> getAttributes() {
- return attributes;
- }
-}
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/ExtractFromNode.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/ExtractFromNode.java
deleted file mode 100644
index 8e3fffbb..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/ExtractFromNode.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Ericsson. All rights reserved.
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
-import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.toscaparser.api.CapabilityAssignment;
-import org.onap.sdc.toscaparser.api.CapabilityAssignments;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.onap.sdc.toscaparser.api.RequirementAssignment;
-import org.onap.sdc.toscaparser.api.RequirementAssignments;
-import org.onap.sdc.toscaparser.api.elements.Metadata;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Extract concerned info from NodeTemplate, currently ONLY HPA Feature.
- *
- * @author Libo Zhu (libo.zhu@intel.com)
- */
-public class ExtractFromNode {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ExtractFromNode.class);
-
- private static final String CONFIGURATION_VALUE = "configurationValue";
- private static final String VDU_TYPE = "tosca.nodes.nfv.Vdu.Compute";
- private static final String VDU_CP_TYPE = "tosca.nodes.nfv.VduCp";
- private static final String VIRTUAL_MEM_SIZE_PATH = "virtual_memory#virtual_mem_size";
- private static final String NUM_VIRTUAL_CPU_PATH = "virtual_cpu#num_virtual_cpu";
- private static final String CPU_ARCHITECTURE_PATH = "virtual_cpu#cpu_architecture";
- private static final String MEMORY_PAGE_SIZE_PATH = "virtual_memory#vdu_mem_requirements#memoryPageSize";
- private static final String NETWORK_INTERFACE_TYPE_PATH =
- "virtual_network_interface_requirements#network_interface_requirements#interfaceType";
- private static final String NETWORK_PCI_PATH =
- "virtual_network_interface_requirements#nic_io_requirements#logical_node_requirements";
- private static final String BASIC_CAPABILITIES_HPA_FEATURE = "basicCapabilities";
- private static final String HUGE_PAGES_HPA_FEATURE = "hugePages";
- private static final Map<String, String> NETWORK_HPA_FEATURE_MAP =
- ImmutableMap.of("SR-IOV", "sriovNICNetwork", "PCI-Passthrough", "pciePassthrough");
- private static final Pattern PATTERN = Pattern.compile("(\\D*)(\\d+)(\\D*)");
- private ISdcCsarHelper sdcCsarHelper;
- final Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().disableHtmlEscaping().create();
-
- public void setSdcCsarHelper(final ISdcCsarHelper sdcCsarHelper) {
- this.sdcCsarHelper = sdcCsarHelper;
- }
-
- /**
- * ExtractInfo from VNF , each VNF may includes more than one VDUs and CPs return new
- * generated OptimizationPolicy if it has got Hpa feature info or else return null.
- *
- * @param node the NodeTemplate
- *
- * @return the extracted info from input node
- *
- * @throws PolicyDecodingException if extract fails
- */
- public Content extractInfo(final NodeTemplate node) throws PolicyDecodingException {
- final Metadata metaData = sdcCsarHelper.getNodeTemplateMetadata(node);
- final Metadata metaDataOfService = sdcCsarHelper.getServiceMetadata();
- LOGGER.debug("the meta data of this nodetemplate = {}", metaData);
- final List<NodeTemplate> lnodeChild = sdcCsarHelper.getNodeTemplateChildren(node);
- LOGGER.debug("the size of lnodeChild = {}", lnodeChild.size());
-
- // Store all the VDUs under one VNF
- final List<NodeTemplate> lnodeVdu = new ArrayList<>();
- // Store all the Cps under one VNF
- final List<NodeTemplate> lnodeVduCp = new ArrayList<>();
- for (final NodeTemplate nodeChild : lnodeChild) {
- final String type = sdcCsarHelper.getTypeOfNodeTemplate(nodeChild);
- LOGGER.debug("the type of this nodeChild = {}", type);
- LOGGER.debug("the meta data of this nodeChild = {}", sdcCsarHelper.getNodeTemplateMetadata(nodeChild));
- if (type.equalsIgnoreCase(VDU_TYPE)) {
- lnodeVdu.add(nodeChild);
- } else if (type.equalsIgnoreCase(VDU_CP_TYPE)) {
- lnodeVduCp.add(nodeChild);
- }
- }
- LOGGER.debug("the size of vdu is = {}", lnodeVdu.size());
- LOGGER.debug("the size of cp is = {}", lnodeVduCp.size());
-
- final Content content = new Content();
- content.getResources().add(metaData.getValue("name"));
- content.getServices().add(metaDataOfService.getValue("name"));
- content.setIdentity(content.getPolicyType() + "_" + metaData.getValue("name"));
- extractInfoVdu(lnodeVdu, content);
- extractInfoVduCp(lnodeVduCp, content);
- if (content.getFlavorFeatures().isEmpty()) {
- return null;
- }
- return content;
- }
-
-
- /**
- * ExtractInfofromVdu, supported hpa features, All under the capability of
- * tosca.nodes.nfv.Vdu.Compute.
- *
- * @param lnodeVdu the list of Vdu node
- *
- * @param content to be change based on lnodeVdu
- */
- public void extractInfoVdu(final List<NodeTemplate> lnodeVdu, final Content content) {
- // each VDU <=> FlavorFeature
- for (final NodeTemplate node : lnodeVdu) {
- final Attribute flavorAttribute = new Attribute();
- flavorAttribute.setAttributeName("flavorName");
- flavorAttribute.setAttributeValue("");
- final Directive flavorDirective = new Directive();
- flavorDirective.setType("flavor_directives");
- flavorDirective.getAttributes().add(flavorAttribute);
- final FlavorFeature flavorFeature = new FlavorFeature();
- flavorFeature.setId(node.toString());
- LOGGER.debug("the name of node = {}", node);
- flavorFeature.getDirectives().add(flavorDirective);
-
- final CapabilityAssignments capabilityAssignments = sdcCsarHelper.getCapabilitiesOf(node);
- final CapabilityAssignment capabilityAssignment =
- capabilityAssignments.getCapabilityByName("virtual_compute");
- if (capabilityAssignment != null) {
- generateBasicCapability(capabilityAssignment, flavorFeature);
- generateHugePages(capabilityAssignment, flavorFeature);
- }
- content.getFlavorFeatures().add(flavorFeature);
- }
- }
-
- /**
- * GenerateBasicCapability, supported hpa features, All under the capability of
- * tosca.nodes.nfv.Vdu.Compute.
- *
- * @param capabilityAssignment represents the capability of node
- *
- * @param flavorFeature represents all the features of specified flavor
- */
- private void generateBasicCapability(final CapabilityAssignment capabilityAssignment,
- final FlavorFeature flavorFeature) {
- // the format is xxx MB/GB like 4096 MB
- final String virtualMemSize =
- sdcCsarHelper.getCapabilityPropertyLeafValue(capabilityAssignment, VIRTUAL_MEM_SIZE_PATH);
- if (virtualMemSize != null) {
- LOGGER.debug("the virtualMemSize = {}", virtualMemSize);
- final HpaFeatureAttribute hpaFeatureAttribute =
- generateHpaFeatureAttribute("virtualMemSize", virtualMemSize);
- final FlavorProperty flavorProperty = new FlavorProperty();
- flavorProperty.setHpaFeature(BASIC_CAPABILITIES_HPA_FEATURE);
- flavorProperty.getHpaFeatureAttributes().add(hpaFeatureAttribute);
- flavorFeature.getFlavorProperties().add(flavorProperty);
- }
-
- // the format is int like 2
- final String numVirtualCpu =
- sdcCsarHelper.getCapabilityPropertyLeafValue(capabilityAssignment, NUM_VIRTUAL_CPU_PATH);
- if (numVirtualCpu != null) {
- LOGGER.debug("the numVirtualCpu = {}", numVirtualCpu);
- final HpaFeatureAttribute hpaFeatureAttribute = generateHpaFeatureAttribute("numVirtualCpu", numVirtualCpu);
- final String cpuArchitecture =
- sdcCsarHelper.getCapabilityPropertyLeafValue(capabilityAssignment, CPU_ARCHITECTURE_PATH);
- final FlavorProperty flavorProperty = new FlavorProperty();
- flavorProperty.setHpaFeature(BASIC_CAPABILITIES_HPA_FEATURE);
- if (cpuArchitecture != null) {
- flavorProperty.setArchitecture(cpuArchitecture);
- }
- flavorProperty.getHpaFeatureAttributes().add(hpaFeatureAttribute);
- flavorFeature.getFlavorProperties().add(flavorProperty);
- }
- }
-
- /**
- * GenerateHpaFeatureAttribute based on the value of featureValue. the format:
- * "hpa-attribute-key": "pciVendorId", "hpa-attribute-value": "1234", "operator": "=",
- * "unit": "xxx".
- *
- * @param hpaAttributeKey get from the high layer tosca DM
- *
- * @param featureValue get from the high layer tosca DM
- *
- */
- private HpaFeatureAttribute generateHpaFeatureAttribute(final String hpaAttributeKey, final String featureValue) {
- // based on input featureValue, return back a suitable hpaFeatureAttribute
- final HpaFeatureAttribute hpaFeatureAttribute = new HpaFeatureAttribute();
- hpaFeatureAttribute.setHpaAttributeKey(hpaAttributeKey);
- final String modifiedValue = featureValue.replace(" ", "");
- final Matcher matcher = PATTERN.matcher(modifiedValue);
- if (matcher.find()) {
- final String matcher1 = matcher.group(1);
- final String matcher2 = matcher.group(2);
- final String matcher3 = matcher.group(3);
- LOGGER.debug("operator {} , value = {} , unit = {}", matcher1, matcher2, matcher3);
- if (matcher.group(1).length() == 0) {
- hpaFeatureAttribute.setOperator("=");
- } else {
- hpaFeatureAttribute.setOperator(matcher1);
- }
- hpaFeatureAttribute.setHpaAttributeValue(matcher2);
- hpaFeatureAttribute.setUnit(matcher3);
- }
- return hpaFeatureAttribute;
- }
-
- /**
- * GenerateHugePages, supported hpa features, All under the capability of
- * tosca.nodes.nfv.Vdu.Compute. The format is a map like: {"schemaVersion": "0",
- * "schemaSelector": "", "hardwarePlatform": "generic", "mandatory": "true",
- * "configurationValue": "2 MB"}
- *
- * @param capabilityAssignment represents the capability of node
- *
- * @param flavorFeature represents all the features of specified flavor
- */
- private void generateHugePages(final CapabilityAssignment capabilityAssignment, final FlavorFeature flavorFeature) {
- final String memoryPageSize =
- sdcCsarHelper.getCapabilityPropertyLeafValue(capabilityAssignment, MEMORY_PAGE_SIZE_PATH);
- LOGGER.debug("the memoryPageSize = {}", memoryPageSize);
- if (memoryPageSize != null) {
- final Map<String, String> retMap =
- gson.fromJson(memoryPageSize, new TypeToken<HashMap<String, String>>() {}.getType());
- LOGGER.debug("the retMap = {}", retMap);
- final String memoryPageSizeValue = retMap.get(CONFIGURATION_VALUE);
- final String mandatory = retMap.get("mandatory");
- if (memoryPageSizeValue == null) {
- return;
- }
- final HpaFeatureAttribute hpaFeatureAttribute =
- generateHpaFeatureAttribute("memoryPageSize", memoryPageSizeValue);
- final FlavorProperty flavorProperty = new FlavorProperty();
- flavorProperty.setHpaFeature(HUGE_PAGES_HPA_FEATURE);
- if (mandatory != null) {
- flavorProperty.setMandatory(mandatory);
- }
- flavorProperty.getHpaFeatureAttributes().add(hpaFeatureAttribute);
- flavorFeature.getFlavorProperties().add(flavorProperty);
- }
- }
-
- /**
- * ExtractInfoVduCp, supported hpa features, under the
- * virtual_network_interface_requirements of tosca.nodes.nfv.VduCp.
- *
- * @param lnodeVduCp the list of VduCp node
- *
- * @param content to be change based on lnodeVduCp
- * @throws PolicyDecodingException if extract CP fails
- */
- public void extractInfoVduCp(final List<NodeTemplate> lnodeVduCp, final Content content)
- throws PolicyDecodingException {
- // each CP will binds to a VDU so need the vdu flavor map info.
- final Map<String, FlavorFeature> vduFlavorMap = new HashMap<>();
- for (final FlavorFeature flavorFeature : content.getFlavorFeatures()) {
- LOGGER.debug("the id = {}", flavorFeature.getId());
- vduFlavorMap.put(flavorFeature.getId(), flavorFeature);
- }
- parseNodeVduCp(lnodeVduCp, vduFlavorMap);
- }
-
- /**
- * Parse the VduCp list.
- *
- * @param lnodeVduCp the lnodeVduCp
- * @param vduFlavorMap the vduFlavorMap
- * @throws PolicyDecodingException if any error occurs
- */
- private void parseNodeVduCp(final List<NodeTemplate> lnodeVduCp, final Map<String, FlavorFeature> vduFlavorMap)
- throws PolicyDecodingException {
- for (final NodeTemplate node : lnodeVduCp) {
- final String interfaceType =
- sdcCsarHelper.getNodeTemplatePropertyLeafValue(node, NETWORK_INTERFACE_TYPE_PATH);
- LOGGER.debug("the interfaceType = {}", interfaceType);
- Map<String, Object> retMap = new HashMap<>();
- if (interfaceType != null) {
- retMap = gson.fromJson(interfaceType, new TypeToken<HashMap<String, Object>>() {}.getType());
- LOGGER.debug("the retMap = {}", retMap);
- }
-
- String networkHpaFeature;
- if (retMap.containsKey(CONFIGURATION_VALUE)
- && NETWORK_HPA_FEATURE_MAP.containsKey(retMap.get(CONFIGURATION_VALUE).toString())) {
- final String interfaceTypeValue = retMap.get(CONFIGURATION_VALUE).toString();
- networkHpaFeature = NETWORK_HPA_FEATURE_MAP.get(interfaceTypeValue);
- LOGGER.debug(" the networkHpaFeature is = {}", networkHpaFeature);
- } else {
- LOGGER.debug(" no networkHpaFeature defined in interfaceType");
- continue;
- }
-
- final RequirementAssignments requriements =
- sdcCsarHelper.getRequirementsOf(node).getRequirementsByName("virtual_binding");
- for (final RequirementAssignment requriement : requriements.getAll()) {
- final String nodeTemplateName = requriement.getNodeTemplateName();
- LOGGER.debug("getNodeTemplateName = {}", nodeTemplateName);
- if (nodeTemplateName == null) {
- continue;
- }
- if (!vduFlavorMap.containsKey(nodeTemplateName)) {
- throw new PolicyDecodingException("vdu Flavor Map should contains the key " + nodeTemplateName);
- }
- generateNetworkFeature(networkHpaFeature, node, vduFlavorMap.get(nodeTemplateName));
- }
- }
- }
-
- /**
- * GenerateNetworkFeature, all pci feature are grouped into FlavorFeature together.
- * The format is a map like: {"schemaVersion": "0", "schemaSelector": "",
- * "hardwarePlatform": "generic", "mandatory": "true", "configurationValue": "2 MB"}
- *
- * @param networkHpaFeature represents the specified Hpa feature
- * @param node represents the CP Node
- * @param flavorFeature represents all the features of specified flavor
- */
- private void generateNetworkFeature(final String networkHpaFeature, final NodeTemplate node,
- final FlavorFeature flavorFeature) {
- final FlavorProperty flavorProperty = new FlavorProperty();
- flavorProperty.setHpaFeature(networkHpaFeature);
- final String[] pciKeys = {"pciVendorId", "pciDeviceId", "pciNumDevices", "physicalNetwork"};
- for (final String pciKey : pciKeys) {
- LOGGER.debug("the pciKey = {}", pciKey);
- final String pciKeyPath = NETWORK_PCI_PATH + "#" + pciKey;
- final String pciValue = sdcCsarHelper.getNodeTemplatePropertyLeafValue(node, pciKeyPath);
- if (pciValue != null) {
- LOGGER.debug("the pciValue = {}", pciValue);
- final Map<String, String> retMap =
- gson.fromJson(pciValue, new TypeToken<HashMap<String, String>>() {}.getType());
- final String pciConfigValue = retMap.get(CONFIGURATION_VALUE);
- if (pciConfigValue == null) {
- return;
- }
- final HpaFeatureAttribute hpaFeatureAttribute = generateHpaFeatureAttribute(pciKey, pciConfigValue);
- flavorProperty.getHpaFeatureAttributes().add(hpaFeatureAttribute);
- }
- }
- flavorFeature.getFlavorProperties().add(flavorProperty);
- }
-}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorFeature.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorFeature.java
deleted file mode 100644
index 75643a72..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorFeature.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The FlavorFeature includes all the specified flavor infos used in multicloud, it represents one VDU of TOSCA.
- *
- * @author Libo Zhu (libo.zhu@intel.com)
- */
-class FlavorFeature {
- private String id;
- private String type = "tosca.nodes.nfv.Vdu.Compute";
- private List<Directive> directives = new ArrayList<>();
- private List<FlavorProperty> flavorProperties = new ArrayList<>();
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- public void setType(final String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
- public List<FlavorProperty> getFlavorProperties() {
- return flavorProperties;
- }
-
- public List<Directive> getDirectives() {
- return directives;
- }
-}
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorProperty.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorProperty.java
deleted file mode 100644
index d92d9edb..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/FlavorProperty.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import com.google.gson.annotations.SerializedName;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The FlavorProperty includes all the properties of Flavor.
- *
- * @author Libo Zhu (libo.zhu@intel.com)
- */
-class FlavorProperty {
- @SerializedName(value = "hpa-feature")
- private String hpaFeature;
- private String mandatory = "True";
- private String architecture = "generic";
- @SerializedName(value = "hpa-version")
- private String hpaVersion = "v1";
- private List<Directive> directives = new ArrayList<>();
- @SerializedName(value = "hpa-feature-attributes")
- private List<HpaFeatureAttribute> hpaFeatureAttributes = new ArrayList<>();
-
- public void setHpaFeature(final String hpaFeature) {
- this.hpaFeature = hpaFeature;
- }
-
- public String getHpaFeature() {
- return hpaFeature;
- }
-
- public void setMandatory(final String mandatory) {
- this.mandatory = mandatory;
- }
-
- public String getMandatory() {
- return mandatory;
- }
-
- public void setArchitecture(final String architecture) {
- this.architecture = architecture;
- }
-
- public String getArchitecture() {
- return architecture;
- }
-
- public void setHpaVersion(final String hpaVersion) {
- this.hpaVersion = hpaVersion;
- }
-
- public String getHpaVersion() {
- return hpaVersion;
- }
-
- public List<Directive> getDirectives() {
- return directives;
- }
-
- public List<HpaFeatureAttribute> getHpaFeatureAttributes() {
- return hpaFeatureAttributes;
- }
-}
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/HpaFeatureAttribute.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/HpaFeatureAttribute.java
deleted file mode 100644
index 8bb078ad..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/HpaFeatureAttribute.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * The HpaFeatureAttribute represents a way to provide match expression.
- *
- * @author Libo Zhu (libo.zhu@intel.com)
- */
-class HpaFeatureAttribute {
- @SerializedName(value = "hpa-attribute-key")
- private String hpaAttributeKey;
- @SerializedName(value = "hpa-attribute-value")
- private String hpaAttributeValue;
- private String operator;
- private String unit;
-
- public void setHpaAttributeKey(final String hpaAttributeKey) {
- this.hpaAttributeKey = hpaAttributeKey;
- }
-
- public String getHpaAttributeKey() {
- return hpaAttributeKey;
- }
-
- public void setHpaAttributeValue(final String hpaAttributeValue) {
- this.hpaAttributeValue = hpaAttributeValue;
- }
-
- public String getHpaAttributeValue() {
- return hpaAttributeValue;
- }
-
- public void setOperator(final String operator) {
- this.operator = operator;
- }
-
- public String getOperator() {
- return operator;
- }
-
- public void setUnit(final String unit) {
- this.unit = unit;
- }
-
- public String getUnit() {
- return unit;
- }
-}
-
-
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpa.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpa.java
deleted file mode 100644
index 5bfb0198..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpa.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2020 AT&T Inc.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.onap.policy.common.parameters.ParameterService;
-import org.onap.policy.distribution.model.Csar;
-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.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
-import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Decodes PDP-X policies from a CSAR file and creates ToscaServiceTemplate for Policy Lifecycle API's.
- */
-public class PolicyDecoderCsarHpa implements PolicyDecoder<Csar, ToscaServiceTemplate> {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(PolicyDecoderCsarHpa.class);
- //
- // This is initialized in configure() but then never used here
- //
- @SuppressWarnings("unused")
- private PolicyDecoderCsarHpaParameters decoderParameters;
-
- public static final String TOSCA_POLICY_SCOPE = "scope";
- public static final String TOSCA_POLICY_SERVICES = "services";
- public static final String TOSCA_POLICY_RESOURCES = "resources";
- public static final String TOSCA_POLICY_IDENTITY = "identity";
- public static final String TOSCA_POLICY_FLAVORFEATURES = "flavorfeatures";
-
- public static final String TOSCA_POLICY_HPA_OOF = "Optimization";
-
- @Override
- public Collection<ToscaServiceTemplate> decode(final Csar csar) throws PolicyDecodingException {
- final List<ToscaServiceTemplate> entities = new ArrayList<>();
- final ISdcCsarHelper sdcCsarHelper = parseCsar(csar);
- final List<NodeTemplate> lnodeVf = sdcCsarHelper.getServiceVfList();
- LOGGER.debug("the size of Vf = {}", lnodeVf.size());
- final ExtractFromNode extractFromNode = new ExtractFromNode();
- extractFromNode.setSdcCsarHelper(sdcCsarHelper);
- final String serviceName = sdcCsarHelper.getServiceMetadata().getValue("name");
- LOGGER.debug("the name of the service = {}", serviceName);
- for (final NodeTemplate node : lnodeVf) {
- final Content content = extractFromNode.extractInfo(node);
- if (content != null) {
- final ToscaServiceTemplate entity = new ToscaServiceTemplate();
- Map<String, Object> props = new LinkedHashMap<>();
- props.put(TOSCA_POLICY_SCOPE, content.getScope());
- props.put(TOSCA_POLICY_SERVICES, content.getServices());
- props.put(TOSCA_POLICY_RESOURCES, content.getResources());
- props.put(TOSCA_POLICY_IDENTITY, content.getIdentity());
- props.put(TOSCA_POLICY_FLAVORFEATURES, content.getFlavorFeatures());
- ToscaPolicy policy = new ToscaPolicy();
- policy.setProperties(props);
- Map<String, ToscaPolicy> map = new LinkedHashMap<>();
- String type = content.getPolicyType();
- map.put(type, policy);
- List<Map<String, ToscaPolicy>> policies = new ArrayList<>();
- policies.add(map);
- ToscaTopologyTemplate topologyTemplate = new ToscaTopologyTemplate();
- topologyTemplate.setPolicies(policies);
- entity.setToscaTopologyTemplate(topologyTemplate);
- entities.add(entity);
- }
- }
- return entities;
- }
-
- @Override
- public boolean canHandle(final PolicyInput policyInput) {
- return Csar.class.isAssignableFrom(policyInput.getClass());
- }
-
- /**
- * Parse the input Csar using SDC TOSCA parser.
- *
- * @param csar represents the service TOSCA Csar
- * @return the object to represents the content of input csar
- * @throws PolicyDecodingException if parse fails
- */
- public ISdcCsarHelper parseCsar(final Csar csar) throws PolicyDecodingException {
- ISdcCsarHelper sdcCsarHelper;
- try {
- final SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
- LOGGER.debug("Csar File Path = {}", csar.getCsarPath());
- final File csarFile = new File(csar.getCsarPath());
- sdcCsarHelper = factory.getSdcCsarHelper(csarFile.getAbsolutePath());
- } catch (final Exception exp) {
- throw new PolicyDecodingException("Failed passing the csar file", exp);
- }
- return sdcCsarHelper;
- }
-
- @Override
- public void configure(final String parameterGroupName) {
- decoderParameters = ParameterService.get(parameterGroupName);
- }
-}
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpaParameters.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpaParameters.java
deleted file mode 100644
index 1929c72f..00000000
--- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/hpa/PolicyDecoderCsarHpaParameters.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import lombok.Getter;
-import org.onap.policy.common.parameters.annotations.NotBlank;
-import org.onap.policy.common.parameters.annotations.NotNull;
-import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
-
-/**
- * This class handles the parameters needed for {@link PolicyDecoderCsarHpa}.
- */
-@Getter
-@NotNull
-@NotBlank
-public class PolicyDecoderCsarHpaParameters extends PolicyDecoderConfigurationParameterGroup {
-
- private String policyNamePrefix;
- private String onapName;
- private String version;
- private String priority;
- private String riskType;
- private String riskLevel;
-
- public PolicyDecoderCsarHpaParameters() {
- super(PolicyDecoderCsarHpaParameters.class.getSimpleName());
- }
-}
-
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestAttribute.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestAttribute.java
deleted file mode 100644
index b4e2ed43..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestAttribute.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Inc.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Class to perform unit test for Attribute 0f {@link Attribute}.
- *
- */
-public class TestAttribute {
-
- @Test
- public void testAttribute() {
- final String attributeName = "dummyName";
- final String attributeValue = "dummyValue";
-
- final Attribute attribute = new Attribute();
- attribute.setAttributeName(attributeName);
- attribute.setAttributeValue(attributeValue);
-
- validateReport(attributeName, attributeValue, attribute);
- }
-
- private void validateReport(final String name, final String value, final Attribute attribute) {
- assertEquals(name, attribute.getAttributeName());
- assertEquals(value, attribute.getAttributeValue());
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestContent.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestContent.java
deleted file mode 100644
index bc8f4d5c..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestContent.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Inc.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Class to perform unit test for Content 0f {@link Content}.
- *
- */
-public class TestContent {
-
- @Test
- public void testContent() {
- final String identity = "dummyidentity";
- final String policyType = "optimization";
-
- final Content content = new Content();
- content.setIdentity(identity);
- content.setPolicyType(policyType);
-
- validateReport(identity, policyType, content);
- }
-
- private void validateReport(final String identity, final String policyType,
- final Content content) {
- assertEquals(0, content.getScope().size());
- assertEquals(0, content.getGeography().size());
- assertEquals(identity, content.getIdentity());
- assertEquals(policyType, content.getPolicyType());
- assertEquals(0, content.getPolicyScope().size());
- content.getPolicyScope().add("vFW");
- assertEquals(1, content.getPolicyScope().size());
- content.getPolicyScope().remove("vFW");
- assertEquals(0, content.getPolicyScope().size());
- assertEquals(0, content.getServices().size());
- content.getServices().add("vCPE");
- assertEquals(1, content.getServices().size());
- content.getServices().remove("vCPE");
- assertEquals(0, content.getServices().size());
- assertEquals(0, content.getFlavorFeatures().size());
- FlavorFeature flavorFeature = new FlavorFeature();
- content.getFlavorFeatures().add(flavorFeature);
- assertEquals(1, content.getFlavorFeatures().size());
- content.getFlavorFeatures().remove(flavorFeature);
- assertEquals(0, content.getFlavorFeatures().size());
- assertEquals(0, content.getResources().size());
- content.getResources().add("vGW");
- assertEquals(1, content.getResources().size());
- content.getResources().remove("vGW");
- assertEquals(0, content.getResources().size());
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestDirective.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestDirective.java
deleted file mode 100644
index 7429fe7a..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestDirective.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Inc.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Class to perform unit test for Directive 0f {@link Directive}.
- *
- */
-public class TestDirective {
-
- @Test
- public void testDirective() {
- final String type = "dummytype";
-
- final Directive directive = new Directive();
- directive.setType(type);
-
- validateReport(type, directive);
- }
-
- private void validateReport(final String type, final Directive directive) {
- assertEquals(type, directive.getType());
- assertEquals(0, directive.getAttributes().size());
- Attribute attribute = new Attribute();
- directive.getAttributes().add(attribute);
- assertEquals(1, directive.getAttributes().size());
- directive.getAttributes().remove(attribute);
- assertEquals(0, directive.getAttributes().size());
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorFeature.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorFeature.java
deleted file mode 100644
index b9fee589..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorFeature.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Inc.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Class to perform unit test for FlavorFeature 0f {@link FlavorFeature}.
- *
- */
-public class TestFlavorFeature {
-
- @Test
- public void testFlavorFeature() {
- final String id = "dummyid";
- final String type = "dummytype";
-
- final FlavorFeature flavorFeature = new FlavorFeature();
- flavorFeature.setId(id);
- flavorFeature.setType(type);
-
- validateReport(id, type, flavorFeature);
- }
-
- private void validateReport(final String id, final String type, final FlavorFeature flavorFeature) {
- assertEquals(id, flavorFeature.getId());
- assertEquals(type, flavorFeature.getType());
-
- assertEquals(0, flavorFeature.getDirectives().size());
- Directive directive = new Directive();
- flavorFeature.getDirectives().add(directive);
- assertEquals(1, flavorFeature.getDirectives().size());
- flavorFeature.getDirectives().remove(directive);
- assertEquals(0, flavorFeature.getDirectives().size());
-
- assertEquals(0, flavorFeature.getFlavorProperties().size());
- FlavorProperty flavorProperty = new FlavorProperty();
- flavorFeature.getFlavorProperties().add(flavorProperty);
- assertEquals(1, flavorFeature.getFlavorProperties().size());
- flavorFeature.getFlavorProperties().remove(flavorProperty);
- assertEquals(0, flavorFeature.getFlavorProperties().size());
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorProperty.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorProperty.java
deleted file mode 100644
index af6600c8..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestFlavorProperty.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Inc.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Class to perform unit test for FlavorProperty 0f {@link FlavorProperty}.
- *
- */
-public class TestFlavorProperty {
-
- @Test
- public void testFlavorProperty() {
- final String hpaFeature = "dummyid";
- final String mandatory = "false";
- final String architecture = "generic";
- final String hpaVersion = "v1";
-
- final FlavorProperty flavorProperty = new FlavorProperty();
- flavorProperty.setHpaFeature(hpaFeature);
- flavorProperty.setMandatory(mandatory);
- flavorProperty.setArchitecture(architecture);
- flavorProperty.setHpaVersion(hpaVersion);
-
- validateReport(hpaFeature, mandatory, architecture, hpaVersion, flavorProperty);
- }
-
- private void validateReport(final String hpaFeature, final String mandatory, final String architecture,
- final String hpaVersion, final FlavorProperty flavorProperty) {
- assertEquals(hpaFeature, flavorProperty.getHpaFeature());
- assertEquals(mandatory, flavorProperty.getMandatory());
- assertEquals(architecture, flavorProperty.getArchitecture());
- assertEquals(hpaVersion, flavorProperty.getHpaVersion());
-
- assertEquals(0, flavorProperty.getDirectives().size());
- Directive directive = new Directive();
- flavorProperty.getDirectives().add(directive);
- assertEquals(1, flavorProperty.getDirectives().size());
- flavorProperty.getDirectives().remove(directive);
- assertEquals(0, flavorProperty.getDirectives().size());
-
- assertEquals(0, flavorProperty.getHpaFeatureAttributes().size());
- HpaFeatureAttribute hpaFeatureAttribute = new HpaFeatureAttribute();
- flavorProperty.getHpaFeatureAttributes().add(hpaFeatureAttribute);
- assertEquals(1, flavorProperty.getHpaFeatureAttributes().size());
- flavorProperty.getHpaFeatureAttributes().remove(hpaFeatureAttribute);
- assertEquals(0, flavorProperty.getHpaFeatureAttributes().size());
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestHpaFeatureAttribute.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestHpaFeatureAttribute.java
deleted file mode 100644
index 3c6531db..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestHpaFeatureAttribute.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2018 Intel. All rights reserved.
- * Modifications Copyright (C) 2020 AT&T Inc.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Class to perform unit test for HpaFeatureAttribute 0f {@link HpaFeatureAttribute}.
- *
- */
-public class TestHpaFeatureAttribute {
-
- @Test
- public void testHpaFeatureAttribute() {
- final String hpaAttributeKey = "dummykey";
- final String hpaAttributeValue = "4096";
- final String operator = ">=";
- final String unit = "MB";
-
- final HpaFeatureAttribute hpaFeatureAttribute = new HpaFeatureAttribute();
- hpaFeatureAttribute.setHpaAttributeKey(hpaAttributeKey);
- hpaFeatureAttribute.setHpaAttributeValue(hpaAttributeValue);
- hpaFeatureAttribute.setOperator(operator);
- hpaFeatureAttribute.setUnit(unit);
-
- validateReport(hpaAttributeKey, hpaAttributeValue, operator, unit, hpaFeatureAttribute);
- }
-
- private void validateReport(final String hpaAttributeKey, final String hpaAttributeValue, final String operator,
- final String unit, final HpaFeatureAttribute hpaFeatureAttribute) {
- assertEquals(hpaAttributeKey, hpaFeatureAttribute.getHpaAttributeKey());
- assertEquals(hpaAttributeValue, hpaFeatureAttribute.getHpaAttributeValue());
- assertEquals(operator, hpaFeatureAttribute.getOperator());
- assertEquals(unit, hpaFeatureAttribute.getUnit());
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpa.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpa.java
deleted file mode 100644
index 552f430e..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpa.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2020 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ParameterGroup;
-import org.onap.policy.common.parameters.ParameterService;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
-import org.onap.policy.distribution.model.Csar;
-import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
-
-/**
- * Class to perform unit test of {@link PolicyDecoderCsarHpa}.
- */
-public class TestPolicyDecoderCsarHpa {
-
- private final StandardCoder encoder = new StandardCoder();
-
- /**
- * Set up for test cases.
- */
- @BeforeClass
- public static void setUp() {
- final ParameterGroup parameterGroup = CommonTestData.getPolicyDecoderParameters(
- "src/test/resources/parameters/HpaPolicyDecoderParameters.json",
- PolicyDecoderCsarHpaParameters.class);
- parameterGroup.setName(PolicyDecoderCsarHpaParameters.class.getSimpleName());
- ParameterService.register(parameterGroup);
- }
-
- /**
- * Tear down.
- */
- @AfterClass
- public static void tearDown() {
- ParameterService.deregister(PolicyDecoderCsarHpaParameters.class.getSimpleName());
- }
-
- @Test
- public void testHpaPolicy2Vnf() throws IOException, PolicyDecodingException, CoderException {
- final Csar csar = new Csar("src/test/resources/service-TestNs8-csar.csar");
- final PolicyDecoderCsarHpa policyDecoderCsarHpa = new PolicyDecoderCsarHpa();
- policyDecoderCsarHpa.configure(PolicyDecoderCsarHpaParameters.class.getSimpleName());
-
- final Collection<ToscaServiceTemplate> entities = policyDecoderCsarHpa.decode(csar);
-
- assertEquals(2, entities.size());
- final ToscaServiceTemplate entity = entities.iterator().next();
- ToscaTopologyTemplate topologyTemplate = entity.getToscaTopologyTemplate();
- Map<String, ToscaPolicy> map = topologyTemplate.getPolicies().get(0);
- ToscaPolicy policy = map.get(PolicyDecoderCsarHpa.TOSCA_POLICY_HPA_OOF);
- Map<String, Object> props = policy.getProperties();
- Object flavorFeatures =
- props.get(PolicyDecoderCsarHpa.TOSCA_POLICY_FLAVORFEATURES);
- String features = encoder.encode(flavorFeatures);
- assertTrue(features.contains("\"id\":\"VDU_vgw_0\""));
- assertTrue(features.contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- assertTrue(features.contains("\"type\":\"flavor_directives\""));
- assertTrue(features.contains("\"hpa-feature\":\"basicCapabilities\""));
- assertTrue(features.contains("\"mandatory\":\"True\""));
- assertTrue(features.contains("\"architecture\":\"generic\""));
- assertTrue(features.contains("\"hpa-version\":\"v1\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"virtualMemSize\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"MB\""));
- }
-
- @Test
- public void testHpaPolicySriov() throws IOException, PolicyDecodingException, CoderException {
- final Csar csar = new Csar("src/test/resources/hpaPolicySriov.csar");
- final PolicyDecoderCsarHpa policyDecoderCsarHpa = new PolicyDecoderCsarHpa();
- policyDecoderCsarHpa.configure(PolicyDecoderCsarHpaParameters.class.getSimpleName());
-
- final Collection<ToscaServiceTemplate> entities = policyDecoderCsarHpa.decode(csar);
- final ToscaServiceTemplate entity = entities.iterator().next();
- ToscaTopologyTemplate topologyTemplate = entity.getToscaTopologyTemplate();
- Map<String, ToscaPolicy> map = topologyTemplate.getPolicies().get(0);
- ToscaPolicy policy = map.get(PolicyDecoderCsarHpa.TOSCA_POLICY_HPA_OOF);
- Map<String, Object> props = policy.getProperties();
- Object flavorFeatures =
- props.get(PolicyDecoderCsarHpa.TOSCA_POLICY_FLAVORFEATURES);
- String features = encoder.encode(flavorFeatures);
- assertTrue(features.contains("\"id\":\"VDU_vgw_0\""));
- assertTrue(features.contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- assertTrue(features.contains("\"type\":\"flavor_directives\""));
- assertTrue(features.contains("\"attribute_name\":\"flavorName\""));
- assertTrue(features.contains("\"attribute_value\":\"\""));
- assertTrue(features.contains("\"hpa-feature\":\"sriovNICNetwork\""));
- assertTrue(features.contains("\"mandatory\":\"True\""));
- assertTrue(features.contains("\"architecture\":\"generic\""));
- assertTrue(features.contains("\"hpa-version\":\"v1\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciVendorId\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"1234\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciDeviceId\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"5678\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciNumDevices\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"1\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- }
-
- @Test
- public void testHpaPolicyPciePassthrough() throws IOException, PolicyDecodingException, CoderException {
- final Csar csar = new Csar("src/test/resources/hpaPolicyPciePassthrough.csar");
- final PolicyDecoderCsarHpa policyDecoderCsarHpa = new PolicyDecoderCsarHpa();
- policyDecoderCsarHpa.configure(PolicyDecoderCsarHpaParameters.class.getSimpleName());
-
- final Collection<ToscaServiceTemplate> entities = policyDecoderCsarHpa.decode(csar);
- assertEquals(2, entities.size());
- final ToscaServiceTemplate entity = entities.iterator().next();
- ToscaTopologyTemplate topologyTemplate = entity.getToscaTopologyTemplate();
- Map<String, ToscaPolicy> map = topologyTemplate.getPolicies().get(0);
- ToscaPolicy policy = map.get(PolicyDecoderCsarHpa.TOSCA_POLICY_HPA_OOF);
- Map<String, Object> props = policy.getProperties();
- Object flavorFeatures =
- props.get(PolicyDecoderCsarHpa.TOSCA_POLICY_FLAVORFEATURES);
- String features = encoder.encode(flavorFeatures);
- assertTrue(features.contains("\"id\":\"VDU_vgw_0\""));
- assertTrue(features.contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- assertTrue(features.contains("\"type\":\"flavor_directives\""));
- assertTrue(features.contains("\"attribute_name\":\"flavorName\""));
- assertTrue(features.contains("\"attribute_value\":\"\""));
- assertTrue(features.contains("\"hpa-feature\":\"pciePassthrough\""));
- assertTrue(features.contains("\"mandatory\":\"True\""));
- assertTrue(features.contains("\"architecture\":\"generic\""));
- assertTrue(features.contains("\"hpa-version\":\"v1\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciVendorId\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"1234\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciDeviceId\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"5678\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciNumDevices\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"1\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- }
-
- @Test
- public void testHpaPolicyHugePage() throws IOException, PolicyDecodingException, CoderException {
- final Csar csar = new Csar("src/test/resources/hpaPolicyHugePage.csar");
- final PolicyDecoderCsarHpa policyDecoderCsarHpa = new PolicyDecoderCsarHpa();
- policyDecoderCsarHpa.configure(PolicyDecoderCsarHpaParameters.class.getSimpleName());
-
- final Collection<ToscaServiceTemplate> entities = policyDecoderCsarHpa.decode(csar);
- assertEquals(2, entities.size());
- final ToscaServiceTemplate entity = entities.iterator().next();
- ToscaTopologyTemplate topologyTemplate = entity.getToscaTopologyTemplate();
- Map<String, ToscaPolicy> map = topologyTemplate.getPolicies().get(0);
- ToscaPolicy policy = map.get(PolicyDecoderCsarHpa.TOSCA_POLICY_HPA_OOF);
- Map<String, Object> props = policy.getProperties();
- Object flavorFeatures =
- props.get(PolicyDecoderCsarHpa.TOSCA_POLICY_FLAVORFEATURES);
- String features = encoder.encode(flavorFeatures);
- assertTrue(features.contains("\"id\":\"VDU_vgw_0\""));
- assertTrue(features.contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- assertTrue(features.contains("\"type\":\"flavor_directives\""));
- assertTrue(features.contains("\"attribute_name\":\"flavorName\""));
- assertTrue(features.contains("\"attribute_value\":\"\""));
- assertTrue(features.contains("\"hpa-feature\":\"hugePages\""));
- assertTrue(features.contains("\"mandatory\":\"true\""));
- assertTrue(features.contains("\"architecture\":\"generic\""));
- assertTrue(features.contains("\"hpa-version\":\"v1\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"memoryPageSize\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"2\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"MB\""));
- }
-
- @Test
- public void testS3p0PciVendorId() throws IOException, PolicyDecodingException, CoderException {
- final Csar csar = new Csar("src/test/resources/s3p_0_pciVendorId.csar");
- final PolicyDecoderCsarHpa policyDecoderCsarHpa = new PolicyDecoderCsarHpa();
- policyDecoderCsarHpa.configure(PolicyDecoderCsarHpaParameters.class.getSimpleName());
-
- final Collection<ToscaServiceTemplate> entities = policyDecoderCsarHpa.decode(csar);
- assertEquals(1, entities.size());
- final ToscaServiceTemplate entity = entities.iterator().next();
- ToscaTopologyTemplate topologyTemplate = entity.getToscaTopologyTemplate();
- Map<String, ToscaPolicy> map = topologyTemplate.getPolicies().get(0);
- ToscaPolicy policy = map.get(PolicyDecoderCsarHpa.TOSCA_POLICY_HPA_OOF);
- Map<String, Object> props = policy.getProperties();
- Object flavorFeatures =
- props.get(PolicyDecoderCsarHpa.TOSCA_POLICY_FLAVORFEATURES);
- String features = encoder.encode(flavorFeatures);
- assertTrue(features.contains("\"id\":\"VDU_vgw_0\""));
- assertTrue(features.contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- assertTrue(features.contains("\"type\":\"flavor_directives\""));
- assertTrue(features.contains("\"attribute_name\":\"flavorName\""));
- assertTrue(features.contains("\"attribute_value\":\"\""));
- assertTrue(features.contains("\"hpa-feature\":\"pciePassthrough\""));
- assertTrue(features.contains("\"mandatory\":\"True\""));
- assertTrue(features.contains("\"architecture\":\"generic\""));
- assertTrue(features.contains("\"hpa-version\":\"v1\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciVendorId\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"1234\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- }
-
- @Test
- public void testserviceVcpeWithAll() throws IOException, PolicyDecodingException, CoderException {
- final Csar csar = new Csar("src/test/resources/service-VcpeWithAll-csar.csar");
- final PolicyDecoderCsarHpa policyDecoderCsarHpa = new PolicyDecoderCsarHpa();
- policyDecoderCsarHpa.configure(PolicyDecoderCsarHpaParameters.class.getSimpleName());
-
- final Collection<ToscaServiceTemplate> entities = policyDecoderCsarHpa.decode(csar);
- assertEquals(5, entities.size());
- final ToscaServiceTemplate entity = entities.iterator().next();
- ToscaTopologyTemplate topologyTemplate = entity.getToscaTopologyTemplate();
- Map<String, ToscaPolicy> map = topologyTemplate.getPolicies().get(0);
- ToscaPolicy policy = map.get(PolicyDecoderCsarHpa.TOSCA_POLICY_HPA_OOF);
- Map<String, Object> props = policy.getProperties();
- Object flavorFeatures =
- props.get(PolicyDecoderCsarHpa.TOSCA_POLICY_FLAVORFEATURES);
- String features = encoder.encode(flavorFeatures);
- assertTrue(features.contains("\"type\":\"tosca.nodes.nfv.Vdu.Compute\""));
- assertTrue(features.contains("\"type\":\"flavor_directives\""));
- assertTrue(features.contains("\"attribute_name\":\"flavorName\""));
- assertTrue(features.contains("\"attribute_value\":\"\""));
- assertTrue(features.contains("\"hpa-feature\":\"sriovNICNetwork\""));
- assertTrue(features.contains("\"mandatory\":\"True\""));
- assertTrue(features.contains("\"architecture\":\"generic\""));
- assertTrue(features.contains("\"hpa-version\":\"v1\""));
- assertTrue(features.contains("\"hpa-attribute-key\":\"pciVendorId\""));
- assertTrue(features.contains("\"hpa-attribute-value\":\"1234\""));
- assertTrue(features.contains("\"operator\":\"=\""));
- assertTrue(features.contains("\"unit\":\"\""));
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpaParameters.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpaParameters.java
deleted file mode 100644
index 1ca9e1a1..00000000
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/TestPolicyDecoderCsarHpaParameters.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.distribution.reception.decoding.hpa;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationStatus;
-
-/**
- * Class to perform unit test of {@link PolicyDecoderCsarHpaParameters}.
- */
-public class TestPolicyDecoderCsarHpaParameters {
-
- @Test
- public void testValidParameters() {
- final PolicyDecoderCsarHpaParameters parameterGroup = CommonTestData.getPolicyDecoderParameters(
- "src/test/resources/parameters/HpaPolicyDecoderParameters.json",
- PolicyDecoderCsarHpaParameters.class);
-
- assertEquals(PolicyDecoderCsarHpaParameters.class.getSimpleName(), parameterGroup.getName());
- assertEquals("onapName", parameterGroup.getOnapName());
- assertEquals("OOF", parameterGroup.getPolicyNamePrefix());
- assertEquals("5", parameterGroup.getPriority());
- assertEquals("2", parameterGroup.getRiskLevel());
- assertEquals("Test", parameterGroup.getRiskType());
- assertEquals("1.0", parameterGroup.getVersion());
- assertEquals(ValidationStatus.CLEAN, parameterGroup.validate().getStatus());
- }
-
- @Test
- public void testInvalidParameters() {
- final PolicyDecoderCsarHpaParameters parameterGroup = CommonTestData.getPolicyDecoderParameters(
- "src/test/resources/parameters/HpaPolicyDecoderParametersInvalid.json",
- PolicyDecoderCsarHpaParameters.class);
-
- assertEquals(ValidationStatus.INVALID, parameterGroup.validate().getStatus());
- }
-
- @Test
- public void testEmptyParameters() {
- final PolicyDecoderCsarHpaParameters configurationParameters =
- CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json",
- PolicyDecoderCsarHpaParameters.class);
-
- assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus());
- }
-}
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
index c3e69037..c3cf3f5b 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyParameterGroupTest.java
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.distribution.reception.decoding.hpa.CommonTestData;
+import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
/**
* Class to perform unit test of {@link PolicyDecoderFileInCsarToPolicyParameterGroup}.
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
index 05bd0780..812ef6d6 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/PolicyDecoderFileInCsarToPolicyTest.java
@@ -35,7 +35,7 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.model.Csar;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
-import org.onap.policy.distribution.reception.decoding.hpa.CommonTestData;
+import org.onap.policy.distribution.reception.handling.sdc.CommonTestData;
import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/CommonTestData.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/CommonTestData.java
index 79790317..e84e265b 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/hpa/CommonTestData.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/CommonTestData.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.distribution.reception.decoding.hpa;
+package org.onap.policy.distribution.reception.handling.sdc;
import java.io.File;
import org.onap.policy.common.utils.coder.Coder;
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
index d981369c..51298c1e 100644
--- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/sdc/TestSdcReceptionHandlerConfigurationParameterGroup.java
@@ -33,7 +33,6 @@ import java.util.Arrays;
import org.junit.Test;
import org.onap.policy.common.parameters.GroupValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.distribution.reception.decoding.hpa.CommonTestData;
/**
* Class to perform unit test of {@link SdcConfiguration}.
diff --git a/plugins/reception-plugins/src/test/resources/hpaPolicyPciePassthrough.csar b/plugins/reception-plugins/src/test/resources/hpaPolicyPciePassthrough.csar
deleted file mode 100644
index 43947110..00000000
--- a/plugins/reception-plugins/src/test/resources/hpaPolicyPciePassthrough.csar
+++ /dev/null
Binary files differ
diff --git a/plugins/reception-plugins/src/test/resources/hpaPolicySriov.csar b/plugins/reception-plugins/src/test/resources/hpaPolicySriov.csar
deleted file mode 100644
index 6940a359..00000000
--- a/plugins/reception-plugins/src/test/resources/hpaPolicySriov.csar
+++ /dev/null
Binary files differ
diff --git a/plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParameters.json b/plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParameters.json
deleted file mode 100644
index 9f686632..00000000
--- a/plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParameters.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "policyNamePrefix": "OOF",
- "onapName": "onapName",
- "version": "1.0",
- "priority": "5",
- "riskType": "Test",
- "riskLevel": "2"
-} \ No newline at end of file
diff --git a/plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParametersInvalid.json b/plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParametersInvalid.json
deleted file mode 100644
index a716452e..00000000
--- a/plugins/reception-plugins/src/test/resources/parameters/HpaPolicyDecoderParametersInvalid.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "policyNamePrefix": "",
- "onapName": "",
- "version": "",
- "priority": "",
- "riskType": "",
- "riskLevel": ""
-} \ No newline at end of file
diff --git a/plugins/reception-plugins/src/test/resources/s3p_0_pciVendorId.csar b/plugins/reception-plugins/src/test/resources/s3p_0_pciVendorId.csar
deleted file mode 100644
index 7e37bd42..00000000
--- a/plugins/reception-plugins/src/test/resources/s3p_0_pciVendorId.csar
+++ /dev/null
Binary files differ
diff --git a/plugins/reception-plugins/src/test/resources/sampleTestService.csar b/plugins/reception-plugins/src/test/resources/sampleTestService.csar
deleted file mode 100644
index c8a4fa39..00000000
--- a/plugins/reception-plugins/src/test/resources/sampleTestService.csar
+++ /dev/null
Binary files differ
diff --git a/plugins/reception-plugins/src/test/resources/service-TestNs8-csar.csar b/plugins/reception-plugins/src/test/resources/service-TestNs8-csar.csar
deleted file mode 100644
index 46b8c418..00000000
--- a/plugins/reception-plugins/src/test/resources/service-TestNs8-csar.csar
+++ /dev/null
Binary files differ
diff --git a/plugins/reception-plugins/src/test/resources/service-VcpeWithAll-csar.csar b/plugins/reception-plugins/src/test/resources/service-VcpeWithAll-csar.csar
deleted file mode 100644
index 809b7736..00000000
--- a/plugins/reception-plugins/src/test/resources/service-VcpeWithAll-csar.csar
+++ /dev/null
Binary files differ