Re-org folders, onboard test folder, test config
[optf/osdf.git] / osdf / models / policy / placement / xacml / placementPolicies.xcore
diff --git a/osdf/models/policy/placement/xacml/placementPolicies.xcore b/osdf/models/policy/placement/xacml/placementPolicies.xcore
new file mode 100644 (file)
index 0000000..866488e
--- /dev/null
@@ -0,0 +1,728 @@
+/*
+ * ================================================================================
+ * Copyright (C) 2018 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.
+*/
+
+package org.onap.oof.osdf.policies.placement
+
+import java.util.UUID
+
+annotation "http://org.onap" as onap
+annotation "http://org.onap.policy" as policy
+
+type UUID  wraps UUID
+
+/*
+ * Comparison operators
+ */
+enum ComparisonOperator{
+        less=1, grater=2, lessEqual=3, greaterEqual=4, equal=5, notEqual=6
+}
+
+enum TenantType{
+        GW_TENANT_ID=1, PORTAL_TENANT_ID=2
+}
+
+/*
+ * Computational operators
+ */
+enum ComputationalOperator{
+        sum=1, product=2
+}
+
+
+/*
+ * Qualifier types
+ */
+enum Qualifier{
+        same=1, different=2
+}
+
+/*
+ * Zone  category
+ */
+enum ZoneCategory{
+        disaster=1, region=2, complex=3, time=4, maintenance=5
+}
+
+/*
+ * Geographical region types
+ */
+enum GeoRegion{
+        US=1, EMEA=2, AP=3, CALA=4, CA=5, INTERNATIONAL=6
+}
+
+/*
+ * Parameters
+ */
+enum Parameter{
+        distance=0, latency=1, cloud_version=2
+        //thoughput=1, geoDistance=1, airDistance=2, latency=3, bandwidth=4
+}
+
+
+/*
+ * The type of inventory defined in cloud
+ */
+enum InventoryType{
+        service=1, cloud=2
+}
+
+/*
+ * The type of network
+ */
+ enum NetworkType{
+        ip=1
+ }
+
+/*
+ * Objective functions.
+ */
+
+enum ObjectiveFunction{
+        minimize=1, maximize=2
+}
+
+/*
+ * This is a model of a condition.
+ * @param parameter This is the parameter of interest.
+ * @param operator This is a comparison operator.
+ * @param value This is a value of a parameter
+ */
+class ConditionalInfo{
+        @onap(^type = "configuration")
+        Parameter parameter
+        @onap(^type = "configuration")
+        ComparisonOperator operator
+        @onap(^type = "configuration")
+        String value
+}
+
+enum LocationInfo{
+        customer_loc=1, none=2, customer_pref_loc=3
+}
+
+
+/*
+ * Model for distance to location property.
+ * @param distanceCondition This is a distance condition.
+ * @param locationInfo This is a location with respect to which distance condition is applied.
+ */
+class DistanceToLocationProperty{
+        //distanceCondition.parameter must be distance.
+        @onap(^type = "configuration")
+        contains ConditionalInfo distanceCondition
+        @onap(^type = "configuration")
+        LocationInfo locationInfo
+}
+
+enum DistanceToLocationPolicyType{
+        distance_to_location=1
+}
+
+/*
+ * Model for distance to location policy.
+ * @param identity This is an identity created by a user.
+ * @param type This is the type of a policy.
+ * @param resourceInstance This is a list of resource instances over which this policy is applied.
+ * @param distanceToLocationProperty This is the distance properties of the policy.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class DistanceToLocationPolicy extends OOFPolicyMetaInfo{
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        DistanceToLocationPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains DistanceToLocationProperty distanceToLocationProperty
+}
+
+/*
+ * The property associated with the NetworkBetweenDemandsPolicy.
+ * @param latencyCondition The latency property associated with the policy.
+ * @param locationInfo The customer location information.
+ */
+class NetworkToLocationProperty{
+        //latencyCondition.parameter must be latency.
+        @onap(^type = "configuration")
+        contains ConditionalInfo latencyCondition
+        @onap(^type = "configuration")
+        LocationInfo locationInfo
+}
+
+enum NetworkToLocationPolicyType{
+        network_to_location=1
+}
+
+/*
+ * Network between demands policy.
+ * @param type The type of a policy.
+ * @param resourceInstanceType The resources associated with a policy.
+ * @param networkToLocationProperty The property associated with the policy.
+ */
+
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class NetworkToLocationPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        NetworkToLocationPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains NetworkToLocationProperty networkToLocationProperty
+}
+
+/*
+ * The property associated with the NetworkBetweenDemandsPolicy.
+ * @param latencyCondition The latency property associated with the policy.
+ */
+class NetworkBetweenDemandsProperty{
+        //latencyCondition.parameter must be latency.
+        @onap(^type = "configuration")
+        contains ConditionalInfo latencyCondition
+}
+
+enum NetworkBetweenDemandsPolicyType{
+        network_between_demands=1
+}
+
+/*
+ * Network between demands policy.
+ * @param type The type of a policy.
+ * @param resourceInstanceType The resources associated with a policy.
+ * @param networkBetweenDemandsProperty The property associated with the policy.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class NetworkBetweenDemandsPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        NetworkBetweenDemandsPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains NetworkBetweenDemandsProperty networkBetweenDemandsProperty
+}
+
+
+/*
+ * Network roles supported a VNF placement
+ * @param all A list of network roles.
+ */
+class NetworkRoles{
+        @onap(^type = "configuration")
+        String[] all
+}
+
+/*
+ * Complex names supported by a VNF placement
+ * @param any A list of complex names.
+ */
+class Complex{
+        @onap(^type = "configuration")
+        String[] any
+}
+/*
+ * This are the cloud properties.
+ * @param cloudVersion This is the version of cloud.
+ * @param cloudType This is the type of cloud.
+ * @param dataPlace This is the type of data plane.
+ * @param hypervisor This is the type of hypervisor.
+ * @param networkRoles This is a list of connected networks.
+ * @param exclusivityGroups This is an exclusivity group Id
+ * @param state State in which a VNF should be located.
+ * @param country Country in which a VNF should be located.
+ * @param getRegion Geographical region in which a VNF should be located.
+ */
+class cloudAttributeProperty{
+        //cloudVersionCondition.parameter must be cloudVersion.
+        @onap(^type = "configuration")
+        String cloudVersion
+        @onap(^type = "configuration")
+        String cloudType
+        @onap(^type = "configuration")
+        String dataPlane
+        @onap(^type = "configuration")
+        String hypervisor
+        @onap(^type = "configuration")
+        contains NetworkRoles networkRoles
+        @onap(^type = "configuration")
+        contains Complex complex
+        @onap(^type = "configuration")
+        String exclusivityGroups
+        @onap(^type = "configuration")
+        String state
+        @onap(^type = "configuration")
+        String country
+        @onap(^type = "configuration")
+        GeoRegion geoRegion
+        @onap(^type = "configuration")
+       String replicationRole
+
+}
+
+enum cloudAttributePolicyType{
+        attribute=1
+}
+
+/*
+ * Model for the cloud attribute policy.
+ * @param type This is the type of a policy.
+ * @param resourceInstance This is a list of resources over which the policy is applied.
+ * @param cloudAttributeProperty This is the properties associated with the policy.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class cloudAttributePolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        cloudAttributePolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains cloudAttributeProperty cloudAttributeProperty
+}
+
+/*
+ * The property associated with the capacity policy.
+ * @param tenant The tenant whose capacity needs to be checked.
+ * @param description The location of a heat template.
+ */
+class CapacityProperty{
+        @onap(^type = "configuration")
+        TenantType tenant
+        @onap(^type = "configuration")
+        String description
+}
+
+enum CapacityPolicyType{
+        cloud_capacity=1
+}
+
+/*
+ * Capacity policy
+ * @param type The type of a policy.
+ * @param resourceInstanceType The type of resources associated with a policy.
+ * @param capacityProperty The property associated with a policy.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class CapacityPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        CapacityPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains CapacityProperty capacityProperty
+}
+
+enum InventoryGroupPolicyType{
+        inventory_group = 1
+}
+
+/*
+ * Model for the inventory group policy.
+ * @param type This is the type of a policy.
+ * @param resourceInstance This is a list of resources that must be grouped/paired
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class InventoryGroupPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        InventoryGroupPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+}
+
+/*
+ * This is the property associated with this policy.
+ * @param controller onap controller.
+ * @param request This should be key-value pairs to be sent in a request.
+ */
+class ResourceInstanceProperty{
+        @onap(^type = "configuration")
+        String controller
+        @onap(^type = "configuration")
+        String request
+}
+
+enum ResourceInstancePolicyType{
+        instance_fit=1
+}
+/*
+ * Model for the resource instance policy.
+ * @param type This is the type of a policy.
+ * @param resourceInstance This is a list of resources.
+ * @param resourceInstanceProperty This is a property associated with each resource in the list.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class ResourceInstancePolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        ResourceInstancePolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains ResourceInstanceProperty resourceInstanceProperty
+
+}
+
+/*
+ * This is the property associated with this policy.
+ * @param controller onap controller
+ * @param request This should be key-value pairs to be sent in a request.
+ */
+class ResourceRegionProperty{
+        @onap(^type = "configuration")
+        String controller
+        @onap(^type = "configuration")
+        String request
+}
+
+enum ResourceRegionPolicyType{
+        region_fit=1
+}
+
+/*
+ * Model for the resource region policy
+ * @param type This is the type of a policy.
+ * @param resourceInstance This is a list of resources.
+ * @param resourceRegionProperty This is a property associated with this policy.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class ResourceRegionPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        ResourceRegionPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains ResourceRegionProperty resourceRegionProperty
+}
+
+/*
+ * This is the property associated with zone policy.
+ * @param qualifier This is the qualifier.
+ * @param category This is the category of a zone.
+ */
+class ZoneProperty{
+        @onap(^type = "configuration")
+        Qualifier qualifier
+        @onap(^type = "configuration")
+        ZoneCategory category
+}
+
+enum ZonePolicyType{
+        zone=1
+}
+
+/*
+ * Model of the zone policy.
+ * @param type This is the type of a policy.
+ * @param resourceInstanceType This is a list of resources.
+ * @param zoneProperty This is the property associated with the policy.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+
+class ZonePolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        ZonePolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains ZoneProperty zoneProperty
+}
+
+/*
+ * The property associated with a VNF type.
+ * @param inventoryProvider The onap entity providing inventory information.
+ * @param inventoryType The type of an inventory.
+ * @param serviceId The id of a service.
+ */
+class VNFPolicyProperty{
+        @onap(^type = "configuration")
+        String inventoryProvider
+        @onap(^type = "configuration")
+        InventoryType inventoryType
+        @onap(^type = "configuration")
+        contains Attributes attributes
+}
+
+/*
+ * The property associated with a Subscriber type.
+ * @param subscriberName The name of a subscriber.
+ * @param subscriberRole The role of a subscriber.
+ * @param provStatus The provisioning status of a subscriber.
+ */
+class SubscriberPolicyProperty{
+        @onap(^type = "configuration")
+        String[] subscriberName
+        @onap(^type = "configuration")
+        String[] subscriberRole
+        @onap(^type = "configuration")
+        String[] provStatus
+}
+
+enum VNFPolicyType{
+        vnfPolicy=1
+}
+
+enum SubscriberPolicyType{
+        subscriberPolicy=1
+}
+
+class Attributes{
+    @onap(^type = "configuration")
+    String globalCustomerId
+    @onap(^type = "configuration")
+    String operationalStatus
+    @onap(^type = "configuration")
+    String[] orchestrationStatus
+    @onap(^type = "configuration")
+    String modelInvariantId
+    @onap(^type = "configuration")
+    String modelVersionId
+    @onap(^type = "configuration")
+    String equipmentRole
+}
+
+/*
+ * Policy associated with a VNF.
+ * @param resourceInstance This parameter identifies a specific VNF.
+ * @param inventoryProvider This is the provider of inventory.
+ * @param inventoryType This is the type of inventory.
+ * @param serviceType The service associated with a VNF.
+ * @param serviceId The Id associated with a service.
+ * @param globalCustomerId The global id of a customer.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class VNFPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        VNFPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains VNFPolicyProperty[] property
+}
+
+/*
+ * Policy associated with a Subscriber.
+ * @param subscriberName The name of a subscriber.
+ * @param subscriberRole The role of a subscriber.
+ * @param provStatus The provisioning status of a subscriber.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class SubscriberPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        SubscriberPolicyType ^type
+        @onap(^type = "configuration")
+        contains SubscriberPolicyProperty[] property
+}
+
+
+/*
+ * This is the property associated with this policy.
+ * @param providerUrl This is the url of provider to check the capacity.
+ * @param request This should be key-value pairs to be sent in a request.
+ */
+class InstanceReservationProperty{
+        @onap(^type = "configuration")
+        String controller
+        @onap(^type = "configuration")
+        String request
+}
+
+enum InstanceReservationPolicyType{
+        instance_reservation=1
+}
+/*
+ * Model for the resource instance policy.
+ * @param identity This is an identity created by a user.
+ * @param type This is the type of a policy.
+ * @param resourceInstance This is a list of resources.
+ * @param resourceInstanceProperty This is a property associated with each resource in the list.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class InstanceReservationPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        InstanceReservationPolicyType ^type
+        @onap(^type = "configuration")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        contains InstanceReservationProperty instanceReservationProperty
+
+}
+
+/*
+ * This is a model of an operand.
+ * @param parameter This is a parameter.
+ * @param associativity This is a list of entities with which a parameter is associated.
+ */
+ /*
+class Operand{
+        @onap(^type = "configuration")
+        Parameter parameter
+        @onap(^type = "configuration")
+        Entity associativity
+}
+*/
+
+/*
+ * This is the optimization function.
+ * @param identity This is an identity of a function.
+ * @param operation This is a computational operator.
+ * @param leftOperand This is a left operand of a function.
+ * @param rightOperand This is a right operand of a function.
+ */
+/*
+class OptimizationFunction{
+        @onap(^type = "configuration")
+        ExpressionIdentity identity
+        @onap(^type = "configuration")
+        ComputationalOperator operation
+        @onap(^type = "configuration")
+        contains Operand[] operands
+}
+*/
+
+/*
+ * Properties associated with a sub-expression.
+ * @param weight The weight of an expression.
+ * @param parameter The parameter involved in an expression.
+ * @param entity The entities involved in an expression.
+ * @param operator The operator of an expression.
+ * @param customerLocationInfo The location of a customer.
+ */
+class AttributeProperty{
+        @onap(^type = "configuration")
+        double weight
+        @onap(^type = "configuration")
+        Parameter parameter
+        @onap(^type = "configuration")
+        String[] resource
+        @onap(^type = "configuration")
+        ComputationalOperator operator
+        @onap(^type = "configuration")
+        LocationInfo customerLocationInfo
+}
+
+enum PlacementOptimizationPolicyType{
+        placementOptimization=1
+}
+
+/*
+ * @param operator An operator in an expression.
+ * @param parameterAttributes Represents sub-expression
+ */
+class ObjectiveParameter{
+        @onap(^type = "configuration")
+        ComputationalOperator operator
+        @onap(^type = "configuration")
+        contains AttributeProperty[] parameterAttributes
+}
+
+/*
+ * Model of the placement optimization policy.
+ * @param type This is the type of a policy.
+ * @param objective This is an objective function.
+ * @param objectiveParameter The parameter/expression to be optimized.
+ */
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+
+class PlacementOptimizationPolicy extends OOFPolicyMetaInfo{
+        @policy (matching = "true")
+        @onap(^type = "configuration")
+        PlacementOptimizationPolicyType ^type
+        @onap(^type = "configuration")
+        ObjectiveFunction objective
+        @onap(^type = "configuration")
+        contains ObjectiveParameter objectiveParameter
+}
+
+
+/*
+ * Meta information required for oof policies.
+ * @param identity This is a user-defined identity.
+ * @param policyScope The scope of a policy
+ */
+
+@policy (
+    policyTemplate = "OOF-PLACEMENT"
+)
+class OOFPolicyMetaInfo{
+        @onap(^type = "configuration")
+        String identity
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        contains Scope policyScope
+}
+
+/*
+ * Scopes in which a policy is applicable.
+ * @param serviceType The type of a service.
+ * @param networkType The type of a network
+ * @param geoRigion The geographical region.
+ * @param resourceInstanceType The resources associated with a policy/
+ * @param subscriberRole 
+ */
+class Scope{
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        String[] serviceType
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        String[] networkType
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        String[] geoRegion
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        String[] resourceInstanceType
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        String[] modelInvariantId
+        @onap(^type = "configuration")
+        @policy (matching = "true")
+        String[] subscriberRole
+}