blob: 44f3b36abe3ad2b7c52ff0dd941ca320edb8908d [file] [log] [blame]
mayankg2703ced85142018-03-20 05:42:53 +00001# Copyright © 2017 Amdocs, Bell Canada, AT&T
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Mandeep Khinda12610242017-09-14 11:37:33 +000015#! /bin/bash
16
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050017# forked from https://gerrit.onap.org/r/gitweb?p=policy/docker.git;a=blob;f=config/pe/push-policies.sh;h=555ab357e6b4f54237bf07ef5e6777d782564bc0;hb=refs/heads/amsterdam and adapted for OOM
Mandeep Khinda12610242017-09-14 11:37:33 +000018
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050019#########################################Upload BRMS Param Template##########################################
Mandeep Khinda12610242017-09-14 11:37:33 +000020
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050021echo "Upload BRMS Param Template"
Mandeep Khinda12610242017-09-14 11:37:33 +000022
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050023sleep 2
24
Jorge Hernandezcb498882018-07-09 11:35:38 -050025wget -O cl-amsterdam-template.drl https://git.onap.org/policy/drools-applications/plain/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050026
27sleep 2
28
Michael Mokry3efae0b2018-08-22 10:58:31 -050029curl -k -v --silent -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -F "file=@cl-amsterdam-template.drl" -F "importParametersJson={\"serviceName\":\"ClosedLoopControlName\",\"serviceType\":\"BRMSPARAM\"}" 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/policyEngineImport'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050030
31echo "PRELOAD_POLICIES is $PRELOAD_POLICIES"
32
33if [ "$PRELOAD_POLICIES" == "false" ]; then
34 exit 0
35fi
36
37#########################################Create BRMS Param policies##########################################
38
39echo "Create BRMSParam Operational Policies"
40
41sleep 2
42
43echo "Create BRMSParamvFirewall Policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -050044curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050045 "policyConfigType": "BRMS_PARAM",
46 "policyName": "com.BRMSParamvFirewall",
47 "policyDescription": "BRMS Param vFirewall policy",
48 "policyScope": "com",
49 "attributes": {
50 "MATCHING": {
51 "controller" : "amsterdam"
52 },
53 "RULE": {
54 "templateName": "ClosedLoopControlName",
55 "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
56 "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
57 }
58 }
Michael Mokry3efae0b2018-08-22 10:58:31 -050059}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050060
61sleep 2
62
63echo "Create BRMSParamvDNS Policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -050064curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050065 "policyConfigType": "BRMS_PARAM",
66 "policyName": "com.BRMSParamvDNS",
67 "policyDescription": "BRMS Param vDNS policy",
68 "policyScope": "com",
69 "attributes": {
70 "MATCHING": {
71 "controller" : "amsterdam"
72 },
73 "RULE": {
74 "templateName": "ClosedLoopControlName",
75 "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
76 "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0D%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-scale-up%0D%0A++++name%3A+Create+a+new+VF+Module%0D%0A++++description%3A%0D%0A++++actor%3A+SO%0D%0A++++recipe%3A+VF+Module+Create%0D%0A++++target%3A%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
77 }
78 }
Michael Mokry3efae0b2018-08-22 10:58:31 -050079}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050080
81sleep 2
82
83echo "Create BRMSParamVOLTE Policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -050084curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -050085 "policyConfigType": "BRMS_PARAM",
86 "policyName": "com.BRMSParamVOLTE",
87 "policyDescription": "BRMS Param VOLTE policy",
88 "policyScope": "com",
89 "attributes": {
90 "MATCHING": {
91 "controller" : "amsterdam"
92 },
93 "RULE": {
94 "templateName": "ClosedLoopControlName",
95 "closedLoopControlName": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b",
96 "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+VFC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
97 }
98 }
Michael Mokry3efae0b2018-08-22 10:58:31 -050099}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500100
101sleep 2
102
103echo "Create BRMSParamvCPE Policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500104curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500105 "policyConfigType": "BRMS_PARAM",
106 "policyName": "com.BRMSParamvCPE",
107 "policyDescription": "BRMS Param vCPE policy",
108 "policyScope": "com",
109 "attributes": {
110 "MATCHING": {
111 "controller" : "amsterdam"
112 },
113 "RULE": {
114 "templateName": "ClosedLoopControlName",
115 "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
116 "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A++abatement%3A+true%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard"
117 }
118 }
Michael Mokry3efae0b2018-08-22 10:58:31 -0500119}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500120
121#########################################Create Micro Service Config policies##########################################
122
123echo "Create MicroService Config Policies"
124
125sleep 2
126
127echo "Create MicroServicevFirewall Policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500128curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500129 "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevFirewall\", \"description\": \"MicroService vFirewall Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vFirewallBroadcastPackets\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 300, \"direction\": \"LESS_OR_EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ONSET\" }, { \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 700, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" } ] }] } } }",
130 "policyConfigType": "MicroService",
131 "policyName": "com.MicroServicevFirewall",
132 "onapName": "DCAE"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500133}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500134
135
136sleep 2
137
138echo "Create MicroServicevDNS Policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500139curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500140 "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevDNS\", \"description\": \"MicroService vDNS Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vLoadBalancer\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 300, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" }] }] } } }",
141 "policyConfigType": "MicroService",
142 "policyName": "com.MicroServicevDNS",
143 "onapName": "DCAE"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500144}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500145
146
147sleep 2
148
149echo "Create MicroServicevCPE Policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500150curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Michael Mokry3f13e282018-09-13 10:53:26 -0500151 "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"Measurement_vGMUX\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": 0, \"direction\": \"EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ABATED\" }, { \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": 0, \"direction\": \"GREATER\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" }] }] } } }",
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500152 "policyConfigType": "MicroService",
153 "policyName": "com.MicroServicevCPE",
154 "onapName": "DCAE"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500155}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500156
Michael Mokry3f13e282018-09-13 10:53:26 -0500157#########################################Create SDNC Naming Policies##########################################
158
159echo "Create SDNC Naming Policies"
160
161sleep 2
162
163echo "Create SDNC vFW Naming Policy"
164curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
165 "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VFW_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vFW\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}",
166 "policyName": "SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP",
167 "policyConfigType": "MicroService",
168 "onapName": "SDNC",
169 "riskLevel": "4",
170 "riskType": "test",
171 "guard": "false",
172 "priority": "4",
173 "description": "ONAP_VFW_NAMING_TIMESTAMP"
174}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
175
176sleep 2
177
178echo "Create SDNC vPG Naming Policy"
179curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
180 "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VPG_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vPG\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}",
181 "policyName": "SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP",
182 "policyConfigType": "MicroService",
183 "onapName": "SDNC",
184 "riskLevel": "4",
185 "riskType": "test",
186 "guard": "false",
187 "priority": "4",
188 "description": "ONAP_VPG_NAMING_TIMESTAMP"
189}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500190
191#########################################Creating Decision Guard policy#########################################
192
193sleep 2
194
195echo "Creating Decision Guard policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500196curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500197 "policyClass": "Decision",
198 "policyName": "com.AllPermitGuard",
199 "policyDescription": "Testing all Permit YAML Guard Policy",
200 "ecompName": "PDPD",
201 "ruleProvider": "GUARD_YAML",
202 "attributes": {
203 "MATCHING": {
204 "actor": ".*",
205 "recipe": ".*",
206 "targets": ".*",
207 "clname": ".*",
208 "limit": "10",
209 "timeWindow": "1",
210 "timeUnits": "minute",
211 "guardActiveStart": "00:00:01-05:00",
212 "guardActiveEnd": "00:00:00-05:00"
213 }
214 }
Michael Mokry3efae0b2018-08-22 10:58:31 -0500215}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/createPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500216
217#########################################Push Decision policy#########################################
218
219sleep 2
220
221echo "Push Decision policy"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500222curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500223 "pdpGroup": "default",
224 "policyName": "com.AllPermitGuard",
225 "policyType": "DECISION"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500226}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500227
228#########################################Pushing BRMS Param policies##########################################
229
230echo "Pushing BRMSParam Operational policies"
231
232sleep 2
233
234echo "pushPolicy : PUT : com.BRMSParamvFirewall"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500235curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Mandeep Khinda12610242017-09-14 11:37:33 +0000236 "pdpGroup": "default",
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500237 "policyName": "com.BRMSParamvFirewall",
238 "policyType": "BRMS_Param"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500239}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Mandeep Khinda12610242017-09-14 11:37:33 +0000240
241sleep 2
242
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500243echo "pushPolicy : PUT : com.BRMSParamvDNS"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500244curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Mandeep Khinda12610242017-09-14 11:37:33 +0000245 "pdpGroup": "default",
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500246 "policyName": "com.BRMSParamvDNS",
247 "policyType": "BRMS_Param"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500248}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500249
250sleep 2
251
252echo "pushPolicy : PUT : com.BRMSParamVOLTE"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500253curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500254 "pdpGroup": "default",
255 "policyName": "com.BRMSParamVOLTE",
256 "policyType": "BRMS_Param"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500257}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500258
259sleep 2
260
261echo "pushPolicy : PUT : com.BRMSParamvCPE"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500262curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500263 "pdpGroup": "default",
264 "policyName": "com.BRMSParamvCPE",
265 "policyType": "BRMS_Param"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500266}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500267
268#########################################Pushing MicroService Config policies##########################################
269
270echo "Pushing MicroService Config policies"
271
272sleep 2
273
274echo "pushPolicy : PUT : com.MicroServicevFirewall"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500275curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500276 "pdpGroup": "default",
277 "policyName": "com.MicroServicevFirewall",
278 "policyType": "MicroService"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500279}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500280
281sleep 10
282
283echo "pushPolicy : PUT : com.MicroServicevDNS"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500284curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500285 "pdpGroup": "default",
286 "policyName": "com.MicroServicevDNS",
Mandeep Khinda12610242017-09-14 11:37:33 +0000287 "policyType": "MicroService"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500288}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Mandeep Khinda12610242017-09-14 11:37:33 +0000289
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500290sleep 10
Mandeep Khinda12610242017-09-14 11:37:33 +0000291
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500292echo "pushPolicy : PUT : com.MicroServicevCPE"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500293curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Mandeep Khinda12610242017-09-14 11:37:33 +0000294 "pdpGroup": "default",
Alexis de Talhouëtdf4db0b2017-12-11 08:36:25 -0500295 "policyName": "com.MicroServicevCPE",
Mandeep Khinda12610242017-09-14 11:37:33 +0000296 "policyType": "MicroService"
Michael Mokry3efae0b2018-08-22 10:58:31 -0500297}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
Michael Mokry3f13e282018-09-13 10:53:26 -0500298
299#########################################Pushing SDNC Naming Policies##########################################
300echo "Pushing SDNC Naming Policies"
301
302sleep 2
303
304echo "pushPolicy : PUT : SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP"
305curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
306 "pdpGroup": "default",
307 "policyName": "SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP",
308 "policyType": "MicroService"
309}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'
310
311sleep 10
312
313echo "pushPolicy : PUT : SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP"
314curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
315 "pdpGroup": "default",
316 "policyName": "SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP",
317 "policyType": "MicroService"
318}' 'https://{{.Values.global.pdp.nameOverride}}:{{.Values.config.pdpPort}}/pdp/api/pushPolicy'