Policy
There are two options to author and execute the Nomadic ONT policy - Apex PDP(Pdp-A) or Drools PDP(Pdp-D).
Apex Engine Triggering
Apex PDP engine is configured to consumes the Nomadic ONT event/DCAE-CL_OUTPUT event from DMAAP and call the SDNC Rest API to take resource re-provisioning actions in the original design in Dublin. Later on, a workaround approach is taken for the BBS MS to consume the pnfUpdate event produced by PRH and eventually calls SNDC API to proceed the service associated resource re-provisioning after certain A&AI query and update. Therefore, the policy engine configuration and policy definition becomes very simple for the time being. The only reason for now to keep a no action policy is for the completeness of the control loop so that to the BBS workflow it is actually an open loop so that a CL can be defined and managed by CLAMP through which DCAE micro-services, such as, Restconf Collector, VES Mapper, PRH as well as the BBS MS can be orchestrated centralized.
PDP-A Configuration (JSON)
Simplified Apex Configuration:
{
"engineServiceParameters": {
"name": "MyApexEngine",
"version": "0.0.1",
"id": 45,
"instanceCount": 4,
"deploymentPort": 12561,
"policyModelFileName": "policy/ONAPvCPEPolicyModel.json",
"engineParameters": {
"executorParameters": {
"JAVASCRIPT": {
"parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
}
},
"contextParameters": {
"parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters",
"schemaParameters": {
"Avro": {
"parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
}
}
}
}
},
"eventInputParameters": {
"BBSInitConsumer": {
"carrierTechnologyParameters": {
"carrierTechnology": "FILE",
"parameters": {
"fileName": "config/BBSInitiationEvent.json" // ... example event
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON",
"parameters": {
"nameAlias": "closedLoopControlName",
"versionAlias": "version",
"sourceAlias": "from"
}
}
},
"DCAEConsumer": {
"carrierTechnologyParameters": {
"carrierTechnology": "RESTCLIENT",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
"parameters": {
"url": "http://<MSB_IP>:3904/dmaap_port>/unauthenticated.DCAE_CL_OUTPUT/APEX/1?timeout=60000"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON",
"parameters": {
"nameAlias": "closedLoopControlName",
"versionAlias": "version",
"sourceAlias": "from"
}
}
}
},
"eventOutputParameters": {
"logProducer": {
"carrierTechnologyParameters": {
"carrierTechnology": "FILE",
"parameters": {
"fileName": "/tmp/BBSEventsOut.json"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
}
},
"SDNCProducer": {
"carrierTechnologyParameters": {
"carrierTechnology": "RESTCLIENT",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
"parameters": {
"url": "http://<MSB_IP>:<sdnc_port>/<path-to-HSIA_Service-Resource-Update>" //... SDNC REST Call API
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
}
},
"PolicyLogProducer": {
"carrierTechnologyParameters": {
"carrierTechnology": "RESTCLIENT",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters",
"parameters": {
"url": "http://<MSB_IP>:<dmaap_port>/events/POLICY_CL_MGT"
}
},
"eventProtocolParameters": {
"eventProtocol": "JSON"
},
"eventNameFilter": "ControlLoopLogEvent"
}
}
}
Apex Policy for Nomadic ONT is created as following. It can be on-board as part of the service Tosca module at design time, distributed to an Apex PDP engine by the policy distribution engine through SDC.
NomadicONT Policy Model (WIP)
This is the Apex Policy state machine for Nomadic ONT. An open loop operational policy is going to be defined here to support the completeness of control loop in BBS use case in Dublin.
#-------------------------------------------------------------------------------
# ============LICENSE_START=======================================================
# Copyright (C) 2016-2019 Huawei. All rights reserved.
# ================================================================================
# 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=NomadicONTPolicyModel
schema create name=SimpleStringType flavour=Java schema=java.lang.String
schema create name=SimpleLongType flavour=Java schema=java.lang.Long
schema create name=SimpleBooleanType flavour=Java schema=java.lang.Boolean
schema create name=UUIDType flavour=Java schema=java.util.UUID
schema create name=BBSAAIInfoType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/BBSAAIInfoType.avsc"
LE
schema create name=SDNCInputBodyType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/SDNCInputBodyType.avsc"
LE
schema create name=SDNCOutputBodyType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/SDNCOutputBodyType.avsc"
LE
schema create name=BBSClosedLoopStatusType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/BBSClosedLoopStatusType.avsc"
LE
album create name=BBSClosedLoopStatusAlbum scope=policy writable=true schemaName=BBSClosedLoopStatusType
album create name=ControlLoopExecutionIDAlbum scope=policy writable=true schemaName=UUIDType
album create name=RequestIDVNFIDAlbum scope=policy writable=true schemaName=UUIDType
event create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b version=1.0.2 nameSpace=org.onap.policy.apex.onap.bbs source=DCAE target=APEX
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=closedLoopControlName schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=closedLoopAlarmStart schemaName=SimpleLongType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=closedLoopEventClient schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=closedLoopEventStatus schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=requestID schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=target_type schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=target schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=from schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=version schemaName=SimpleStringType
event parameter create name=ControlLoop-BBS-2179b738-fd36-4843-a71a-a8c24c70c88b parName=AAI schemaName=BBSAAIInfoType
event create name=BBSStateUpdatedEvent nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=APEX
event parameter create name=BBSStateUpdatedEvent parName=requestID schemaName=UUIDType
event parameter create name=BBSStateUpdatedEvent parName=vnfID schemaName=UUIDType
event create name=SDNCResourceUpdate nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=SDNC
event parameter create name=SDNCResourceUpdate parName=body schemaName=SDNCInputBodyType
event parameter create name=SDNCResourceUpdate parName=version schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=rpc-name schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=service-instance-id schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=pon-uni schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=olt-nni schemaName=SimpleStringType
event create name=SDNCResourceUpdate nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=SDNC
event parameter create name=SDNCResourceUpdate parName=body schemaName=SDNCOutputBodyType
event parameter create name=SDNCResourceUpdate parName=version schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=rpc-name schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=service-instance-id schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=pon-uni schemaName=SimpleStringType
event parameter create name=SDNCResourceUpdate parName=olt-nni schemaName=SimpleStringType
event create name=ControlLoopLogEvent nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=APEX
event parameter create name=ControlLoopLogEvent parName=AAI schemaName=VCPEAAIInfoType
event parameter create name=ControlLoopLogEvent parName=closedLoopControlName schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=closedLoopAlarmStart schemaName=SimpleLongType
event parameter create name=ControlLoopLogEvent parName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true
event parameter create name=ControlLoopLogEvent parName=closedLoopEventClient schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=closedLoopEventStatus schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=version schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=requestID schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=target_type schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=target schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=from schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=policyScope schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=policyName schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=policyVersion schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=notification schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=message schemaName=SimpleStringType
event parameter create name=ControlLoopLogEvent parName=notificationTime schemaName=SimpleStringType
task create name=GetBBSStateTask
task inputfield create name=GetBBSStateTask fieldName=closedLoopControlName schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=closedLoopAlarmStart schemaName=SimpleLongType
task inputfield create name=GetBBSStateTask fieldName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true
task inputfield create name=GetBBSStateTask fieldName=closedLoopEventClient schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=closedLoopEventStatus schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=requestID schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=target_type schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=target schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=from schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=version schemaName=SimpleStringType
task inputfield create name=GetBBSStateTask fieldName=AAI schemaName=BBSAAIInfoType
task contextref create name=GetBBSStateTask albumName=BBSClosedLoopStatusAlbum
task outputfield create name=GetBBSStateTask fieldName=requestID schemaName=UUIDType
task outputfield create name=GetBBSStateTask fieldName=vnfID schemaName=UUIDType
task logic create name=GetBBSStateTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/GetBBSStateTask.js"
LE
task create name=SDNCResourceUpdateTask
task inputfield create name=SDNCResourceUpdateTask fieldName=requestID schemaName=UUIDType
task inputfield create name=SDNCResourceUpdateTask fieldName=vnfID schemaName=UUIDType
task outputfield create name=SDNCResourceUpdateTask fieldName=body schemaName=SDNCInputBodyType
task outputfield create name=SDNCResourceUpdateTask fieldName=version schemaName=SimpleStringType
task outputfield create name=SDNCResourceUpdateTask fieldName=rpc-name schemaName=SimpleStringType
task outputfield create name=SDNCResourceUpdateTask fieldName=correlation-id schemaName=SimpleStringType
task outputfield create name=SDNCResourceUpdateTask fieldName=type schemaName=SimpleStringType
task contextref create name=SDNCResourceUpdateTask albumName=VCPEClosedLoopStatusAlbum
task contextref create name=SDNCResourceUpdateTask albumName=RequestIDVNFIDAlbum
task logic create name=SDNCResourceUpdateTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/SDNCResourceUpdateTask.js"
LE
task create name=SDNCResourceUpdateRepTask
task inputfield create name=SDNCResourceUpdateRepTask fieldName=body schemaName=BBSOutputBodyType
task inputfield create name=SDNCResourceUpdateRepTask fieldName=version schemaName=SimpleStringType
task inputfield create name=SDNCResourceUpdateRepTask fieldName=rpc-name schemaName=SimpleStringType
task inputfield create name=SDNCResourceUpdateRepTask fieldName=service-instance-id schemaName=SimpleStringType
task outputfield create name=SDNCResourceUpdateRepTask fieldName=requestID schemaName=UUIDType
task outputfield create name=SDNCResourceUpdateRepTask fieldName=pon-uni schemaName=UUIDType
task contextref create name=SDNCResourceUpdateRepTask albumName=BBSClosedLoopStatusAlbum
task contextref create name=SDNCResourceUpdateRepTask albumName=RequestIDVNFIDAlbum
task logic create name=SDNCResourceUpdateRepTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/SDNCResourceUpdateRepTask.js"
LE
task create name=ControlLoopLogTask
task inputfield create name=ControlLoopLogTask fieldName=requestID schemaName=UUIDType
task inputfield create name=ControlLoopLogTask fieldName=pon-uni schemaName=UUIDType
task outputfield create name=ControlLoopLogTask fieldName=AAI schemaName=VCPEAAIInfoType
task outputfield create name=ControlLoopLogTask fieldName=closedLoopControlName schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=closedLoopAlarmStart schemaName=SimpleLongType
task outputfield create name=ControlLoopLogTask fieldName=closedLoopAlarmEnd schemaName=SimpleLongType optional=true
task outputfield create name=ControlLoopLogTask fieldName=closedLoopEventClient schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=closedLoopEventStatus schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=requestID schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=version schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=target_type schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=target schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=from schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=policyScope schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=policyName schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=policyVersion schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=notification schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=message schemaName=SimpleStringType
task outputfield create name=ControlLoopLogTask fieldName=notificationTime schemaName=SimpleStringType
task contextref create name=ControlLoopLogTask albumName=BBSClosedLoopStatusAlbum
task logic create name=ControlLoopLogTask logicFlavour=JAVASCRIPT logic=LS
#MACROFILE:"src/main/resources/logic/ControlLoopLogTask.js"
LE
policy create name=ReceiveEventPolicy template=Freestyle firstState=GetBBSState
267 policy state create name=ReceiveEventPolicy stateName=AbatedState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask
268 policy state output create name=ReceiveEventPolicy stateName=AbatedState outputName=AbatedOutput eventName=ControlLoopLogEvent
269 policy state taskref create name=ReceiveEventPolicy stateName=AbatedState taskName=ControlLoopLogTask outputType=DIRECT outputName=AbatedOutput
270
271 policy state create name=ReceiveEventPolicy stateName=OnsetOrAbatedState triggerName=VCPEStateUpdatedEvent defaultTaskName=AbatedTask
272 policy state output create name=ReceiveEventPolicy stateName=OnsetOrAbatedState outputName=OnsetOutput eventName=GuardRequestEvent
273 policy state taskref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState taskName=GuardRequestTask outputType=DIRECT outputName=OnsetOutput
274 policy state output create name=ReceiveEventPolicy stateName=OnsetOrAbatedState outputName=AbatedOutput eventName=VCPEStateUpdatedEvent nextState=AbatedState
275 policy state taskref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState taskName=AbatedTask outputType=DIRECT outputName=AbatedOutput
276
277 policy state contextref create name=ReceiveEventPolicy stateName=OnsetOrAbatedState albumName=VCPEClosedLoopStatusAlbum
278
279 policy state selecttasklogic create name=ReceiveEventPolicy stateName=OnsetOrAbatedState logicFlavour=JAVASCRIPT logic=LS
280 #MACROFILE:"src/main/resources/logic/ReceiveEventPolicyOnsetOrAbatedStateTSL.js"
281 LE
282
283 policy state create name=ReceiveEventPolicy stateName=GetVCPEState triggerName=ControlLoop-vCPE-85317438-861d-42a9-979e-9d96dc0a9ef1 defaultTaskName=GetVCPEStateTask
284 policy state output create name=ReceiveEventPolicy stateName=GetVCPEState outputName=GetVCPEStateOutput eventName=VCPEStateUpdatedEvent nextState=OnsetOrAbatedState
285 policy state taskref create name=ReceiveEventPolicy stateName=GetVCPEState taskName=GetVCPEStateTask outputType=DIRECT outputName=GetVCPEStateOutput
286
287 policy create name=RestartAPPCRequestPolicy template=Freestyle firstState=PolicyGuardResponseState
288
289 policy state create name=RestartAPPCRequestPolicy stateName=DeniedState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask
290 policy state output create name=RestartAPPCRequestPolicy stateName=DeniedState outputName=DeniedOutput eventName=ControlLoopLogEvent
291 policy state taskref create name=RestartAPPCRequestPolicy stateName=DeniedState taskName=ControlLoopLogTask outputType=DIRECT outputName=DeniedOutput
292
293 policy state create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState triggerName=VCPEStateUpdatedEvent defaultTaskName=DeniedTask
294 policy state output create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState outputName=PermitOutput eventName=APPCRestartVNFRequestEvent
295 policy state taskref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState taskName=APPCRestartVNFRequestTask outputType=DIRECT outputName=PermitOutput
296 policy state output create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState outputName=DenyOutput eventName=VCPEStateUpdatedEvent nextState=DeniedState
297 policy state taskref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState taskName=DeniedTask outputType=DIRECT outputName=DenyOutput
298
299 policy state create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState triggerName=GuardResponseEvent defaultTaskName=GuardResponseTask
300 policy state output create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState outputName=GuardResponseOutput eventName=VCPEStateUpdatedEvent nextState=PermitOrDenyState
301 policy state taskref create name=RestartAPPCRequestPolicy stateName=PolicyGuardResponseState taskName=GuardResponseTask outputType=DIRECT outputName=GuardResponseOutput
302
303 policy state contextref create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState albumName=VCPEClosedLoopStatusAlbum
304
305 policy state selecttasklogic create name=RestartAPPCRequestPolicy stateName=PermitOrDenyState logicFlavour=JAVASCRIPT logic=LS
306 #MACROFILE:"src/main/resources/logic/RestartAPPCRequestPolicyPermitOrDenyTSL.js"
307 LE
308
309 policy create name=RestartAPPCResponsePolicy template=Freestyle firstState=RestartAPPCResponseState
310
311 policy state create name=RestartAPPCResponsePolicy stateName=ResponseLogState triggerName=VCPEStateUpdatedEvent defaultTaskName=ControlLoopLogTask
312 policy state output create name=RestartAPPCResponsePolicy stateName=ResponseLogState outputName=ResponseLogOutput eventName=ControlLoopLogEvent
313 policy state taskref create name=RestartAPPCResponsePolicy stateName=ResponseLogState taskName=ControlLoopLogTask outputType=DIRECT outputName=ResponseLogOutput
314
315 policy state create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState triggerName=APPCRestartVNFResponseEvent defaultTaskName=APPCRestartVNFResponseTask
316 policy state output create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState outputName=APPCRestartVNFResponseOutput eventName=VCPEStateUpdatedEvent nextState=ResponseLogState
317 policy state taskref create name=RestartAPPCResponsePolicy stateName=RestartAPPCResponseState taskName=APPCRestartVNFResponseTask outputType=DIRECT outputName=APPCRestartVNFResponseOutput
318
319 validate
320
Logic Artifacts
Schema
Pdp-D Option
Operational Policy
A simple open loop operation policy to support the completeness of BBS control loop.
ontrolLoop:
version: 2.0.0
controlLoopName: ControlLoop-BBS-Open-2179b738-fd36-4843-a71a-a8c24c70c88b
services:
- serviceName: service (or Swisscom BBS)
resources:
- resourceType: ONT
- resourceName: Huawei Access SDN M&C
trigger_policy: final_openloop
timeout: 0
policies:
SDNC API/Recipe
# No supported in Dublin for now...