\r
package org.onap.policy.api.main.rest.provider;\r
\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
import java.util.List;\r
import java.util.Map;\r
import javax.ws.rs.core.Response;\r
import org.onap.policy.models.base.PfModelException;\r
import org.onap.policy.models.pdp.concepts.PdpGroup;\r
import org.onap.policy.models.pdp.concepts.PdpGroupFilter;\r
+import org.onap.policy.models.pdp.concepts.PdpSubGroup;\r
import org.onap.policy.models.provider.PolicyModelsProvider;\r
import org.onap.policy.models.provider.PolicyModelsProviderFactory;\r
import org.onap.policy.models.provider.PolicyModelsProviderParameters;\r
public ToscaServiceTemplate fetchPolicies(String policyTypeId, String policyTypeVersion,\r
String policyId, String policyVersion) throws PfModelException {\r
\r
- validatePolicyTypeExist(policyTypeId, policyTypeVersion);\r
+ ToscaPolicyFilter policyFilter = ToscaPolicyFilter.builder()\r
+ .name(policyId).version(policyVersion)\r
+ .type(policyTypeId).typeVersion(policyTypeVersion).build();\r
+ ToscaServiceTemplate serviceTemplate = modelsProvider.getFilteredPolicies(policyFilter);\r
\r
- ToscaServiceTemplate serviceTemplate;\r
- if (policyId == null || policyVersion == null) {\r
- ToscaPolicyFilter policyFilter = ToscaPolicyFilter.builder()\r
- .name(policyId).version(policyVersion)\r
- .type(policyTypeId).typeVersion(policyTypeVersion).build();\r
- serviceTemplate = modelsProvider.getFilteredPolicies(policyFilter);\r
- } else {\r
- serviceTemplate = modelsProvider.getPolicies(policyId, policyVersion);\r
+ if (!hasPolicy(serviceTemplate)) {\r
+ throw new PfModelException(Response.Status.NOT_FOUND,\r
+ constructResourceNotFoundMessage(policyTypeId, policyTypeVersion, policyId, policyVersion));\r
}\r
\r
- validatePolicyTypeMatch(policyTypeId, policyTypeVersion, serviceTemplate);\r
-\r
close();\r
return serviceTemplate;\r
}\r
public ToscaServiceTemplate fetchLatestPolicies(String policyTypeId, String policyTypeVersion,\r
String policyId) throws PfModelException {\r
\r
- validatePolicyTypeExist(policyTypeId, policyTypeVersion);\r
-\r
ToscaPolicyFilter policyFilter = ToscaPolicyFilter.builder()\r
.name(policyId).version(ToscaPolicyFilter.LATEST_VERSION)\r
.type(policyTypeId).typeVersion(policyTypeVersion).build();\r
ToscaServiceTemplate serviceTemplate = modelsProvider.getFilteredPolicies(policyFilter);\r
\r
- validatePolicyTypeMatch(policyTypeId, policyTypeVersion, serviceTemplate);\r
+ if (!hasPolicy(serviceTemplate)) {\r
+ throw new PfModelException(Response.Status.NOT_FOUND,\r
+ constructResourceNotFoundMessage(policyTypeId, policyTypeVersion, policyId, null));\r
+ }\r
\r
close();\r
return serviceTemplate;\r
public Map<Pair<String, String>, List<ToscaPolicy>> fetchDeployedPolicies(\r
String policyTypeId, String policyTypeVersion, String policyId) throws PfModelException {\r
\r
- validatePolicyTypeExist(policyTypeId, policyTypeVersion);\r
-\r
- ToscaPolicyIdentifier policyIdentifier = new ToscaPolicyIdentifier();\r
- policyIdentifier.setName(policyId);\r
- PdpGroupFilter pdpGroupFilter = PdpGroupFilter.builder()\r
- .policyType(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion))\r
- .policy(policyIdentifier).build();\r
+ List<ToscaPolicyTypeIdentifier> policyTypes = new ArrayList<>();\r
+ policyTypes.add(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion));\r
+ PdpGroupFilter pdpGroupFilter = PdpGroupFilter.builder().policyTypeList(policyTypes).build();\r
List<PdpGroup> pdpGroups = modelsProvider.getFilteredPdpGroups(pdpGroupFilter);\r
\r
- //TODO: I don't know how to get policies matching policyId that are deployed in those PDP groups\r
+ if (pdpGroups.isEmpty()) {\r
+ throw new PfModelException(Response.Status.NOT_FOUND,\r
+ constructDeploymentNotFoundMessage(policyTypeId, policyTypeVersion, policyId));\r
+ }\r
+\r
+ Map<Pair<String, String>, List<ToscaPolicy>> deployedPolicyMap = constructDeployedPolicyMap(\r
+ pdpGroups, policyId);\r
+ if (deployedPolicyMap.isEmpty()) {\r
+ throw new PfModelException(Response.Status.NOT_FOUND,\r
+ constructDeploymentNotFoundMessage(policyTypeId, policyTypeVersion, policyId));\r
+ }\r
\r
close();\r
- return null;\r
+ return deployedPolicyMap;\r
}\r
\r
/**\r
public ToscaServiceTemplate deletePolicy(String policyTypeId, String policyTypeVersion,\r
String policyId, String policyVersion) throws PfModelException {\r
\r
- validatePolicyTypeExist(policyTypeId, policyTypeVersion);\r
-\r
- ToscaServiceTemplate serviceTemplate = modelsProvider.getPolicies(policyId, policyVersion);\r
-\r
- validatePolicyTypeMatch(policyTypeId, policyTypeVersion, serviceTemplate);\r
validateDeleteEligibility(policyTypeId, policyTypeVersion, policyId, policyVersion);\r
\r
- ToscaServiceTemplate deletedServiceTemplate = modelsProvider.deletePolicy(policyId, policyVersion);\r
+ ToscaServiceTemplate serviceTemplate = modelsProvider.deletePolicy(policyId, policyVersion);\r
+\r
+ if (!hasPolicy(serviceTemplate)) {\r
+ throw new PfModelException(Response.Status.NOT_FOUND,\r
+ constructResourceNotFoundMessage(policyTypeId, policyTypeVersion, policyId, policyVersion));\r
+ }\r
\r
close();\r
- return deletedServiceTemplate;\r
+ return serviceTemplate;\r
}\r
\r
/**\r
\r
List<Map<String, ToscaPolicy>> policies = serviceTemplate.getToscaTopologyTemplate().getPolicies();\r
for (Map<String, ToscaPolicy> policy : policies) {\r
- if (policy.size() != 1) {\r
+ if (policy.size() > 1) {\r
throw new PfModelException(Response.Status.BAD_REQUEST,\r
"one policy block contains more than one policies");\r
}\r
ToscaPolicy policyContent = policy.values().iterator().next();\r
- if (!policyTypeId.equalsIgnoreCase(policyContent.getType())\r
- || !policyTypeVersion.equalsIgnoreCase(policyContent.getTypeVersion())) {\r
- throw new PfModelException(Response.Status.BAD_REQUEST, "policy type does not match");\r
+ if (!policyTypeId.equalsIgnoreCase(policyContent.getType())) {\r
+ throw new PfModelException(Response.Status.BAD_REQUEST, "policy type id does not match");\r
+ }\r
+ if (policyContent.getTypeVersion() != null\r
+ && !policyTypeVersion.equalsIgnoreCase(policyContent.getTypeVersion())) {\r
+ throw new PfModelException(Response.Status.BAD_REQUEST, "policy type version does not match");\r
}\r
}\r
}\r
private void validateDeleteEligibility(String policyTypeId, String policyTypeVersion,\r
String policyId, String policyVersion) throws PfModelException {\r
\r
+ List<ToscaPolicyTypeIdentifier> policyTypes = new ArrayList<>();\r
+ policyTypes.add(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion));\r
+ List<ToscaPolicyIdentifier> policies = new ArrayList<>();\r
+ policies.add(new ToscaPolicyIdentifier(policyId, policyVersion));\r
PdpGroupFilter pdpGroupFilter = PdpGroupFilter.builder()\r
- .policyType(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion))\r
- .policy(new ToscaPolicyIdentifier(policyId, policyVersion)).build();\r
+ .policyTypeList(policyTypes).policyList(policies).build();\r
\r
List<PdpGroup> pdpGroups = modelsProvider.getFilteredPdpGroups(pdpGroupFilter);\r
+\r
if (!pdpGroups.isEmpty()) {\r
throw new PfModelException(Response.Status.CONFLICT, "the policy has been deployed in pdp group");\r
}\r
}\r
\r
+ private Map<Pair<String, String>, List<ToscaPolicy>> constructDeployedPolicyMap(\r
+ List<PdpGroup> pdpGroups, String policyId) throws PfModelException {\r
+\r
+ Map<Pair<String, String>, List<ToscaPolicy>> deployedPolicyMap = new HashMap<>();\r
+ for (PdpGroup pdpGroup : pdpGroups) {\r
+ List<ToscaPolicyIdentifier> policyIdentifiers = new ArrayList<>();\r
+ for (PdpSubGroup pdpSubGroup : pdpGroup.getPdpSubgroups()) {\r
+ for (ToscaPolicyIdentifier policyIdentifier : pdpSubGroup.getPolicies()) {\r
+ if (policyId.equalsIgnoreCase(policyIdentifier.getName())) {\r
+ policyIdentifiers.add(policyIdentifier);\r
+ }\r
+ }\r
+ }\r
+ List<ToscaPolicy> deployedPolicies = new ArrayList<>();\r
+ if (!policyIdentifiers.isEmpty()) {\r
+ for (ToscaPolicyIdentifier policyIdentifier : policyIdentifiers) {\r
+ deployedPolicies.addAll(\r
+ modelsProvider.getPolicyList(policyIdentifier.getName(), policyIdentifier.getVersion()));\r
+ }\r
+ }\r
+ if (!deployedPolicies.isEmpty()) {\r
+ deployedPolicyMap.put(Pair.of(pdpGroup.getName(), pdpGroup.getVersion()), deployedPolicies);\r
+ }\r
+ }\r
+ return deployedPolicyMap;\r
+ }\r
+\r
+ /**\r
+ * Constructs returned message for not found resource.\r
+ *\r
+ * @param policyTypeId the ID of policy type\r
+ * @param policyTypeVersion the version of policy type\r
+ * @param policyId the ID of policy\r
+ * @param policyVersion the version of policy\r
+ *\r
+ * @return constructed message\r
+ */\r
+ private String constructResourceNotFoundMessage(String policyTypeId, String policyTypeVersion,\r
+ String policyId, String policyVersion) {\r
+\r
+ return "policy with ID " + policyId + ":" + policyVersion\r
+ + " and type " + policyTypeId + ":" + policyTypeVersion + " does not exist";\r
+ }\r
+\r
+ /**\r
+ * Constructs returned message for not found policy deployment.\r
+ *\r
+ * @param policyTypeId the ID of policy type\r
+ * @param policyTypeVersion the version of policy type\r
+ * @param policyId the ID of policy\r
+ * @param policyVersion the version of policy\r
+ *\r
+ * @return constructed message\r
+ */\r
+ private String constructDeploymentNotFoundMessage(String policyTypeId, String policyTypeVersion,\r
+ String policyId) {\r
+\r
+ return "could not find policy with ID " + policyId + " and type "\r
+ + policyTypeId + ":" + policyTypeVersion + " deployed in any pdp group";\r
+ }\r
+\r
+ /**\r
+ * Checks if service template contains any policy.\r
+ *\r
+ * @param serviceTemplate the service template to check against\r
+ *\r
+ * @return boolean whether service template contains any policy\r
+ */\r
+ private boolean hasPolicy(ToscaServiceTemplate serviceTemplate) {\r
+\r
+ if (serviceTemplate.getToscaTopologyTemplate().getPolicies() == null) {\r
+ return false;\r
+ } else if (serviceTemplate.getToscaTopologyTemplate().getPolicies().isEmpty()) {\r
+ return false;\r
+ } else if (serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty()) {\r
+ return false;\r
+ } else {\r
+ return true;\r
+ }\r
+ }\r
+\r
/**\r
* Closes the connection to database.\r
*\r
import org.onap.policy.api.main.parameters.ApiParameterGroup;\r
import org.onap.policy.common.parameters.ParameterService;\r
import org.onap.policy.models.base.PfModelException;\r
-import org.onap.policy.models.pdp.concepts.PdpGroup;\r
-import org.onap.policy.models.pdp.concepts.PdpGroupFilter;\r
import org.onap.policy.models.provider.PolicyModelsProvider;\r
import org.onap.policy.models.provider.PolicyModelsProviderFactory;\r
import org.onap.policy.models.provider.PolicyModelsProviderParameters;\r
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;\r
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;\r
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;\r
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;\r
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;\r
\r
/**\r
public ToscaServiceTemplate fetchPolicyTypes(String policyTypeId, String policyTypeVersion)\r
throws PfModelException {\r
\r
- ToscaServiceTemplate serviceTemplate;\r
- if (policyTypeId == null || policyTypeVersion == null) {\r
- ToscaPolicyTypeFilter policyTypeFilter = ToscaPolicyTypeFilter.builder()\r
- .name(policyTypeId).version(policyTypeVersion).build();\r
- serviceTemplate = modelsProvider.getFilteredPolicyTypes(policyTypeFilter);\r
- } else {\r
- serviceTemplate = modelsProvider.getPolicyTypes(policyTypeId, policyTypeVersion);\r
+ ToscaPolicyTypeFilter policyTypeFilter = ToscaPolicyTypeFilter.builder()\r
+ .name(policyTypeId).version(policyTypeVersion).build();\r
+ ToscaServiceTemplate serviceTemplate = modelsProvider.getFilteredPolicyTypes(policyTypeFilter);\r
+\r
+ if (policyTypeId != null && !hasPolicyType(serviceTemplate)) {\r
+ throw new PfModelException(Response.Status.NOT_FOUND,\r
+ constructResourceNotFoundMessage(policyTypeId, policyTypeVersion));\r
}\r
\r
close();\r
ToscaPolicyTypeFilter policyTypeFilter = ToscaPolicyTypeFilter.builder()\r
.name(policyTypeId).version(ToscaPolicyTypeFilter.LATEST_VERSION).build();\r
ToscaServiceTemplate serviceTemplate = modelsProvider.getFilteredPolicyTypes(policyTypeFilter);\r
+ if (serviceTemplate.getPolicyTypes().isEmpty()) {\r
+ throw new PfModelException(Response.Status.NOT_FOUND,\r
+ constructResourceNotFoundMessage(policyTypeId, null));\r
+ }\r
\r
close();\r
return serviceTemplate;\r
*\r
* @param policyTypeId the ID of policy type\r
* @param policyTypeVersion the version of policy type\r
- * @param policyId the ID of policy\r
- * @param policyVersion the version of policy\r
*\r
* @throws PfModelException the PfModel parsing exception\r
*/\r
private void validateDeleteEligibility(String policyTypeId, String policyTypeVersion) throws PfModelException {\r
\r
- PdpGroupFilter pdpGroupFilter = PdpGroupFilter.builder()\r
- .policyType(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion)).build();\r
-\r
- List<PdpGroup> pdpGroups = modelsProvider.getFilteredPdpGroups(pdpGroupFilter);\r
- if (!pdpGroups.isEmpty()) {\r
+ ToscaPolicyFilter policyFilter = ToscaPolicyFilter.builder()\r
+ .type(policyTypeId).typeVersion(policyTypeVersion).build();\r
+ List<ToscaPolicy> policies = modelsProvider.getFilteredPolicyList(policyFilter);\r
+ if (!policies.isEmpty()) {\r
throw new PfModelException(Response.Status.CONFLICT,\r
- "the policy type is parameterized by at least one policies that have been deployed in pdp group");\r
+ "the policy type has been parameterized by at least one policies");\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Constructs returned message for not found resource.\r
+ *\r
+ * @param policyTypeId the ID of policy type\r
+ * @param policyTypeVersion the version of policy type\r
+ *\r
+ * @return constructed message\r
+ */\r
+ private String constructResourceNotFoundMessage(String policyTypeId, String policyTypeVersion) {\r
+\r
+ return "policy type with ID " + policyTypeId + ":" + policyTypeVersion + " does not exist";\r
+ }\r
+\r
+ /**\r
+ * Checks if service template contains any policy type.\r
+ *\r
+ * @param serviceTemplate the service template to check against\r
+ *\r
+ * @return boolean whether service template contains any policy type\r
+ */\r
+ private boolean hasPolicyType(ToscaServiceTemplate serviceTemplate) {\r
+\r
+ if (serviceTemplate.getPolicyTypes() == null) {\r
+ return false;\r
+ } else if (serviceTemplate.getPolicyTypes().isEmpty()) {\r
+ return false;\r
+ } else if (serviceTemplate.getPolicyTypes().get(0).isEmpty()) {\r
+ return false;\r
+ } else {\r
+ return true;\r
}\r
}\r
\r
* @throws PfModelException the PfModel parsing exception\r
*/\r
private void close() throws PfModelException {\r
+\r
try {\r
modelsProvider.close();\r
} catch (Exception e) {\r
<!--
============LICENSE_START=======================================================
Copyright (C) 2019 Nordix Foundation.
+ Copyright (C) 2019 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.
<class>org.onap.policy.models.base.PfConceptKey</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<class>org.onap.policy.models.base.PfConceptKey</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />
<property name="eclipselink.logging.level.query" value="ALL" />
<property name="eclipselink.logging.level.properties" value="ALL" /-->
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
+ <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="INFO" />
</properties>
<!--
============LICENSE_START=======================================================
Copyright (C) 2019 Nordix Foundation.
+ Copyright (C) 2019 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.
<class>org.onap.policy.models.base.PfConceptKey</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<class>org.onap.policy.models.dao.converters.CDataConditioner</class>
<class>org.onap.policy.models.dao.converters.Uuid2String</class>
<class>org.onap.policy.models.base.PfConceptKey</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />
<property name="eclipselink.logging.level.query" value="ALL" />
<property name="eclipselink.logging.level.properties" value="ALL" /-->
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
+ <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="INFO" />
</properties>
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.AffinityPolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - zone
+ identity:
+ type: string
+ required: true
+ applicableResources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - any
+ - all
+ affinityProperties:
+ type: policy.data.affinityProperties_properties
+ required: true
+ resources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+data_types:
+ -
+ policy.data.affinityProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ qualifier:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - same
+ - different
+ category:
+ type: string
+ required: true
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.DistancePolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - distance_to_location
+ identity:
+ type: string
+ required: true
+ resources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ applicableResources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - any
+ - all
+ distanceProperties:
+ type: policy.data.distanceProperties_properties
+ required: true
+data_types:
+ -
+ policy.data.distanceProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ locationInfo:
+ type: string
+ required: true
+ distance:
+ type: policy.data.distance_properties
+ required: true
+ policy.data.distance_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ value:
+ type: string
+ required: true
+ operator:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - <
+ - <=
+ - '>'
+ - '>='
+ - '='
+ unit:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - km
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.HpaPolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - hpa
+ resources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ identity:
+ type: string
+ required: true
+ flavorFeatures:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.flavorFeatures_properties
+data_types:
+ -
+ policy.data.flavorFeatures_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ id:
+ type: string
+ required: true
+ type:
+ type: string
+ required: true
+ directives:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.directives_properties
+ flavorProperties:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.flavorProperties_properties
+ -
+ policy.data.directives_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ type:
+ type: string
+ attributes:
+ type: list
+ entry_schema:
+ type: policy.data.directives_attributes_properties
+ -
+ policy.data.directives_attributes_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ attribute_name:
+ type: string
+ attribute_value:
+ type: string
+ -
+ policy.data.flavorProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ hpa-feature:
+ type: string
+ required: true
+ mandatory:
+ type: string
+ required: true
+ score:
+ type: string
+ required: false
+ architecture:
+ type: string
+ required: true
+ hpa-version:
+ type: string
+ required: true
+ directives:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.directives_properties
+ hpa-feature-attributes:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.hpa-feature-attributes_properties
+ -
+ policy.data.hpa-feature-attributes_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ hpa-attribute-key:
+ type: string
+ required: true
+ hpa-attribute-value:
+ type: string
+ required: true
+ operator:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - <
+ - <=
+ - '>'
+ - '>='
+ - '='
+ - '!='
+ - any
+ - all
+ - subset
+ unit:
+ type: string
+ required: false
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.OptimizationPolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - placement_optimization
+ identity:
+ type: string
+ required: true
+ objective:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - minimize
+ - maximize
+ objectiveParameter:
+ type: policy.data.objectiveParameter_properties
+ required: true
+data_types:
+ -
+ policy.data.objectiveParameter_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ parameterAttributes:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.parameterAttributes_properties
+ operator:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - '*'
+ - +
+ - '-'
+ - /
+ - '%'
+ policy.data.parameterAttributes_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ resources:
+ type: string
+ required: true
+ customerLocationInfo:
+ type: string
+ required: true
+ parameter:
+ type: string
+ required: true
+ weight:
+ type: string
+ required: true
+ operator:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - '*'
+ - +
+ - '-'
+ - /
+ - '%'
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.PciPolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - pciPolicy
+ identity:
+ type: string
+ required: true
+ resources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ pciProperties:
+ type: list
+ required: false
+ entry_schema:
+ type: policy.data.pciProperties_properties
+data_types:
+ -
+ policy.data.pciProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ algoCategory:
+ type: string
+ required: false
+ pciOptmizationAlgoName:
+ type: string
+ required: false
+ pciOptimizationNwConstraint:
+ type: string
+ required: false
+ pciOptimizationPriority:
+ type: string
+ required: false
+ pciOptimizationTimeConstraint:
+ type: string
+ required: false
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.QueryPolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - request_param_query
+ identity:
+ type: string
+ required: true
+ queryProperties:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.queryProperties_properties
+data_types:
+ -
+ policy.data.queryProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ attribute:
+ type: string
+ required: true
+ value:
+ type: string
+ required: true
+ attribute_location:
+ type: string
+ required: true
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.SubscriberPolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - subscriberPolicy
+ identity:
+ type: string
+ required: true
+ properties:
+ type: policy.data.properties_properties
+ required: true
+data_types:
+ -
+ policy.data.properties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ subscriberName:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ subscriberRole:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ provStatus:
+ type: list
+ required: true
+ entry_schema:
+ type: string
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.Vim_fit:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - vim_fit
+ identity:
+ type: string
+ required: true
+ applicableResources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - any
+ - all
+ resources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ capacityProperties:
+ type: policy.data.capacityProperties_properties
+ required: true
+data_types:
+ -
+ policy.data.capacityProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ controller:
+ type: string
+ required: true
+ request:
+ type: string
+ required: true
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ - onap.policies.Optimization:
+ derived_from: tosca.policies.Root
+ version: 1.0.0
+ description: a base policy type for all policies that govern optimization
+ - onap.policies.optimization.VnfPolicy:
+ derived_from: onap.policies.Optimization
+ properties:
+ policyScope:
+ type: list
+ description: scope where the policy is applicable
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ policyType:
+ type: list
+ description: type of a policy
+ required: true
+ matchable: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - vnfPolicy
+ identity:
+ type: string
+ required: true
+ resources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ applicableResources:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - any
+ - all
+ vnfProperties:
+ type: list
+ required: true
+ entry_schema:
+ type: policy.data.vnfProperties_properties
+data_types:
+ -
+ policy.data.vnfProperties_properties:
+ derived_from: tosca.nodes.Root
+ properties:
+ inventoryProvider:
+ type: string
+ required: true
+ serviceType:
+ type: string
+ required: true
+ inventoryType:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ constraints:
+ - valid_values:
+ - serviceInstanceId
+ - vnfName
+ - cloudRegionId
+ - vimId
+ customerId:
+ type: string
+ required: true
+
}
},
{
- "onap.policy.monitoring.cdap.tca.hi.lo.app": {
+ "onap.policies.monitoring.cdap.tca.hi.lo.app": {
"derived_from": "onap.policies.Monitoring",
"version": "1.0.0",
"properties": {
derived_from: tosca.policies.Root
description: a base policy type for all policies that governs monitoring provisioning
-
- onap.policy.monitoring.cdap.tca.hi.lo.app:
+ onap.policies.monitoring.cdap.tca.hi.lo.app:
derived_from: onap.policies.Monitoring
version: 1.0.0
properties: