Fixed Bugs in HPA automtion script

Signed-off-by: Itohan Ukponmwan <itohan.ukponmwan@intel.com>
Issue-ID: INT-1137
Change-Id: Ib681f797bb9ed631cfe36507425bcbd1fc2b5561
diff --git a/test/hpa_automation/heat/hpa_automation.py b/test/hpa_automation/heat/hpa_automation.py
index bd893d7..ab1d8d0 100755
--- a/test/hpa_automation/heat/hpa_automation.py
+++ b/test/hpa_automation/heat/hpa_automation.py
@@ -483,6 +483,7 @@
 service_dict = create_service_instance(parameters, service_model_list)
 print "service instance parameters={}".format(service_dict)
 service_model_uuid = service_dict["service_uuid"]
+time.sleep(2)
 db_dict = query_db(parameters, service_model_uuid, vf_id)
 
 #Wait for Service instance to be created then create VNF Instance
diff --git a/test/hpa_automation/heat/hpa_automation_config.json b/test/hpa_automation/heat/hpa_automation_config.json
index 70ec268..9587ffd 100755
--- a/test/hpa_automation/heat/hpa_automation_config.json
+++ b/test/hpa_automation/heat/hpa_automation_config.json
@@ -13,7 +13,7 @@
 "sdc_governor" : "gv0001",
 "sdc_operator" : "op0001",
 "csar-file-path" : "/root/vfw_hpa.zip",
-"sdnc_url" : "http://10.12.5.110:30208",
+"sdnc_url" : "https://10.12.5.110:30267",
 "sdnc_user" : "admin",
 "sdnc_password" : "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",
 "sdnc_preload_file" : "/root/integration/test/hpa_automation/heat/sample_vfw_hpa_preload.txt",
@@ -137,7 +137,7 @@
 "//" : "Onboarding parameters",
 "vendor-name" : "hpa-vendor",
 "entitlement-pool-name" : "hpa-pool",
-"start-date" : "09/30/2019",
+"start-date" : "10/08/2019",
 "expiry-date" : "12/31/2040",
 "key-group-name" : "hpa-key",
 "key-group-type" : "Universal",
diff --git a/test/hpa_automation/heat/sample_vfw_hpa_preload.txt b/test/hpa_automation/heat/sample_preload_files/sample_vfw_hpa_preload.txt
similarity index 97%
rename from test/hpa_automation/heat/sample_vfw_hpa_preload.txt
rename to test/hpa_automation/heat/sample_preload_files/sample_vfw_hpa_preload.txt
index 9e7289e..0f40d25 100644
--- a/test/hpa_automation/heat/sample_vfw_hpa_preload.txt
+++ b/test/hpa_automation/heat/sample_preload_files/sample_vfw_hpa_preload.txt
@@ -159,8 +159,8 @@
             "vnf-topology-identifier": {
            "generic-vnf-name": "vfw-hpa-vnf",
            "generic-vnf-type": "hpa-vf-0 0",
-         "service-type": "e34efe67-b461-4978-8462-2e1217da48c7",
-           "vnf-name": "vfw-cli-stack",
+         "service-type": "9545d48f-03da-467e-8994-ae0716e7372d",
+           "vnf-name": "vfw-sriov-cli",
            "vnf-type": "HpaVf0..base_vfw..module-0"
                 				
             }
diff --git a/test/hpa_automation/heat/sample_vfw_hpa_preload.txt b/test/hpa_automation/heat/sample_preload_files/sample_vfw_hpa_preload_sriov.txt
similarity index 89%
copy from test/hpa_automation/heat/sample_vfw_hpa_preload.txt
copy to test/hpa_automation/heat/sample_preload_files/sample_vfw_hpa_preload_sriov.txt
index 9e7289e..e0d3b03 100644
--- a/test/hpa_automation/heat/sample_vfw_hpa_preload.txt
+++ b/test/hpa_automation/heat/sample_preload_files/sample_vfw_hpa_preload_sriov.txt
@@ -43,17 +43,24 @@
                 },
 				 {
                     "vnf-parameter-name": "unprotected_private_net_id",
-                    "vnf-parameter-value": "unprotected_private_net_00"
+                    "vnf-parameter-value": "unprotected_private_net_11"
                 },
 				{
                     "vnf-parameter-name": "protected_private_net_id",
-                    "vnf-parameter-value": "protected_private_net_00"
+                    "vnf-parameter-value": "protected_private_net_11"
                 },
                 {
                     "vnf-parameter-name": "onap_private_net_id",
                     "vnf-parameter-value": "oam_onap_vnf_test"
                 },
