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.

  1. 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 )
  2. To add/remove HPA Capabilities edit the flavors section in the body of PUT Cloud-Region{x}
  3. Once all the necessary Use postman to add the complex and cloud regions in the order specified below
  4. 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

  1. Select Policy→Dictionary from left panel
  2. 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

  1. Select Policy→Dictionary from left panel
  2. Select MicroService Policy from Policy Type Dictionary drop down
  3. Select MicroService Models from Select Dictionary drop down
  4. Click on the CREATE button.
  5. 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'
Push 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 '{
"pdpGroup": "default",
"policyName": "OSDF_CASABLANCA.hpa_policy_vFW_1",
"policyType": "MicroService"
}' 'https://pdp:8081/pdp/api/pushPolicy'
Create Optimiazation 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\": \"optimizationPolicy\", \"guard\": \"False\", \"content\": {\"policyType\": \"placement_optimization\", \"objective\": \"minimize\", \"objectiveParameter\": {\"operator\": \"sum\", \"parameterAttributes\": [{\"parameter\": \"distance\", \"operator\": \"product\", \"customerLocationInfo\": \"customer_loc\", \"weight\": \"1\", \"resources\": [\"vGMuxInfra\"]}, {\"parameter\": \"distance\", \"operator\": \"product\", \"customerLocationInfo\": \"customer_loc\", \"weight\": \"1\", \"resources\": [\"vG\"]}, {\"parameter\": \"hpa_score\", \"operator\": \"product\", \"weight\": \"200\", \"resources\": [\"vG\"]}, {\"parameter\": \"distance\", \"operator\": \"product\", \"customerLocationInfo\": \"customer_loc\", \"weight\": \"100\", \"resources\": [\"vFW\", \"7400fd06C75f4a44A68f\"]}, {\"parameter\": \"hpa_score\", \"operator\": \"product\", \"weight\": \"200\", \"resources\": [\"vFW\", \"7400fd06C75f4a44A68f\"]}]}, \"identity\": \"optimization\", \"policyScope\": [\"vcpe\", \"us\", \"international\", \"ip\", \"vGMuxInfra\", \"vG\", \"vfw\"]}, \"priority\": \"5\", \"templateVersion\": \"OpenSource.version.1\", \"riskLevel\": \"3\", \"description\": \"Placement Optimization Policy for vGMuxInfra\", \"policyName\": \"OSDF_CASABLANCA.Placement_Optimization_1\", \"version\": \"test1\", \"riskType\": \"test\"}",
    "policyName": "OSDF_CASABLANCA.Placement_Optimization_1",
    "policyConfigType": "MicroService",
    "onapName": "SampleDemo",
    "policyScope": "OSDF_CASABLANCA"
}' 'https://pdp:8081/pdp/api/createPolicy'
Push Optimization 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.Placement_Optimization_1",
"policyType": "MicroService"
}' 'https://pdp:8081/pdp/api/pushPolicy'
Create Query 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\": \"queryPolicy\", \"guard\": \"False\", \"content\": {\"policyType\": \"request_param_query\", \"queryProperties\": [{\"attribute\": \"customerLatitude\", \"attribute_location\": \"customerLatitude\"}, {\"attribute\": \"customerLongitude\", \"attribute_location\": \"customerLongitude\"}], \"identity\": \"vFW_Query_Policy\", \"serviceName\": \"vFW\", \"policyScope\": [\"vfw\", \"us\", \"international\", \"ip\"]}, \"priority\": \"3\", \"templateVersion\": \"OpenSource.version.1\", \"riskLevel\": \"2\", \"description\": \"Query policy for vFW\", \"policyName\": \"OSDF_CASABLANCA.QueryPolicy_vFW\", \"version\": \"test1\", \"riskType\": \"test\"}",
    "policyName": "OSDF_CASABLANCA.QueryPolicy_vFW",
    "policyConfigType": "MicroService",
    "onapName": "SampleDemo",
    "policyScope": "OSDF_CASABLANCA"
}' 'https://pdp:8081/pdp/api/createPolicy'
Push Query 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.QueryPolicy_vFW",
"policyType": "MicroService"
}' 'https://pdp:8081/pdp/api/pushPolicy'
Create VNF 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\": \"vnfPolicy\", \"guard\": \"False\", \"content\": {\"policyType\": \"vnfPolicy\", \"policyScope\": [\"vfw\", \"us\", \"international\", \"ip\"], \"identity\": \"vnf_vFW\", \"resources\": [\"vFW\", \"7400fd06C75f4a44A68f\"], \"applicableResources\": \"any\", \"vnfProperties\": [{\"equipmentRole\": \"\", \"inventoryProvider\": \"aai\", \"inventoryType\": \"cloud\", \"serviceType\": \"\", \"customerId\": \"\", \"orchestrationStatus\": \"\"}]}, \"priority\": \"6\", \"templateVersion\": \"OpenSource.version.1\", \"riskLevel\": \"3\", \"description\": \"vnfPolicy\", \"policyName\": \"OSDF_CASABLANCA.vnfPolicy_vFW\", \"version\": \"test1\", \"riskType\": \"test\"}",
    "policyName": "OSDF_CASABLANCA.vnfPolicy_vFW",
    "policyConfigType": "MicroService",
    "onapName": "SampleDemo",
    "policyScope": "OSDF_CASABLANCA"
}' 'https://pdp:8081/pdp/api/createPolicy'
Push VNF 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.vnfPolicy_vFW",
"policyType": "MicroService"
}' 'https://pdp:8081/pdp/api/pushPolicy'
  • No labels