Update vLB ScaleOut use case doc
[integration.git] / docs / docs_vipsec.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2018 ONAP
4
5 .. _docs_vipsec_hpa:
6
7 :orphan:
8
9 vIPsec with HPA Tutorial: Setting Up and Configuration
10 --------------------------------------------------------
11
12 Description
13 ~~~~~~~~~~~
14 This is a new use case in ONAP for IPsec which also provides VMs certain hardware features (such as SRIOV NIC, CPU pinning, pci passthrough.. etc.) in order to enhance their performance. Multiple cloud regions with flavors that have HPA features are registered with ONAP. We then create policies that specify the HPA requirements of each VM in the use case. When a service instance is created with OOF specified as the homing solution, OOF responds with the homing solution (cloud region) and flavor directives that meet the requirements specified in the policy.
15 The deploy steps look just alike the one for vFW with HPA use case. It is also using the same test plan `Here <https://wiki.onap.org/pages/viewpage.action?pageId=41421112>`_. In Dublin release, we just focus on test plan 1 and 2.
16
17 **Useful Links**
18
19 `HPA Enhancements Page <https://wiki.onap.org/pages/viewpage.action?pageId=34376310>`_
20
21 `Hardware Platform Enablement in ONAP <https://wiki.onap.org/display/DW/Hardware+Platform+Enablement+In+ONAP>`_
22
23
24
25 Setting Up and Installation
26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 Instructions for updating the manifest of ONAP docker images can be found here:  https://onap.readthedocs.io/en/casablanca/submodules/integration.git/docs/#deploying-an-updated-docker-manifest
28
29 Install OOM ONAP using the deploy script in the integration repo. Instructions for this can be found in this link https://wiki.onap.org/display/DW/OOM+Component. When the installation is complete (all the pods are either in running or completed state) Do the following;
30
31
32 1. Check that all the required components were deployed;
33
34  ``oom-rancher# helm list``
35
36 2. Check the state of the pods;
37
38    ``oom-rancher# kubectl get pods -n onap``
39
40 3. Run robot health check
41
42    ``oom-rancher# cd oom/kubernetes/robot``
43
44    ``oom-rancher# ./ete-k8s.sh onap health``
45
46    Ensure all the required components pass the health tests
47 4. Modify the SO bpmn configmap to change the SO vnf adapter endpoint to v2
48
49    ``oom-rancher#    kubectl -n onap edit configmap dev-so-so-bpmn-infra-app-configmap``
50
51                         ``- vnf:``
52
53                                   ``endpoint: http://so-openstack-adapter.onap:8087/services/VnfAdapter``
54
55                                   ``rest:``
56
57                                     ``endpoint: http://so-openstack-adapter.onap:8087/services/rest/v1/vnfs``
58                          
59                         ``+ vnf:``
60
61                                   ``endpoint: http://so-openstack-adapter.onap:8087/services/VnfAdapter``
62
63                                   ``rest:``
64
65                                     ``endpoint: http://so-openstack-adapter.onap:8087/services/rest/v2/vnfs`` 
66
67    Then delete the bpmn pod
68
69    ``oom-rancher#  kubectl delete <pod-name> -n onap``
70
71 5. Run robot healthdist
72
73    ``oom-rancher# ./ete-k8s.sh onap healthdist``
74 6. Run robot demo init, this initializes the default Demonstration customer and distributes the default models
75
76   ``oom-rancher# ./demo-k8s.sh onap init``
77
78 7. Create HPA flavors in cloud regions to be registered with ONAP. All HPA flavor names must start with onap. During our tests, 3 cloud regions were registered and we created flavors in each cloud. The flavors match the flavors described in the test plan `here <https://wiki.onap.org/pages/viewpage.action?pageId=41421112>`_.
79
80 - **Cloud Region One**
81
82     **Flavor11**
83      ``#nova flavor-create onap.hpa.flavor11 111 8 20 2``
84
85      ``#nova flavor-key onap.hpa.flavor11 set hw:mem_page_size=2048``
86
87     **Flavor12**
88      ``#nova flavor-create onap.hpa.flavor12 112 12 20 2``
89
90      ``#nova flavor-key onap.hpa.flavor12 set hw:mem_page_size=2048``
91
92      ``#openstack aggregate create --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-shared-1:3 aggr121``
93
94      ``#openstack flavor set onap.hpa.flavor12 --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-shared-1:3``
95
96     **Flavor13**
97      ``#nova flavor-create onap.hpa.flavor13 113 12 20 2``
98
99      ``#nova flavor-key onap.hpa.flavor13 set hw:mem_page_size=2048``
100
101      ``#openstack aggregate create --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-private-1:1 aggr131``
102
103      ``#openstack flavor set onap.hpa.flavor13 --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-private-1:1``
104
105 - **Cloud Region Two**
106
107     **Flavor21**
108      ``#nova flavor-create onap.hpa.flavor21 221 8 20 2``
109
110      ``#nova flavor-key onap.hpa.flavor21 set hw:mem_page_size=2048``
111
112      ``#nova flavor-key onap.hpa.flavor21 set hw:cpu_policy=dedicated``
113
114      ``#nova flavor-key onap.hpa.flavor21 set hw:cpu_thread_policy=isolate``
115
116     **Flavor22**
117      ``#nova flavor-create onap.hpa.flavor22 222 12 20 2``
118
119      ``#nova flavor-key onap.hpa.flavor22 set hw:mem_page_size=2048``
120
121      ``#openstack aggregate create --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-shared-1:2 aggr221``
122
123      ``#openstack flavor set onap.hpa.flavor22 --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-shared-1:2``
124
125     **Flavor23**
126      ``#nova flavor-create onap.hpa.flavor23 223 12 20 2``
127
128      ``#nova flavor-key onap.hpa.flavor23 set hw:mem_page_size=2048``
129
130      ``#openstack aggregate create --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-private-1:2 aggr231``
131
132      ``#openstack flavor set onap.hpa.flavor23 --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-private-1:2``
133
134 - **Cloud Region Three**
135
136     **Flavor31**
137      ``#nova flavor-create onap.hpa.flavor31 331 8 20 2``
138
139      ``#nova flavor-key onap.hpa.flavor31 set hw:mem_page_size=2048``
140
141      ``#nova flavor-key onap.hpa.flavor31 set hw:cpu_policy=dedicated``
142
143      ``#nova flavor-key onap.hpa.flavor31 set hw:cpu_thread_policy=isolate``
144
145     **Flavor32**
146      ``#nova flavor-create onap.hpa.flavor32 332 8192 20 2``
147
148      ``#nova flavor-key onap.hpa.flavor32 set hw:mem_page_size=1048576``
149
150     **Flavor33**
151      ``#nova flavor-create onap.hpa.flavor33 333 12 20 2``
152
153      ``#nova flavor-key onap.hpa.flavor33 set hw:mem_page_size=2048``
154
155      ``#openstack aggregate create --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-shared-1:1 aggr331``
156
157      ``#openstack flavor set onap.hpa.flavor33 --property aggregate_instance_extra_specs:sriov_nic=sriov-nic-intel-8086-154C-shared-1:1``
158
159
160 8. Check that the cloud complex has the right values and update if it does not. Required values are;
161
162     "elevation": "example-elevation-val-28399",
163
164     "lata": "example-lata-val-28399",
165
166     "country": "USA",
167
168     "latitude": "32.89948",
169
170     "longitude": "97.045443",
171
172     "postal-code": "00000
173
174
175 If an update is needed, the update can be done via rest using curl or postman
176
177 ::
178
179     curl -X PUT \
180     https://$ONAP_AAI_IP:$ONAP_AAI_PORT/aai/v14/cloud-infrastructure/complexes/complex/clli1 \
181     -H 'Accept: application/json' \
182     -H 'Authorization: Basic QUFJOkFBSQ==' \
183     -H 'Cache-Control: no-cache' \
184     -H 'Content-Type: application/json' \
185     -H 'Postman-Token: 2b272126-aa65-41e6-aa5d-46bc70b9eb4f' \
186     -H 'Real-Time: true' \
187     -H 'X-FromAppId: jimmy-postman' \
188     -H 'X-TransactionId: 9999' \
189     -d '{
190          "physical-location-id": "clli1",
191          "data-center-code": "example-data-center-code-val-5556",
192          "complex-name": "clli1",
193          "identity-url": "example-identity-url-val-56898",
194          "resource-version": "1543284556407",
195          "physical-location-type": "example-physical-location-type-val-7608",
196          "street1": "example-street1-val-34205",
197          "street2": "example-street2-val-99210",
198          "city": "example-city-val-27150",
199          "state": "example-state-val-59487",
200          "postal-code": "00000",
201          "country": "USA",
202          "region": "example-region-val-13893",
203          "latitude": "32.89948",
204          "longitude": "97.045443",
205          "elevation": "example-elevation-val-28399",
206          "lata": "example-lata-val-28399"
207
208         }'
209
210 9. Register new cloud regions. This can be done using instructions (Step 1 to Step 3) on this `page <https://docs.onap.org/projects/onap-multicloud-framework/en/latest/multicloud-plugin-windriver/UserGuide-MultiCloud-WindRiver-TitaniumCloud.html?highlight=multicloud>`_. The already existing CloudOwner and cloud complex can be used. If step 3 does not work using the k8s ip and external port. It can be done using the internal ip address and port. Exec into any pod and run the command from the pod.
211
212 - Get msb-iag internal ip address and port
213
214  ``oom-rancher#  kubectl get services -n onap |grep msb-iag``
215
216 - Exec into any pod (oof in this case) and run curl command, you may need to install curl
217
218   ``oom-rancher#  kubectl exec dev-oof-oof-6c848594c5-5khps -it -- bash``
219
220 10. Put required subscription list into tenant for all the newly added cloud regions. An easy way to do this is to do a get on the default cloud region, copy the tenant information with the subscription. Then paste it in your put command and modify the region id, tenant-id, tenant-name and resource-version.
221
222 **GET COMMAND**
223
224 ::
225
226     curl -X GET \
227     https://$ONAP_AAI_IP:$ONAP_AAI_PORT/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/${CLOUD_OWNER}/${CLOUD_REGION_ID}?depth=all \
228     -H 'Accept: application/json' \
229     -H 'Authorization: Basic QUFJOkFBSQ==' \
230     -H 'Cache-Control: no-cache' \
231     -H 'Content-Type: application/json' \
232     -H 'Postman-Token: 2899359f-871b-4e61-a307-ecf8b3144e3f' \
233     -H 'Real-Time: true' \
234     -H 'X-FromAppId: jimmy-postman' \
235     -H 'X-TransactionId: 9999'
236
237 **PUT COMMAND**
238 ::
239
240  curl -X PUT \
241     https://{{AAI1_PUB_IP}}:{{AAI1_PUB_PORT}}/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/{{cloud-owner}}/{{cloud-region-id}}/tenants/tenant/{{tenant-id}} \
242     -H 'Accept: application/json' \
243     -H 'Authorization: Basic QUFJOkFBSQ==' \
244     -H 'Cache-Control: no-cache' \
245     -H 'Content-Type: application/json' \
246     -H 'Postman-Token: 2b272126-aa65-41e6-aa5d-46bc70b9eb4f' \
247     -H 'Real-Time: true' \
248     -H 'X-FromAppId: jimmy-postman' \
249     -H 'X-TransactionId: 9999' \
250     -d '{
251                 "tenant-id": "709ba629fe194f8699b12f9d6ffd86a0",
252                 "tenant-name": "Integration-HPA",
253                 "resource-version": "1542650451856",
254                 "relationship-list": {
255                     "relationship": [
256                         {
257                             "related-to": "service-subscription",
258                             "relationship-label": "org.onap.relationships.inventory.Uses",
259                             "related-link": "/aai/v14/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFWCL",
260                             "relationship-data": [
261                                 {
262                                     "relationship-key": "customer.global-customer-id",
263                                     "relationship-value": "Demonstration"
264                                 },
265                                 {
266                                     "relationship-key": "service-subscription.service-type",
267                                     "relationship-value": "vFWCL"
268                                 }
269                             ]
270                         },
271                         {
272                             "related-to": "service-subscription",
273                             "relationship-label": "org.onap.relationships.inventory.Uses",
274                             "related-link": "/aai/v14/business/customers/customer/Demonstration/service-subscriptions/service-subscription/gNB",
275                             "relationship-data": [
276                                 {
277                                     "relationship-key": "customer.global-customer-id",
278                                     "relationship-value": "Demonstration"
279                                 },
280                                 {
281                                     "relationship-key": "service-subscription.service-type",
282                                     "relationship-value": "gNB"
283                                 }
284                             ]
285                         },
286                         {
287                             "related-to": "service-subscription",
288                             "relationship-label": "org.onap.relationships.inventory.Uses",
289                             "related-link": "/aai/v14/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW",
290                             "relationship-data": [
291                                 {
292                                     "relationship-key": "customer.global-customer-id",
293                                     "relationship-value": "Demonstration"
294                                 },
295                                 {
296                                     "relationship-key": "service-subscription.service-type",
297                                     "relationship-value": "vFW"
298                                 }
299                             ]
300                         },
301                         {
302                             "related-to": "service-subscription",
303                             "relationship-label": "org.onap.relationships.inventory.Uses",
304                             "related-link": "/aai/v14/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vCPE",
305                             "relationship-data": [
306                                 {
307                                     "relationship-key": "customer.global-customer-id",
308                                     "relationship-value": "Demonstration"
309                                 },
310                                 {
311                                     "relationship-key": "service-subscription.service-type",
312                                     "relationship-value": "vCPE"
313                                 }
314                             ]
315                         },
316                         {
317                             "related-to": "service-subscription",
318                             "relationship-label": "org.onap.relationships.inventory.Uses",
319                             "related-link": "/aai/v14/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW_HPA",
320                             "relationship-data": [
321                                 {
322                                     "relationship-key": "customer.global-customer-id",
323                                     "relationship-value": "Demonstration"
324                                 },
325                                 {
326                                     "relationship-key": "service-subscription.service-type",
327                                     "relationship-value": "vFW_HPA"
328                                 }
329                             ]
330                         },
331                         {
332                             "related-to": "service-subscription",
333                             "relationship-label": "org.onap.relationships.inventory.Uses",
334                             "related-link": "/aai/v14/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vLB",
335                             "relationship-data": [
336                                 {
337                                     "relationship-key": "customer.global-customer-id",
338                                     "relationship-value": "Demonstration"
339                                 },
340                                 {
341                                     "relationship-key": "service-subscription.service-type",
342                                     "relationship-value": "vLB"
343                                 }
344                             ]
345                         },
346                         {
347                             "related-to": "service-subscription",
348                             "relationship-label": "org.onap.relationships.inventory.Uses",
349                             "related-link": "/aai/v14/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vIMS",
350                             "relationship-data": [
351                                 {
352                                     "relationship-key": "customer.global-customer-id",
353                                     "relationship-value": "Demonstration"
354                                 },
355                                 {
356                                     "relationship-key": "service-subscription.service-type",
357                                     "relationship-value": "vIMS"
358                                 }
359                             ]
360                         }
361                     ]
362                 }
363             }'
364
365
366 11.  Onboard the vFW HPA template. The templates can be gotten from the `demo <https://github.com/onap/demo>`_ repo. The heat and env files used are located in demo/heat/vFW_HPA/vFW/. Create a zip file using the files. For onboarding instructions see steps 4 to 9 of `vFWCL instantiation, testing and debugging <https://wiki.onap.org/display/DW/vFWCL+instantiation%2C+testing%2C+and+debuging>`_. Note that in step 5, only one VSP is created. For the VSP the option to submit for testing in step 5cii was not shown. So you can check in and certify the VSP and proceed to step 6.
367
368 12. Get the parameters (model info, model invarant id...etc) required to create a service instance via rest. This can be done by creating a service instance via VID as in step 10 of `vFWCL instantiation, testing and debugging <https://wiki.onap.org/display/DW/vFWCL+instantiation%2C+testing%2C+and+debuging>`_.  After creating the service instance, exec into the SO bpmn pod and look into the /app/logs/bpmn/debug.log file. Search for the service instance and look for its request details. Then populate the parameters required to create a service instance via rest in step 13 below.
369
370 13. Create a service instance rest request but do not create service instance yet. Specify OOF as the homing solution and multicloud as the orchestrator. Be sure to use a service instance name that does not exist and populate the parameters with values gotten from step 12.
371
372 ::
373
374     curl -k -X POST \
375     http://{{k8s}}:30277/onap/so/infra/serviceInstances/v6 \
376     -H 'authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== \
377     -H 'content-type: application/json' \
378     -d '{
379           "requestDetails":{
380               "modelInfo":{
381                   "modelInvariantId":"de7c3733-93c8-4740-ada5-c37b8bcc0aa8",
382                   "modelType":"service",
383                   "modelName":"ipsec",
384                   "modelVersion":"1.0",
385                   "modelVersionId":"48deb45c-ced1-4526-a070-4b162fe0a472",
386                   "modelUuid":"48deb45c-ced1-4526-a070-4b162fe0a472",
387                   "modelInvariantUuid":"de7c3733-93c8-4740-ada5-c37b8bcc0aa8"
388               },
389               "requestInfo":{
390                   "source":"VID",
391                   "instanceName":"ipsec-testing",
392                   "suppressRollback":false,
393                   "requestorId":"demo"
394               },
395               "subscriberInfo":{
396                   "globalSubscriberId":"Demonstration"
397               },
398               "requestParameters":{
399                   "subscriptionServiceType":"vFW",
400                   "aLaCarte":true,
401                   "testApi":"VNF_API",
402                   "userParams":[
403                       {
404                        "name":"Customer_Location",
405                        "value":{
406                            "customerLatitude":"32.897480",
407                            "customerLongitude":"97.040443",
408                            "customerName":"some_company"
409                         }
410                       },
411                       {
412                        "name":"Homing_Solution",
413                        "value":"oof"
414                       },
415                       {
416                        "name":"orchestrator",
417                        "value":"multicloud"
418                       }
419                   ]
420               },
421               "project":{
422                   "projectName":"Project-Demonstration"
423               },
424               "owningEntity":{
425                   "owningEntityId":"fed3fd5c-5c82-46d7-b040-5f4837cc9e52",
426                   "owningEntityName":"OE-Demonstration"
427               }
428           }
429     }'
430
431
432 14. Get the resourceModuleName to be used for creating policies. This can be gotten from the CSAR file of the service model created. However, an easy way to get the resourceModuleName is to send the service instance create request in step 13 above. This will fail as there are no policies but you can then go into the bpmn debug.log file and get its value by searching for resourcemodulename.
433
434 15. Create policies. For instructions to do this, look in **method 2 (Manual upload)** of `OOF - HPA guide for integration testing <https://wiki.onap.org/display/DW/OOF+-+HPA+guide+for+integration+testing>`_. Put in the correct resouceModuleName. This is located in the resources section of the rest request. For example the resourceModuleName in the distance policy is 7400fd06C75f4a44A68f.
435
436 16. Do a get to verify all the polcies have been put in correctly. This can be done by doing an exec into the policy-pdp pod and running the following curl command.
437
438 ::
439
440     curl -k -v -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": "OSDF_DUBLIN.*", "configAttributes": {"policyScope": "us"}}' 'https://pdp:8081/pdp/api/getConfig' | python -m json.tool
441
442 To Update a policy, use the following curl command. Modify the policy as required
443
444 ::
445
446     curl -k -v  -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
447         "configBody": "{\"service\":\"hpaPolicy\",\"guard\":\"False\",\"content\":{\"flavorFeatures\":[{\"directives\":[{\"attributes\":[{\"attribute_value\":\"\",\"attribute_name\":\"firewall_flavor_name\"}],\"type\":\"flavor_directives\"}],\"type\":\"vnfc\",\"flavorProperties\":[{\"mandatory\":\"True\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"2\",\"unit\":\"\",\"operator\":\"=\",\"hpa-attribute-key\":\"numVirtualCpu\"},{\"hpa-attribute-value\":\"8\",\"unit\":\"MB\",\"operator\":\"=\",\"hpa-attribute-key\":\"virtualMemSize\"}],\"directives\":[],\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"hpa-feature\":\"basicCapabilities\"},{\"mandatory\":\"True\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"2\",\"unit\":\"MB\",\"operator\":\"=\",\"hpa-attribute-key\":\"memoryPageSize\"}],\"directives\":[],\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"hpa-feature\":\"hugePages\"},{\"hpa-feature\":\"localStorage\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"diskSize\",\"hpa-attribute-value\":\"10\",\"operator\":\">=\",\"unit\":\"GB\"}]},{\"mandatory\":\"False\",\"score\":\"100\",\"directives\":[],\"hpa-version\":\"v1\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"1\",\"unit\":\"\",\"operator\":\"=\",\"hpa-attribute-key\":\"pciCount\"},{\"hpa-attribute-value\":\"8086\",\"unit\":\"\",\"operator\":\"=\",\"hpa-attribute-key\":\"pciVendorId\"},{\"hpa-attribute-value\":\"37c9\",\"unit\":\"\",\"operator\":\"=\",\"hpa-attribute-key\":\"pciDeviceId\"}],\"architecture\":\"vf\",\"hpa-feature\":\"pciePassthrough\"}],\"id\":\"vfw\"},{\"directives\":[{\"attributes\":[{\"attribute_value\":\"\",\"attribute_name\":\"packetgen_flavor_name\"}],\"type\":\"flavor_directives\"}],\"type\":\"vnfc\",\"flavorProperties\":[{\"mandatory\":\"True\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"1\",\"operator\":\">=\",\"hpa-attribute-key\":\"numVirtualCpu\"},{\"hpa-attribute-value\":\"7\",\"unit\":\"GB\",\"operator\":\">=\",\"hpa-attribute-key\":\"virtualMemSize\"}],\"directives\":[],\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"hpa-feature\":\"basicCapabilities\"},{\"hpa-feature\":\"localStorage\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"diskSize\",\"hpa-attribute-value\":\"10\",\"operator\":\">=\",\"unit\":\"GB\"}]}],\"id\":\"vgenerator\"},{\"directives\":[{\"attributes\":[{\"attribute_value\":\"\",\"attribute_name\":\"sink_flavor_name\"}],\"type\":\"flavor_directives\"}],\"id\":\"vsink\",\"type\":\"vnfc\",\"flavorProperties\":[{\"mandatory\":\"True\",\"directives\":[],\"hpa-version\":\"v1\",\"hpa-feature-attributes\":[],\"architecture\":\"generic\",\"hpa-feature\":\"basicCapabilities\"}]}],\"policyType\":\"hpa\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"hpa-vFW\",\"resources\":[\"vFW\",\"A5ece5a02e86450391d6\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"HPApolicyforvFW\",\"policyName\":\"OSDF_CASABLANCA.hpa_policy_vFW_1\",\"version\":\"test1\",\"riskType\":\"test\"}",
448         "policyName": "OSDF_DUBLIN.hpa_policy_vIPsec_1",
449         "policyConfigType": "MicroService",
450         "onapName": "SampleDemo",
451         "policyScope": "OSDF_DUBLIN"
452     }' 'https://pdp:8081/pdp/api/updatePolicy'
453
454
455 To delete a policy, use two commands below to delete from PDP and PAP
456
457 **DELETE POLICY INSIDE PDP**
458
459 ::
460
461     curl -k -v -H 'Content-Type: application/json' \
462      -H 'Accept: application/json' \
463      -H 'ClientAuth: cHl0aG9uOnRlc3Q=' \
464      -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' \
465      -H 'Environment: TEST' \
466      -X DELETE \
467      -d '{"policyName": "OSDF_DUBLIN.Config_MS_vnfPolicy_vIPsec.1.xml","policyComponent":"PDP","policyType":"MicroService","pdpGroup":"default"}' https://pdp:8081/pdp/api/deletePolicy
468
469
470 **DELETE POLICY INSIDE PAP**
471
472 ::
473
474     curl -k -v -H 'Content-Type: application/json' \
475     -H 'Accept: application/json' \
476     -H 'ClientAuth: cHl0aG9uOnRlc3Q=' \
477     -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' \
478     -H 'Environment: TEST' \
479     -X DELETE \
480     -d '{"policyName": "OSDF_DUBLIN.Config_MS_vnfPolicy_vIPsec.1.xml","policyComponent":"PAP","policyType":"Optimization","deleteCondition":"ALL"}' https://pdp:8081/pdp/api/deletePolicy
481
482 Below provides one HPA policy example for test cases one
483
484 **Test 1 (Basic)**
485
486 Create Policy
487
488 ::
489
490     curl -k -v  -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
491     "configBody": "{\"service\":\"hpaPolicy\",\"guard\":\"False\",\"content\":{\"flavorFeatures\":[{\"directives\":[{\"attributes\":[{\"attribute_value\":\"\",\"attribute_name\":\"firewall_flavor_name\"}],\"type\":\"flavor_directives\"}],\"type\":\"vnfc\",\"flavorProperties\":[{\"mandatory\":\"True\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"2\",\"unit\":\"\",\"operator\":\"=\",\"hpa-attribute-key\":\"numVirtualCpu\"},{\"hpa-attribute-value\":\"512\",\"unit\":\"MB\",\"operator\":\">=\",\"hpa-attribute-key\":\"virtualMemSize\"}],\"directives\":[],\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"hpa-feature\":\"basicCapabilities\"},{\"mandatory\":\"True\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"2\",\"unit\":\"MB\",\"operator\":\"=\",\"hpa-attribute-key\":\"memoryPageSize\"}],\"directives\":[],\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"hpa-feature\":\"hugePages\"},{\"hpa-feature\":\"localStorage\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"diskSize\",\"hpa-attribute-value\":\"10\",\"operator\":\">=\",\"unit\":\"GB\"}]},{\"mandatory\":\"False\",\"score\":\"100\",\"directives\":[],\"hpa-version\":\"v1\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"isolate\",\"unit\":\"\",\"operator\":\"=\",\"hpa-attribute-key\":\"logicalCpuThreadPinningPolicy\"},{\"hpa-attribute-value\":\"dedicated\",\"unit\":\"\",\"operator\":\"=\",\"hpa-attribute-key\":\"logicalCpuPinningPolicy\"}],\"architecture\":\"generic\",\"hpa-feature\":\"cpuPinning\"}],\"id\":\"vfw\"},{\"directives\":[{\"attributes\":[{\"attribute_value\":\"\",\"attribute_name\":\"packetgen_flavor_name\"}],\"type\":\"flavor_directives\"}],\"type\":\"vnfc\",\"flavorProperties\":[{\"mandatory\":\"True\",\"hpa-feature-attributes\":[{\"hpa-attribute-value\":\"1\",\"operator\":\">=\",\"hpa-attribute-key\":\"numVirtualCpu\"},{\"hpa-attribute-value\":\"7\",\"unit\":\"GB\",\"operator\":\">=\",\"hpa-attribute-key\":\"virtualMemSize\"}],\"directives\":[],\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"hpa-feature\":\"basicCapabilities\"},{\"hpa-feature\":\"localStorage\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"diskSize\",\"hpa-attribute-value\":\"10\",\"operator\":\">=\",\"unit\":\"GB\"}]}],\"id\":\"vgenerator\"},{\"directives\":[{\"attributes\":[{\"attribute_value\":\"\",\"attribute_name\":\"sink_flavor_name\"}],\"type\":\"flavor_directives\"}],\"id\":\"vsink\",\"type\":\"vnfc\",\"flavorProperties\":[{\"mandatory\":\"True\",\"directives\":[],\"hpa-version\":\"v1\",\"hpa-feature-attributes\":[],\"architecture\":\"generic\",\"hpa-feature\":\"basicCapabilities\"}]}],\"policyType\":\"hpa\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"hpa-vFW\",\"resources\":[\"vFW\",\"Ipsec\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"HPApolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.hpa_policy_vFWHPA_1\",\"version\":\"1.0\",\"riskType\":\"test\"}",
492     "policyName": "OSDF_DUBLIN.hpa_policy_IPsec_1",
493     "policyConfigType": "Optimization",
494     "onapName": "SampleDemo",
495     "policyScope": "OSDF_DUBLIN"
496     }' 'https://pdp:8081/pdp/api/createPolicy'
497
498
499
500 Push Policy
501
502 ::
503
504         curl -k -v  -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{
505         "pdpGroup": "default",
506         "policyName": "OSDF_DUBLIN.hpa_policy_IPsec_1",
507         "policyType": "MicroService"
508         }' 'https://pdp:8081/pdp/api/pushPolicy'
509
510
511
512 17. Create Service Instance using step 13 above
513
514 18. Check bpmn logs to ensure that OOF sent homing response and flavor directives.
515
516 19. Create vnf using VID as in 10f and 10g in `vFWCL instantiation, testing and debugging <https://wiki.onap.org/display/DW/vFWCL+instantiation%2C+testing%2C+and+debuging>`_.
517
518 20. Do SDNC Preload. Instructions for this can be found in this `video <https://wiki.onap.org/display/DW/Running+the+ONAP+Demos?preview=/1015891/16010290/vFW_closed_loop.mp4>`_ (Fast forward to 3:55 in the video). The contents of my preload file are shown below;
519
520 ::
521
522     {
523         "input": {
524             "request-information": {
525                 "notification-url": "openecomp.org",
526                 "order-number": "1",
527                 "order-version": "1",
528                 "request-action": "PreloadVNFRequest",
529                 "request-id": "test"
530             },
531             "sdnc-request-header": {
532                 "svc-action": "reserve",
533                 "svc-notification-url": "http://openecomp.org:8080/adapters/rest/SDNCNotify",
534                 "svc-request-id": "test"
535             },
536             "vnf-topology-information": {
537                 "vnf-assignments": {
538                     "availability-zones": [],
539                     "vnf-networks": [],
540                     "vnf-vms": []
541                 },
542
543
544                 "vnf-parameters": [
545                     {
546                      "vnf-parameter-name":"vf_module_id",
547                      "vnf-parameter-value":"Ipsec..base_vipsec..module-0"
548                     },
549                     {
550                      "vnf-parameter-name":"vipsec_name_0",
551                      "vnf-parameter-value":"ipsec01"
552                     },
553                     {
554                      "vnf-parameter-name":"ipsec_provider_net_id",
555                      "vnf-parameter-value":"private-1"
556                     },
557                     {
558                      "vnf-parameter-name":"output_interface_B",
559                      "vnf-parameter-value":"0000:00:06.0"
560                     },
561                     {
562                      "vnf-parameter-name":"ipsec_private_net_id",
563                      "vnf-parameter-value":"ipsec_net"
564                     },
565                     {
566                      "vnf-parameter-name":"onap_private_net_id",
567                      "vnf-parameter-value":"oam_onap_test"
568                     },
569                     {
570                      "vnf-parameter-name":"vipsec_B_private_ip_1",
571                      "vnf-parameter-value":"20.0.100.8"
572                     },
573                     {
574                      "vnf-parameter-name":"vipsec_B_private_ip_0",
575                      "vnf-parameter-value":"192.168.80.100"
576                     },
577                     {
578                      "vnf-parameter-name":"vipsec_B_private_ip_2",
579                      "vnf-parameter-value":"192.168.100.4"
580                     },
581                     {
582                      "vnf-parameter-name":"router_name",
583                      "vnf-parameter-value":"external"
584                     },
585                     {
586                      "vnf-parameter-name":"vipsec_private_2_port_vnic_type",
587                      "vnf-parameter-value":"direct"
588                     },
589                     {
590                      "vnf-parameter-name":"vipsec_A_private_ip_0",
591                      "vnf-parameter-value":"192.168.70.100"
592                     },
593                     {
594                      "vnf-parameter-name":"vipsec_A_private_ip_1",
595                      "vnf-parameter-value":"20.0.100.7"
596                     },
597                     {
598                      "vnf-parameter-name":"onap_private_subnet_id",
599                      "vnf-parameter-value":"oam_onap_test"
600                     },
601                     {
602                      "vnf-parameter-name":"vipsec_name_1",
603                      "vnf-parameter-value":"ipsec02"
604                     },
605                     {
606                      "vnf-parameter-name":"onap_private_net_cidr",
607                      "vnf-parameter-value":"20.0.0.0/16"
608                     },
609                     {
610                      "vnf-parameter-name":"install_script_version",
611                      "vnf-parameter-value":"1.4.0-SNAPSHOT"
612                     },
613                     {
614                      "vnf-parameter-name":"protected_clientA_private_net_id",
615                      "vnf-parameter-value":"private_net_clientA"
616                     },
617                     {
618                      "vnf-parameter-name":"protected_clientB_private_net_id",
619                      "vnf-parameter-value":"private_net_clientB"
620                     },
621                     {
622                      "vnf-parameter-name":"packetgen_flavor_name",
623                      "vnf-parameter-value":"m1.medium"
624                     },
625                     {
626                      "vnf-parameter-name":"protected_clientB_private_net_cidr",
627                       "vnf-parameter-value":"192.168.80.0/24"
628                     },
629                     {
630                      "vnf-parameter-name":"ipsec_private_net_cidr",
631                      "vnf-parameter-value":"192.168.100.0/24"
632                     },
633                     {
634                       "vnf-parameter-name":"cloud_env",
635                       "vnf-parameter-value":"openstack"
636                      },
637                     {
638                       "vnf-parameter-name":"key_name",
639                       "vnf-parameter-value":"vipsec_key"
640                     },
641                     {
642                       "vnf-parameter-name":"ipsec_B_MAC_address",
643                       "vnf-parameter-value":"11:11:11:11:00:11"
644                     },
645                     {
646                       "vnf-parameter-name":"vpg_name_0",
647                       "vnf-parameter-value":"vpg01"
648                     },
649                     {
650                       "vnf-parameter-name":"input_device_interface_A",
651                       "vnf-parameter-value":"VirtualFunctionEthernet0/5/0"
652                       },
653                     {
654                       "vnf-parameter-name":"input_device_interface_B",
655                       "vnf-parameter-value":"VirtualFunctionEthernet0/6/0"
656                     },
657                     {
658                       "vnf-parameter-name":"input_interface_B",
659                       "vnf-parameter-value":"0000:00:05.0"
660                     },
661                     {
662                       "vnf-parameter-name":"vsn_private_1_port_vnic_type",
663                       "vnf-parameter-value":"normal"
664                     },
665                     {
666                       "vnf-parameter-name":"vnf_id",
667                       "vnf-parameter-value":"vIPsec_demo_app"
668                     },
669                     {
670                       "vnf-parameter-name":"vipsec_B_private_0_port_vnic_type",
671                       "vnf-parameter-value":"direct"
672                     },
673                     {
674                       "vnf-parameter-name":"ipsec_A_MAC_address",
675                       "vnf-parameter-value":"1:00:00:00:00:01"
676                     },
677                     {
678                        "vnf-parameter-name":"input_interface_A",
679                        "vnf-parameter-value":"0000:00:05.0"
680                     },
681                     {
682                       "vnf-parameter-name":"vpg_private_ip_0",
683                       "vnf-parameter-value":"192.168.70.200"
684                     },
685                     {
686                       "vnf-parameter-name":"vpg_private_ip_1",
687                       "vnf-parameter-value":"20.0.100.10"
688                     },
689                     {
690                       "vnf-parameter-name":"vsn_private_ip_0",
691                       "vnf-parameter-value":"192.168.80.250"
692                     },
693                     {
694                       "vnf-parameter-name":"vsn_private_ip_1",
695                       "vnf-parameter-value":"20.0.100.9"
696                      },
697                     {
698                       "vnf-parameter-name":"sink_flavor_name",
699                       "vnf-parameter-value":"m1.medium"
700                     },
701                     {
702                       "vnf-parameter-name":"protected_clientA_private_net_cidr",
703                       "vnf-parameter-value":"192.168.70.0/24"
704                     },
705                     {
706                       "vnf-parameter-name":"output_device_interface_A",
707                       "vnf-parameter-value":"VirtualFunctionEthernet0/6/0"
708                     },
709                     {
710                       "vnf-parameter-name":"output_device_interface_B",
711                       "vnf-parameter-value":"VirtualFunctionEthernet0/5/0"
712                     },
713                     {
714                       "vnf-parameter-name":"vpg_private_1_port_vnic_type",
715                       "vnf-parameter-value":"normal"
716                     },
717                     {
718                       "vnf-parameter-name":"basic_image_name",
719                       "vnf-parameter-value":"ubuntu-16.04"
720                     },
721                     {
722                       "vnf-parameter-name":"vipsec_private_1_port_vnic_type",
723                       "vnf-parameter-value":"normal"
724                     },
725                     {
726                       "vnf-parameter-name":"vpg_private_0_port_vnic_type",
727                       "vnf-parameter-value":"direct"
728                     },
729                     {
730                       "vnf-parameter-name":"vipsec_A_private_0_port_vnic_type",
731                       "vnf-parameter-value":"direct"
732                     },
733                     {
734                       "vnf-parameter-name":"vipsec_image_name",
735                       "vnf-parameter-value":"ubuntu-16.04"
736                      },
737                     {
738                       "vnf-parameter-name":"protected_clientA_provider_net_id",
739                       "vnf-parameter-value":"private-1"
740                     },
741                     {
742                        "vnf-parameter-name":"ipsec_flavor_name",
743                        "vnf-parameter-value":"onap.hpa.flavor33"
744                     },
745                     {
746                       "vnf-parameter-name":"ipsec_config",
747                       "vnf-parameter-value":"/opt/config/ipsec.config"
748                     },
749                     {
750                       "vnf-parameter-name":"vipsec_A_private_ip_2",
751                       "vnf-parameter-value":"192.168.100.3"
752                     },
753                     {
754                       "vnf-parameter-name":"vsn_private_0_port_vnic_type",
755                       "vnf-parameter-value":"direct"
756                     },
757                     {
758                       "vnf-parameter-name":"public_net_id",
759                       "vnf-parameter-value":"external"
760                     },
761                     {
762                       "vnf-parameter-name":"vsn_name_0",
763                       "vnf-parameter-value":"vsn01"
764                     },
765                     {
766                       "vnf-parameter-name":"protected_clientB_provider_net_id",
767                       "vnf-parameter-value":"private-1"
768                     },
769                     {
770                       "vnf-parameter-name":"demo_artifacts_version",
771                       "vnf-parameter-value":"1.4.0-SNAPSHOT"
772                     },
773                     {
774                       "vnf-parameter-name":"vpp_config",
775                       "vnf-parameter-value":"/opt/config/vpp.config"
776                     },
777                     {
778                       "vnf-parameter-name":"output_interface_A",
779                       "vnf-parameter-value":"0000:00:06.0"
780                     },
781                     {
782                       "vnf-parameter-name": "template_type",
783                       "vnf-parameter-value": "heat"
784                     }
785                 ],
786                 "vnf-topology-identifier": {
787                     "generic-vnf-name": "Ipsec",
788                     "generic-vnf-type": "ipsec 0",
789                     "service-type": "8c071bd1-c361-4157-8282-3fef7689d32e",
790                     "vnf-name": "ipsec-test",
791                     "vnf-type": "Ipsec..base_vipsec..module-0"
792
793                 }
794             }
795         }}
796
797
798 Change parameters based on your environment.
799
800 **Note**
801
802 ::
803
804     "generic-vnf-name": "Ipsec",     <-- NAME GIVEN TO VNF
805     "generic-vnf-type": "ipsec 0",   <-- can be found on VNF dialog screen get the part of the VNF-TYPE after the '/'
806     "service-type": "8c071bd1-c361-4157-8282-3fef7689d32e",  <-- same as Service Instance ID
807     "vnf-name": "ipsec-test",  <-- name to be given to the vf module
808     "vnf-type": "Ipsec..base_vipsec..module-0" <-- can be found on the VID - VF Module dialog screen - Model Name
809
810 21. Create vf module (11g of `vFWCL instantiation, testing and debugging <https://wiki.onap.org/display/DW/vFWCL+instantiation%2C+testing%2C+and+debuging>`_). If everything worked properly, you should see the stack created in your VIM(WR titanium cloud openstack in this case).