blob: b0cbcb7c068b2e90dbaf89341aeda5405b1109f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
#-------------------------------------------------------------------------------
# ============LICENSE_START=======================================================
# Copyright (C) 2020 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
#-------------------------------------------------------------------------------
model create name=APEXgRPCPolicy
##
## SCHEMAS
##
schema create name=SimpleStringType flavour=Java schema=java.lang.String
schema create name=UUIDType flavour=Java schema=java.util.UUID
schema create name=SimpleIntType flavour=Java schema=java.lang.Integer
schema create name=CDSRequestCommonHeaderType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSRequestCommonHeaderType.avsc"
LE
schema create name=CDSResponseCommonHeaderType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSResponseCommonHeaderType.avsc"
LE
schema create name=CDSActionIdentifiersType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSActionIdentifiersType.avsc"
LE
schema create name=CDSResponseStatusType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSResponseStatusType.avsc"
LE
schema create name=CDSCreateSubscriptionPayloadType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSCreateSubscriptionPayloadType.avsc"
LE
schema create name=CDSDeleteSubscriptionPayloadType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSDeleteSubscriptionPayloadType.avsc"
LE
schema create name=CDSResponsePayloadType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSResponsePayloadType.avsc"
LE
schema create name=SubscriptionStatusType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/SubscriptionStatusType.avsc"
LE
schema create name=PMSubscriptionType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/PMSubscriptionType.avsc"
LE
schema create name=SubscriptionType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/SubscriptionType.avsc"
LE
##
## EVENTS
##
album create name=PMSubscriptionAlbum scope=policy writable=true schemaName=PMSubscriptionType
event create name=testPolicyB version=0.0.1 nameSpace=org.onap.policy.apex.onap.pmcontrol source=DCAE target=APEX
event parameter create name=testPolicyB parName=nfName schemaName=SimpleStringType
event parameter create name=testPolicyB parName=policyName schemaName=SimpleStringType
event parameter create name=testPolicyB parName=changeType schemaName=SimpleStringType
event parameter create name=testPolicyB parName=closedLoopControlName schemaName=SimpleStringType
event parameter create name=testPolicyB parName=subscription schemaName=SubscriptionType
event create name=PMSubscriptionOutputEvent nameSpace=org.onap.policy.apex.onap.pmcontrol source=APEX target=APEX
event parameter create name=PMSubscriptionOutputEvent parName=albumID schemaName=UUIDType
event create name=CreateSubscriptionPayloadEvent nameSpace=org.onap.policy.apex.onap.pmcontrol source=APEX target=APEX
event parameter create name=CreateSubscriptionPayloadEvent parName=payload schemaName=CDSCreateSubscriptionPayloadType
event parameter create name=CreateSubscriptionPayloadEvent parName=albumID schemaName=UUIDType
event create name=DeleteSubscriptionPayloadEvent nameSpace=org.onap.policy.apex.onap.pmcontrol source=APEX target=APEX
event parameter create name=DeleteSubscriptionPayloadEvent parName=payload schemaName=CDSDeleteSubscriptionPayloadType
event parameter create name=DeleteSubscriptionPayloadEvent parName=albumID schemaName=UUIDType
event create name=CreateSubscriptionRequestEvent nameSpace=org.onap.policy.apex.onap.pmcontrol source=APEX target=APEX
event parameter create name=CreateSubscriptionRequestEvent parName=commonHeader schemaName=CDSRequestCommonHeaderType
event parameter create name=CreateSubscriptionRequestEvent parName=actionIdentifiers schemaName=CDSActionIdentifiersType
event parameter create name=CreateSubscriptionRequestEvent parName=payload schemaName=CDSCreateSubscriptionPayloadType
event create name=DeleteSubscriptionRequestEvent nameSpace=org.onap.policy.apex.onap.pmcontrol source=APEX target=APEX
event parameter create name=DeleteSubscriptionRequestEvent parName=commonHeader schemaName=CDSRequestCommonHeaderType
event parameter create name=DeleteSubscriptionRequestEvent parName=actionIdentifiers schemaName=CDSActionIdentifiersType
event parameter create name=DeleteSubscriptionRequestEvent parName=payload schemaName=CDSDeleteSubscriptionPayloadType
event create name=CDSResponseEvent nameSpace=org.onap.policy.apex.onap.pmcontrol source=CDS target=APEX
event parameter create name=CDSResponseEvent parName=commonHeader schemaName=CDSResponseCommonHeaderType
event parameter create name=CDSResponseEvent parName=actionIdentifiers schemaName=CDSActionIdentifiersType
event parameter create name=CDSResponseEvent parName=status schemaName=CDSResponseStatusType
event parameter create name=CDSResponseEvent parName=payload schemaName=CDSResponsePayloadType
event create name=CDSResponseStatusEvent nameSpace=org.onap.policy.apex.onap.pmcontrol source=APEX target=DCAE
event parameter create name=CDSResponseStatusEvent parName=status schemaName=SubscriptionStatusType
##
## TASKS
##
task create name=ReceivePMSubscriptionTask
task inputfield create name=ReceivePMSubscriptionTask fieldName=subscription schemaName=SubscriptionType
task inputfield create name=ReceivePMSubscriptionTask fieldName=nfName schemaName=SimpleStringType
task inputfield create name=ReceivePMSubscriptionTask fieldName=policyName schemaName=SimpleStringType
task inputfield create name=ReceivePMSubscriptionTask fieldName=changeType schemaName=SimpleStringType
task inputfield create name=ReceivePMSubscriptionTask fieldName=closedLoopControlName schemaName=SimpleStringType
task outputfield create name=ReceivePMSubscriptionTask fieldName=albumID schemaName=UUIDType
task contextref create name=ReceivePMSubscriptionTask albumName=PMSubscriptionAlbum
task logic create name=ReceivePMSubscriptionTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/ReceivePMSubscriptionTask.js"
LE
task create name=CreateSubscriptionPayloadTask
task inputfield create name=CreateSubscriptionPayloadTask fieldName=albumID schemaName=UUIDType
task outputfield create name=CreateSubscriptionPayloadTask fieldName=payload schemaName=CDSCreateSubscriptionPayloadType
task outputfield create name=CreateSubscriptionPayloadTask fieldName=albumID schemaName=UUIDType
task contextref create name=CreateSubscriptionPayloadTask albumName=PMSubscriptionAlbum
task logic create name=CreateSubscriptionPayloadTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/CreateSubscriptionPayloadTask.js"
LE
task create name=DeleteSubscriptionPayloadTask
task inputfield create name=DeleteSubscriptionPayloadTask fieldName=albumID schemaName=UUIDType
task outputfield create name=DeleteSubscriptionPayloadTask fieldName=payload schemaName=CDSDeleteSubscriptionPayloadType
task outputfield create name=DeleteSubscriptionPayloadTask fieldName=albumID schemaName=UUIDType
task contextref create name=DeleteSubscriptionPayloadTask albumName=PMSubscriptionAlbum
task logic create name=DeleteSubscriptionPayloadTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/DeleteSubscriptionPayloadTask.js"
LE
task create name=CreateSubscriptionRequestTask
task inputfield create name=CreateSubscriptionRequestTask fieldName=albumID schemaName=UUIDType
task inputfield create name=CreateSubscriptionRequestTask fieldName=payload schemaName=CDSCreateSubscriptionPayloadType
task outputfield create name=CreateSubscriptionRequestTask fieldName=commonHeader schemaName=CDSRequestCommonHeaderType
task outputfield create name=CreateSubscriptionRequestTask fieldName=actionIdentifiers schemaName=CDSActionIdentifiersType
task outputfield create name=CreateSubscriptionRequestTask fieldName=payload schemaName=CDSCreateSubscriptionPayloadType
task contextref create name=CreateSubscriptionRequestTask albumName=PMSubscriptionAlbum
task logic create name=CreateSubscriptionRequestTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/CreateSubscriptionRequestTask.js"
LE
task create name=DeleteSubscriptionRequestTask
task inputfield create name=DeleteSubscriptionRequestTask fieldName=albumID schemaName=UUIDType
task inputfield create name=DeleteSubscriptionRequestTask fieldName=payload schemaName=CDSDeleteSubscriptionPayloadType
task outputfield create name=DeleteSubscriptionRequestTask fieldName=commonHeader schemaName=CDSRequestCommonHeaderType
task outputfield create name=DeleteSubscriptionRequestTask fieldName=actionIdentifiers schemaName=CDSActionIdentifiersType
task outputfield create name=DeleteSubscriptionRequestTask fieldName=payload schemaName=CDSDeleteSubscriptionPayloadType
task contextref create name=DeleteSubscriptionRequestTask albumName=PMSubscriptionAlbum
task logic create name=DeleteSubscriptionRequestTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/DeleteSubscriptionRequestTask.js"
LE
task create name=CDSResponseTask
task inputfield create name=CDSResponseTask fieldName=commonHeader schemaName=CDSResponseCommonHeaderType
task inputfield create name=CDSResponseTask fieldName=actionIdentifiers schemaName=CDSActionIdentifiersType
task inputfield create name=CDSResponseTask fieldName=status schemaName=CDSResponseStatusType
task inputfield create name=CDSResponseTask fieldName=payload schemaName=CDSResponsePayloadType
task outputfield create name=CDSResponseTask fieldName=status schemaName=SubscriptionStatusType
task contextref create name=CDSResponseTask albumName=PMSubscriptionAlbum
task logic create name=CDSResponseTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/ResponseTask.js"
LE
##
## POLICIES
##
# Policy ReceiveEventPolicy
policy create name=ReceiveEventPolicy template=Freestyle firstState=ReceiveSubscriptionState
# State CreateSubscription
policy state create name=ReceiveEventPolicy stateName=CreateSubscription triggerName=CreateSubscriptionPayloadEvent defaultTaskName=CreateSubscriptionRequestTask
policy state output create name=ReceiveEventPolicy stateName=CreateSubscription outputName=IssueCreateSubscriptionRequestOutput eventName=CreateSubscriptionRequestEvent nextState=NULL
policy state taskref create name=ReceiveEventPolicy stateName=CreateSubscription taskName=CreateSubscriptionRequestTask outputType=DIRECT outputName=IssueCreateSubscriptionRequestOutput
policy state contextref create name=ReceiveEventPolicy stateName=CreateSubscription albumName=PMSubscriptionAlbum
# State DeleteSubscription
policy state create name=ReceiveEventPolicy stateName=DeleteSubscription triggerName=DeleteSubscriptionPayloadEvent defaultTaskName=DeleteSubscriptionRequestTask
policy state output create name=ReceiveEventPolicy stateName=DeleteSubscription outputName=IssueDeleteSubscriptionRequestOutput eventName=DeleteSubscriptionRequestEvent nextState=NULL
policy state taskref create name=ReceiveEventPolicy stateName=DeleteSubscription taskName=DeleteSubscriptionRequestTask outputType=DIRECT outputName=IssueDeleteSubscriptionRequestOutput
policy state contextref create name=ReceiveEventPolicy stateName=DeleteSubscription albumName=PMSubscriptionAlbum
# State CreateOrDeleteState
policy state create name=ReceiveEventPolicy stateName=CreateOrDeleteState triggerName=PMSubscriptionOutputEvent defaultTaskName=CreateSubscriptionPayloadTask
policy state output create name=ReceiveEventPolicy stateName=CreateOrDeleteState outputName=CreateSubscriptionPayload eventName=CreateSubscriptionPayloadEvent nextState=CreateSubscription
policy state taskref create name=ReceiveEventPolicy stateName=CreateOrDeleteState taskName=CreateSubscriptionPayloadTask outputType=DIRECT outputName=CreateSubscriptionPayload
policy state output create name=ReceiveEventPolicy stateName=CreateOrDeleteState outputName=DeleteSubscriptionPayload eventName=DeleteSubscriptionPayloadEvent nextState=DeleteSubscription
policy state taskref create name=ReceiveEventPolicy stateName=CreateOrDeleteState taskName=DeleteSubscriptionPayloadTask outputType=DIRECT outputName=DeleteSubscriptionPayload
policy state contextref create name=ReceiveEventPolicy stateName=CreateOrDeleteState albumName=PMSubscriptionAlbum
policy state selecttasklogic create name=ReceiveEventPolicy stateName=CreateOrDeleteState logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/CreateOrDeleteStateTSL.js"
LE
# State ReceiveSubscriptionState
policy state create name=ReceiveEventPolicy stateName=ReceiveSubscriptionState triggerName=testPolicyB defaultTaskName=ReceivePMSubscriptionTask
policy state output create name=ReceiveEventPolicy stateName=ReceiveSubscriptionState outputName=ReceivePMSubscriptionOutput eventName=PMSubscriptionOutputEvent nextState=CreateOrDeleteState
policy state taskref create name=ReceiveEventPolicy stateName=ReceiveSubscriptionState taskName=ReceivePMSubscriptionTask outputType=DIRECT outputName=ReceivePMSubscriptionOutput
policy state contextref create name=ReceiveEventPolicy stateName=ReceiveSubscriptionState albumName=PMSubscriptionAlbum
# Policy CDSResponsePolicy
policy create name=CDSResponsePolicy template=Freestyle firstState=CDSResponseState
# State CDSResponseState
policy state create name=CDSResponsePolicy stateName=CDSResponseState triggerName=CDSResponseEvent defaultTaskName=CDSResponseTask
policy state output create name=CDSResponsePolicy stateName=CDSResponseState outputName=ResponseOutput eventName=CDSResponseStatusEvent
policy state taskref create name=CDSResponsePolicy stateName=CDSResponseState taskName=CDSResponseTask outputType=DIRECT outputName=ResponseOutput
validate
|