866488e1593c71c1cb759769c47d5efda718b37e
[optf/osdf.git] / models / policy / placement / xacml / placementPolicies.xcore
1 /*
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16 */
17
18 package org.onap.oof.osdf.policies.placement
19
20 import java.util.UUID
21
22 annotation "http://org.onap" as onap
23 annotation "http://org.onap.policy" as policy
24
25 type UUID  wraps UUID
26
27 /*
28  * Comparison operators
29  */
30 enum ComparisonOperator{
31         less=1, grater=2, lessEqual=3, greaterEqual=4, equal=5, notEqual=6
32 }
33
34 enum TenantType{
35         GW_TENANT_ID=1, PORTAL_TENANT_ID=2
36 }
37
38 /*
39  * Computational operators
40  */
41 enum ComputationalOperator{
42         sum=1, product=2
43 }
44
45
46 /*
47  * Qualifier types
48  */
49 enum Qualifier{
50         same=1, different=2
51 }
52
53 /*
54  * Zone  category
55  */
56 enum ZoneCategory{
57         disaster=1, region=2, complex=3, time=4, maintenance=5
58 }
59
60 /*
61  * Geographical region types
62  */
63 enum GeoRegion{
64         US=1, EMEA=2, AP=3, CALA=4, CA=5, INTERNATIONAL=6
65 }
66
67 /*
68  * Parameters
69  */
70 enum Parameter{
71         distance=0, latency=1, cloud_version=2
72         //thoughput=1, geoDistance=1, airDistance=2, latency=3, bandwidth=4
73 }
74
75
76 /*
77  * The type of inventory defined in cloud
78  */
79 enum InventoryType{
80         service=1, cloud=2
81 }
82
83 /*
84  * The type of network
85  */
86  enum NetworkType{
87         ip=1
88  }
89
90 /*
91  * Objective functions.
92  */
93
94 enum ObjectiveFunction{
95         minimize=1, maximize=2
96 }
97
98 /*
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
103  */
104 class ConditionalInfo{
105         @onap(^type = "configuration")
106         Parameter parameter
107         @onap(^type = "configuration")
108         ComparisonOperator operator
109         @onap(^type = "configuration")
110         String value
111 }
112
113 enum LocationInfo{
114         customer_loc=1, none=2, customer_pref_loc=3
115 }
116
117
118 /*
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.
122  */
123 class DistanceToLocationProperty{
124         //distanceCondition.parameter must be distance.
125         @onap(^type = "configuration")
126         contains ConditionalInfo distanceCondition
127         @onap(^type = "configuration")
128         LocationInfo locationInfo
129 }
130
131 enum DistanceToLocationPolicyType{
132         distance_to_location=1
133 }
134
135 /*
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.
141  */
142 @policy (
143     policyTemplate = "OOF-PLACEMENT"
144 )
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
153 }
154
155 /*
156  * The property associated with the NetworkBetweenDemandsPolicy.
157  * @param latencyCondition The latency property associated with the policy.
158  * @param locationInfo The customer location information.
159  */
160 class NetworkToLocationProperty{
161         //latencyCondition.parameter must be latency.
162         @onap(^type = "configuration")
163         contains ConditionalInfo latencyCondition
164         @onap(^type = "configuration")
165         LocationInfo locationInfo
166 }
167
168 enum NetworkToLocationPolicyType{
169         network_to_location=1
170 }
171
172 /*
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.
177  */
178
179 @policy (
180     policyTemplate = "OOF-PLACEMENT"
181 )
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
190 }
191
192 /*
193  * The property associated with the NetworkBetweenDemandsPolicy.
194  * @param latencyCondition The latency property associated with the policy.
195  */
196 class NetworkBetweenDemandsProperty{
197         //latencyCondition.parameter must be latency.
198         @onap(^type = "configuration")
199         contains ConditionalInfo latencyCondition
200 }
201
202 enum NetworkBetweenDemandsPolicyType{
203         network_between_demands=1
204 }
205
206 /*
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.
211  */
212 @policy (
213     policyTemplate = "OOF-PLACEMENT"
214 )
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
223 }
224
225
226 /*
227  * Network roles supported a VNF placement
228  * @param all A list of network roles.
229  */
230 class NetworkRoles{
231         @onap(^type = "configuration")
232         String[] all
233 }
234
235 /*
236  * Complex names supported by a VNF placement
237  * @param any A list of complex names.
238  */
239 class Complex{
240         @onap(^type = "configuration")
241         String[] any
242 }
243 /*
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.
254  */
255 class cloudAttributeProperty{
256         //cloudVersionCondition.parameter must be cloudVersion.
257         @onap(^type = "configuration")
258         String cloudVersion
259         @onap(^type = "configuration")
260         String cloudType
261         @onap(^type = "configuration")
262         String dataPlane
263         @onap(^type = "configuration")
264         String hypervisor
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")
272         String state
273         @onap(^type = "configuration")
274         String country
275         @onap(^type = "configuration")
276         GeoRegion geoRegion
277         @onap(^type = "configuration")
278         String replicationRole
279
280 }
281
282 enum cloudAttributePolicyType{
283         attribute=1
284 }
285
286 /*
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.
291  */
292 @policy (
293     policyTemplate = "OOF-PLACEMENT"
294 )
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
303 }
304
305 /*
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.
309  */
310 class CapacityProperty{
311         @onap(^type = "configuration")
312         TenantType tenant
313         @onap(^type = "configuration")
314         String description
315 }
316
317 enum CapacityPolicyType{
318         cloud_capacity=1
319 }
320
321 /*
322  * Capacity policy
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.
326  */
327 @policy (
328     policyTemplate = "OOF-PLACEMENT"
329 )
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
338 }
339
340 enum InventoryGroupPolicyType{
341         inventory_group = 1
342 }
343
344 /*
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
348  */
349 @policy (
350     policyTemplate = "OOF-PLACEMENT"
351 )
352 class InventoryGroupPolicy extends OOFPolicyMetaInfo{
353         @policy (matching = "true")
354         @onap(^type = "configuration")
355         InventoryGroupPolicyType ^type
356         @onap(^type = "configuration")
357         String[] resourceInstanceType
358 }
359
360 /*
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.
364  */
365 class ResourceInstanceProperty{
366         @onap(^type = "configuration")
367         String controller
368         @onap(^type = "configuration")
369         String request
370 }
371
372 enum ResourceInstancePolicyType{
373         instance_fit=1
374 }
375 /*
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.
380  */
381 @policy (
382     policyTemplate = "OOF-PLACEMENT"
383 )
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
392
393 }
394
395 /*
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.
399  */
400 class ResourceRegionProperty{
401         @onap(^type = "configuration")
402         String controller
403         @onap(^type = "configuration")
404         String request
405 }
406
407 enum ResourceRegionPolicyType{
408         region_fit=1
409 }
410
411 /*
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.
416  */
417 @policy (
418     policyTemplate = "OOF-PLACEMENT"
419 )
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
428 }
429
430 /*
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.
434  */
435 class ZoneProperty{
436         @onap(^type = "configuration")
437         Qualifier qualifier
438         @onap(^type = "configuration")
439         ZoneCategory category
440 }
441
442 enum ZonePolicyType{
443         zone=1
444 }
445
446 /*
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.
451  */
452 @policy (
453     policyTemplate = "OOF-PLACEMENT"
454 )
455
456 class ZonePolicy extends OOFPolicyMetaInfo{
457         @policy (matching = "true")
458         @onap(^type = "configuration")
459         ZonePolicyType ^type
460         @onap(^type = "configuration")
461         String[] resourceInstanceType
462         @onap(^type = "configuration")
463         contains ZoneProperty zoneProperty
464 }
465
466 /*
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.
471  */
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
479 }
480
481 /*
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.
486  */
487 class SubscriberPolicyProperty{
488         @onap(^type = "configuration")
489         String[] subscriberName
490         @onap(^type = "configuration")
491         String[] subscriberRole
492         @onap(^type = "configuration")
493         String[] provStatus
494 }
495
496 enum VNFPolicyType{
497         vnfPolicy=1
498 }
499
500 enum SubscriberPolicyType{
501         subscriberPolicy=1
502 }
503
504 class Attributes{
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")
516     String equipmentRole
517 }
518
519 /*
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.
527  */
528 @policy (
529     policyTemplate = "OOF-PLACEMENT"
530 )
531 class VNFPolicy extends OOFPolicyMetaInfo{
532         @policy (matching = "true")
533         @onap(^type = "configuration")
534         VNFPolicyType ^type
535         @onap(^type = "configuration")
536         String[] resourceInstanceType
537         @onap(^type = "configuration")
538         contains VNFPolicyProperty[] property
539 }
540
541 /*
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.
546  */
547 @policy (
548     policyTemplate = "OOF-PLACEMENT"
549 )
550 class SubscriberPolicy extends OOFPolicyMetaInfo{
551         @policy (matching = "true")
552         @onap(^type = "configuration")
553         SubscriberPolicyType ^type
554         @onap(^type = "configuration")
555         contains SubscriberPolicyProperty[] property
556 }
557
558
559 /*
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.
563  */
564 class InstanceReservationProperty{
565         @onap(^type = "configuration")
566         String controller
567         @onap(^type = "configuration")
568         String request
569 }
570
571 enum InstanceReservationPolicyType{
572         instance_reservation=1
573 }
574 /*
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.
580  */
581 @policy (
582     policyTemplate = "OOF-PLACEMENT"
583 )
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
592
593 }
594
595 /*
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.
599  */
600  /*
601 class Operand{
602         @onap(^type = "configuration")
603         Parameter parameter
604         @onap(^type = "configuration")
605         Entity associativity
606 }
607 */
608
609 /*
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.
615  */
616 /*
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
624 }
625 */
626
627 /*
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.
634  */
635 class AttributeProperty{
636         @onap(^type = "configuration")
637         double weight
638         @onap(^type = "configuration")
639         Parameter parameter
640         @onap(^type = "configuration")
641         String[] resource
642         @onap(^type = "configuration")
643         ComputationalOperator operator
644         @onap(^type = "configuration")
645         LocationInfo customerLocationInfo
646 }
647
648 enum PlacementOptimizationPolicyType{
649         placementOptimization=1
650 }
651
652 /*
653  * @param operator An operator in an expression.
654  * @param parameterAttributes Represents sub-expression
655  */
656 class ObjectiveParameter{
657         @onap(^type = "configuration")
658         ComputationalOperator operator
659         @onap(^type = "configuration")
660         contains AttributeProperty[] parameterAttributes
661 }
662
663 /*
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.
668  */
669 @policy (
670     policyTemplate = "OOF-PLACEMENT"
671 )
672
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
681 }
682
683
684 /*
685  * Meta information required for oof policies.
686  * @param identity This is a user-defined identity.
687  * @param policyScope The scope of a policy
688  */
689
690 @policy (
691     policyTemplate = "OOF-PLACEMENT"
692 )
693 class OOFPolicyMetaInfo{
694         @onap(^type = "configuration")
695         String identity
696         @onap(^type = "configuration")
697         @policy (matching = "true")
698         contains Scope policyScope
699 }
700
701 /*
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 
708  */
709 class Scope{
710         @onap(^type = "configuration")
711         @policy (matching = "true")
712         String[] serviceType
713         @onap(^type = "configuration")
714         @policy (matching = "true")
715         String[] networkType
716         @onap(^type = "configuration")
717         @policy (matching = "true")
718         String[] geoRegion
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
728 }