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