OOF - HPA guide for integration testing
Disclaimer: We are using the HPA & Cloud Agnostic Intent - R3 Test Plan as reference. The postman given here are only for reference. Please make necessary edits according to the test plan.
Generating AAI data
Note: Required only if the Multicloud has no real cloud-regions and HPA discovery cannot happen.
If Multicloud team has data for creating the Cloud-region and doesn't have the HPA, then please update the existing data with the flavors with HPA.
Import the postman collection committed to the repository: https://gerrit.onap.org/r/gitweb?p=aai%2Ftest-config.git;hb=refs%2Fchanges%2F88%2F86588%2F1;f=testsuite%2Fdatacollections%2FOOF-HPA-Cloud-Agnostic-Intent-CASABLANCA.postman_collection.json (original version attached to wiki: CASABLANCA_AAI_postman.json )
To add/remove HPA Capabilities edit the flavors section in the body of PUT Cloud-Region{x}
Once all the necessary Use postman to add the complex and cloud regions in the order specified below
Use the GET requests to verify the data.
Creating Policy
Note: For testing purposes, policies go hand in hand with the available HPA capabilities. This means for a matching homing solution to be identified, we have to inject policies that is a subset of available HPA capabilities.
Login to Policy GUI by using the pap port https://${k8s_node_ip}:30219/onap/login.htm credentials are demo/demo
Wiki reference for Policy GUI - Policy OOF HPA. The models in this wiki might not be the latest. Please refer below for the OOF Policy models.
Create Policy model
Using the policy GUI upload all the policy models in the portal using either Method 1 or Method 2.
Method 1 (Import CSV)
Shortcurt to upload model - Not tested
Select Policy→Dictionary from left panel
Click on the Import Dictionary's button and use the OOFPolicyDictionary_For_Import.csv to import models.
Method 2 (Manual upload)
Manual Method to Upload models by creating dictionary as per the below screen shots.
OOF Policy models including HPA available here OOF Policy Tosca Models
Select Policy→Dictionary from left panel
Select MicroService Policy from Policy Type Dictionary drop down
Select MicroService Models from Select Dictionary drop down
Click on the Create button.
Creating menu is self explanatory, please give same version for all the models imported together.
Create and Push Policy
Login to any pod (We OSDF) - and use the pdp servicename and port using the curl commands below.
Create Distance Policy for vFW
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 '{
"configBody": "{\"service\": \"distancePolicy\", \"guard\": \"False\", \"content\": {\"policyType\": \"distance_to_location\", \"applicableResources\": \"any\", \"identity\": \"distance-vFW\", \"policyScope\": [\"vfw\", \"us\", \"international\", \"ip\"], \"distanceProperties\": {\"distance\": {\"value\": \"100\", \"unit\": \"km\", \"operator\": \"<\"}, \"locationInfo\": \"customer_loc\"}, \"resources\": [\"vFW\", \"7400fd06C75f4a44A68f\"]}, \"priority\": \"3\", \"templateVersion\": \"OpenSource.version.1\", \"riskLevel\": \"2\", \"description\": \"Distance Policy for vFW\", \"policyName\": \"OSDF_CASABLANCA.Distance_vFW_1\", \"version\": \"test1\", \"riskType\": \"test\"}",
"policyName": "OSDF_CASABLANCA.Distance_vFW_1",
"policyConfigType": "MicroService",
"onapName": "SampleDemo",
"policyScope": "OSDF_CASABLANCA"
}' 'https://pdp:8081/pdp/api/createPolicy'
Push Distance Policy for vFW
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 '{
"pdpGroup": "default",
"policyName": "OSDF_CASABLANCA.Distance_vFW_1",
"policyType": "MicroService"
}' 'https://pdp:8081/pdp/api/pushPolicy'
Create HPA Policy for vFW
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 '{
"configBody": "{\"service\": \"hpaPolicy\", \"guard\": \"False\", \"content\": {\"flavorFeatures\": [{\"directives\": [{\"attributes\": [{\"attribute_value\": \"\", \"attribute_name\": \"label_1\"}], \"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\": \"\", \"operator\": \"=\", \"hpa-attribute-key\": \"numaNodes\"}, {\"hpa-attribute-value\": \"2\", \"operator\": \"=\", \"hpa-attribute-key\": \"numaCpu-0\"}, {\"hpa-attribute-value\": \"4\", \"operator\": \"=\", \"hpa-attribute-key\": \"numaCpu-1\"}, {\"hpa-attribute-value\": \"2\", \"unit\": \"GB\", \"operator\": \"=\", \"hpa-attribute-key\": \"numaMem-0\"}, {\"hpa-attribute-value\": \"4\", \"unit\": \"GB\", \"operator\": \"=\", \"hpa-attribute-key\": \"numaMem-1\"}], \"directives\": [], \"hpa-version\": \"v1\", \"architecture\": \"generic\", \"hpa-feature\": \"numa\"}, {\"mandatory\": \"True\", \"hpa-feature-attributes\": [{\"hpa-attribute-value\": \"2\", \"unit\": \"MB\", \"operator\": \"=\", \"hpa-attribute-key\": \"memoryPageSize\"}, {\"hpa-attribute-value\": \"4\", \"operator\": \"=\", \"hpa-attribute-key\": \"numberOfPages\"}], \"directives\": [], \"hpa-version\": \"v1\", \"architecture\": \"generic\", \"hpa-feature\": \"hugePages\"}, {\"mandatory\": \"False\", \"score\": \"100\", \"directives\": [{\"attributes\": [{\"attribute_value\": \"direct\", \"attribute_name\": \"oof_returned_vnic_type_for_firewall_protected\"}], \"type\": \"sriovNICNetwork_directives\"}], \"hpa-version\": \"v1\", \"hpa-feature-attributes\": [{\"hpa-attribute-value\": \"1\", \"unit\": \"\", \"operator\": \"=\", \"hpa-attribute-key\": \"pciCount\"}, {\"hpa-attribute-value\": \"1234\", \"unit\": \"\", \"operator\": \"=\", \"hpa-attribute-key\": \"pciVendorId\"}, {\"hpa-attribute-value\": \"7890\", \"unit\": \"\", \"operator\": \"=\", \"hpa-attribute-key\": \"pciDeviceId\"}], \"architecture\": \"Intel64\", \"hpa-feature\": \"sriovNICNetwork\"}], \"id\": \"vfw_1\"}, {\"directives\": [{\"attributes\": [{\"attribute_value\": \"\", \"attribute_name\": \"label_2\"}], \"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\"}], \"id\": \"vfw_2\"}, {\"directives\": [{\"attributes\": [{\"attribute_value\": \"\", \"attribute_name\": \"label_3\"}], \"type\": \"flavor_directives\"}], \"id\": \"vfw_3\", \"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\", \"7400fd06C75f4a44A68f\"]}, \"priority\": \"3\", \"templateVersion\": \"OpenSource.version.1\", \"riskLevel\": \"2\", \"description\": \"HPA policy for vFW\", \"policyName\": \"OSDF_CASABLANCA.hpa_policy_vFW_1\", \"version\": \"test1\", \"riskType\": \"test\"}",
"policyName": "OSDF_CASABLANCA.hpa_policy_vFW_1",
"policyConfigType": "MicroService",
"onapName": "SampleDemo",
"policyScope": "OSDF_CASABLANCA"
}' 'https://pdp:8081/pdp/api/createPolicy'