From c8c6422f9980299886e3b03d08a532ad5a39caf2 Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Mon, 2 Apr 2018 00:25:06 -0500 Subject: 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 --- test/csit/tests/policy/suite1/Policy-CSIT.robot | 50 +++++++++++++++++++++- .../csit/tests/policy/suite1/getoofpolicy.template | 6 +++ .../tests/policy/suite1/oofpolicy_HPA_R1.template | 6 +++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 test/csit/tests/policy/suite1/getoofpolicy.template create mode 100644 test/csit/tests/policy/suite1/oofpolicy_HPA_R1.template (limited to 'test/csit/tests/policy') 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" +} -- cgit 1.2.3-korg