blob: a64c8e17152f701e06314138f8ed7d3116cfffd1 [file] [log] [blame]
Pamela Dragoshd1728dc2017-02-14 19:57:17 -05001#! /bin/bash
2
rb7147227bd092017-09-27 16:13:50 -04003#########################################Upload BRMS Param Template##########################################
Pamela Dragoshd1728dc2017-02-14 19:57:17 -05004
rb7147227bd092017-09-27 16:13:50 -04005echo "Upload BRMS Param Template"
Pamela Dragoshd1728dc2017-02-14 19:57:17 -05006
rb7147227bd092017-09-27 16:13:50 -04007curl -v --silent -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST'
8-F "file=@ClosedLoopControlName.drl"
9'http://pdp:8081/pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%ClosedLoopControlName%22%2C%20%22serviceType%22%20%3A%20%22BRMSPARAM%22%20%7D'
Pamela Dragoshd1728dc2017-02-14 19:57:17 -050010
rb7147227bd092017-09-27 16:13:50 -040011#########################################Create BRMS Param policies##########################################
12
13echo "Create BRMSParam Operational Policies"
Pamela Dragoshd1728dc2017-02-14 19:57:17 -050014
15sleep 2
16
rb7147227bd092017-09-27 16:13:50 -040017echo "Create BRMSParamvFirewall Policy"
18curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
19 "policyConfigType": "BRMS_PARAM",
20 "policyName": "com.BRMSParamvFirewall",
21 "policyDescription": "BRMS Param vFirewall policy",
22 "policyScope": "com",
23 "attributes": {
24 "MATCHING": {
25 "controller" : "amsterdam"
26 },
27 "RULE": {
28 "templateName": "ClosedLoopControlName",
29 "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
30 "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++services%3A%0D%0A++++-+serviceInvariantUUID%3A+5cfe6f4a-41bc-4247-8674-ebd4b98e35cc%0D%0A++++++serviceUUID%3A+0f40bba5-986e-4b3c-803f-ddd1b7b25f24%0D%0A++++++serviceName%3A+57e66ea7-0ed6-45c7-970f%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%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++++++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"
31 }
32 }
33}' 'http://pdp:8081/pdp/api/createPolicy'
Pamela Dragoshd1728dc2017-02-14 19:57:17 -050034
35sleep 2
Jorge Hernandez0eab4f22017-06-20 17:32:25 -050036
rb7147227bd092017-09-27 16:13:50 -040037echo "Create BRMSParamvDNS Policy"
38curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
39 "policyConfigType": "BRMS_PARAM",
40 "policyName": "com.BRMSParamvDNS",
41 "policyDescription": "BRMS Param vDNS policy",
42 "policyScope": "com",
43 "attributes": {
44 "MATCHING": {
45 "controller" : "amsterdam"
46 },
47 "RULE": {
48 "templateName": "ClosedLoopControlName",
49 "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
50 "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0D%0A++services%3A%0D%0A++++-+serviceName%3A+d4738992-6497-4dca-9db9%0D%0A++++++serviceInvariantUUID%3A+dc112d6e-7e73-4777-9c6f-1a7fb5fd1b6f%0D%0A++++++serviceUUID%3A+2eea06c6-e1d3-4c3a-b9c4-478c506eeedf%0D%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0D%0A++timeout%3A+1200%0D%0A+%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+MSO%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"
51 }
52 }
53}' 'http://pdp:8081/pdp/api/createPolicy'
54
55sleep 2
56
57echo "Create BRMSParamVOLTE Policy"
58curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
59 "policyConfigType": "BRMS_PARAM",
60 "policyName": "com.BRMSParamVOLTE",
61 "policyDescription": "BRMS Param VOLTE policy",
62 "policyScope": "com",
63 "attributes": {
64 "MATCHING": {
65 "controller" : "amsterdam"
66 },
67 "RULE": {
68 "templateName": "ClosedLoopControlName",
69 "closedLoopControlName": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b",
70 "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+%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"
71 }
72 }
73}' 'http://pdp:8081/pdp/api/createPolicy'
74
75sleep 2
76
77echo "Create BRMSParamvCPE Policy"
78curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/html' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
79 "policyConfigType": "BRMS_PARAM",
80 "policyName": "com.BRMSParamvCPE",
81 "policyDescription": "BRMS Param vCPE policy",
82 "policyScope": "com",
83 "attributes": {
84 "MATCHING": {
85 "controller" : "amsterdam"
86 },
87 "RULE": {
88 "templateName": "ClosedLoopControlName",
89 "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
90 "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+%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"
91 }
92 }
93}' 'http://pdp:8081/pdp/api/createPolicy'
94
95#########################################Create Micro Service Config policies##########################################
96
97echo "Create MicroService Config Policies"
98
99sleep 2
100
101echo "Create MicroServicevFirewall Policy"
102curl -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: DEVL' -d '{
103 "configBody": "{\"service\": \"policy_tosca_tca\",\"location\": \"SampleServiceLocation\",\"uuid\": \"test\",\"policyName\": \"MicroServicevFirewall\",\"description\": \"MicroService vFirewall Policy\",\"configName\": \"SampleConfigName\",\"templateVersion\": \"OpenSource.version.1\",\"version\": \"1.0.0\",\"priority\": \"1\",\"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\",\"riskType\": \"SampleRiskType\",\"riskLevel\": \"1\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"4000\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"20000\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"CL-FRWL-HIGH-TRAFFIC-SIG-EA36FE84-9342-5E13-A656-EC5F21309A09\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"DCAE.Config_tca-hi-lo\",\"controlLoopSchemaType\": \"VNF\",\"policyScope\": \"DCAE\",\"eventName\": \"vFirewallBroadcastPackets\"}}",
104 "policyConfigType": "MicroService",
105 "policyName": "com.MicroServicevFirewall",
106 "onapName": "DCAE"
107}' 'http://pdp:8081/pdp/api/createPolicy'
108
109
110sleep 2
111
112echo "Create MicroServicevDNS Policy"
113curl -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: DEVL' -d '{
114 "configBody": "{ \"service\": \"policy_tosca_tca\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevDNS\", \"description\": \"MicroService vDNS Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.0.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\", \"thresholdValue\": \"500\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A\", \"version\": \"1.0.2\", \"direction\": \"LESS_OR_EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\", \"thresholdValue\": \"5000\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"CL-LBAL-HIGH-TRAFFIC-SIG-0C5920A6-B564-8035-C878-0E814352BC2B\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vLoadBalancer\" } }",
115 "policyConfigType": "MicroService",
116 "policyName": "com.MicroServicevDNS",
117 "onapName": "DCAE"
118}' 'http://pdp:8081/pdp/api/createPolicy'
119
120
121sleep 2
122
123echo "Create MicroServicevCPE Policy"
124curl -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: DEVL' -d '{
125 "configBody": "{ \"service\": \"policy_tosca_tca\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.0.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"1000\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vCPEvGMUXPacketLoss\" } }",
126 "policyConfigType": "MicroService",
127 "policyName": "com.MicroServicevCPE",
128 "onapName": "DCAE"
129}' 'http://pdp:8081/pdp/api/createPolicy'
130
131
132
133#########################################Pushing BRMS Param policies##########################################
134
135echo "Pushing BRMSParam Operational policies"
136
137sleep 2
138
139echo "pushPolicy : PUT : com.BRMSParamvFirewall"
Jorge Hernandezdc8bdd52017-06-19 23:02:43 -0500140curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Pamela Dragoshd1728dc2017-02-14 19:57:17 -0500141 "pdpGroup": "default",
rb7147227bd092017-09-27 16:13:50 -0400142 "policyName": "com.BRMSParamvFirewall",
Pamela Dragoshd1728dc2017-02-14 19:57:17 -0500143 "policyType": "BRMS_Param"
ITSERVICES\rb7147b150eba2017-05-09 13:54:45 -0400144}' 'http://pdp:8081/pdp/api/pushPolicy'
Pamela Dragoshd1728dc2017-02-14 19:57:17 -0500145
146sleep 2
147
rb7147227bd092017-09-27 16:13:50 -0400148echo "pushPolicy : PUT : com.BRMSParamvDNS"
Jorge Hernandezdc8bdd52017-06-19 23:02:43 -0500149curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Pamela Dragoshd1728dc2017-02-14 19:57:17 -0500150 "pdpGroup": "default",
rb7147227bd092017-09-27 16:13:50 -0400151 "policyName": "com.BRMSParamvDNS",
Pamela Dragoshd1728dc2017-02-14 19:57:17 -0500152 "policyType": "BRMS_Param"
ITSERVICES\rb7147b150eba2017-05-09 13:54:45 -0400153}' 'http://pdp:8081/pdp/api/pushPolicy'
Pamela Dragoshd1728dc2017-02-14 19:57:17 -0500154
155sleep 2
156
rb7147227bd092017-09-27 16:13:50 -0400157echo "pushPolicy : PUT : com.BRMSParamVOLTE"
rb714716ca5982017-06-23 15:03:19 -0400158curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
159 "pdpGroup": "default",
rb7147227bd092017-09-27 16:13:50 -0400160 "policyName": "com.BRMSParamVOLTE",
161 "policyType": "BRMS_Param"
162}' 'http://pdp:8081/pdp/api/pushPolicy'
163
164sleep 2
165
166echo "pushPolicy : PUT : com.BRMSParamvCPE"
167curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
168 "pdpGroup": "default",
169 "policyName": "com.BRMSParamvCPE",
170 "policyType": "BRMS_Param"
171}' 'http://pdp:8081/pdp/api/pushPolicy'
172
173#########################################Pushing MicroService Config policies##########################################
174
175echo "Pushing MicroService Config policies"
176
177sleep 2
178
179echo "pushPolicy : PUT : com.MicroServicevFirewall"
180curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
181 "pdpGroup": "default",
182 "policyName": "com.MicroServicevFirewall",
rb714716ca5982017-06-23 15:03:19 -0400183 "policyType": "MicroService"
184}' 'http://pdp:8081/pdp/api/pushPolicy'
185
186sleep 2
187
rb7147227bd092017-09-27 16:13:50 -0400188echo "pushPolicy : PUT : com.MicroServicevDNS"
rb714716ca5982017-06-23 15:03:19 -0400189curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
190 "pdpGroup": "default",
rb7147227bd092017-09-27 16:13:50 -0400191 "policyName": "com.MicroServicevDNS",
rb714716ca5982017-06-23 15:03:19 -0400192 "policyType": "MicroService"
rb7147227bd092017-09-27 16:13:50 -0400193}' 'http://pdp: 8081/pdp/api/pushPolicy'
rb714716ca5982017-06-23 15:03:19 -0400194
195sleep 2
196
rb7147227bd092017-09-27 16:13:50 -0400197echo "pushPolicy : PUT : com.MicroServicevCPE"
Jorge Hernandezdc8bdd52017-06-19 23:02:43 -0500198curl -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
Pamela Dragoshd1728dc2017-02-14 19:57:17 -0500199 "pdpGroup": "default",
rb7147227bd092017-09-27 16:13:50 -0400200 "policyName": "com.MicroServicevCPE",
201 "policyType": "MicroService"
202}' 'http://pdp: 8081/pdp/api/pushPolicy'