summaryrefslogtreecommitdiffstats
path: root/test/csit
diff options
context:
space:
mode:
authorMichael Mokry <mm117s@att.com>2018-04-02 00:25:06 -0500
committerMichael Mokry <mm117s@att.com>2018-04-12 07:26:00 -0500
commitc8c6422f9980299886e3b03d08a532ad5a39caf2 (patch)
tree4c7837689aa65185645af9b8c09c5e8a6c762e2e /test/csit
parentbdd171db75cc52ad30b48d91b708cc8d08bbc1cc (diff)
Optimization Policy CSIT tests
This CSIT tests requires an entry in the database. I modified the sql script in the PE packages. That commit should be merged in order for this to pass I had the wrong variable name for ${policy_name} in the template. I fixed this but I am not able to test locally so I cant be 100% sure this will resolve the issue I added fixes for the 2 failures. I think the createPolicy failed due to an invalid model but I see the model being inserted in the pap log. The only thing I can think of is that it does not like the camel case for hpaPolicy and the all caps for CSIT version so I just made these all lower case in the request template Change-Id: I59fe578c57ab927fe356071a5b4a28bd987fafd7 Issue-ID: POLICY-639 Signed-off-by: Michael Mokry <mm117s@att.com>
Diffstat (limited to 'test/csit')
-rwxr-xr-xtest/csit/scripts/policy/script1.sh2
-rw-r--r--test/csit/tests/policy/suite1/Policy-CSIT.robot50
-rw-r--r--test/csit/tests/policy/suite1/getoofpolicy.template6
-rw-r--r--test/csit/tests/policy/suite1/oofpolicy_HPA_R1.template6
4 files changed, 62 insertions, 2 deletions
diff --git a/test/csit/scripts/policy/script1.sh b/test/csit/scripts/policy/script1.sh
index a09fa5f24..0db34f080 100755
--- a/test/csit/scripts/policy/script1.sh
+++ b/test/csit/scripts/policy/script1.sh
@@ -123,7 +123,7 @@ echo ${NEXUS_IP}
MARIADB_IP=`docker inspect --format '{{ .NetworkSettings.Networks.docker_default.IPAddress}}' mariadb`
echo ${MARIADB_IP}
-sleep 1m
+sleep 5m
netstat -tnl
diff --git a/test/csit/tests/policy/suite1/Policy-CSIT.robot b/test/csit/tests/policy/suite1/Policy-CSIT.robot
index fd5e23048..5909abd29 100644
--- a/test/csit/tests/policy/suite1/Policy-CSIT.robot
+++ b/test/csit/tests/policy/suite1/Policy-CSIT.robot
@@ -16,10 +16,12 @@ ${CREATE_CONFIG_VFW_TEMPLATE} ${CURDIR}/configpolicy_vFW_R1.template
${CREATE_CONFIG_VDNS_TEMPLATE} ${CURDIR}/configpolicy_vDNS_R1.template
${CREATE_CONFIG_VCPE_TEMPLATE} ${CURDIR}/configpolicy_vCPE_R1.template
${CREATE_OPS_VFW_TEMPLATE} ${CURDIR}/opspolicy_VFW_R1.template
+${CREATE_OOF_HPA_TEMPLATE} ${CURDIR}/oofpolicy_HPA_R1.template
${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template
${CREATE_OPS_VDNS_TEMPLATE} ${CURDIR}/opspolicy_VDNS_R1.template
${DEL_POLICY_TEMPLATE} ${CURDIR}/deletepolicy.template
${GETCONFIG_TEMPLATE} ${CURDIR}/getconfigpolicy.template
+${GETOOF_TEMPLATE} ${CURDIR}/getoofpolicy.template
${CONFIG_POLICY_VFW_NAME} vFirewall
${CONFIG_POLICY_VFW_TYPE} MicroService
${CONFIG_POLICY_VDNS_NAME} vLoadBalancer
@@ -34,6 +36,8 @@ ${OPS_POLICY_VCPE_NAME} vCPE
${OPS_POLICY_VCPE_TYPE} BRMS_PARAM
${OPS_POLICY_VOLTE_NAME} VoLTE
${OPS_POLICY_VOLTE_TYPE} BRMS_PARAM
+${OOF_POLICY_HPA_NAME} HPA
+${OOF_POLICY_HPA_TYPE} Optimization
${file_path} ../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl
${RESOURCE_PATH_UPLOAD} /pdp/api/policyEngineImport?importParametersJson=%7B%22serviceName%22%3A%22Manyu456%22%2C%20%22serviceType%22%3A%22BRMSPARAM%22%7D
${CREATE_OPS_VCPE_TEMPLATE} ${CURDIR}/opspolicy_vCPE_R1.template
@@ -75,6 +79,12 @@ VOLTE Ops Policy
${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
#VOLTE Policy Tests
+
+HPA OOF Policy
+ ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
+ Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
+ #HPA Policy Tests
+
VFW Get Configs Policy
Sleep 5s
Get Configs VFW Policy
@@ -87,6 +97,10 @@ VCPE Get Configs Policy
Sleep 5s
Get Configs VCPE Policy
+HPA Get OOF Policy
+ Sleep 5s
+ Get OOF HPA Policy
+
*** Keywords ***
VFW Policy Tests
@@ -114,6 +128,11 @@ VOLTE Policy Tests
${OPS_POLICY_VOLTE_NAME}= Create Ops VOLTE Policy
Push Ops Policy ${OPS_POLICY_VOLTE_NAME} ${OPS_POLICY_VOLTE_TYPE}
+HPA Policy Tests
+ ${OOF_POLICY_HPA_NAME}= Create OOF HPA Policy
+ Push Config Policy ${OOF_POLICY_HPA_NAME} ${OOF_POLICY_HPA_TYPE}
+ Get OOF HPA Policy
+
Get Configs VFW Policy
[Documentation] Get Config Policy for VFW
${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}*
@@ -122,6 +141,26 @@ Get Configs VFW Policy
${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
Should Be Equal As Strings ${get_resp.status_code} 200
+Create OOF HPA Policy
+ [Documentation] Create OOF Policy
+ ${randompolicyname} = Create Policy Name
+ ${policyname1}= Catenate com.${randompolicyname}_HPA
+ ${OOF_POLICY_HPA_NAME}= Set Test Variable ${policyname1}
+ ${hpapolicy}= Create Dictionary policy_name=${policyname1}
+ ${output} = Fill JSON Template File ${CREATE_OOF_HPA_TEMPLATE} ${hpapolicy}
+ ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output}
+ Log ${put_resp}
+ Should Be Equal As Strings ${put_resp.status_code} 200
+ [Return] ${policyname1}
+
+Get OOF HPA Policy
+ [Documentation] Get OOF Policy for HPA
+ ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}*
+ ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy}
+ ${output} = Fill JSON Template File ${GETOOF_TEMPLATE} ${hpapolicy_name}
+ ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output}
+ Should Be Equal As Strings ${get_resp.status_code} 200
+
Create Config VFW Policy
[Documentation] Create Config Policy
${randompolicyname} = Create Policy Name
@@ -186,6 +225,15 @@ Delete Config Policy
${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
Should Be Equal As Strings ${put_resp.status_code} 200
+Delete OOF Policy
+ [Documentation] Delete OOF Policy
+ [Arguments] ${policy_name}
+ ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml
+ ${dict}= Create Dictionary policy_name=${policyname3}
+ ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict}
+ ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output}
+ Should Be Equal As Strings ${put_resp.status_code} 200
+
Get Configs VDNS Policy
[Documentation] Get Config Policy for VDNS
${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}*
@@ -267,4 +315,4 @@ Upload DRL file
# ${files2} = {'file': open('../testsuite/robot/assets/templates/ControlLoopDemo__closedLoopControlName.drl', 'rb')}
# ${files}= Create Dictionary file ${file_data}
${put_resp} = Run Policy Post form Request ${RESOURCE_PATH_UPLOAD} ${files}
- Should Be Equal As Strings ${put_resp.status_code} 200 \ No newline at end of file
+ Should Be Equal As Strings ${put_resp.status_code} 200
diff --git a/test/csit/tests/policy/suite1/getoofpolicy.template b/test/csit/tests/policy/suite1/getoofpolicy.template
new file mode 100644
index 000000000..37fe0471b
--- /dev/null
+++ b/test/csit/tests/policy/suite1/getoofpolicy.template
@@ -0,0 +1,6 @@
+{
+ "configAttributes" : {
+ },
+ "policyName" : "${oof_policy_name}",
+ "unique" : false
+}
diff --git a/test/csit/tests/policy/suite1/oofpolicy_HPA_R1.template b/test/csit/tests/policy/suite1/oofpolicy_HPA_R1.template
new file mode 100644
index 000000000..3a170b207
--- /dev/null
+++ b/test/csit/tests/policy/suite1/oofpolicy_HPA_R1.template
@@ -0,0 +1,6 @@
+{
+ "configBody": "{\"service\":\"hpaPolicy\",\"policyName\":\"testWorkingTOSCA\",\"description\":\"testing\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"CSIT\",\"priority\":\"5\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"identity\":\"testIdentity\",\"policyScope\":[\"test1\",\"test2\",\"test3\"],\"policyType\":\"hpaPolicy\",\"resources\":\"testResources1\",\"flavorFeatures\":[{\"flavorLabel\":\"testFlavor\",\"flavorProperties\":[{\"score\":\"testScore\",\"featureAttributes\":[{\"unit\":\"testUnit\",\"attribute\":\"teatFeatureAttribute\",\"value\":\"testValue\",\"operator\":\"any\"}],\"mandatory\":\"testMandatory\",\"hpaFeature\":\"testHAPFeature\",\"architecture\":\"testArch\"}]}]}}",
+ "policyConfigType": "Optimization",
+ "policyName": "${policy_name}",
+ "onapName": "OOF"
+}