2 * ================================================================================
3 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package org.onap.oof.osdf.policies.placement
22 annotation "http://org.onap" as onap
23 annotation "http://org.onap.policy" as policy
28 * Comparison operators
30 enum ComparisonOperator{
31 less=1, grater=2, lessEqual=3, greaterEqual=4, equal=5, notEqual=6
35 GW_TENANT_ID=1, PORTAL_TENANT_ID=2
39 * Computational operators
41 enum ComputationalOperator{
57 disaster=1, region=2, complex=3, time=4, maintenance=5
61 * Geographical region types
64 US=1, EMEA=2, AP=3, CALA=4, CA=5, INTERNATIONAL=6
71 distance=0, latency=1, cloud_version=2
72 //thoughput=1, geoDistance=1, airDistance=2, latency=3, bandwidth=4
77 * The type of inventory defined in cloud
91 * Objective functions.
94 enum ObjectiveFunction{
95 minimize=1, maximize=2
99 * This is a model of a condition.
100 * @param parameter This is the parameter of interest.
101 * @param operator This is a comparison operator.
102 * @param value This is a value of a parameter
104 class ConditionalInfo{
105 @onap(^type = "configuration")
107 @onap(^type = "configuration")
108 ComparisonOperator operator
109 @onap(^type = "configuration")
114 customer_loc=1, none=2, customer_pref_loc=3
119 * Model for distance to location property.
120 * @param distanceCondition This is a distance condition.
121 * @param locationInfo This is a location with respect to which distance condition is applied.
123 class DistanceToLocationProperty{
124 //distanceCondition.parameter must be distance.
125 @onap(^type = "configuration")
126 contains ConditionalInfo distanceCondition
127 @onap(^type = "configuration")
128 LocationInfo locationInfo
131 enum DistanceToLocationPolicyType{
132 distance_to_location=1
136 * Model for distance to location policy.
137 * @param identity This is an identity created by a user.
138 * @param type This is the type of a policy.
139 * @param resourceInstance This is a list of resource instances over which this policy is applied.
140 * @param distanceToLocationProperty This is the distance properties of the policy.
143 policyTemplate = "OOF-PLACEMENT"
145 class DistanceToLocationPolicy extends OOFPolicyMetaInfo{
146 @onap(^type = "configuration")
147 @policy (matching = "true")
148 DistanceToLocationPolicyType ^type
149 @onap(^type = "configuration")
150 String[] resourceInstanceType
151 @onap(^type = "configuration")
152 contains DistanceToLocationProperty distanceToLocationProperty
156 * The property associated with the NetworkBetweenDemandsPolicy.
157 * @param latencyCondition The latency property associated with the policy.
158 * @param locationInfo The customer location information.
160 class NetworkToLocationProperty{
161 //latencyCondition.parameter must be latency.
162 @onap(^type = "configuration")
163 contains ConditionalInfo latencyCondition
164 @onap(^type = "configuration")
165 LocationInfo locationInfo
168 enum NetworkToLocationPolicyType{
169 network_to_location=1
173 * Network between demands policy.
174 * @param type The type of a policy.
175 * @param resourceInstanceType The resources associated with a policy.
176 * @param networkToLocationProperty The property associated with the policy.
180 policyTemplate = "OOF-PLACEMENT"
182 class NetworkToLocationPolicy extends OOFPolicyMetaInfo{
183 @policy (matching = "true")
184 @onap(^type = "configuration")
185 NetworkToLocationPolicyType ^type
186 @onap(^type = "configuration")
187 String[] resourceInstanceType
188 @onap(^type = "configuration")
189 contains NetworkToLocationProperty networkToLocationProperty
193 * The property associated with the NetworkBetweenDemandsPolicy.
194 * @param latencyCondition The latency property associated with the policy.
196 class NetworkBetweenDemandsProperty{
197 //latencyCondition.parameter must be latency.
198 @onap(^type = "configuration")
199 contains ConditionalInfo latencyCondition
202 enum NetworkBetweenDemandsPolicyType{
203 network_between_demands=1
207 * Network between demands policy.
208 * @param type The type of a policy.
209 * @param resourceInstanceType The resources associated with a policy.
210 * @param networkBetweenDemandsProperty The property associated with the policy.
213 policyTemplate = "OOF-PLACEMENT"
215 class NetworkBetweenDemandsPolicy extends OOFPolicyMetaInfo{
216 @policy (matching = "true")
217 @onap(^type = "configuration")
218 NetworkBetweenDemandsPolicyType ^type
219 @onap(^type = "configuration")
220 String[] resourceInstanceType
221 @onap(^type = "configuration")
222 contains NetworkBetweenDemandsProperty networkBetweenDemandsProperty
227 * Network roles supported a VNF placement
228 * @param all A list of network roles.
231 @onap(^type = "configuration")
236 * Complex names supported by a VNF placement
237 * @param any A list of complex names.
240 @onap(^type = "configuration")
244 * This are the cloud properties.
245 * @param cloudVersion This is the version of cloud.
246 * @param cloudType This is the type of cloud.
247 * @param dataPlace This is the type of data plane.
248 * @param hypervisor This is the type of hypervisor.
249 * @param networkRoles This is a list of connected networks.
250 * @param exclusivityGroups This is an exclusivity group Id
251 * @param state State in which a VNF should be located.
252 * @param country Country in which a VNF should be located.
253 * @param getRegion Geographical region in which a VNF should be located.
255 class cloudAttributeProperty{
256 //cloudVersionCondition.parameter must be cloudVersion.
257 @onap(^type = "configuration")
259 @onap(^type = "configuration")
261 @onap(^type = "configuration")
263 @onap(^type = "configuration")
265 @onap(^type = "configuration")
266 contains NetworkRoles networkRoles
267 @onap(^type = "configuration")
268 contains Complex complex
269 @onap(^type = "configuration")
270 String exclusivityGroups
271 @onap(^type = "configuration")
273 @onap(^type = "configuration")
275 @onap(^type = "configuration")
277 @onap(^type = "configuration")
278 String replicationRole
282 enum cloudAttributePolicyType{
287 * Model for the cloud attribute policy.
288 * @param type This is the type of a policy.
289 * @param resourceInstance This is a list of resources over which the policy is applied.
290 * @param cloudAttributeProperty This is the properties associated with the policy.
293 policyTemplate = "OOF-PLACEMENT"
295 class cloudAttributePolicy extends OOFPolicyMetaInfo{
296 @policy (matching = "true")
297 @onap(^type = "configuration")
298 cloudAttributePolicyType ^type
299 @onap(^type = "configuration")
300 String[] resourceInstanceType
301 @onap(^type = "configuration")
302 contains cloudAttributeProperty cloudAttributeProperty
306 * The property associated with the capacity policy.
307 * @param tenant The tenant whose capacity needs to be checked.
308 * @param description The location of a heat template.
310 class CapacityProperty{
311 @onap(^type = "configuration")
313 @onap(^type = "configuration")
317 enum CapacityPolicyType{
323 * @param type The type of a policy.
324 * @param resourceInstanceType The type of resources associated with a policy.
325 * @param capacityProperty The property associated with a policy.
328 policyTemplate = "OOF-PLACEMENT"
330 class CapacityPolicy extends OOFPolicyMetaInfo{
331 @policy (matching = "true")
332 @onap(^type = "configuration")
333 CapacityPolicyType ^type
334 @onap(^type = "configuration")
335 String[] resourceInstanceType
336 @onap(^type = "configuration")
337 contains CapacityProperty capacityProperty
340 enum InventoryGroupPolicyType{
345 * Model for the inventory group policy.
346 * @param type This is the type of a policy.
347 * @param resourceInstance This is a list of resources that must be grouped/paired
350 policyTemplate = "OOF-PLACEMENT"
352 class InventoryGroupPolicy extends OOFPolicyMetaInfo{
353 @policy (matching = "true")
354 @onap(^type = "configuration")
355 InventoryGroupPolicyType ^type
356 @onap(^type = "configuration")
357 String[] resourceInstanceType
361 * This is the property associated with this policy.
362 * @param controller onap controller.
363 * @param request This should be key-value pairs to be sent in a request.
365 class ResourceInstanceProperty{
366 @onap(^type = "configuration")
368 @onap(^type = "configuration")
372 enum ResourceInstancePolicyType{
376 * Model for the resource instance policy.
377 * @param type This is the type of a policy.
378 * @param resourceInstance This is a list of resources.
379 * @param resourceInstanceProperty This is a property associated with each resource in the list.
382 policyTemplate = "OOF-PLACEMENT"
384 class ResourceInstancePolicy extends OOFPolicyMetaInfo{
385 @policy (matching = "true")
386 @onap(^type = "configuration")
387 ResourceInstancePolicyType ^type
388 @onap(^type = "configuration")
389 String[] resourceInstanceType
390 @onap(^type = "configuration")
391 contains ResourceInstanceProperty resourceInstanceProperty
396 * This is the property associated with this policy.
397 * @param controller onap controller
398 * @param request This should be key-value pairs to be sent in a request.
400 class ResourceRegionProperty{
401 @onap(^type = "configuration")
403 @onap(^type = "configuration")
407 enum ResourceRegionPolicyType{
412 * Model for the resource region policy
413 * @param type This is the type of a policy.
414 * @param resourceInstance This is a list of resources.
415 * @param resourceRegionProperty This is a property associated with this policy.
418 policyTemplate = "OOF-PLACEMENT"
420 class ResourceRegionPolicy extends OOFPolicyMetaInfo{
421 @policy (matching = "true")
422 @onap(^type = "configuration")
423 ResourceRegionPolicyType ^type
424 @onap(^type = "configuration")
425 String[] resourceInstanceType
426 @onap(^type = "configuration")
427 contains ResourceRegionProperty resourceRegionProperty
431 * This is the property associated with zone policy.
432 * @param qualifier This is the qualifier.
433 * @param category This is the category of a zone.
436 @onap(^type = "configuration")
438 @onap(^type = "configuration")
439 ZoneCategory category
447 * Model of the zone policy.
448 * @param type This is the type of a policy.
449 * @param resourceInstanceType This is a list of resources.
450 * @param zoneProperty This is the property associated with the policy.
453 policyTemplate = "OOF-PLACEMENT"
456 class ZonePolicy extends OOFPolicyMetaInfo{
457 @policy (matching = "true")
458 @onap(^type = "configuration")
460 @onap(^type = "configuration")
461 String[] resourceInstanceType
462 @onap(^type = "configuration")
463 contains ZoneProperty zoneProperty
467 * The property associated with a VNF type.
468 * @param inventoryProvider The onap entity providing inventory information.
469 * @param inventoryType The type of an inventory.
470 * @param serviceId The id of a service.
472 class VNFPolicyProperty{
473 @onap(^type = "configuration")
474 String inventoryProvider
475 @onap(^type = "configuration")
476 InventoryType inventoryType
477 @onap(^type = "configuration")
478 contains Attributes attributes
482 * The property associated with a Subscriber type.
483 * @param subscriberName The name of a subscriber.
484 * @param subscriberRole The role of a subscriber.
485 * @param provStatus The provisioning status of a subscriber.
487 class SubscriberPolicyProperty{
488 @onap(^type = "configuration")
489 String[] subscriberName
490 @onap(^type = "configuration")
491 String[] subscriberRole
492 @onap(^type = "configuration")
500 enum SubscriberPolicyType{
505 @onap(^type = "configuration")
506 String globalCustomerId
507 @onap(^type = "configuration")
508 String operationalStatus
509 @onap(^type = "configuration")
510 String[] orchestrationStatus
511 @onap(^type = "configuration")
512 String modelInvariantId
513 @onap(^type = "configuration")
514 String modelVersionId
515 @onap(^type = "configuration")
520 * Policy associated with a VNF.
521 * @param resourceInstance This parameter identifies a specific VNF.
522 * @param inventoryProvider This is the provider of inventory.
523 * @param inventoryType This is the type of inventory.
524 * @param serviceType The service associated with a VNF.
525 * @param serviceId The Id associated with a service.
526 * @param globalCustomerId The global id of a customer.
529 policyTemplate = "OOF-PLACEMENT"
531 class VNFPolicy extends OOFPolicyMetaInfo{
532 @policy (matching = "true")
533 @onap(^type = "configuration")
535 @onap(^type = "configuration")
536 String[] resourceInstanceType
537 @onap(^type = "configuration")
538 contains VNFPolicyProperty[] property
542 * Policy associated with a Subscriber.
543 * @param subscriberName The name of a subscriber.
544 * @param subscriberRole The role of a subscriber.
545 * @param provStatus The provisioning status of a subscriber.
548 policyTemplate = "OOF-PLACEMENT"
550 class SubscriberPolicy extends OOFPolicyMetaInfo{
551 @policy (matching = "true")
552 @onap(^type = "configuration")
553 SubscriberPolicyType ^type
554 @onap(^type = "configuration")
555 contains SubscriberPolicyProperty[] property
560 * This is the property associated with this policy.
561 * @param providerUrl This is the url of provider to check the capacity.
562 * @param request This should be key-value pairs to be sent in a request.
564 class InstanceReservationProperty{
565 @onap(^type = "configuration")
567 @onap(^type = "configuration")
571 enum InstanceReservationPolicyType{
572 instance_reservation=1
575 * Model for the resource instance policy.
576 * @param identity This is an identity created by a user.
577 * @param type This is the type of a policy.
578 * @param resourceInstance This is a list of resources.
579 * @param resourceInstanceProperty This is a property associated with each resource in the list.
582 policyTemplate = "OOF-PLACEMENT"
584 class InstanceReservationPolicy extends OOFPolicyMetaInfo{
585 @policy (matching = "true")
586 @onap(^type = "configuration")
587 InstanceReservationPolicyType ^type
588 @onap(^type = "configuration")
589 String[] resourceInstanceType
590 @onap(^type = "configuration")
591 contains InstanceReservationProperty instanceReservationProperty
596 * This is a model of an operand.
597 * @param parameter This is a parameter.
598 * @param associativity This is a list of entities with which a parameter is associated.
602 @onap(^type = "configuration")
604 @onap(^type = "configuration")
610 * This is the optimization function.
611 * @param identity This is an identity of a function.
612 * @param operation This is a computational operator.
613 * @param leftOperand This is a left operand of a function.
614 * @param rightOperand This is a right operand of a function.
617 class OptimizationFunction{
618 @onap(^type = "configuration")
619 ExpressionIdentity identity
620 @onap(^type = "configuration")
621 ComputationalOperator operation
622 @onap(^type = "configuration")
623 contains Operand[] operands
628 * Properties associated with a sub-expression.
629 * @param weight The weight of an expression.
630 * @param parameter The parameter involved in an expression.
631 * @param entity The entities involved in an expression.
632 * @param operator The operator of an expression.
633 * @param customerLocationInfo The location of a customer.
635 class AttributeProperty{
636 @onap(^type = "configuration")
638 @onap(^type = "configuration")
640 @onap(^type = "configuration")
642 @onap(^type = "configuration")
643 ComputationalOperator operator
644 @onap(^type = "configuration")
645 LocationInfo customerLocationInfo
648 enum PlacementOptimizationPolicyType{
649 placementOptimization=1
653 * @param operator An operator in an expression.
654 * @param parameterAttributes Represents sub-expression
656 class ObjectiveParameter{
657 @onap(^type = "configuration")
658 ComputationalOperator operator
659 @onap(^type = "configuration")
660 contains AttributeProperty[] parameterAttributes
664 * Model of the placement optimization policy.
665 * @param type This is the type of a policy.
666 * @param objective This is an objective function.
667 * @param objectiveParameter The parameter/expression to be optimized.
670 policyTemplate = "OOF-PLACEMENT"
673 class PlacementOptimizationPolicy extends OOFPolicyMetaInfo{
674 @policy (matching = "true")
675 @onap(^type = "configuration")
676 PlacementOptimizationPolicyType ^type
677 @onap(^type = "configuration")
678 ObjectiveFunction objective
679 @onap(^type = "configuration")
680 contains ObjectiveParameter objectiveParameter
685 * Meta information required for oof policies.
686 * @param identity This is a user-defined identity.
687 * @param policyScope The scope of a policy
691 policyTemplate = "OOF-PLACEMENT"
693 class OOFPolicyMetaInfo{
694 @onap(^type = "configuration")
696 @onap(^type = "configuration")
697 @policy (matching = "true")
698 contains Scope policyScope
702 * Scopes in which a policy is applicable.
703 * @param serviceType The type of a service.
704 * @param networkType The type of a network
705 * @param geoRigion The geographical region.
706 * @param resourceInstanceType The resources associated with a policy/
707 * @param subscriberRole
710 @onap(^type = "configuration")
711 @policy (matching = "true")
713 @onap(^type = "configuration")
714 @policy (matching = "true")
716 @onap(^type = "configuration")
717 @policy (matching = "true")
719 @onap(^type = "configuration")
720 @policy (matching = "true")
721 String[] resourceInstanceType
722 @onap(^type = "configuration")
723 @policy (matching = "true")
724 String[] modelInvariantId
725 @onap(^type = "configuration")
726 @policy (matching = "true")
727 String[] subscriberRole