diff options
author | Gary Wu <gary.wu@futurewei.com> | 2019-07-10 00:01:32 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-10 00:01:32 +0000 |
commit | c354411b4df2ca9929749ba9283972d3b3dddeff (patch) | |
tree | 5aff9ffbf78feefcdcbdcec73c4a00f4fa66b39f | |
parent | f265a2f799456ce8c43ac21dbfbe8c8c782ec962 (diff) | |
parent | 1a207a405ce7321347de1edc36c2076484700705 (diff) |
Merge "remvoing json templater use"
33 files changed, 100 insertions, 221 deletions
diff --git a/tests/policy/engine/Policy-CSIT.robot b/tests/policy/engine/Policy-CSIT.robot index 514cc840..e55ccac8 100644 --- a/tests/policy/engine/Policy-CSIT.robot +++ b/tests/policy/engine/Policy-CSIT.robot @@ -4,8 +4,8 @@ Library String Library HttpLibrary.HTTP LIbrary Process Library BuiltIn +Library ONAPLibrary.Templating Resource policy_interface.robot -Resource json_templater.robot *** Variables *** ${RESOURCE_PATH_CREATE} /pdp/api/createPolicy @@ -13,21 +13,21 @@ ${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy ${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy ${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig ${RESOURCE_PATH_LISTPOLICY} /pdp/api/listPolicy -${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 -${CREATE_SDNC_VFW_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vFW.template -${CREATE_SDNC_VPG_TEMPLATE} ${CURDIR}/sdncnamingpolicy_vPG.template -${PUSH_POLICY_TEMPLATE} ${CURDIR}/pushpolicy.template -${MULTIPLE_PUSH_POLICY_TEMPLATE} ${CURDIR}/multiple_pushpolicy.template -${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${CURDIR}/multiple_unpushpolicy.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 -${LISTPOLICY_TEMPLATE} ${CURDIR}/listpolicy.template +${CREATE_CONFIG_VFW_TEMPLATE} configpolicy_vFW_R1.jinja +${CREATE_CONFIG_VDNS_TEMPLATE} configpolicy_vDNS_R1.jinja +${CREATE_CONFIG_VCPE_TEMPLATE} configpolicy_vCPE_R1.jinja +${CREATE_OPS_VFW_TEMPLATE} opspolicy_VFW_R1.jinja +${CREATE_OOF_HPA_TEMPLATE} oofpolicy_HPA_R1.jinja +${CREATE_SDNC_VFW_TEMPLATE} sdncnamingpolicy_vFW.jinja +${CREATE_SDNC_VPG_TEMPLATE} sdncnamingpolicy_vPG.jinja +${PUSH_POLICY_TEMPLATE} pushpolicy.jinja +${MULTIPLE_PUSH_POLICY_TEMPLATE} multiple_pushpolicy.jinja +${MULTIPLE_UNPUSH_POLICY_TEMPLATE} multiple_unpushpolicy.jinja +${CREATE_OPS_VDNS_TEMPLATE} opspolicy_VDNS_R1.jinja +${DEL_POLICY_TEMPLATE} deletepolicy.jinja +${GETCONFIG_TEMPLATE} getconfigpolicy.jinja +${GETOOF_TEMPLATE} getoofpolicy.jinja +${LISTPOLICY_TEMPLATE} listpolicy.jinja ${CONFIG_POLICY_VFW_NAME} vFirewall ${CONFIG_POLICY_VFW_TYPE} MicroService ${CONFIG_POLICY_VDNS_NAME} vLoadBalancer @@ -51,8 +51,8 @@ ${MULTIPLE_PUSH_POLICY_NAME2} com.testBase2 ${MULTIPLE_PUSH_POLICY_NAME3} com.testBase3 ${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 -${CREATE_OPS_VOLTE_TEMPLATE} ${CURDIR}/opspolicy_vOLTE_R1.template +${CREATE_OPS_VCPE_TEMPLATE} opspolicy_vCPE_R1.jinja +${CREATE_OPS_VOLTE_TEMPLATE} opspolicy_vOLTE_R1.jinja *** Test Cases *** @@ -173,19 +173,21 @@ HPA Policy Tests Get Configs VFW Policy [Documentation] Get Config Policy for VFW + Create Environment policy ${CURDIR} ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VFW_NAME}* ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} + ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name} ${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 + Create Environment policy ${CURDIR} ${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} + ${output} = Apply Template policy ${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 @@ -193,41 +195,45 @@ Create OOF HPA Policy Get OOF HPA Policy [Documentation] Get OOF Policy for HPA + Create Environment policy ${CURDIR} ${gethpapolicy}= Catenate .*${OOF_POLICY_HPA_NAME}* ${hpapolicy_name}= Create Dictionary oof_policy_name=${gethpapolicy} - ${output} = Fill JSON Template File ${GETOOF_TEMPLATE} ${hpapolicy_name} + ${output} = Apply Template policy ${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 + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_vFirewall ${CONFIG_POLICY_VFW_NAME}= Set Test Variable ${policyname1} ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy} + ${output} = Apply Template policy ${CREATE_CONFIG_VFW_TEMPLATE} ${configpolicy} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 [Return] ${policyname1} Create VPG SDNC Naming Policy [Documentation] Create VPG SDNC Naming Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_ONAP_vPG_Naming ${SDNC_POLICY_VPG_NAME}= Set Test Variable ${policyname1} ${sdncpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_SDNC_VPG_TEMPLATE} ${sdncpolicy} + ${output} = Apply Template policy ${CREATE_SDNC_VPG_TEMPLATE} ${sdncpolicy} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 [Return] ${policyname1} Create VFW SDNC Naming Policy [Documentation] Create VFW SDNC Naming Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_ONAP_vFW_Naming ${SDNC_POLICY_VFW_NAME}= Set Test Variable ${policyname1} ${sdncpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_SDNC_VFW_TEMPLATE} ${sdncpolicy} + ${output} = Apply Template policy ${CREATE_SDNC_VFW_TEMPLATE} ${sdncpolicy} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 [Return] ${policyname1} @@ -241,11 +247,12 @@ Create Policy Name Create Ops VFW Policy [Documentation] Create Operational Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_vFirewall ${OPS_POLICY_VFW_NAME}= Set Test Variable ${policyname1} ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VFW_TEMPLATE} ${dict} + ${output} = Apply Template policy ${CREATE_OPS_VFW_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Log ${put_resp} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -254,72 +261,80 @@ Create Ops VFW Policy Push Ops Policy [Documentation] Push Ops Policy [Arguments] ${policyname} ${policytype} + Create Environment policy ${CURDIR} ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${PUSH_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 Push Config Policy [Documentation] Push Config Policy [Arguments] ${policyname} ${policytype} + Create Environment policy ${CURDIR} ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} - ${output} = Fill JSON Template File ${PUSH_POLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${PUSH_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 Delete Ops Policy [Documentation] Delete Config Policy [Arguments] ${policy_name} + Create Environment policy ${CURDIR} ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${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 Delete Config Policy [Documentation] Delete Ops Policy [Arguments] ${policy_name} + Create Environment policy ${CURDIR} ${policyname3}= Catenate com.Config_MS_com.${policy_name}.1.xml ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${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 Delete OOF Policy [Documentation] Delete OOF Policy [Arguments] ${policy_name} + Create Environment policy ${CURDIR} ${policyname3}= Catenate com.Config_OOF_${policy_name}.1.xml ${dict}= Create Dictionary policy_name=${policyname3} - ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${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 + Create Environment policy ${CURDIR} ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VDNS_NAME}* ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} + ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_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 VDNS Policy [Documentation] Create Config Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer ${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy} + ${output} = Apply Template policy ${CREATE_CONFIG_VDNS_TEMPLATE} ${configpolicy} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 [Return] ${policyname1} Create Ops VDNS Policy [Documentation] Create Operational Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_vLoadBalancer ${OPS_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VDNS_TEMPLATE} ${dict} + ${output} = Apply Template policy ${CREATE_OPS_VDNS_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Log ${put_resp} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -327,30 +342,33 @@ Create Ops VDNS Policy Create Config VCPE Policy [Documentation] Create Config Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_vCPE ${CONFIG_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} ${configpolicy}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy} + ${output} = Apply Template policy ${CREATE_CONFIG_VCPE_TEMPLATE} ${configpolicy} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 [Return] ${policyname1} Get Configs VCPE Policy [Documentation] Get Config Policy for VCPE + Create Environment policy ${CURDIR} ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}* ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} - ${output} = Fill JSON Template File ${GETCONFIG_TEMPLATE} ${configpolicy_name} + ${output} = Apply Template policy ${GETCONFIG_TEMPLATE} ${configpolicy_name} ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} Should Be Equal As Strings ${get_resp.status_code} 200 Create Ops vCPE Policy [Documentation] Create Operational Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_vCPE ${OPS_POLICY_VCPE_NAME}= Set Test Variable ${policyname1} ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VCPE_TEMPLATE} ${dict} + ${output} = Apply Template policy ${CREATE_OPS_VCPE_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Log ${put_resp} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -358,10 +376,11 @@ Create Ops vCPE Policy Create Ops VolTE Policy [Documentation] Create Operational Policy + Create Environment policy ${CURDIR} ${randompolicyname} = Create Policy Name ${policyname1}= Catenate com.${randompolicyname}_VoLTE ${dict}= Create Dictionary policy_name=${policyname1} - ${output} = Fill JSON Template File ${CREATE_OPS_VOLTE_TEMPLATE} ${dict} + ${output} = Apply Template policy ${CREATE_OPS_VOLTE_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} Log ${put_resp} Should Be Equal As Strings ${put_resp.status_code} 200 @@ -380,24 +399,27 @@ Upload DRL file ListPolicy test [Documentation] Listing Config Policies [Arguments] ${policy_name} + Create Environment policy ${CURDIR} ${dict}= Create Dictionary policy_name=${policy_name} - ${output} = Fill JSON Template File ${LISTPOLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${LISTPOLICY_TEMPLATE} ${dict} ${put_resp} = policy_interface.Run Policy Post Request ${RESOURCE_PATH_LISTPOLICY} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 Push Multiple Policy test [Documentation] Push Multiple Policy [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} + Create Environment policy ${CURDIR} ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} - ${output} = Fill JSON Template File ${MULTIPLE_PUSH_POLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${MULTIPLE_PUSH_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 Delete Multiple Policy test [Documentation] Delete Multiple Policy [Arguments] ${policyname1} ${policyname2} ${policyname3} ${policytype} + Create Environment policy ${CURDIR} ${dict}= Create Dictionary policy_name1=${policyname1} policy_name2=${policyname2} policy_name3=${policyname3} policy_type=${policytype} - ${output} = Fill JSON Template File ${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${dict} + ${output} = Apply Template policy ${MULTIPLE_UNPUSH_POLICY_TEMPLATE} ${dict} ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} Should Be Equal As Strings ${put_resp.status_code} 200 diff --git a/tests/policy/engine/configpolicy_vCPE.template b/tests/policy/engine/configpolicy_vCPE.template deleted file mode 100644 index e3e3a2d0..00000000 --- a/tests/policy/engine/configpolicy_vCPE.template +++ /dev/null @@ -1,6 +0,0 @@ -{ -"configBody": "{ \"service\": \"policy_tosca_tca\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.0.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta\", \"thresholdValue\": \"1000\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"CL-vCPEvGMUX-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241ABA1\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vCPEvGMUXPacketLoss\" } }", -"policyConfigType": "MicroService", -"policyName": "${policy_name}", -"ecompName": "DCAE" -} diff --git a/tests/policy/engine/configpolicy_vCPE_R1.template b/tests/policy/engine/configpolicy_vCPE_R1.jinja index 77653c3f..6bcd74fe 100644 --- a/tests/policy/engine/configpolicy_vCPE_R1.template +++ b/tests/policy/engine/configpolicy_vCPE_R1.jinja @@ -1,7 +1,7 @@ { "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevCPE\", \"description\": \"MicroService vCPE Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"MAJOR\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ABATED\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"EQUAL\" }, { \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\", \"thresholdValue\": \"0\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\", \"version\": \"1.0.2\", \"direction\": \"GREATER\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"eventName\": \"Measurement_vGMUX\" } }", "policyConfigType": "MicroService", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "onapName": "DCAE", "priority": "5" } diff --git a/tests/policy/engine/configpolicy_vDNS.template b/tests/policy/engine/configpolicy_vDNS.template deleted file mode 100644 index ab1d2e0d..00000000 --- a/tests/policy/engine/configpolicy_vDNS.template +++ /dev/null @@ -1,6 +0,0 @@ -{ -"configBody": "{\"service\": \"policy_tosca_tca\",\"location\": \"TestMSLocation\",\"uuid\": \"/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vLoadBalancer\",\"policyName\": \"vLoadBalancer\",\"description\": \"vLoadBalancer\",\"configName\": \"TestConfigName\",\"templateVersion\": \"1607\",\"version\": \"8.7.6.5\",\"priority\": \"1\",\"policyScope\": \"resource=TestResource,service=TestService,type=TestType,closedLoopControlName=TestClosedLoop\",\"riskType\": \"test\",\"riskLevel\": \"2\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"500\",\"closedLoopControlName\": \"CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"5000\",\"closedLoopControlName\": \"CL-LBAL-HIGH-TRAFFIC-SIG-0C5920A6-B564-8035-C878-0E814352BC2B\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"configuration.ae.microservice.tca.xml\",\"functionalRole\": \"ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8\"}}", -"policyConfigType": "MicroService", -"policyName": "${policy_name}", -"ecompName": "DCAE" -}
\ No newline at end of file diff --git a/tests/policy/engine/configpolicy_vDNS_R1.template b/tests/policy/engine/configpolicy_vDNS_R1.jinja index 185a7c72..a2c3eeb9 100644 --- a/tests/policy/engine/configpolicy_vDNS_R1.template +++ b/tests/policy/engine/configpolicy_vDNS_R1.jinja @@ -1,7 +1,7 @@ { "configBody": "{ \"service\": \"tca_policy\", \"location\": \"SampleServiceLocation\", \"uuid\": \"test\", \"policyName\": \"MicroServicevDNS\", \"description\": \"MicroService vDNS Policy\", \"configName\": \"SampleConfigName\", \"templateVersion\": \"OpenSource.version.1\", \"version\": \"1.1.0\", \"priority\": \"1\", \"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"riskType\": \"SampleRiskType\", \"riskLevel\": \"1\", \"guard\": \"False\", \"content\": { \"policyVersion\": \"v0.0.1\", \"threshholds\": [{ \"severity\": \"CRITICAL\", \"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": \"300\", \"closedLoopEventStatus\": \"ONSET\", \"closedLoopControlName\": \"ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3\", \"version\": \"1.0.2\", \"direction\": \"GREATER_OR_EQUAL\" }], \"policyName\": \"DCAE.Config_tca-hi-lo\", \"controlLoopSchemaType\": \"VM\", \"policyScope\": \"DCAE\", \"eventName\": \"vLoadBalancer\" } }", "policyConfigType": "MicroService", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "onapName": "DCAE", "priority": "5" } diff --git a/tests/policy/engine/configpolicy_vFW.template b/tests/policy/engine/configpolicy_vFW.template deleted file mode 100644 index 39e99e7b..00000000 --- a/tests/policy/engine/configpolicy_vFW.template +++ /dev/null @@ -1,6 +0,0 @@ -{ -"configBody": "{\"service\": \"policy_tosca_tca\",\"location\": \"Ravi\",\"uuid\": \"/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vFireWall\",\"policyName\": \"vFireWall\",\"description\": \"vFireWall\",\"configName\": \"TestConfigName\",\"templateVersion\": \"1607\",\"version\": \"8.7.6.5\",\"priority\": \"1\",\"policyScope\": \"resource=TestResource,service=TestService,type=TestType,closedLoopControlName=TestClosedLoop\",\"riskType\": \"test\",\"riskLevel\": \"2\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"4000\",\"closedLoopControlName\": \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated\",\"thresholdValue\": \"20000\",\"closedLoopControlName\": \"CL-FRWL-HIGH-TRAFFIC-SIG-EA36FE84-9342-5E13-A656-EC5F21309A09\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"configuration.ae.microservice.tca.xml\",\"functionalRole\": \"ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8\"}}", -"policyConfigType": "MicroService", -"policyName": "${policy_name}", -"ecompName": "DCAE" -}
\ No newline at end of file diff --git a/tests/policy/engine/configpolicy_vFW_R1.template b/tests/policy/engine/configpolicy_vFW_R1.jinja index 067ed07f..b843a0b0 100644 --- a/tests/policy/engine/configpolicy_vFW_R1.template +++ b/tests/policy/engine/configpolicy_vFW_R1.jinja @@ -1,7 +1,7 @@ { "configBody": "{\"service\": \"tca_policy\",\"location\": \"SampleServiceLocation\",\"uuid\": \"test\",\"policyName\": \"MicroServicevFirewall\",\"description\": \"MicroService vFirewall Policy\",\"configName\": \"SampleConfigName\",\"templateVersion\": \"OpenSource.version.1\",\"version\": \"1.1.0\",\"priority\": \"1\",\"policyScope\": \"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"riskType\": \"SampleRiskType\",\"riskLevel\": \"1\",\"guard\": \"False\",\"content\": {\"policyVersion\": \"v0.0.1\",\"threshholds\": [{\"severity\": \"MAJOR\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"300\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"LESS_OR_EQUAL\"}, {\"severity\": \"CRITICAL\",\"fieldPath\": \"$$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\": \"700\",\"closedLoopEventStatus\": \"ONSET\",\"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\": \"1.0.2\",\"direction\": \"GREATER_OR_EQUAL\"}],\"policyName\": \"DCAE.Config_tca-hi-lo\",\"controlLoopSchemaType\": \"VNF\",\"policyScope\": \"DCAE\",\"eventName\": \"vFirewallBroadcastPackets\"}}", "policyConfigType": "MicroService", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "onapName": "DCAE", "priority": "5" } diff --git a/tests/policy/engine/createpolicy.template b/tests/policy/engine/createpolicy.jinja index 7c693e84..bbb1f1ad 100644 --- a/tests/policy/engine/createpolicy.template +++ b/tests/policy/engine/createpolicy.jinja @@ -1,6 +1,6 @@ { "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "policyDescription": "Create BRMS Param policy", "attributes": { "RULE": { diff --git a/tests/policy/engine/deletepolicy.template b/tests/policy/engine/deletepolicy.jinja index 55510102..73c5badf 100644 --- a/tests/policy/engine/deletepolicy.template +++ b/tests/policy/engine/deletepolicy.jinja @@ -1,5 +1,5 @@ { "pdpGroup": "default", "policyComponent": "PDP", - "policyName": "${policy_name}" + "policyName": "{{policy_name}}" } diff --git a/tests/policy/engine/getconfigpolicy.template b/tests/policy/engine/getconfigpolicy.jinja index 611e65d0..11e8cae6 100644 --- a/tests/policy/engine/getconfigpolicy.template +++ b/tests/policy/engine/getconfigpolicy.jinja @@ -3,6 +3,6 @@ }, "configName" : ".*", "ecompName" : "DCAE", - "policyName" : "${config_policy_name}", + "policyName" : "{{config_policy_name}}", "unique" : false }
\ No newline at end of file diff --git a/tests/policy/engine/getoofpolicy.template b/tests/policy/engine/getoofpolicy.jinja index 37fe0471..3c7dd755 100644 --- a/tests/policy/engine/getoofpolicy.template +++ b/tests/policy/engine/getoofpolicy.jinja @@ -1,6 +1,6 @@ { "configAttributes" : { }, - "policyName" : "${oof_policy_name}", + "policyName" : "{{oof_policy_name}}", "unique" : false } diff --git a/tests/policy/engine/json_templater.robot b/tests/policy/engine/json_templater.robot deleted file mode 100644 index 7fe0ff74..00000000 --- a/tests/policy/engine/json_templater.robot +++ /dev/null @@ -1,21 +0,0 @@ -*** Settings *** -Documentation This resource is filling out json string templates and returning the json back -Library RequestsLibrary -Library ONAPLibrary.TemplatingKeywords -Library OperatingSystem -Resource global_properties.robot - -*** Keywords *** -Fill JSON Template - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json} ${arguments} - ${returned_string}= Template String ${json} ${arguments} - ${returned_json}= To Json ${returned_string} - [Return] ${returned_json} - -Fill JSON Template File - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json_file} ${arguments} - ${json}= OperatingSystem.Get File ${json_file} - ${returned_json}= Fill JSON Template ${json} ${arguments} - [Return] ${returned_json} diff --git a/tests/policy/engine/listpolicy.jinja b/tests/policy/engine/listpolicy.jinja new file mode 100644 index 00000000..ce2d3df0 --- /dev/null +++ b/tests/policy/engine/listpolicy.jinja @@ -0,0 +1,3 @@ +{ + "policyName": "{{policy_name}}" +} diff --git a/tests/policy/engine/listpolicy.template b/tests/policy/engine/listpolicy.template deleted file mode 100644 index aef17a23..00000000 --- a/tests/policy/engine/listpolicy.template +++ /dev/null @@ -1,3 +0,0 @@ -{ - "policyName": "${policy_name}" -} diff --git a/tests/policy/engine/multiple_pushpolicy.jinja b/tests/policy/engine/multiple_pushpolicy.jinja new file mode 100644 index 00000000..bda0da08 --- /dev/null +++ b/tests/policy/engine/multiple_pushpolicy.jinja @@ -0,0 +1,5 @@ +{ + "policyName":"{{policy_name1}},{{policy_name2}},{{policy_name3}}", + "policyType":"{{policy_type}}", + "pdpGroup":"default" +} diff --git a/tests/policy/engine/multiple_pushpolicy.template b/tests/policy/engine/multiple_pushpolicy.template deleted file mode 100644 index 5f20b647..00000000 --- a/tests/policy/engine/multiple_pushpolicy.template +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policyName":"${policy_name1},${policy_name2},${policy_name3}", - "policyType":"${policy_type}", - "pdpGroup":"default" -} diff --git a/tests/policy/engine/multiple_unpushpolicy.jinja b/tests/policy/engine/multiple_unpushpolicy.jinja new file mode 100644 index 00000000..55fb8810 --- /dev/null +++ b/tests/policy/engine/multiple_unpushpolicy.jinja @@ -0,0 +1,6 @@ +{ + "policyName": "{{policy_name1}},{{policy_name2}},{{policy_name3}}", + "policyType": "{{policy_type}}", + "policyComponent": "PDP", + "pdpGroup": "default" +} diff --git a/tests/policy/engine/multiple_unpushpolicy.template b/tests/policy/engine/multiple_unpushpolicy.template deleted file mode 100644 index afee7aeb..00000000 --- a/tests/policy/engine/multiple_unpushpolicy.template +++ /dev/null @@ -1,6 +0,0 @@ -{ - "policyName": "${policy_name1},${policy_name2},${policy_name3}", - "policyType": "${policy_type}", - "policyComponent": "PDP", - "pdpGroup": "default" -} diff --git a/tests/policy/engine/oofpolicy_HPA_R1.template b/tests/policy/engine/oofpolicy_HPA_R1.jinja index 3a170b20..6834ceb6 100644 --- a/tests/policy/engine/oofpolicy_HPA_R1.template +++ b/tests/policy/engine/oofpolicy_HPA_R1.jinja @@ -1,6 +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}", + "policyName": "{{policy_name}}", "onapName": "OOF" } diff --git a/tests/policy/engine/opspolicy_VDNS.template b/tests/policy/engine/opspolicy_VDNS.template deleted file mode 100644 index 801773d5..00000000 --- a/tests/policy/engine/opspolicy_VDNS.template +++ /dev/null @@ -1,26 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "policyDescription": "Create BRMS Param policy for vLB", - "attributes": { - "MATCHING": { - "controller": "vDNS" - }, - "RULE": { - "templateName": "ControlLoopDemo__closedLoopControlName", - "closedLoopControlName": "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8", - "policyVersion": "v1.0", - "actor": "MSO", - "aaiNamedQueryUUID": "4ff56a54-9e3f-46b7-a337-07a1d3c6b469", - "aaiURL": "https://aai.api.simpledemo.openecomp.org:8443/aai/search/named-query", - "aaiUsername": "POLICY", - "aaiPassword": "POLICY", - "msoURL": "http://vm1.mso.simpledemo.openecomp.org:8080/ecomp/mso/infra", - "msoUsername": "InfraPortalClient", - "msoPassword": "password11", - "aaiPatternMatch": 0, - "notificationTopic": "POLICY-CL-MGT", - "appcTopic": "APPC-CL" - } - } -}
\ No newline at end of file diff --git a/tests/policy/engine/opspolicy_VDNS_R1.template b/tests/policy/engine/opspolicy_VDNS_R1.jinja index 92627cc2..8b1e6d2d 100644 --- a/tests/policy/engine/opspolicy_VDNS_R1.template +++ b/tests/policy/engine/opspolicy_VDNS_R1.jinja @@ -1,6 +1,6 @@ { "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "policyDescription": "BRMS Param vDNS policy", "policyScope": "com", "attributes": { diff --git a/tests/policy/engine/opspolicy_VFW.template b/tests/policy/engine/opspolicy_VFW.template deleted file mode 100644 index 224f5cf4..00000000 --- a/tests/policy/engine/opspolicy_VFW.template +++ /dev/null @@ -1,24 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "policyDescription": "Create BRMS Param policy for vFW", - "attributes": { - "RULE": { - "templateName": "ControlLoopDemo__closedLoopControlName", - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "policyVersion": "v1.0", - "aaiNamedQueryUUID": "null", - "aaiPassword": "null", - "aaiURL": "null", - "actor": "APPC", - "appcTopic": "APPC-CL", - "msoPassword": "null", - "msoURL": "null", - "msoUsername": "null", - "aaiUsername": "null", - "notificationTopic": "POLICY-CL-MGT", - "aaiPatternMatch": 1 - } - } -} - diff --git a/tests/policy/engine/opspolicy_VFW_R1.template b/tests/policy/engine/opspolicy_VFW_R1.jinja index a93063f7..0a6977df 100644 --- a/tests/policy/engine/opspolicy_VFW_R1.template +++ b/tests/policy/engine/opspolicy_VFW_R1.jinja @@ -1,6 +1,6 @@ { "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "policyDescription": "BRMS Param vFirewall policy", "policyScope": "com", "attributes": { diff --git a/tests/policy/engine/opspolicy_vCPE.template b/tests/policy/engine/opspolicy_vCPE.template deleted file mode 100644 index c17a1bc6..00000000 --- a/tests/policy/engine/opspolicy_vCPE.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "policyDescription": "BRMS Param vCPE policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}
\ No newline at end of file diff --git a/tests/policy/engine/opspolicy_vCPE_R1.template b/tests/policy/engine/opspolicy_vCPE_R1.jinja index 36695daa..a04a0c1e 100644 --- a/tests/policy/engine/opspolicy_vCPE_R1.template +++ b/tests/policy/engine/opspolicy_vCPE_R1.jinja @@ -1,6 +1,6 @@ { "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "policyDescription": "BRMS Param vCPE policy", "policyScope": "com", "attributes": { diff --git a/tests/policy/engine/opspolicy_vOLTE.template b/tests/policy/engine/opspolicy_vOLTE.template deleted file mode 100644 index e43a3e6f..00000000 --- a/tests/policy/engine/opspolicy_vOLTE.template +++ /dev/null @@ -1,16 +0,0 @@ -{ - "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", - "policyDescription": "BRMS Param VOLTE policy", - "policyScope": "com", - "attributes": { - "MATCHING": { - "controller" : "amsterdam" - }, - "RULE": { - "templateName": "ClosedLoopControlName", - "closedLoopControlName": "ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b", - "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-VOLTE-2179b738-fd36-4843-a71a-a8c24c70c55b%0D%0A++trigger_policy%3A+unique-policy-id-1-restart%0D%0A++timeout%3A+3600%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-restart%0D%0A++++name%3A+Restart+the+VM%0D%0A++++description%3A%0D%0A++++actor%3A+VFC%0D%0A++++recipe%3A+Restart%0D%0A++++target%3A%0D%0A++++++type%3A+VM%0D%0A++++retry%3A+3%0D%0A++++timeout%3A+1200%0D%0A++++success%3A+final_success%0D%0A++++failure%3A+final_failure%0D%0A++++failure_timeout%3A+final_failure_timeout%0D%0A++++failure_retries%3A+final_failure_retries%0D%0A++++failure_exception%3A+final_failure_exception%0D%0A++++failure_guard%3A+final_failure_guard" - } - } -}
\ No newline at end of file diff --git a/tests/policy/engine/opspolicy_vOLTE_R1.template b/tests/policy/engine/opspolicy_vOLTE_R1.jinja index ff5fc42c..67119659 100644 --- a/tests/policy/engine/opspolicy_vOLTE_R1.template +++ b/tests/policy/engine/opspolicy_vOLTE_R1.jinja @@ -1,6 +1,6 @@ { "policyConfigType": "BRMS_PARAM", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "policyDescription": "BRMS Param VOLTE policy", "policyScope": "com", "attributes": { diff --git a/tests/policy/engine/pushpolicy.jinja b/tests/policy/engine/pushpolicy.jinja new file mode 100644 index 00000000..a1faaede --- /dev/null +++ b/tests/policy/engine/pushpolicy.jinja @@ -0,0 +1,5 @@ +{ + "policyName":"{{policy_name}}", + "policyType":"{{policy_type}}", + "pdpGroup":"default" +}
\ No newline at end of file diff --git a/tests/policy/engine/pushpolicy.template b/tests/policy/engine/pushpolicy.template deleted file mode 100644 index 7e236e3d..00000000 --- a/tests/policy/engine/pushpolicy.template +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policyName":"${policy_name}", - "policyType":"${policy_type}", - "pdpGroup":"default" -}
\ No newline at end of file diff --git a/tests/policy/engine/sdncnamingpolicy_vFW.template b/tests/policy/engine/sdncnamingpolicy_vFW.jinja index d9c773d1..a012d59c 100644 --- a/tests/policy/engine/sdncnamingpolicy_vFW.template +++ b/tests/policy/engine/sdncnamingpolicy_vFW.jinja @@ -1,6 +1,6 @@ { "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VFW_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vFW\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vFW\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}", - "policyName": "${policy_name}", + "policyName": "{{policy_name}}", "policyConfigType": "MicroService", "onapName": "SDNC", "riskLevel": "4", diff --git a/tests/policy/engine/sdncnamingpolicy_vPG.template b/tests/policy/engine/sdncnamingpolicy_vPG.jinja index 9bae20a1..9aa4f505 100644 --- a/tests/policy/engine/sdncnamingpolicy_vPG.template +++ b/tests/policy/engine/sdncnamingpolicy_vPG.jinja @@ -1,6 +1,6 @@ { - "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VPG_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vPG\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}", "policyName": "${policy_name}", - "policyName": "${policy_name}", + "configBody": "{\"service\":\"SDNC-GenerateName\",\"version\":\"CSIT\",\"content\":{\"policy-instance-name\":\"ONAP_VPG_NAMING_TIMESTAMP\",\"naming-models\":[{\"naming-properties\":[{\"property-name\":\"AIC_CLOUD_REGION\"},{\"property-name\":\"nfRole\"},{\"property-name\":\"TIMESTAMP\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNF\",\"nfRole\":\"vPG\",\"naming-recipe\":\"AIC_CLOUD_REGION|DELIMITER|nfRole|DELIMITER|TIMESTAMP\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"ENTIRETY\",\"start-value\":\"001\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}},{\"property-name\":\"NFC_NAMING_CODE\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"VNFC\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"},{\"property-name\":\"VF_MODULE_LABEL\"},{\"property-name\":\"VF_MODULE_TYPE\"},{\"property-name\":\"SEQUENCE\",\"increment-sequence\":{\"max\":\"zzz\",\"scope\":\"PRECEEDING\",\"start-value\":\"01\",\"length\":\"3\",\"increment\":\"1\",\"sequence-type\":\"alpha-numeric\"}}],\"naming-type\":\"VF-MODULE\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"}],\"naming-type\":\"KEY\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"protected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"protected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"},{\"naming-properties\":[{\"property-name\":\"VNF_NAME\"},{\"property-value\":\"unprotected\",\"property-name\":\"CONSTANT\"},{\"property-value\":\"_\",\"property-name\":\"DELIMITER\"}],\"naming-type\":\"unprotected_private_net_id\",\"nfRole\":\"vPG\",\"naming-recipe\":\"VNF_NAME|DELIMITER|CONSTANT\"}]}}", "policyName": "{{policy_name}}", + "policyName": "{{policy_name}}", "policyConfigType": "MicroService", "onapName": "SDNC", "riskLevel": "4", diff --git a/tests/portal/testsuites/json_templater.robot b/tests/portal/testsuites/json_templater.robot deleted file mode 100644 index 01eba480..00000000 --- a/tests/portal/testsuites/json_templater.robot +++ /dev/null @@ -1,21 +0,0 @@ -*** Settings *** -Documentation This resource is filling out json string templates and returning the json back -Library RequestsLibrary -Library eteutils/StringTemplater.py -Library OperatingSystem -#Resource global_properties.robot - -*** Keywords *** -Fill JSON Template - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json} ${arguments} - ${returned_string}= Template String ${json} ${arguments} - ${returned_json}= To Json ${returned_string} - [Return] ${returned_json} - -Fill JSON Template File - [Documentation] Runs substitution on template to return a filled in json - [Arguments] ${json_file} ${arguments} - ${json}= OperatingSystem.Get File ${json_file} - ${returned_json}= Fill JSON Template ${json} ${arguments} - [Return] ${returned_json}
\ No newline at end of file diff --git a/tests/portal/testsuites/test1.robot b/tests/portal/testsuites/test1.robot index d3196f83..93316548 100644 --- a/tests/portal/testsuites/test1.robot +++ b/tests/portal/testsuites/test1.robot @@ -2,15 +2,13 @@ Documentation This is RobotFrame work script Library ExtendedSelenium2Library Library OperatingSystem -Library eteutils/RequestsClientCert.py Library RequestsLibrary Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating Library DateTime Library Collections -Library eteutils/StringTemplater.py Library String Library XvfbRobot -Resource json_templater.robot *** Variables *** ${PORTAL_URL} http://portal.api.simpledemo.onap.org:8989 @@ -63,7 +61,7 @@ ${GLOBAL_BUILD_NUMBER} 0 ${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt ${jira} jira ${RESOURCE_PATH} ONAPPORTAL/auxapi/ticketevent -${portal_Template} ${CURDIR}/portal.template +${portal_Template} portal.template ${Result} FALSE ${td_id} 0 @@ -1097,7 +1095,8 @@ Enhanced Notification on ONAP Portal Notification on ONAP Portal [Documentation] Create Config portal ${configportal}= Create Dictionary jira_id=${jira} - ${output} = Fill JSON Template File ${portal_Template} ${configportal} + Create Environment portal ${CURDIR} + ${output} = Apply Template portal ${portal_Template} ${configportal} ${post_resp} = Enhanced Notification on ONAP Portal ${RESOURCE_PATH} ${output} Should Be Equal As Strings ${post_resp.status_code} 200 |