Merge "Push policy adapter code (adapted from ECOMP)"
[optf/osdf.git] / osdf / models / policy / cmso / xacml / placementPolicies.xcore
1 /*
2  * This XCORE file contains models for the placement optimization policies in SNIRO.
3  * @author Ankitkumar Patel
4  * @version 0.0.1
5  * @since 2017-04-13
6  */
7
8 package com.att.ecomp.sniro.policies.placement
9
10 import java.util.UUID
11
12 annotation "http://ecomp.att.com" as ecomp
13 annotation "http://ecomp.att.com/policy" as policy
14
15 type UUID  wraps UUID
16
17 /*
18  * Comparison operators
19  */
20 enum ComparisonOperator{
21         less=1, grater=2, lessEqual=3, greaterEqual=4, equal=5, notEqual=6
22 }
23
24 enum TenantType{
25         GW_TENANT_ID=1, PORTAL_TENANT_ID=2
26 }
27
28 /*
29  * Computational operators
30  */
31 enum ComputationalOperator{
32         sum=1, product=2
33 }
34
35
36 /*
37  * Qualifier types
38  */
39 enum Qualifier{
40         same=1, different=2
41 }
42
43 /*
44  * Zone  category
45  */
46 enum ZoneCategory{
47         disaster=1, region=2, complex=3, time=4, maintenance=5
48 }
49
50 /*
51  * Geographical region types
52  */
53 enum GeoRegion{
54         US=1, EMEA=2, AP=3, CALA=4, CA=5, INTERNATIONAL=6
55 }
56
57 /*
58  * Parameters
59  */
60 enum Parameter{
61         distance=0, latency=1, aic_version=2
62         //thoughput=1, geoDistance=1, airDistance=2, latency=3, bandwidth=4
63 }
64
65
66 /*
67  * The type of inventory defined in AIC
68  */
69 enum InventoryType{
70         service=1, cloud=2
71 }
72
73 /*
74  * The type of AT&T network
75  */
76  enum NetworkType{
77         ip=1
78  }
79
80 /*
81  * Objective functions.
82  */
83
84 enum ObjectiveFunction{
85         minimize=1, maximize=2
86 }
87
88 /*
89  * This is a model of a condition.
90  * @param parameter This is the parameter of interest.
91  * @param operator This is a comparison operator.
92  * @param value This is a value of a parameter
93  */
94 class ConditionalInfo{
95         @ecomp(^type = "configuration")
96         Parameter parameter
97         @ecomp(^type = "configuration")
98         ComparisonOperator operator
99         @ecomp(^type = "configuration")
100         String value
101 }
102
103 enum LocationInfo{
104         customer_loc=1, none=2, customer_pref_loc=3
105 }
106
107
108 /*
109  * Model for distance to location property.
110  * @param distanceCondition This is a distance condition.
111  * @param locationInfo This is a location with respect to which distance condition is applied.
112  */
113 class DistanceToLocationProperty{
114         //distanceCondition.parameter must be distance.
115         @ecomp(^type = "configuration")
116         contains ConditionalInfo distanceCondition
117         @ecomp(^type = "configuration")
118         LocationInfo locationInfo
119 }
120
121 enum DistanceToLocationPolicyType{
122         distance_to_location=1
123 }
124
125 /*
126  * Model for distance to location policy.
127  * @param identity This is an identity created by a user.
128  * @param type This is the type of a policy.
129  * @param resourceInstance This is a list of resource instances over which this policy is applied.
130  * @param distanceToLocationProperty This is the distance properties of the policy.
131  */
132 @policy (
133     policyTemplate = "SNIRO-PLACEMENT"
134 )
135 class DistanceToLocationPolicy extends SniroPolicyMetaInfo{
136         @ecomp(^type = "configuration")
137         @policy (matching = "true")
138         DistanceToLocationPolicyType ^type
139         @ecomp(^type = "configuration")
140         String[] resourceInstanceType
141         @ecomp(^type = "configuration")
142         contains DistanceToLocationProperty distanceToLocationProperty
143 }
144
145 /*
146  * The property associated with the NetworkBetweenDemandsPolicy.
147  * @param latencyCondition The latency property associated with the policy.
148  * @param locationInfo The customer location information.
149  */
150 class NetworkToLocationProperty{
151         //latencyCondition.parameter must be latency.
152         @ecomp(^type = "configuration")
153         contains ConditionalInfo latencyCondition
154         @ecomp(^type = "configuration")
155         LocationInfo locationInfo
156 }
157
158 enum NetworkToLocationPolicyType{
159         network_to_location=1
160 }
161
162 /*
163  * Network between demands policy.
164  * @param type The type of a policy.
165  * @param resourceInstanceType The resources associated with a policy.
166  * @param networkToLocationProperty The property associated with the policy.
167  */
168
169 @policy (
170     policyTemplate = "SNIRO-PLACEMENT"
171 )
172 class NetworkToLocationPolicy extends SniroPolicyMetaInfo{
173         @policy (matching = "true")
174         @ecomp(^type = "configuration")
175         NetworkToLocationPolicyType ^type
176         @ecomp(^type = "configuration")
177         String[] resourceInstanceType
178         @ecomp(^type = "configuration")
179         contains NetworkToLocationProperty networkToLocationProperty
180 }
181
182 /*
183  * The property associated with the NetworkBetweenDemandsPolicy.
184  * @param latencyCondition The latency property associated with the policy.
185  */
186 class NetworkBetweenDemandsProperty{
187         //latencyCondition.parameter must be latency.
188         @ecomp(^type = "configuration")
189         contains ConditionalInfo latencyCondition
190 }
191
192 enum NetworkBetweenDemandsPolicyType{
193         network_between_demands=1
194 }
195
196 /*
197  * Network between demands policy.
198  * @param type The type of a policy.
199  * @param resourceInstanceType The resources associated with a policy.
200  * @param networkBetweenDemandsProperty The property associated with the policy.
201  */
202 @policy (
203     policyTemplate = "SNIRO-PLACEMENT"
204 )
205 class NetworkBetweenDemandsPolicy extends SniroPolicyMetaInfo{
206         @policy (matching = "true")
207         @ecomp(^type = "configuration")
208         NetworkBetweenDemandsPolicyType ^type
209         @ecomp(^type = "configuration")
210         String[] resourceInstanceType
211         @ecomp(^type = "configuration")
212         contains NetworkBetweenDemandsProperty networkBetweenDemandsProperty
213 }
214
215
216 /*
217  * Network roles supported a VNF placement
218  * @param all A list of network roles.
219  */
220 class NetworkRoles{
221         @ecomp(^type = "configuration")
222         String[] all
223 }
224
225 /*
226  * Complex names supported by a VNF placement
227  * @param any A list of complex names.
228  */
229 class Complex{
230         @ecomp(^type = "configuration")
231         String[] any
232 }
233 /*
234  * This are the AIC properties.
235  * @param aicVersion This is the version of AIC.
236  * @param aicType This is the type of AIC.
237  * @param dataPlace This is the type of data plane.
238  * @param hypervisor This is the type of hypervisor.
239  * @param networkRoles This is a list of connected networks.
240  * @param exclusivityGroups This is an exclusivity group Id
241  * @param state State in which a VNF should be located.
242  * @param country Country in which a VNF should be located.
243  * @param getRegion Geographical region in which a VNF should be located.
244  */
245 class AicAttributeProperty{
246         //aicVersionCondition.parameter must be aicVersion.
247         @ecomp(^type = "configuration")
248         String aicVersion
249         @ecomp(^type = "configuration")
250         String aicType
251         @ecomp(^type = "configuration")
252         String dataPlane
253         @ecomp(^type = "configuration")
254         String hypervisor
255         @ecomp(^type = "configuration")
256         contains NetworkRoles networkRoles
257         @ecomp(^type = "configuration")
258         contains Complex complex
259         @ecomp(^type = "configuration")
260         String exclusivityGroups
261         @ecomp(^type = "configuration")
262         String state
263         @ecomp(^type = "configuration")
264         String country
265         @ecomp(^type = "configuration")
266         GeoRegion geoRegion
267         @ecomp(^type = "configuration")
268         String replicationRole
269
270 }
271
272 enum AicAttributePolicyType{
273         attribute=1
274 }
275
276 /*
277  * Model for the AIC attribute policy.
278  * @param type This is the type of a policy.
279  * @param resourceInstance This is a list of resources over which the policy is applied.
280  * @param aicAttributeProperty This is the properties associated with the policy.
281  */
282 @policy (
283     policyTemplate = "SNIRO-PLACEMENT"
284 )
285 class AicAttributePolicy extends SniroPolicyMetaInfo{
286         @policy (matching = "true")
287         @ecomp(^type = "configuration")
288         AicAttributePolicyType ^type
289         @ecomp(^type = "configuration")
290         String[] resourceInstanceType
291         @ecomp(^type = "configuration")
292         contains AicAttributeProperty aicAttributeProperty
293 }
294
295 /*
296  * The property associated with the capacity policy.
297  * @param tenant The tenant whose capacity needs to be checked.
298  * @param description The location of a heat template.
299  */
300 class CapacityProperty{
301         @ecomp(^type = "configuration")
302         TenantType tenant
303         @ecomp(^type = "configuration")
304         String description
305 }
306
307 enum CapacityPolicyType{
308         cloud_capacity=1
309 }
310
311 /*
312  * Capacity policy
313  * @param type The type of a policy.
314  * @param resourceInstanceType The type of resources associated with a policy.
315  * @param capacityProperty The property associated with a policy.
316  */
317 @policy (
318     policyTemplate = "SNIRO-PLACEMENT"
319 )
320 class CapacityPolicy extends SniroPolicyMetaInfo{
321         @policy (matching = "true")
322         @ecomp(^type = "configuration")
323         CapacityPolicyType ^type
324         @ecomp(^type = "configuration")
325         String[] resourceInstanceType
326         @ecomp(^type = "configuration")
327         contains CapacityProperty capacityProperty
328 }
329
330 enum InventoryGroupPolicyType{
331         inventory_group = 1
332 }
333
334 /*
335  * Model for the inventory group policy.
336  * @param type This is the type of a policy.
337  * @param resourceInstance This is a list of resources that must be grouped/paired
338  */
339 @policy (
340     policyTemplate = "SNIRO-PLACEMENT"
341 )
342 class InventoryGroupPolicy extends SniroPolicyMetaInfo{
343         @policy (matching = "true")
344         @ecomp(^type = "configuration")
345         InventoryGroupPolicyType ^type
346         @ecomp(^type = "configuration")
347         String[] resourceInstanceType
348 }
349
350 /*
351  * This is the property associated with this policy.
352  * @param controller ECOMP controller.
353  * @param request This should be key-value pairs to be sent in a request.
354  */
355 class ResourceInstanceProperty{
356         @ecomp(^type = "configuration")
357         String controller
358         @ecomp(^type = "configuration")
359         String request
360 }
361
362 enum ResourceInstancePolicyType{
363         instance_fit=1
364 }
365 /*
366  * Model for the resource instance policy.
367  * @param type This is the type of a policy.
368  * @param resourceInstance This is a list of resources.
369  * @param resourceInstanceProperty This is a property associated with each resource in the list.
370  */
371 @policy (
372     policyTemplate = "SNIRO-PLACEMENT"
373 )
374 class ResourceInstancePolicy extends SniroPolicyMetaInfo{
375         @policy (matching = "true")
376         @ecomp(^type = "configuration")
377         ResourceInstancePolicyType ^type
378         @ecomp(^type = "configuration")
379         String[] resourceInstanceType
380         @ecomp(^type = "configuration")
381         contains ResourceInstanceProperty resourceInstanceProperty
382
383 }
384
385 /*
386  * This is the property associated with this policy.
387  * @param controller ECOMP controller
388  * @param request This should be key-value pairs to be sent in a request.
389  */
390 class ResourceRegionProperty{
391         @ecomp(^type = "configuration")
392         String controller
393         @ecomp(^type = "configuration")
394         String request
395 }
396
397 enum ResourceRegionPolicyType{
398         region_fit=1
399 }
400
401 /*
402  * Model for the resource region policy
403  * @param type This is the type of a policy.
404  * @param resourceInstance This is a list of resources.
405  * @param resourceRegionProperty This is a property associated with this policy.
406  */
407 @policy (
408     policyTemplate = "SNIRO-PLACEMENT"
409 )
410 class ResourceRegionPolicy extends SniroPolicyMetaInfo{
411         @policy (matching = "true")
412         @ecomp(^type = "configuration")
413         ResourceRegionPolicyType ^type
414         @ecomp(^type = "configuration")
415         String[] resourceInstanceType
416         @ecomp(^type = "configuration")
417         contains ResourceRegionProperty resourceRegionProperty
418 }
419
420 /*
421  * This is the property associated with zone policy.
422  * @param qualifier This is the qualifier.
423  * @param category This is the category of a zone.
424  */
425 class ZoneProperty{
426         @ecomp(^type = "configuration")
427         Qualifier qualifier
428         @ecomp(^type = "configuration")
429         ZoneCategory category
430 }
431
432 enum ZonePolicyType{
433         zone=1
434 }
435
436 /*
437  * Model of the zone policy.
438  * @param type This is the type of a policy.
439  * @param resourceInstanceType This is a list of resources.
440  * @param zoneProperty This is the property associated with the policy.
441  */
442 @policy (
443     policyTemplate = "SNIRO-PLACEMENT"
444 )
445
446 class ZonePolicy extends SniroPolicyMetaInfo{
447         @policy (matching = "true")
448         @ecomp(^type = "configuration")
449         ZonePolicyType ^type
450         @ecomp(^type = "configuration")
451         String[] resourceInstanceType
452         @ecomp(^type = "configuration")
453         contains ZoneProperty zoneProperty
454 }
455
456 /*
457  * The property associated with a VNF type.
458  * @param inventoryProvider The ECOMP entity providing inventory information.
459  * @param inventoryType The type of an inventory.
460  * @param serviceId The id of a service.
461  */
462 class VNFPolicyProperty{
463         @ecomp(^type = "configuration")
464         String inventoryProvider
465         @ecomp(^type = "configuration")
466         InventoryType inventoryType
467         @ecomp(^type = "configuration")
468         contains Attributes attributes
469 }
470
471 /*
472  * The property associated with a Subscriber type.
473  * @param subscriberName The name of a subscriber.
474  * @param subscriberRole The role of a subscriber.
475  * @param provStatus The provisioning status of a subscriber.
476  */
477 class SubscriberPolicyProperty{
478         @ecomp(^type = "configuration")
479         String[] subscriberName
480         @ecomp(^type = "configuration")
481         String[] subscriberRole
482         @ecomp(^type = "configuration")
483         String[] provStatus
484 }
485
486 enum VNFPolicyType{
487         vnfPolicy=1
488 }
489
490 enum SubscriberPolicyType{
491         subscriberPolicy=1
492 }
493
494 class Attributes{
495     @ecomp(^type = "configuration")
496     String globalCustomerId
497     @ecomp(^type = "configuration")
498     String operationalStatus
499     @ecomp(^type = "configuration")
500     String[] orchestrationStatus
501     @ecomp(^type = "configuration")
502     String modelInvariantId
503     @ecomp(^type = "configuration")
504     String modelVersionId
505     @ecomp(^type = "configuration")
506     String equipmentRole
507 }
508
509 /*
510  * Policy associated with a VNF.
511  * @param resourceInstance This parameter identifies a specific VNF.
512  * @param inventoryProvider This is the provider of inventory.
513  * @param inventoryType This is the type of inventory.
514  * @param serviceType The service associated with a VNF.
515  * @param serviceId The Id associated with a service.
516  * @param globalCustomerId The global id of a customer.
517  */
518 @policy (
519     policyTemplate = "SNIRO-PLACEMENT"
520 )
521 class VNFPolicy extends SniroPolicyMetaInfo{
522         @policy (matching = "true")
523         @ecomp(^type = "configuration")
524         VNFPolicyType ^type
525         @ecomp(^type = "configuration")
526         String[] resourceInstanceType
527         @ecomp(^type = "configuration")
528         contains VNFPolicyProperty[] property
529 }
530
531 /*
532  * Policy associated with a Subscriber.
533  * @param subscriberName The name of a subscriber.
534  * @param subscriberRole The role of a subscriber.
535  * @param provStatus The provisioning status of a subscriber.
536  */
537 @policy (
538     policyTemplate = "SNIRO-PLACEMENT"
539 )
540 class SubscriberPolicy extends SniroPolicyMetaInfo{
541         @policy (matching = "true")
542         @ecomp(^type = "configuration")
543         SubscriberPolicyType ^type
544         @ecomp(^type = "configuration")
545         contains SubscriberPolicyProperty[] property
546 }
547
548
549 /*
550  * This is the property associated with this policy.
551  * @param providerUrl This is the url of provider to check the capacity.
552  * @param request This should be key-value pairs to be sent in a request.
553  */
554 class InstanceReservationProperty{
555         @ecomp(^type = "configuration")
556         String controller
557         @ecomp(^type = "configuration")
558         String request
559 }
560
561 enum InstanceReservationPolicyType{
562         instance_reservation=1
563 }
564 /*
565  * Model for the resource instance policy.
566  * @param identity This is an identity created by a user.
567  * @param type This is the type of a policy.
568  * @param resourceInstance This is a list of resources.
569  * @param resourceInstanceProperty This is a property associated with each resource in the list.
570  */
571 @policy (
572     policyTemplate = "SNIRO-PLACEMENT"
573 )
574 class instanceReservationPolicy extends SniroPolicyMetaInfo{
575         @policy (matching = "true")
576         @ecomp(^type = "configuration")
577         InstanceReservationPolicyType ^type
578         @ecomp(^type = "configuration")
579         String[] resourceInstanceType
580         @ecomp(^type = "configuration")
581         contains InstanceReservationProperty instanceReservationProperty
582
583 }
584
585 /*
586  * This is a model of an operand.
587  * @param parameter This is a parameter.
588  * @param associativity This is a list of entities with which a parameter is associated.
589  */
590  /*
591 class Operand{
592         @ecomp(^type = "configuration")
593         Parameter parameter
594         @ecomp(^type = "configuration")
595         Entity associativity
596 }
597 */
598
599 /*
600  * This is the optimization function.
601  * @param identity This is an identity of a function.
602  * @param operation This is a computational operator.
603  * @param leftOperand This is a left operand of a function.
604  * @param rightOperand This is a right operand of a function.
605  */
606 /*
607 class OptimizationFunction{
608         @ecomp(^type = "configuration")
609         ExpressionIdentity identity
610         @ecomp(^type = "configuration")
611         ComputationalOperator operation
612         @ecomp(^type = "configuration")
613         contains Operand[] operands
614 }
615 */
616
617 /*
618  * Properties associated with a sub-expression.
619  * @param weight The weight of an expression.
620  * @param parameter The parameter involved in an expression.
621  * @param entity The entities involved in an expression.
622  * @param operator The operator of an expression.
623  * @param customerLocationInfo The location of a customer.
624  */
625 class AttributeProperty{
626         @ecomp(^type = "configuration")
627         double weight
628         @ecomp(^type = "configuration")
629         Parameter parameter
630         @ecomp(^type = "configuration")
631         String[] resource
632         @ecomp(^type = "configuration")
633         ComputationalOperator operator
634         @ecomp(^type = "configuration")
635         LocationInfo customerLocationInfo
636 }
637
638 enum PlacementOptimizationPolicyType{
639         placementOptimization=1
640 }
641
642 /*
643  * @param operator An operator in an expression.
644  * @param parameterAttributes Represents sub-expression
645  */
646 class ObjectiveParameter{
647         @ecomp(^type = "configuration")
648         ComputationalOperator operator
649         @ecomp(^type = "configuration")
650         contains AttributeProperty[] parameterAttributes
651 }
652
653 /*
654  * Model of the placement optimization policy.
655  * @param type This is the type of a policy.
656  * @param objective This is an objective function.
657  * @param objectiveParameter The parameter/expression to be optimized.
658  */
659 @policy (
660     policyTemplate = "SNIRO-PLACEMENT"
661 )
662
663 class PlacementOptimizationPolicy extends SniroPolicyMetaInfo{
664         @policy (matching = "true")
665         @ecomp(^type = "configuration")
666         PlacementOptimizationPolicyType ^type
667         @ecomp(^type = "configuration")
668         ObjectiveFunction objective
669         @ecomp(^type = "configuration")
670         contains ObjectiveParameter objectiveParameter
671 }
672
673
674 /*
675  * Meta information required for SNIRO policies.
676  * @param identity This is a user-defined identity.
677  * @param policyScope The scope of a policy
678  */
679
680 @policy (
681     policyTemplate = "SNIRO"
682 )
683 class SniroPolicyMetaInfo{
684         @ecomp(^type = "configuration")
685         String identity
686         @ecomp(^type = "configuration")
687         @policy (matching = "true")
688         contains Scope policyScope
689 }
690
691 /*
692  * Scopes in which a policy is applicable.
693  * @param serviceType The type of a service.
694  * @param networkType The type of a network
695  * @param geoRigion The geographical region.
696  * @param resourceInstanceType The resources associated with a policy/
697  * @param subscriberRole 
698  */
699 class Scope{
700         @ecomp(^type = "configuration")
701         @policy (matching = "true")
702         String[] serviceType
703         @ecomp(^type = "configuration")
704         @policy (matching = "true")
705         String[] networkType
706         @ecomp(^type = "configuration")
707         @policy (matching = "true")
708         String[] geoRegion
709         @ecomp(^type = "configuration")
710         @policy (matching = "true")
711         String[] resourceInstanceType
712         @ecomp(^type = "configuration")
713         @policy (matching = "true")
714         String[] modelInvariantId
715         @ecomp(^type = "configuration")
716         @policy (matching = "true")
717         String[] subscriberRole
718 }