-   
+                {
+                    "vnf-parameter-name": "protected_private_provider_net",
+                    "vnf-parameter-value": "a"
+                },
+                {
+                    "vnf-parameter-name": "unprotected_private_provider_net",
+                    "vnf-parameter-value": "b"
+                },
 
                 {
                     "vnf-parameter-name": "onap_private_subnet_id",
@@ -81,7 +88,7 @@
                 },
 				{
                     "vnf-parameter-name": "vfw_private_ip_2",
-                    "vnf-parameter-value": "10.0.200.1"
+                    "vnf-parameter-value": "10.0.100.11"
                 },
 				{
                     "vnf-parameter-name": "vpg_private_ip_0",
@@ -89,7 +96,7 @@
                 },
 				{
                     "vnf-parameter-name": "vpg_private_ip_1",
-                    "vnf-parameter-value": "10.0.200.2"
+                    "vnf-parameter-value": "10.0.100.12"
                 },
 				{
                     "vnf-parameter-name": "vsn_private_ip_0",
@@ -97,7 +104,7 @@
                 },
 				{
                     "vnf-parameter-name": "vsn_private_ip_1",
-                    "vnf-parameter-value": "10.0.200.3"
+                    "vnf-parameter-value": "10.0.100.13"
                 },
 				
 				{
@@ -159,8 +166,8 @@
             "vnf-topology-identifier": {
            "generic-vnf-name": "vfw-hpa-vnf",
            "generic-vnf-type": "hpa-vf-0 0",
-         "service-type": "e34efe67-b461-4978-8462-2e1217da48c7",
-           "vnf-name": "vfw-cli-stack",
+         "service-type": "9545d48f-03da-467e-8994-ae0716e7372d",
+           "vnf-name": "vfw-sriov-cli",
            "vnf-type": "HpaVf0..base_vfw..module-0"
                 				
             }
diff --git a/test/hpa_automation/heat/sample_vfw_policies/optimization_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/optimization_policy.txt
deleted file mode 100644
index 24c075b..0000000
--- a/test/hpa_automation/heat/sample_vfw_policies/optimization_policy.txt
+++ /dev/null
@@ -1 +0,0 @@
-{\"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\",\"resource_name\"]},{\"parameter\":\"hpa_score\",\"operator\":\"product\",\"weight\":\"200\",\"resources\":[\"vFW\",\"resource_name\"]}]},\"identity\":\"optimization\",\"policyScope\":[\"vcpe\",\"us\",\"international\",\"ip\",\"vGMuxInfra\",\"vG\",\"vfw\"]},\"priority\":\"5\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"3\",\"description\":\"PlacementOptimizationPolicyforvGMuxInfra\",\"policyName\":\"OSDF_CASABLANCA.Placement_Optimization_3\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/DistancePolicy.tx b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/DistancePolicy.tx
similarity index 82%
rename from test/hpa_automation/heat/sample_vfw_policies/DistancePolicy.tx
rename to test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/DistancePolicy.tx
index fcea468..55b7440 100644
--- a/test/hpa_automation/heat/sample_vfw_policies/DistancePolicy.tx
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/DistancePolicy.tx
@@ -1 +1 @@
-{\"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\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"DistancePolicyforvFW\",\"policyName\":\"OSDF_CASABLANCA.Distance_vFWHPA_2\",\"version\":\"test1\",\"riskType\":\"test\"}
+{\"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\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"DistancePolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.Distance_vFWHPA_2\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/hpa_policy_test1.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/hpa_policy_test1.txt
similarity index 97%
rename from test/hpa_automation/heat/sample_vfw_policies/hpa_policy_test1.txt
rename to test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/hpa_policy_test1.txt
index e1567db..545fd63 100644
--- a/test/hpa_automation/heat/sample_vfw_policies/hpa_policy_test1.txt
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/hpa_policy_test1.txt
@@ -1 +1 @@
-{\"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\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"HPApolicyforvFW\",\"policyName\":\"OSDF_CASABLANCA.hpa_policy_vFWHPA_2\",\"version\":\"test1\",\"riskType\":\"test\"}
+{\"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\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"HPApolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.hpa_policy_vFWHPA_2\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/optimization_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/optimization_policy.txt
new file mode 100644
index 0000000..5951d2e
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/optimization_policy.txt
@@ -0,0 +1 @@
+{\"service\":\"optimizationPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"placement_optimization\",\"objective\":\"minimize\",\"objectiveParameter\":{\"operator\":\"sum\",\"parameterAttributes\":[{\"parameter\":\"distance\",\"operator\":\"product\",\"customerLocationInfo\":\"customer_loc\",\"weight\":\"100\",\"resources\":[\"vFW\",\"resource_name\"]},{\"parameter\":\"hpa_score\",\"operator\":\"product\",\"weight\":\"200\",\"resources\":[\"vFW\",\"resource_name\"]}]},\"identity\":\"optimization\",\"policyScope\":[\"us\",\"international\",\"ip\",\"vfw\"]},\"priority\":\"5\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"3\",\"description\":\"PlacementOptimizationPolicyforvFWHPA\",\"policyName\":\"OSDF_DUBLIN.Placement_Optimization_vfw\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/query_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/query_policy.txt
similarity index 81%
rename from test/hpa_automation/heat/sample_vfw_policies/query_policy.txt
rename to test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/query_policy.txt
index 39fb116..96ee0fb 100644
--- a/test/hpa_automation/heat/sample_vfw_policies/query_policy.txt
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/query_policy.txt
@@ -1 +1 @@
-{\"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\":\"QuerypolicyforvFW\",\"policyName\":\"OSDF_CASABLANCA.QueryPolicy_vFWHPA_3\",\"version\":\"test1\",\"riskType\":\"test\"}
+{\"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\":\"QuerypolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.QueryPolicy_vFWHPA_3\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/vnf_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/vnf_policy.txt
similarity index 80%
rename from test/hpa_automation/heat/sample_vfw_policies/vnf_policy.txt
rename to test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/vnf_policy.txt
index 075c734..6449ac7 100644
--- a/test/hpa_automation/heat/sample_vfw_policies/vnf_policy.txt
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_1/vnf_policy.txt
@@ -1 +1 @@
-{\"service\":\"vnfPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"vnfPolicy\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"vnf_vFW\",\"resources\":[\"vFW\",\"resource_name\"],\"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_vFWHPA_3\",\"version\":\"test1\",\"riskType\":\"test\"}
+{\"service\":\"vnfPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"vnfPolicy\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"vnf_vFW\",\"resources\":[\"vFW\",\"resource_name\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"equipmentRole\":\"\",\"inventoryProvider\":\"aai\",\"inventoryType\":\"cloud\",\"serviceType\":\"\",\"customerId\":\"\",\"orchestrationStatus\":\"\"}]},\"priority\":\"6\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"3\",\"description\":\"vnfPolicy\",\"policyName\":\"OSDF_DUBLIN.vnfPolicy_vFWHPA_3\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/DistancePolicy.tx b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/DistancePolicy.tx
new file mode 100644
index 0000000..8ed5e87
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/DistancePolicy.tx
@@ -0,0 +1 @@
+{\"service\":\"distancePolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"distance_to_location\",\"applicableResources\":\"any\",\"identity\":\"distance-vFW-sriov\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"distanceProperties\":{\"distance\":{\"value\":\"100\",\"unit\":\"km\",\"operator\":\"<\"},\"locationInfo\":\"customer_loc\"},\"resources\":[\"vFW\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"DistancePolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.Distance_vFWHPA_sriov_1\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/hpa_policy_test2.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/hpa_policy_test2.txt
new file mode 100644
index 0000000..f7924cc
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/hpa_policy_test2.txt
@@ -0,0 +1 @@
+{\"service\":\"hpaPolicy\",\"guard\":\"False\",\"content\":{\"flavorFeatures\":[{\"id\":\"vfw\",\"type\":\"vnfc\",\"directives\":[{\"type\":\"flavor_directives\",\"attributes\":[{\"attribute_name\":\"firewall_flavor_name\",\"attribute_value\":\"\"}]}],\"flavorProperties\":[{\"hpa-feature\":\"sriovNICNetwork\",\"hpa-version\":\"v1\",\"architecture\":\"intel\",\"mandatory\":\"True\",\"directives\":[{\"type\":\"sriovNICNetwork_directives\",\"attributes\":[{\"attribute_name\":\"vfw_private_0_port_vnic_type\",\"attribute_value\":\"direct\"},{\"attribute_name\":\"unprotected_private_provider_net\",\"attribute_value\":\"private-1\"}]},{\"type\":\"sriovNICNetwork_directives\",\"attributes\":[{\"attribute_name\":\"vfw_private_1_port_vnic_type\",\"attribute_value\":\"direct\"},{\"attribute_name\":\"protected_private_provider_net\",\"attribute_value\":\"private-1\"}]}],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"pciCount\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\"},{\"hpa-attribute-key\":\"pciVendorId\",\"hpa-attribute-value\":\"8086\",\"operator\":\"=\"},{\"hpa-attribute-key\":\"pciDeviceId\",\"hpa-attribute-value\":\"154C\",\"operator\":\"=\"},{\"hpa-attribute-key\":\"physicalNetwork\",\"hpa-attribute-value\":\"private-1\",\"operator\":\"=\"}]}]},{\"id\":\"vgenerator\",\"type\":\"vnfc\",\"directives\":[{\"type\":\"flavor_directives\",\"attributes\":[{\"attribute_name\":\"packetgen_flavor_name\",\"attribute_value\":\"\"}]}],\"flavorProperties\":[{\"hpa-feature\":\"sriovNICNetwork\",\"hpa-version\":\"v1\",\"architecture\":\"intel\",\"mandatory\":\"True\",\"directives\":[{\"type\":\"sriovNICNetwork_directives\",\"attributes\":[{\"attribute_name\":\"vpg_private_0_port_vnic_type\",\"attribute_value\":\"direct\"},{\"attribute_name\":\"unprotected_private_provider_net\",\"attribute_value\":\"private-1\"}]}],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"pciCount\",\"hpa-attribute-value\":\"1\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciVendorId\",\"hpa-attribute-value\":\"8086\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciDeviceId\",\"hpa-attribute-value\":\"154C\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"physicalNetwork\",\"hpa-attribute-value\":\"private-1\",\"operator\":\"=\"}]}]},{\"id\":\"vsink\",\"type\":\"vnfc\",\"directives\":[{\"type\":\"flavor_directives\",\"attributes\":[{\"attribute_name\":\"sink_flavor_name\",\"attribute_value\":\"\"}]}],\"flavorProperties\":[{\"hpa-feature\":\"sriovNICNetwork\",\"hpa-version\":\"v1\",\"architecture\":\"intel\",\"mandatory\":\"True\",\"directives\":[{\"type\":\"sriovNICNetwork_directives\",\"attributes\":[{\"attribute_name\":\"vsn_private_0_port_vnic_type\",\"attribute_value\":\"direct\"},{\"attribute_name\":\"unprotected_private_provider_net\",\"attribute_value\":\"private-1\"}]}],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"pciCount\",\"hpa-attribute-value\":\"1\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciVendorId\",\"hpa-attribute-value\":\"8086\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"pciDeviceId\",\"hpa-attribute-value\":\"154C\",\"operator\":\"=\",\"unit\":\"\"},{\"hpa-attribute-key\":\"physicalNetwork\",\"hpa-attribute-value\":\"private-1\",\"operator\":\"=\"}]}]}],\"policyType\":\"hpa\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"hpa-vFW-sriov\",\"resources\":[\"vFW\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"HPApolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.hpa_policy_vFWHPA_sriov_1\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/optimization_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/optimization_policy.txt
new file mode 100644
index 0000000..6c825b7
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/optimization_policy.txt
@@ -0,0 +1 @@
+{\"service\":\"optimizationPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"placement_optimization\",\"objective\":\"minimize\",\"objectiveParameter\":{\"operator\":\"sum\",\"parameterAttributes\":[{\"parameter\":\"distance\",\"operator\":\"product\",\"customerLocationInfo\":\"customer_loc\",\"weight\":\"100\",\"resources\":[\"vFW\",\"resource_name\"]},{\"parameter\":\"hpa_score\",\"operator\":\"product\",\"weight\":\"200\",\"resources\":[\"vFW\",\"resource_name\"]}]},\"identity\":\"optimization_sriov\",\"policyScope\":[\"us\",\"international\",\"ip\",\"vfw\"]},\"priority\":\"5\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"3\",\"description\":\"PlacementOptimizationPolicyforvFWHPA\",\"policyName\":\"OSDF_DUBLIN.Placement_Optimization_vfw_sriov\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/query_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/query_policy.txt
new file mode 100644
index 0000000..dec9632
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/query_policy.txt
@@ -0,0 +1 @@
+{\"service\":\"queryPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"request_param_query\",\"queryProperties\":[{\"attribute\":\"customerLatitude\",\"attribute_location\":\"customerLatitude\"},{\"attribute\":\"customerLongitude\",\"attribute_location\":\"customerLongitude\"}],\"identity\":\"vFW_Query_Policy_sriov\",\"serviceName\":\"vFW\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"QuerypolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.QueryPolicy_vFWHPA_sriov_1\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/vnf_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/vnf_policy.txt
new file mode 100644
index 0000000..821fad7
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_2/vnf_policy.txt
@@ -0,0 +1 @@
+{\"service\":\"vnfPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"vnfPolicy\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"vnf_vFW_sriov\",\"resources\":[\"vFW\",\"resource_name\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"equipmentRole\":\"\",\"inventoryProvider\":\"aai\",\"inventoryType\":\"cloud\",\"serviceType\":\"\",\"customerId\":\"\",\"orchestrationStatus\":\"\"}]},\"priority\":\"6\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"3\",\"description\":\"vnfPolicy\",\"policyName\":\"OSDF_DUBLIN.vnfPolicy_vFWHPA_sriov\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/DistancePolicy.tx b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/DistancePolicy.tx
new file mode 100644
index 0000000..49e0c7c
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/DistancePolicy.tx
@@ -0,0 +1 @@
+{\"service\":\"distancePolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"distance_to_location\",\"applicableResources\":\"any\",\"identity\":\"vFW_Distance-new\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"distanceProperties\":{\"distance\":{\"value\":\"100\",\"unit\":\"km\",\"operator\":\"<\"},\"locationInfo\":\"customer_loc\"},\"resources\":[\"vFW\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"DistancePolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.Distance_vFWHPA_sriov_test3\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/hpa_policy_test3.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/hpa_policy_test3.txt
new file mode 100644
index 0000000..b098dcf
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/hpa_policy_test3.txt
@@ -0,0 +1 @@
+{\"service\":\"hpaPolicy\",\"guard\":\"False\",\"content\":{\"flavorFeatures\":[{\"id\":\"vfw\",\"type\":\"vnfc\",\"directives\":[{\"type\":\"flavor_directives\",\"attributes\":[{\"attribute_name\":\"firewall_flavor_name\",\"attribute_value\":\"\"}]}],\"flavorProperties\":[{\"hpa-feature\":\"sriovNICNetwork\",\"hpa-version\":\"v1\",\"architecture\":\"intel\",\"mandatory\":\"False\",\"score\":\"100\",\"directives\":[{\"type\":\"sriovNICNetwork_directives\",\"attributes\":[{\"attribute_name\":\"vfw_private_1_port_vnic_type\",\"attribute_value\":\"direct\"},{\"attribute_name\":\"protected_private_provider_net\",\"attribute_value\":\"private-1\"}]}],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"pciCount\",\"hpa-attribute-value\":\"1\",\"operator\":\"=\"},{\"hpa-attribute-key\":\"pciVendorId\",\"hpa-attribute-value\":\"8086\",\"operator\":\"=\"},{\"hpa-attribute-key\":\"pciDeviceId\",\"hpa-attribute-value\":\"154C\",\"operator\":\"=\"},{\"hpa-attribute-key\":\"physicalNetwork\",\"hpa-attribute-value\":\"private-1\",\"operator\":\"=\"}]},{\"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\"}]},{\"hpa-feature\":\"hugePages\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"memoryPageSize\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\",\"unit\":\"MB\"}]},{\"hpa-feature\":\"basicCapabilities\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"2\",\"operator\":\"=\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"4096\",\"operator\":\"=\",\"unit\":\"MB\"}]}]},{\"id\":\"vgenerator\",\"type\":\"vnfc\",\"directives\":[{\"type\":\"flavor_directives\",\"attributes\":[{\"attribute_name\":\"packetgen_flavor_name\",\"attribute_value\":\"\"}]}],\"flavorProperties\":[{\"hpa-feature\":\"hugePages\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"False\",\"score\":\"200\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"memoryPageSize\",\"hpa-attribute-value\":\"1\",\"operator\":\"=\",\"unit\":\"GB\"}]},{\"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\"}]},{\"hpa-feature\":\"sriovNICNetwork\",\"hpa-version\":\"v1\",\"architecture\":\"intel\",\"mandatory\":\"False\",\"score\":\"100\",\"directives\":[{\"type\":\"sriovNICNetwork_directives\",\"attributes\":[{\"attribute_name\":\"unprotected_private_provider_net\",\"attribute_value\":\"private-0\"}]}],\"hpa-feature-attributes\":[]},{\"hpa-feature\":\"basicCapabilities\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[{\"hpa-attribute-key\":\"numVirtualCpu\",\"hpa-attribute-value\":\"1\",\"operator\":\">=\"},{\"hpa-attribute-key\":\"virtualMemSize\",\"hpa-attribute-value\":\"2\",\"operator\":\">=\",\"unit\":\"GB\"}]}]},{\"id\":\"vsink\",\"type\":\"vnfc\",\"directives\":[{\"type\":\"flavor_directives\",\"attributes\":[{\"attribute_name\":\"sink_flavor_name\",\"attribute_value\":\"\"}]}],\"flavorProperties\":[{\"hpa-feature\":\"basicCapabilities\",\"hpa-version\":\"v1\",\"architecture\":\"generic\",\"mandatory\":\"True\",\"directives\":[],\"hpa-feature-attributes\":[]},{\"hpa-feature\":\"sriovNICNetwork\",\"hpa-version\":\"v1\",\"architecture\":\"intel\",\"mandatory\":\"False\",\"score\":\"100\",\"directives\":[{\"type\":\"sriovNICNetwork_directives\",\"attributes\":[{\"attribute_name\":\"vsn_private_0_port_vnic_type\",\"attribute_value\":\"direct\"}]}],\"hpa-feature-attributes\":[]}]}],\"policyType\":\"hpa\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"vFW_HPA_new\",\"resources\":[\"vFW\",\"resource_name\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"HPApolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.hpa_policy_vFWHPA_test3\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/optimization_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/optimization_policy.txt
new file mode 100644
index 0000000..886a2b8
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/optimization_policy.txt
@@ -0,0 +1 @@
+{\"service\":\"optimizationPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"placement_optimization\",\"objective\":\"minimize\",\"objectiveParameter\":{\"operator\":\"sum\",\"parameterAttributes\":[{\"parameter\":\"distance\",\"operator\":\"product\",\"customerLocationInfo\":\"customer_loc\",\"weight\":\"100\",\"resources\":[\"vFW\",\"resource_name\"]},{\"parameter\":\"hpa_score\",\"operator\":\"product\",\"weight\":\"200\",\"resources\":[\"vFW\",\"resource_name\"]}]},\"identity\":\"optimization-vfw-new\",\"policyScope\":[\"us\",\"international\",\"ip\",\"vfw\"]},\"priority\":\"5\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"3\",\"description\":\"PlacementOptimizationPolicyforvGMuxInfra\",\"policyName\":\"OSDF_DUBLIN.Placement_Optimization_test3\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/query_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/query_policy.txt
new file mode 100644
index 0000000..3dac693
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/query_policy.txt
@@ -0,0 +1 @@
+{\"service\":\"queryPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"request_param_query\",\"queryProperties\":[{\"attribute\":\"customerLatitude\",\"attribute_location\":\"customerLatitude\"},{\"attribute\":\"customerLongitude\",\"attribute_location\":\"customerLongitude\"}],\"identity\":\"Query_vFW_new\",\"serviceName\":\"vFW\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"QuerypolicyforvFW\",\"policyName\":\"OSDF_DUBLIN.QueryPolicy_vFWHPA_test3\",\"version\":\"test1\",\"riskType\":\"test\"}
diff --git a/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/vnf_policy.txt b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/vnf_policy.txt
new file mode 100644
index 0000000..44b8851
--- /dev/null
+++ b/test/hpa_automation/heat/sample_vfw_policies/sample_vfw_policies_3/vnf_policy.txt
@@ -0,0 +1 @@
+{\"service\":\"vnfPolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"vnfPolicy\",\"policyScope\":[\"vfw\",\"us\",\"international\",\"ip\"],\"identity\":\"vFW_vnf_new\",\"resources\":[\"vFW\",\"resource_name\"],\"applicableResources\":\"any\",\"vnfProperties\":[{\"equipmentRole\":\"\",\"inventoryProvider\":\"aai\",\"inventoryType\":\"cloud\",\"serviceType\":\"\",\"customerId\":\"\",\"orchestrationStatus\":\"\"}]},\"priority\":\"6\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"3\",\"description\":\"vnfPolicy\",\"policyName\":\"OSDF_DUBLIN.vnfPolicy_vFWHPA_sriov_test3\",\"version\":\"test1\",\"riskType\":\"test\"}