From 3b13ec30b442b68fd757065fa65d049e7db26774 Mon Sep 17 00:00:00 2001 From: Sandeep Shah Date: Tue, 17 Dec 2019 11:21:38 -0600 Subject: Velocity templates for A1 Adapter DG's Velocity templates used in DG's for A1 policy type and policy instance creation Issue-ID: SDNC-1011 Signed-off-by: SandeepLinux Change-Id: Ie16d89271a9ce058e47f879ad107545df8da03c8 Former-commit-id: febc82515ae59dc9247d78914fc1a00066d20568 --- ...1-policy-instance-property-payload-template.vtl | 10 +++++++++ ...ype-create-schema-property-payload-template.vtl | 26 ++++++++++++++++++++++ ...diator-dmaap-publish-getNearRT-RICs-payload.vtl | 1 + ...or-dmaap-publish-getPolicyInstances-payload.vtl | 1 + ...ediator-dmaap-publish-getPolicyType-payload.vtl | 1 + ...diator-dmaap-publish-getPolicyTypes-payload.vtl | 1 + .../a1Mediator-dmaap-publish-getStatus-payload.vtl | 1 + 7 files changed, 41 insertions(+) create mode 100644 platform-logic/restapi-templates/src/main/velocity/a1-policy-instance-property-payload-template.vtl create mode 100644 platform-logic/restapi-templates/src/main/velocity/a1-policy-type-create-schema-property-payload-template.vtl create mode 100644 platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getNearRT-RICs-payload.vtl create mode 100644 platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyInstances-payload.vtl create mode 100644 platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyType-payload.vtl create mode 100644 platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyTypes-payload.vtl create mode 100644 platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getStatus-payload.vtl diff --git a/platform-logic/restapi-templates/src/main/velocity/a1-policy-instance-property-payload-template.vtl b/platform-logic/restapi-templates/src/main/velocity/a1-policy-instance-property-payload-template.vtl new file mode 100644 index 00000000..c743d2b5 --- /dev/null +++ b/platform-logic/restapi-templates/src/main/velocity/a1-policy-instance-property-payload-template.vtl @@ -0,0 +1,10 @@ +## Velocity template for creating payload for creating A1 Policy instance +#set($begCntr=0) +#set($endCntr=0) +#set($entries=$ctx.getAttribute("create-policy-instance-input.properties_length")) +#set($endCntr=$endCntr.parseInt($entries)) +#set( $endCntr = $endCntr - 1) +{#foreach($no in [$begCntr..$endCntr]) +"$ctx.getAttribute("create-policy-instance-input.properties[$no].property-name")" : +$ctx.getAttribute("create-policy-instance-input.properties[$no].property-value") +#if( $foreach.count < $endCntr+1), #end #end} diff --git a/platform-logic/restapi-templates/src/main/velocity/a1-policy-type-create-schema-property-payload-template.vtl b/platform-logic/restapi-templates/src/main/velocity/a1-policy-type-create-schema-property-payload-template.vtl new file mode 100644 index 00000000..0230addd --- /dev/null +++ b/platform-logic/restapi-templates/src/main/velocity/a1-policy-type-create-schema-property-payload-template.vtl @@ -0,0 +1,26 @@ +## Velocity template for creating the payload for creating A1 policy type +#set($begCntr1=0) +#set($endCntr1=0) +#set($entries=$ctx.getAttribute("create-policy-type-input.properties_length")) +#set($endCntr1=$endCntr1.parseInt($entries)) +#set( $endCntr1 = $endCntr1 - 1) +{ + "description": "$ctx.getAttribute("create-policy-type-input.description")", + "name": "$ctx.getAttribute("create-policy-type-input.name")", + "policy_type_id": $ctx.getAttribute("create-policy-type-input.policy-type-id"), + "create_schema": { + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "type": "object", + "properties": {#foreach($no1 in [$begCntr1..$endCntr1]) + "$ctx.getAttribute("create-policy-type-input.properties[$no1].property-name")" : { + #set($begCntr2=0) + #set($endCntr2=0) + #set($entries=$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements_length")) + #set($endCntr2=$endCntr2.parseInt($entries)) + #set( $endCntr2 = $endCntr2 - 1) + #foreach($no2 in [$begCntr2..$endCntr2]) + "$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements[$no2].policy-statement")" : + "$ctx.getAttribute("create-policy-type-input.properties[$no1].policy-statements[$no2].policy-statement-value")" + #if( $no2 < $endCntr2), #end#end}#if( $no1 < $endCntr1), #end #end +}}} diff --git a/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getNearRT-RICs-payload.vtl b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getNearRT-RICs-payload.vtl new file mode 100644 index 00000000..cfe7f03e --- /dev/null +++ b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getNearRT-RICs-payload.vtl @@ -0,0 +1 @@ +## Velocity template for getNearRT-RICs DMAAP response payload diff --git a/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyInstances-payload.vtl b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyInstances-payload.vtl new file mode 100644 index 00000000..0d007ac9 --- /dev/null +++ b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyInstances-payload.vtl @@ -0,0 +1 @@ +## Velocity template for getPolicyInstances DMAAP response payload diff --git a/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyType-payload.vtl b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyType-payload.vtl new file mode 100644 index 00000000..19449d08 --- /dev/null +++ b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyType-payload.vtl @@ -0,0 +1 @@ +## Velocity template for getPolicyType DMAAP response payload diff --git a/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyTypes-payload.vtl b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyTypes-payload.vtl new file mode 100644 index 00000000..cf396f0f --- /dev/null +++ b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getPolicyTypes-payload.vtl @@ -0,0 +1 @@ +## Velocity template for getPolicyTypes DMAAP response payload diff --git a/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getStatus-payload.vtl b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getStatus-payload.vtl new file mode 100644 index 00000000..3af64402 --- /dev/null +++ b/platform-logic/restapi-templates/src/main/velocity/a1Mediator-dmaap-publish-getStatus-payload.vtl @@ -0,0 +1 @@ +## Velocity template for getStatus DMAAP response payload -- cgit 1.2.3-korg