f59d25b540cc19ec4e1d510b173ebd8ba4d84a80
[policy/models.git] / models-examples / src / main / resources / nodetemplates / nodetemplates.metadatasets.input.tosca.yaml
1 ---
2 # Representation of list of metadataSet entities as node templates in tosca that can be persisted to the database independently.
3
4 tosca_definitions_version: tosca_simple_yaml_1_1_0
5 node_types:
6   org.onap.nodetypes.policy.MetadataSet:
7     derived_from: tosca.nodetypes.Root
8     version: 1.0.0
9 topology_template:
10   node_templates:
11     apexMetadata_grpc:
12       version: 1.2.1
13       type: org.onap.nodetypes.policy.MetadataSet
14       type_version: 1.0.0
15       description: Metadata set for GRPC
16       metadata:
17         policyModel:
18           key:
19             name: GrpcPolicyModel
20             version: 1.0.1
21         threshold: 3.14
22         state: active
23     apexMetadata_adaptive:
24       version: 2.3.1
25       type: org.onap.nodetypes.policy.MetadataSet
26       type_version: 1.0.0
27       description: Metadata set for an Adaptive Policy
28       metadata:
29         policyModel:
30           key:
31             name: AdaptivePolicyModel
32             version: 1.2.1
33         radius: 1.23
34         height: 2.13
35         length: 45
36     apexMetadata_decisionMaker:
37       version: 1.0.0
38       type: org.onap.nodetypes.policy.MetadataSet
39       type_version: 1.0.0
40       description: Metadata set for an Adaptive Policy
41       metadata:
42         policyModel:
43           key:
44             name: DecisionMakerPolicyModel
45             version: 1.0.0
46           keyInformation:
47             key:
48               name: DecisionMakerPolicyModel_KeyInfo
49               version: 0.0.1
50             keyInfoMap:
51               entry:
52                 - key:
53                     name: AnswerAlbum
54                     version: 0.0.1
55                   value:
56                     key:
57                       name: AnswerAlbum
58                       version: 0.0.1
59                     UUID: 4ea21a2c-5dc7-337f-ba13-f427a4ae79a1
60                     description: Generated description for concept referred to by key
61                       "AnswerAlbum:0.0.1"
62                 - key:
63                     name: AnswerEvent
64                     version: 0.0.1
65                   value:
66                     key:
67                       name: AnswerEvent
68                       version: 0.0.1
69                     UUID: ce2233b8-bb89-3c5e-a18f-1d13089d2bb6
70                     description: Generated description for concept referred to by key
71                       "AnswerEvent:0.0.1"
72                 - key:
73                     name: AnswerInitPolicy
74                     version: 0.0.1
75                   value:
76                     key:
77                       name: AnswerInitPolicy
78                       version: 0.0.1
79                     UUID: c8254064-b171-3ccb-85c0-29b5719ee8fc
80                     description: Generated description for concept referred to by key
81                       "AnswerInitPolicy:0.0.1"
82                 - key:
83                     name: AnswerInitTask
84                     version: 0.0.1
85                   value:
86                     key:
87                       name: AnswerInitTask
88                       version: 0.0.1
89                     UUID: 28fb33d2-a4e0-3046-8302-7baf9a2056d1
90                     description: Generated description for concept referred to by key
91                       "AnswerInitTask:0.0.1"
92                 - key:
93                     name: DecisionEvent
94                     version: 0.0.1
95                   value:
96                     key:
97                       name: DecisionEvent
98                       version: 0.0.1
99                     UUID: 487acc75-b5a1-3285-90cf-98ecd6fb3500
100                     description: Generated description for concept referred to by key
101                       "DecisionEvent:0.0.1"
102                 - key:
103                     name: DecisionMakerPolicy
104                     version: 0.0.1
105                   value:
106                     key:
107                       name: DecisionMakerPolicy
108                       version: 0.0.1
109                     UUID: 9e8dda9a-6f85-311d-842b-00b5b5578edd
110                     description: Generated description for concept referred to by key
111                       "DecisionMakerPolicy:0.0.1"
112                 - key:
113                     name: DecisionMakerPolicyModel
114                     version: 0.0.1
115                   value:
116                     key:
117                       name: DecisionMakerPolicyModel
118                       version: 0.0.1
119                     UUID: d7789464-e4d1-382e-8481-fba53fa7b9a9
120                     description: Generated description for concept referred to by key
121                       "DecisionMakerPolicyModel:0.0.1"
122                 - key:
123                     name: DecisionMakerPolicyModel_Albums
124                     version: 0.0.1
125                   value:
126                     key:
127                       name: DecisionMakerPolicyModel_Albums
128                       version: 0.0.1
129                     UUID: e5dfbadd-5229-3ad9-996c-eda030ef5dc1
130                     description: Generated description for concept referred to by key
131                       "DecisionMakerPolicyModel_Albums:0.0.1"
132                 - key:
133                     name: DecisionMakerPolicyModel_Events
134                     version: 0.0.1
135                   value:
136                     key:
137                       name: DecisionMakerPolicyModel_Events
138                       version: 0.0.1
139                     UUID: b4248202-ff8e-3d45-8b3d-0ed0fd2eaed4
140                     description: Generated description for concept referred to by key
141                       "DecisionMakerPolicyModel_Events:0.0.1"
142                 - key:
143                     name: DecisionMakerPolicyModel_KeyInfo
144                     version: 0.0.1
145                   value:
146                     key:
147                       name: DecisionMakerPolicyModel_KeyInfo
148                       version: 0.0.1
149                     UUID: 693b1b29-c4c6-34ba-98e1-bc1a7576f0f8
150                     description: Generated description for concept referred to by key
151                       "DecisionMakerPolicyModel_KeyInfo:0.0.1"
152                 - key:
153                     name: DecisionMakerPolicyModel_Policies
154                     version: 0.0.1
155                   value:
156                     key:
157                       name: DecisionMakerPolicyModel_Policies
158                       version: 0.0.1
159                     UUID: 2dee1e42-9caa-32b1-9298-784dcdcb9cae
160                     description: Generated description for concept referred to by key
161                       "DecisionMakerPolicyModel_Policies:0.0.1"
162                 - key:
163                     name: DecisionMakerPolicyModel_Schemas
164                     version: 0.0.1
165                   value:
166                     key:
167                       name: DecisionMakerPolicyModel_Schemas
168                       version: 0.0.1
169                     UUID: c256f102-2681-3f35-bbbd-1f4948587e15
170                     description: Generated description for concept referred to by key
171                       "DecisionMakerPolicyModel_Schemas:0.0.1"
172                 - key:
173                     name: DecisionMakerPolicyModel_Tasks
174                     version: 0.0.1
175                   value:
176                     key:
177                       name: DecisionMakerPolicyModel_Tasks
178                       version: 0.0.1
179                     UUID: 660cbdba-687d-3a05-ba26-69daf93a8158
180                     description: Generated description for concept referred to by key
181                       "DecisionMakerPolicyModel_Tasks:0.0.1"
182                 - key:
183                     name: DitheringAnswerTask
184                     version: 0.0.1
185                   value:
186                     key:
187                       name: DitheringAnswerTask
188                       version: 0.0.1
189                     UUID: da31cee8-2e84-39d2-9337-9ee3bf347c98
190                     description: Generated description for concept referred to by key
191                       "DitheringAnswerTask:0.0.1"
192                 - key:
193                     name: LastAnswerAlbum
194                     version: 0.0.1
195                   value:
196                     key:
197                       name: LastAnswerAlbum
198                       version: 0.0.1
199                     UUID: 21399145-3fbe-39a5-b863-8a59a8add4a8
200                     description: Generated description for concept referred to by key
201                       "LastAnswerAlbum:0.0.1"
202                 - key:
203                     name: MakeDecisionEvent
204                     version: 0.0.1
205                   value:
206                     key:
207                       name: MakeDecisionEvent
208                       version: 0.0.1
209                     UUID: 02ec632a-aeae-31fe-8f6d-656e1875749f
210                     description: Generated description for concept referred to by key
211                       "MakeDecisionEvent:0.0.1"
212                 - key:
213                     name: OptimisticAnswerTask
214                     version: 0.0.1
215                   value:
216                     key:
217                       name: OptimisticAnswerTask
218                       version: 0.0.1
219                     UUID: 818e6b9e-0109-31f5-a95c-17f6fb016027
220                     description: Generated description for concept referred to by key
221                       "OptimisticAnswerTask:0.0.1"
222                 - key:
223                     name: PessimisticAnswerTask
224                     version: 0.0.1
225                   value:
226                     key:
227                       name: PessimisticAnswerTask
228                       version: 0.0.1
229                     UUID: 8f4a707e-0d8b-3e09-b921-332f6f81f302
230                     description: Generated description for concept referred to by key
231                       "PessimisticAnswerTask:0.0.1"
232                 - key:
233                     name: RandomAnswerTask
234                     version: 0.0.1
235                   value:
236                     key:
237                       name: RandomAnswerTask
238                       version: 0.0.1
239                     UUID: bfb0af88-b454-3b08-911f-7ff2475350bf
240                     description: Generated description for concept referred to by key
241                       "RandomAnswerTask:0.0.1"
242                 - key:
243                     name: RoundRobinAnswerTask
244                     version: 0.0.1
245                   value:
246                     key:
247                       name: RoundRobinAnswerTask
248                       version: 0.0.1
249                     UUID: eac6fb59-8aca-3011-b7ba-69875f1db4b6
250                     description: Generated description for concept referred to by key
251                       "RoundRobinAnswerTask:0.0.1"
252                 - key:
253                     name: SimpleIntegerType
254                     version: 0.0.1
255                   value:
256                     key:
257                       name: SimpleIntegerType
258                       version: 0.0.1
259                     UUID: ab00a5b8-7edd-340f-8140-4d14f571edfb
260                     description: Generated description for concept referred to by key
261                       "SimpleIntegerType:0.0.1"
262                 - key:
263                     name: SimpleStringType
264                     version: 0.0.1
265                   value:
266                     key:
267                       name: SimpleStringType
268                       version: 0.0.1
269                     UUID: 8a4957cf-9493-3a76-8c22-a208e23259af
270                     description: Generated description for concept referred to by key
271                       "SimpleStringType:0.0.1"
272           policies:
273             key:
274               name: DecisionMakerPolicyModel_Policies
275               version: 0.0.1
276             policyMap:
277               entry:
278                 - key:
279                     name: AnswerInitPolicy
280                     version: 0.0.1
281                   value:
282                     policyKey:
283                       name: AnswerInitPolicy
284                       version: 0.0.1
285                     template: freestyle
286                     state:
287                       entry:
288                         - key: AnswerInitState
289                           value:
290                             stateKey:
291                               parentKeyName: AnswerInitPolicy
292                               parentKeyVersion: 0.0.1
293                               parentLocalName: 'NULL'
294                               localName: AnswerInitState
295                             trigger:
296                               name: AnswerEvent
297                               version: 0.0.1
298                             stateOutputs:
299                               entry:
300                                 - key: AnswerInitOutput
301                                   value:
302                                     key:
303                                       parentKeyName: AnswerInitPolicy
304                                       parentKeyVersion: 0.0.1
305                                       parentLocalName: AnswerInitState
306                                       localName: AnswerInitOutput
307                                     outgoingEvent:
308                                       name: AnswerEvent
309                                       version: 0.0.1
310                                     outgoingEventReference:
311                                       - name: AnswerEvent
312                                         version: 0.0.1
313                                     nextState:
314                                       parentKeyName: 'NULL'
315                                       parentKeyVersion: 0.0.0
316                                       parentLocalName: 'NULL'
317                                       localName: 'NULL'
318                             contextAlbumReference: []
319                             taskSelectionLogic:
320                               key: 'NULL'
321                               logicFlavour: UNDEFINED
322                               logic: ''
323                             stateFinalizerLogicMap:
324                               entry: []
325                             defaultTask:
326                               name: AnswerInitTask
327                               version: 0.0.1
328                             taskReferences:
329                               entry:
330                                 - key:
331                                     name: AnswerInitTask
332                                     version: 0.0.1
333                                   value:
334                                     key:
335                                       parentKeyName: AnswerInitPolicy
336                                       parentKeyVersion: 0.0.1
337                                       parentLocalName: AnswerInitState
338                                       localName: AnswerInitPolicy
339                                     outputType: DIRECT
340                                     output:
341                                       parentKeyName: AnswerInitPolicy
342                                       parentKeyVersion: 0.0.1
343                                       parentLocalName: AnswerInitState
344                                       localName: AnswerInitOutput
345                     firstState: AnswerInitState
346                 - key:
347                     name: DecisionMakerPolicy
348                     version: 0.0.1
349                   value:
350                     policyKey:
351                       name: DecisionMakerPolicy
352                       version: 0.0.1
353                     template: freestyle
354                     state:
355                       entry:
356                         - key: MakeDecisionState
357                           value:
358                             stateKey:
359                               parentKeyName: DecisionMakerPolicy
360                               parentKeyVersion: 0.0.1
361                               parentLocalName: 'NULL'
362                               localName: MakeDecisionState
363                             trigger:
364                               name: MakeDecisionEvent
365                               version: 0.0.1
366                             stateOutputs:
367                               entry:
368                                 - key: DecisionFinalOutput
369                                   value:
370                                     key:
371                                       parentKeyName: DecisionMakerPolicy
372                                       parentKeyVersion: 0.0.1
373                                       parentLocalName: MakeDecisionState
374                                       localName: DecisionFinalOutput
375                                     outgoingEvent:
376                                       name: DecisionEvent
377                                       version: 0.0.1
378                                     outgoingEventReference:
379                                       - name: DecisionEvent
380                                         version: 0.0.1
381                                     nextState:
382                                       parentKeyName: 'NULL'
383                                       parentKeyVersion: 0.0.0
384                                       parentLocalName: 'NULL'
385                                       localName: 'NULL'
386                             contextAlbumReference: []
387                             taskSelectionLogic:
388                               key: TaskSelectionLogic
389                               logicFlavour: JAVASCRIPT
390                               logic: |-
391                                 /*
392                                  * ============LICENSE_START=======================================================
393                                  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
394                                  *  Modifications Copyright (C) 2020 Nordix Foundation.
395                                  * ================================================================================
396                                  * Licensed under the Apache License, Version 2.0 (the "License");
397                                  * you may not use this file except in compliance with the License.
398                                  * You may obtain a copy of the License at
399                                  *
400                                  *      http://www.apache.org/licenses/LICENSE-2.0
401                                  *
402                                  * Unless required by applicable law or agreed to in writing, software
403                                  * distributed under the License is distributed on an "AS IS" BASIS,
404                                  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
405                                  * See the License for the specific language governing permissions and
406                                  * limitations under the License.
407                                  *
408                                  * SPDX-License-Identifier: Apache-2.0
409                                  * ============LICENSE_END=========================================================
410                                  */
411
412                                 executor.logger.info(executor.subject.id);
413                                 executor.logger.info(executor.inFields);
414
415                                 if (executor.inFields.get("mode").equals("random")) {
416                                     executor.subject.getTaskKey("RandomAnswerTask").copyTo(executor.selectedTask);
417                                 }
418                                 else if (executor.inFields.get("mode").equals("pessimistic")) {
419                                     executor.subject.getTaskKey("PessimisticAnswerTask").copyTo(executor.selectedTask);
420                                 }
421                                 else if (executor.inFields.get("mode").equals("optimistic")) {
422                                     executor.subject.getTaskKey("OptimisticAnswerTask").copyTo(executor.selectedTask);
423                                 }
424                                 else if (executor.inFields.get("mode").equals("dithering")) {
425                                     executor.subject.getTaskKey("DitheringAnswerTask").copyTo(executor.selectedTask);
426                                 }
427                                 else if (executor.inFields.get("mode").equals("roundrobin")) {
428                                     executor.subject.getTaskKey("RoundRobinAnswerTask").copyTo(executor.selectedTask);
429                                 }
430
431                                 executor.logger.info("Answer Selected Task:" + executor.selectedTask);
432
433                                 true;
434                             stateFinalizerLogicMap:
435                               entry: []
436                             defaultTask:
437                               name: RandomAnswerTask
438                               version: 0.0.1
439                             taskReferences:
440                               entry:
441                                 - key:
442                                     name: DitheringAnswerTask
443                                     version: 0.0.1
444                                   value:
445                                     key:
446                                       parentKeyName: DecisionMakerPolicy
447                                       parentKeyVersion: 0.0.1
448                                       parentLocalName: MakeDecisionState
449                                       localName: DecisionMakerPolicy
450                                     outputType: DIRECT
451                                     output:
452                                       parentKeyName: DecisionMakerPolicy
453                                       parentKeyVersion: 0.0.1
454                                       parentLocalName: MakeDecisionState
455                                       localName: DecisionFinalOutput
456                                 - key:
457                                     name: OptimisticAnswerTask
458                                     version: 0.0.1
459                                   value:
460                                     key:
461                                       parentKeyName: DecisionMakerPolicy
462                                       parentKeyVersion: 0.0.1
463                                       parentLocalName: MakeDecisionState
464                                       localName: DecisionMakerPolicy
465                                     outputType: DIRECT
466                                     output:
467                                       parentKeyName: DecisionMakerPolicy
468                                       parentKeyVersion: 0.0.1
469                                       parentLocalName: MakeDecisionState
470                                       localName: DecisionFinalOutput
471                                 - key:
472                                     name: PessimisticAnswerTask
473                                     version: 0.0.1
474                                   value:
475                                     key:
476                                       parentKeyName: DecisionMakerPolicy
477                                       parentKeyVersion: 0.0.1
478                                       parentLocalName: MakeDecisionState
479                                       localName: DecisionMakerPolicy
480                                     outputType: DIRECT
481                                     output:
482                                       parentKeyName: DecisionMakerPolicy
483                                       parentKeyVersion: 0.0.1
484                                       parentLocalName: MakeDecisionState
485                                       localName: DecisionFinalOutput
486                                 - key:
487                                     name: RandomAnswerTask
488                                     version: 0.0.1
489                                   value:
490                                     key:
491                                       parentKeyName: DecisionMakerPolicy
492                                       parentKeyVersion: 0.0.1
493                                       parentLocalName: MakeDecisionState
494                                       localName: DecisionMakerPolicy
495                                     outputType: DIRECT
496                                     output:
497                                       parentKeyName: DecisionMakerPolicy
498                                       parentKeyVersion: 0.0.1
499                                       parentLocalName: MakeDecisionState
500                                       localName: DecisionFinalOutput
501                                 - key:
502                                     name: RoundRobinAnswerTask
503                                     version: 0.0.1
504                                   value:
505                                     key:
506                                       parentKeyName: DecisionMakerPolicy
507                                       parentKeyVersion: 0.0.1
508                                       parentLocalName: MakeDecisionState
509                                       localName: DecisionMakerPolicy
510                                     outputType: DIRECT
511                                     output:
512                                       parentKeyName: DecisionMakerPolicy
513                                       parentKeyVersion: 0.0.1
514                                       parentLocalName: MakeDecisionState
515                                       localName: DecisionFinalOutput
516                     firstState: MakeDecisionState
517           tasks:
518             key:
519               name: DecisionMakerPolicyModel_Tasks
520               version: 0.0.1
521             taskMap:
522               entry:
523                 - key:
524                     name: AnswerInitTask
525                     version: 0.0.1
526                   value:
527                     key:
528                       name: AnswerInitTask
529                       version: 0.0.1
530                     inputEvent:
531                       key:
532                         name: AnswerEvent
533                         version: 0.0.1
534                       nameSpace: org.onap.policy.apex.domains.decisionmaker
535                       source: DCAE
536                       target: apex
537                       parameter:
538                         entry:
539                           - key: a0
540                             value:
541                               key: a0
542                               fieldSchemaKey:
543                                 name: SimpleStringType
544                                 version: 0.0.1
545                               optional: false
546                           - key: a1
547                             value:
548                               key: a1
549                               fieldSchemaKey:
550                                 name: SimpleStringType
551                                 version: 0.0.1
552                               optional: false
553                           - key: a2
554                             value:
555                               key: a2
556                               fieldSchemaKey:
557                                 name: SimpleStringType
558                                 version: 0.0.1
559                               optional: false
560                           - key: a3
561                             value:
562                               key: a3
563                               fieldSchemaKey:
564                                 name: SimpleStringType
565                                 version: 0.0.1
566                               optional: false
567                           - key: a4
568                             value:
569                               key: a4
570                               fieldSchemaKey:
571                                 name: SimpleStringType
572                                 version: 0.0.1
573                               optional: false
574                           - key: a5
575                             value:
576                               key: a5
577                               fieldSchemaKey:
578                                 name: SimpleStringType
579                                 version: 0.0.1
580                               optional: false
581                           - key: a6
582                             value:
583                               key: a6
584                               fieldSchemaKey:
585                                 name: SimpleStringType
586                                 version: 0.0.1
587                               optional: false
588                       toscaPolicyState: ''
589                     outputEvents:
590                       entry:
591                         - key: AnswerEvent
592                           value:
593                             key:
594                               name: AnswerEvent
595                               version: 0.0.1
596                             nameSpace: org.onap.policy.apex.domains.decisionmaker
597                             source: DCAE
598                             target: apex
599                             parameter:
600                               entry:
601                                 - key: a0
602                                   value:
603                                     key: a0
604                                     fieldSchemaKey:
605                                       name: SimpleStringType
606                                       version: 0.0.1
607                                     optional: false
608                                 - key: a1
609                                   value:
610                                     key: a1
611                                     fieldSchemaKey:
612                                       name: SimpleStringType
613                                       version: 0.0.1
614                                     optional: false
615                                 - key: a2
616                                   value:
617                                     key: a2
618                                     fieldSchemaKey:
619                                       name: SimpleStringType
620                                       version: 0.0.1
621                                     optional: false
622                                 - key: a3
623                                   value:
624                                     key: a3
625                                     fieldSchemaKey:
626                                       name: SimpleStringType
627                                       version: 0.0.1
628                                     optional: false
629                                 - key: a4
630                                   value:
631                                     key: a4
632                                     fieldSchemaKey:
633                                       name: SimpleStringType
634                                       version: 0.0.1
635                                     optional: false
636                                 - key: a5
637                                   value:
638                                     key: a5
639                                     fieldSchemaKey:
640                                       name: SimpleStringType
641                                       version: 0.0.1
642                                     optional: false
643                                 - key: a6
644                                   value:
645                                     key: a6
646                                     fieldSchemaKey:
647                                       name: SimpleStringType
648                                       version: 0.0.1
649                                     optional: false
650                             toscaPolicyState: ''
651                     taskParameters:
652                       entry: []
653                     contextAlbumReference:
654                       - name: AnswerAlbum
655                         version: 0.0.1
656                       - name: LastAnswerAlbum
657                         version: 0.0.1
658                     taskLogic:
659                       key: TaskLogic
660                       logicFlavour: JAVASCRIPT
661                       logic: |-
662                         /*
663                          * ============LICENSE_START=======================================================
664                          *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
665                          *  Modifications Copyright (C) 2020 Nordix Foundation.
666                          * ================================================================================
667                          * Licensed under the Apache License, Version 2.0 (the "License");
668                          * you may not use this file except in compliance with the License.
669                          * You may obtain a copy of the License at
670                          *
671                          *      http://www.apache.org/licenses/LICENSE-2.0
672                          *
673                          * Unless required by applicable law or agreed to in writing, software
674                          * distributed under the License is distributed on an "AS IS" BASIS,
675                          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
676                          * See the License for the specific language governing permissions and
677                          * limitations under the License.
678                          *
679                          * SPDX-License-Identifier: Apache-2.0
680                          * ============LICENSE_END=========================================================
681                          */
682
683                         executor.logger.info(executor.subject.id);
684                         executor.logger.info(executor.inFields);
685
686                         var answerAlbum = executor.getContextAlbum("AnswerAlbum");
687
688                         answerAlbum.put("a0", executor.inFields.get("a0"));
689                         answerAlbum.put("a1", executor.inFields.get("a1"));
690                         answerAlbum.put("a2", executor.inFields.get("a2"));
691                         answerAlbum.put("a3", executor.inFields.get("a3"));
692                         answerAlbum.put("a4", executor.inFields.get("a4"));
693                         answerAlbum.put("a5", executor.inFields.get("a5"));
694                         answerAlbum.put("a6", executor.inFields.get("a6"));
695
696                         var lastAnswerAlbum = executor.getContextAlbum("LastAnswerAlbum");
697                         lastAnswerAlbum.put("lastAnswer", answerAlbum.size() - 1);
698
699                         executor.outFields.put("a0", answerAlbum.get("a0"));
700                         executor.outFields.put("a1", answerAlbum.get("a1"));
701                         executor.outFields.put("a2", answerAlbum.get("a2"));
702                         executor.outFields.put("a3", answerAlbum.get("a3"));
703                         executor.outFields.put("a4", answerAlbum.get("a4"));
704                         executor.outFields.put("a5", answerAlbum.get("a5"));
705                         executor.outFields.put("a6", answerAlbum.get("a6"));
706
707                         executor.logger.info(executor.outFields);
708
709                         true;
710                 - key:
711                     name: DitheringAnswerTask
712                     version: 0.0.1
713                   value:
714                     key:
715                       name: DitheringAnswerTask
716                       version: 0.0.1
717                     inputEvent:
718                       key:
719                         name: MakeDecisionEvent
720                         version: 0.0.1
721                       nameSpace: org.onap.policy.apex.domains.decisionmaker
722                       source: DCAE
723                       target: apex
724                       parameter:
725                         entry:
726                           - key: mode
727                             value:
728                               key: mode
729                               fieldSchemaKey:
730                                 name: SimpleStringType
731                                 version: 0.0.1
732                               optional: false
733                       toscaPolicyState: ''
734                     outputEvents:
735                       entry:
736                         - key: DecisionEvent
737                           value:
738                             key:
739                               name: DecisionEvent
740                               version: 0.0.1
741                             nameSpace: org.onap.policy.apex.domains.decisionmaker
742                             source: DCAE
743                             target: apex
744                             parameter:
745                               entry:
746                                 - key: decision
747                                   value:
748                                     key: decision
749                                     fieldSchemaKey:
750                                       name: SimpleStringType
751                                       version: 0.0.1
752                                     optional: false
753                             toscaPolicyState: ''
754                     taskParameters:
755                       entry: []
756                     contextAlbumReference:
757                       - name: AnswerAlbum
758                         version: 0.0.1
759                     taskLogic:
760                       key: TaskLogic
761                       logicFlavour: JAVASCRIPT
762                       logic: |-
763                         /*
764                          * ============LICENSE_START=======================================================
765                          *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
766                          *  Modifications Copyright (C) 2020 Nordix Foundation.
767                          * ================================================================================
768                          * Licensed under the Apache License, Version 2.0 (the "License");
769                          * you may not use this file except in compliance with the License.
770                          * You may obtain a copy of the License at
771                          *
772                          *      http://www.apache.org/licenses/LICENSE-2.0
773                          *
774                          * Unless required by applicable law or agreed to in writing, software
775                          * distributed under the License is distributed on an "AS IS" BASIS,
776                          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
777                          * See the License for the specific language governing permissions and
778                          * limitations under the License.
779                          *
780                          * SPDX-License-Identifier: Apache-2.0
781                          * ============LICENSE_END=========================================================
782                          */
783
784                         executor.logger.info(executor.subject.id);
785                         executor.logger.info(executor.inFields);
786
787                         var size = executor.getContextAlbum("AnswerAlbum").size();
788
789                         var selection = 2 + Math.floor(Math.random() * 3);
790
791                         var selectionA = "a" + selection;
792
793                         executor.logger.info(size);
794                         executor.logger.info(selectionA);
795
796                         executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA));
797
798                         executor.logger.info(executor.outFields);
799
800                         true;
801                 - key:
802                     name: OptimisticAnswerTask
803                     version: 0.0.1
804                   value:
805                     key:
806                       name: OptimisticAnswerTask
807                       version: 0.0.1
808                     inputEvent:
809                       key:
810                         name: MakeDecisionEvent
811                         version: 0.0.1
812                       nameSpace: org.onap.policy.apex.domains.decisionmaker
813                       source: DCAE
814                       target: apex
815                       parameter:
816                         entry:
817                           - key: mode
818                             value:
819                               key: mode
820                               fieldSchemaKey:
821                                 name: SimpleStringType
822                                 version: 0.0.1
823                               optional: false
824                       toscaPolicyState: ''
825                     outputEvents:
826                       entry:
827                         - key: DecisionEvent
828                           value:
829                             key:
830                               name: DecisionEvent
831                               version: 0.0.1
832                             nameSpace: org.onap.policy.apex.domains.decisionmaker
833                             source: DCAE
834                             target: apex
835                             parameter:
836                               entry:
837                                 - key: decision
838                                   value:
839                                     key: decision
840                                     fieldSchemaKey:
841                                       name: SimpleStringType
842                                       version: 0.0.1
843                                     optional: false
844                             toscaPolicyState: ''
845                     taskParameters:
846                       entry: []
847                     contextAlbumReference:
848                       - name: AnswerAlbum
849                         version: 0.0.1
850                     taskLogic:
851                       key: TaskLogic
852                       logicFlavour: JAVASCRIPT
853                       logic: |-
854                         /*
855                          * ============LICENSE_START=======================================================
856                          *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
857                          *  Modifications Copyright (C) 2020 Nordix Foundation.
858                          * ================================================================================
859                          * Licensed under the Apache License, Version 2.0 (the "License");
860                          * you may not use this file except in compliance with the License.
861                          * You may obtain a copy of the License at
862                          *
863                          *      http://www.apache.org/licenses/LICENSE-2.0
864                          *
865                          * Unless required by applicable law or agreed to in writing, software
866                          * distributed under the License is distributed on an "AS IS" BASIS,
867                          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
868                          * See the License for the specific language governing permissions and
869                          * limitations under the License.
870                          *
871                          * SPDX-License-Identifier: Apache-2.0
872                          * ============LICENSE_END=========================================================
873                          */
874
875                         executor.logger.info(executor.subject.id);
876                         executor.logger.info(executor.inFields);
877
878                         var size = executor.getContextAlbum("AnswerAlbum").size();
879
880                         var selection = size - Math.floor(Math.random() * size / 2) - 1;
881
882                         var selectionA = "a" + selection;
883
884                         executor.logger.info(size);
885                         executor.logger.info(selectionA);
886
887                         executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA));
888
889                         executor.logger.info(executor.outFields);
890
891                         true;
892                 - key:
893                     name: PessimisticAnswerTask
894                     version: 0.0.1
895                   value:
896                     key:
897                       name: PessimisticAnswerTask
898                       version: 0.0.1
899                     inputEvent:
900                       key:
901                         name: MakeDecisionEvent
902                         version: 0.0.1
903                       nameSpace: org.onap.policy.apex.domains.decisionmaker
904                       source: DCAE
905                       target: apex
906                       parameter:
907                         entry:
908                           - key: mode
909                             value:
910                               key: mode
911                               fieldSchemaKey:
912                                 name: SimpleStringType
913                                 version: 0.0.1
914                               optional: false
915                       toscaPolicyState: ''
916                     outputEvents:
917                       entry:
918                         - key: DecisionEvent
919                           value:
920                             key:
921                               name: DecisionEvent
922                               version: 0.0.1
923                             nameSpace: org.onap.policy.apex.domains.decisionmaker
924                             source: DCAE
925                             target: apex
926                             parameter:
927                               entry:
928                                 - key: decision
929                                   value:
930                                     key: decision
931                                     fieldSchemaKey:
932                                       name: SimpleStringType
933                                       version: 0.0.1
934                                     optional: false
935                             toscaPolicyState: ''
936                     taskParameters:
937                       entry: []
938                     contextAlbumReference:
939                       - name: AnswerAlbum
940                         version: 0.0.1
941                     taskLogic:
942                       key: TaskLogic
943                       logicFlavour: JAVASCRIPT
944                       logic: |-
945                         /*
946                          * ============LICENSE_START=======================================================
947                          *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
948                          *  Modifications Copyright (C) 2020 Nordix Foundation.
949                          * ================================================================================
950                          * Licensed under the Apache License, Version 2.0 (the "License");
951                          * you may not use this file except in compliance with the License.
952                          * You may obtain a copy of the License at
953                          *
954                          *      http://www.apache.org/licenses/LICENSE-2.0
955                          *
956                          * Unless required by applicable law or agreed to in writing, software
957                          * distributed under the License is distributed on an "AS IS" BASIS,
958                          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
959                          * See the License for the specific language governing permissions and
960                          * limitations under the License.
961                          *
962                          * SPDX-License-Identifier: Apache-2.0
963                          * ============LICENSE_END=========================================================
964                          */
965
966                         executor.logger.info(executor.subject.id);
967                         executor.logger.info(executor.inFields);
968
969                         var size = executor.getContextAlbum("AnswerAlbum").size();
970
971                         var selection = Math.floor(Math.random() * size / 2);
972
973                         var selectionA = "a" + selection;
974
975                         executor.logger.info(size);
976                         executor.logger.info(selectionA);
977
978                         executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA));
979
980                         executor.logger.info(executor.outFields);
981
982                         true;
983                 - key:
984                     name: RandomAnswerTask
985                     version: 0.0.1
986                   value:
987                     key:
988                       name: RandomAnswerTask
989                       version: 0.0.1
990                     inputEvent:
991                       key:
992                         name: MakeDecisionEvent
993                         version: 0.0.1
994                       nameSpace: org.onap.policy.apex.domains.decisionmaker
995                       source: DCAE
996                       target: apex
997                       parameter:
998                         entry:
999                           - key: mode
1000                             value:
1001                               key: mode
1002                               fieldSchemaKey:
1003                                 name: SimpleStringType
1004                                 version: 0.0.1
1005                               optional: false
1006                       toscaPolicyState: ''
1007                     outputEvents:
1008                       entry:
1009                         - key: DecisionEvent
1010                           value:
1011                             key:
1012                               name: DecisionEvent
1013                               version: 0.0.1
1014                             nameSpace: org.onap.policy.apex.domains.decisionmaker
1015                             source: DCAE
1016                             target: apex
1017                             parameter:
1018                               entry:
1019                                 - key: decision
1020                                   value:
1021                                     key: decision
1022                                     fieldSchemaKey:
1023                                       name: SimpleStringType
1024                                       version: 0.0.1
1025                                     optional: false
1026                             toscaPolicyState: ''
1027                     taskParameters:
1028                       entry: []
1029                     contextAlbumReference:
1030                       - name: AnswerAlbum
1031                         version: 0.0.1
1032                     taskLogic:
1033                       key: TaskLogic
1034                       logicFlavour: JAVASCRIPT
1035                       logic: |-
1036                         /*
1037                          * ============LICENSE_START=======================================================
1038                          *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
1039                          *  Modifications Copyright (C) 2020 Nordix Foundation.
1040                          * ================================================================================
1041                          * Licensed under the Apache License, Version 2.0 (the "License");
1042                          * you may not use this file except in compliance with the License.
1043                          * You may obtain a copy of the License at
1044                          *
1045                          *      http://www.apache.org/licenses/LICENSE-2.0
1046                          *
1047                          * Unless required by applicable law or agreed to in writing, software
1048                          * distributed under the License is distributed on an "AS IS" BASIS,
1049                          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1050                          * See the License for the specific language governing permissions and
1051                          * limitations under the License.
1052                          *
1053                          * SPDX-License-Identifier: Apache-2.0
1054                          * ============LICENSE_END=========================================================
1055                          */
1056
1057                         executor.logger.info(executor.subject.id);
1058                         executor.logger.info(executor.inFields);
1059
1060                         var size = executor.getContextAlbum("AnswerAlbum").size();
1061
1062                         var selection = Math.floor(Math.random() * size);
1063
1064                         var selectionA = "a" + selection;
1065
1066                         executor.logger.info(size);
1067                         executor.logger.info(selectionA);
1068
1069                         executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA));
1070
1071                         executor.logger.info(executor.outFields);
1072
1073                         true;
1074                 - key:
1075                     name: RoundRobinAnswerTask
1076                     version: 0.0.1
1077                   value:
1078                     key:
1079                       name: RoundRobinAnswerTask
1080                       version: 0.0.1
1081                     inputEvent:
1082                       key:
1083                         name: MakeDecisionEvent
1084                         version: 0.0.1
1085                       nameSpace: org.onap.policy.apex.domains.decisionmaker
1086                       source: DCAE
1087                       target: apex
1088                       parameter:
1089                         entry:
1090                           - key: mode
1091                             value:
1092                               key: mode
1093                               fieldSchemaKey:
1094                                 name: SimpleStringType
1095                                 version: 0.0.1
1096                               optional: false
1097                       toscaPolicyState: ''
1098                     outputEvents:
1099                       entry:
1100                         - key: DecisionEvent
1101                           value:
1102                             key:
1103                               name: DecisionEvent
1104                               version: 0.0.1
1105                             nameSpace: org.onap.policy.apex.domains.decisionmaker
1106                             source: DCAE
1107                             target: apex
1108                             parameter:
1109                               entry:
1110                                 - key: decision
1111                                   value:
1112                                     key: decision
1113                                     fieldSchemaKey:
1114                                       name: SimpleStringType
1115                                       version: 0.0.1
1116                                     optional: false
1117                             toscaPolicyState: ''
1118                     taskParameters:
1119                       entry: []
1120                     contextAlbumReference:
1121                       - name: AnswerAlbum
1122                         version: 0.0.1
1123                       - name: LastAnswerAlbum
1124                         version: 0.0.1
1125                     taskLogic:
1126                       key: TaskLogic
1127                       logicFlavour: JAVASCRIPT
1128                       logic: |-
1129                         /*
1130                          * ============LICENSE_START=======================================================
1131                          *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
1132                          *  Modifications Copyright (C) 2020 Nordix Foundation.
1133                          * ================================================================================
1134                          * Licensed under the Apache License, Version 2.0 (the "License");
1135                          * you may not use this file except in compliance with the License.
1136                          * You may obtain a copy of the License at
1137                          *
1138                          *      http://www.apache.org/licenses/LICENSE-2.0
1139                          *
1140                          * Unless required by applicable law or agreed to in writing, software
1141                          * distributed under the License is distributed on an "AS IS" BASIS,
1142                          * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1143                          * See the License for the specific language governing permissions and
1144                          * limitations under the License.
1145                          *
1146                          * SPDX-License-Identifier: Apache-2.0
1147                          * ============LICENSE_END=========================================================
1148                          */
1149
1150                         executor.logger.info(executor.subject.id);
1151                         executor.logger.info(executor.inFields);
1152
1153                         var size = executor.getContextAlbum("AnswerAlbum").size();
1154                         var lastAnswer = executor.getContextAlbum("LastAnswerAlbum").get("lastAnswer");
1155
1156                         executor.logger.info(size);
1157                         executor.logger.info(lastAnswer);
1158
1159                         var answer = ++lastAnswer;
1160                         if (answer >= size) {
1161                             answer = 0;
1162                         }
1163
1164                         executor.getContextAlbum("LastAnswerAlbum").put("lastAnswer", answer)
1165
1166                         var selectionA = "a" + answer;
1167
1168                         executor.logger.info(selectionA);
1169
1170                         executor.outFields.put("decision", executor.getContextAlbum("AnswerAlbum").get(selectionA));
1171
1172                         executor.logger.info(executor.outFields);
1173
1174                         true;
1175           events:
1176             key:
1177               name: DecisionMakerPolicyModel_Events
1178               version: 0.0.1
1179             eventMap:
1180               entry:
1181                 - key:
1182                     name: AnswerEvent
1183                     version: 0.0.1
1184                   value:
1185                     key:
1186                       name: AnswerEvent
1187                       version: 0.0.1
1188                     nameSpace: org.onap.policy.apex.domains.decisionmaker
1189                     source: DCAE
1190                     target: apex
1191                     parameter:
1192                       entry:
1193                         - key: a0
1194                           value:
1195                             key: a0
1196                             fieldSchemaKey:
1197                               name: SimpleStringType
1198                               version: 0.0.1
1199                             optional: false
1200                         - key: a1
1201                           value:
1202                             key: a1
1203                             fieldSchemaKey:
1204                               name: SimpleStringType
1205                               version: 0.0.1
1206                             optional: false
1207                         - key: a2
1208                           value:
1209                             key: a2
1210                             fieldSchemaKey:
1211                               name: SimpleStringType
1212                               version: 0.0.1
1213                             optional: false
1214                         - key: a3
1215                           value:
1216                             key: a3
1217                             fieldSchemaKey:
1218                               name: SimpleStringType
1219                               version: 0.0.1
1220                             optional: false
1221                         - key: a4
1222                           value:
1223                             key: a4
1224                             fieldSchemaKey:
1225                               name: SimpleStringType
1226                               version: 0.0.1
1227                             optional: false
1228                         - key: a5
1229                           value:
1230                             key: a5
1231                             fieldSchemaKey:
1232                               name: SimpleStringType
1233                               version: 0.0.1
1234                             optional: false
1235                         - key: a6
1236                           value:
1237                             key: a6
1238                             fieldSchemaKey:
1239                               name: SimpleStringType
1240                               version: 0.0.1
1241                             optional: false
1242                     toscaPolicyState: ''
1243                 - key:
1244                     name: DecisionEvent
1245                     version: 0.0.1
1246                   value:
1247                     key:
1248                       name: DecisionEvent
1249                       version: 0.0.1
1250                     nameSpace: org.onap.policy.apex.domains.decisionmaker
1251                     source: DCAE
1252                     target: apex
1253                     parameter:
1254                       entry:
1255                         - key: decision
1256                           value:
1257                             key: decision
1258                             fieldSchemaKey:
1259                               name: SimpleStringType
1260                               version: 0.0.1
1261                             optional: false
1262                     toscaPolicyState: ''
1263                 - key:
1264                     name: MakeDecisionEvent
1265                     version: 0.0.1
1266                   value:
1267                     key:
1268                       name: MakeDecisionEvent
1269                       version: 0.0.1
1270                     nameSpace: org.onap.policy.apex.domains.decisionmaker
1271                     source: DCAE
1272                     target: apex
1273                     parameter:
1274                       entry:
1275                         - key: mode
1276                           value:
1277                             key: mode
1278                             fieldSchemaKey:
1279                               name: SimpleStringType
1280                               version: 0.0.1
1281                             optional: false
1282                     toscaPolicyState: ''
1283           albums:
1284             key:
1285               name: DecisionMakerPolicyModel_Albums
1286               version: 0.0.1
1287             albums:
1288               entry:
1289                 - key:
1290                     name: AnswerAlbum
1291                     version: 0.0.1
1292                   value:
1293                     key:
1294                       name: AnswerAlbum
1295                       version: 0.0.1
1296                     scope: policy
1297                     isWritable: true
1298                     itemSchema:
1299                       name: SimpleStringType
1300                       version: 0.0.1
1301                 - key:
1302                     name: LastAnswerAlbum
1303                     version: 0.0.1
1304                   value:
1305                     key:
1306                       name: LastAnswerAlbum
1307                       version: 0.0.1
1308                     scope: policy
1309                     isWritable: true
1310                     itemSchema:
1311                       name: SimpleIntegerType
1312                       version: 0.0.1
1313           schemas:
1314             key:
1315               name: DecisionMakerPolicyModel_Schemas
1316               version: 0.0.1
1317             schemas:
1318               entry:
1319                 - key:
1320                     name: SimpleIntegerType
1321                     version: 0.0.1
1322                   value:
1323                     key:
1324                       name: SimpleIntegerType
1325                       version: 0.0.1
1326                     schemaFlavour: Java
1327                     schemaDefinition: java.lang.Integer
1328                 - key:
1329                     name: SimpleStringType
1330                     version: 0.0.1
1331                   value:
1332                     key:
1333                       name: SimpleStringType
1334                       version: 0.0.1
1335                     schemaFlavour: Java
1336                     schemaDefinition: java.lang.String