diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2018-09-27 10:38:50 -0700 |
---|---|---|
committer | Gary Wu <gary.i.wu@huawei.com> | 2018-09-27 10:39:43 -0700 |
commit | 9abb61ca2cea1907cab2cec312d6dca6e53a93cd (patch) | |
tree | c8ff0718b6626832efd3ff3acc48590dbd6cb64c /tests/policy/suite1 | |
parent | a328a3e2e531240ea4a9ed2ce4a284af1be5e225 (diff) |
Move CSIT to integration/csit repo
To facilite branching of CSIT tests, all CSIT test
code and scripts are relocated to the integration/csit
repo.
Change-Id: I1e4c0eff44691f73f8098b3c52764107f6b8b8df
Issue-ID: INT-671
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'tests/policy/suite1')
27 files changed, 731 insertions, 0 deletions
diff --git a/tests/policy/suite1/Policy-CSIT.robot b/tests/policy/suite1/Policy-CSIT.robot new file mode 100644 index 00000000..785619f9 --- /dev/null +++ b/tests/policy/suite1/Policy-CSIT.robot @@ -0,0 +1,360 @@ +*** Settings *** +Documentation Policy ONAP CSIT Test cases +Library String +Library HttpLibrary.HTTP +LIbrary Process +Library BuiltIn +Resource policy_interface.robot +Resource json_templater.robot + +*** Variables *** +${RESOURCE_PATH_CREATE} /pdp/api/createPolicy +${RESOURCE_PATH_CREATE_PUSH} /pdp/api/pushPolicy +${RESOURCE_PATH_CREATE_DELETE} /pdp/api/deletePolicy +${RESOURCE_PATH_GET_CONFIG} /pdp/api/getConfig +${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 +${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 +${CONFIG_POLICY_VDNS_TYPE} MicroService +${OPS_POLICY_VFW_NAME} vFirewall +${OPS_POLICY_VFW_TYPE} BRMS_PARAM +${OPS_POLICY_VDNS_NAME} vLoadBalancer +${OPS_POLICY_VDNS_TYPE} BRMS_PARAM +${CONFIG_POLICY_VCPE_NAME} vCPE +${CONFIG_POLICY_VCPE_TYPE} MicroService +${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 +${SDNC_POLICY_VFW_NAME} ONAP_vFW_Naming +${SDNC_POLICY_VPG_NAME} ONAP_vPG_Naming +${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 + + +*** Test Cases *** +Policy Health check + Run Policy Health Check + +VFW Config Policy + ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy + Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + #VFW Policy Tests + +VDNS Config Policy + ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy + Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} + #VDNS Policy Tests + +VCPE Config Policy + ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy + Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} + #VCPE Policy Tests + +VFW Ops Policy + ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy + Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} + +VDNS Ops Policy + ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy + Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} + +VCPE Ops Policy + ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy + Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} + +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 + +VFW SDNC Naming Policy + ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy + Push Config Policy ${SDNC_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + #VFW Policy Tests + +VPG SDNC Naming Policy + ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy + Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} + #VPG 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 + +VDNS Get Configs Policy + Sleep 5s + Get Configs VDNS Policy + +VCPE Get Configs Policy + Sleep 5s + Get Configs VCPE Policy + +HPA Get OOF Policy + Sleep 5s + Get OOF HPA Policy + +*** Keywords *** + +VFW Policy Tests + ${CONFIG_POLICY_VFW_NAME}= Create Config VFW Policy + Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + Get Configs VFW Policy + ${OPS_POLICY_VFW_NAME}= Create Ops VFW Policy + Push Ops Policy ${OPS_POLICY_VFW_NAME} ${OPS_POLICY_VFW_TYPE} + ${SDNC_POLICY_VFW_NAME}= Create VFW SDNC Naming Policy + Push Config Policy ${CONFIG_POLICY_VFW_NAME} ${CONFIG_POLICY_VFW_TYPE} + +VDNS Policy Tests + ${CONFIG_POLICY_VDNS_NAME}= Create Config VDNS Policy + Push Config Policy ${CONFIG_POLICY_VDNS_NAME} ${CONFIG_POLICY_VDNS_TYPE} + Get Configs VDNS Policy + ${OPS_POLICY_VDNS_NAME}= Create Ops VDNS Policy + Push Ops Policy ${OPS_POLICY_VDNS_NAME} ${OPS_POLICY_VDNS_TYPE} + +VCPE Policy Tests + ${CONFIG_POLICY_VCPE_NAME}= Create Config VCPE Policy + Push Config Policy ${CONFIG_POLICY_VCPE_NAME} ${CONFIG_POLICY_VCPE_TYPE} + Get Configs VCPE Policy + ${OPS_POLICY_VCPE_NAME}= Create Ops VCPE Policy + Push Ops Policy ${OPS_POLICY_VCPE_NAME} ${OPS_POLICY_VCPE_TYPE} + +VPG Policy Tests + ${SDNC_POLICY_VPG_NAME}= Create VPG SDNC Naming Policy + Push Config Policy ${SDNC_POLICY_VPG_NAME} ${CONFIG_POLICY_VFW_TYPE} + +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}* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${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 + ${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 + ${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} + ${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 + ${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} + ${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 + ${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} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + [Return] ${policyname1} + +Create Policy Name + [Documentation] Generate Policy Name + [Arguments] ${prefix}=CSIT_ + ${random}= Generate Random String 15 [LOWER][NUMBERS] + ${policyname}= Catenate ${prefix}${random} + [Return] ${policyname} + +Create Ops VFW Policy + [Documentation] Create Operational Policy + ${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} + ${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} + +Push Ops Policy + [Documentation] Push Ops Policy + [Arguments] ${policyname} ${policytype} + ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} + ${output} = Fill JSON Template File ${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} + ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} + ${output} = Fill JSON Template File ${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} + ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.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 + +Delete Config Policy + [Documentation] Delete Ops Policy + [Arguments] ${policy_name} + ${policyname3}= Catenate com.Config_MS_com.${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 + +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}* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${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 + ${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} + ${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 + ${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} + ${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} + +Create Config VCPE Policy + [Documentation] Create Config Policy + ${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} + ${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 + ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_VCPE_NAME}* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${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 + ${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} + ${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} + +Create Ops VolTE Policy + [Documentation] Create Operational Policy + ${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} + ${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} + +Upload DRL file + [Documentation] Upload DRL file1 + ${file_data}= Get Binary File ${file_path} + ${files}= Create Dictionary file=${file_data} + #${CONFIG_POLICY_VDNS_NAME}= Set Test Variable ${policyname1} + # ${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 diff --git a/tests/policy/suite1/__init__.robot b/tests/policy/suite1/__init__.robot new file mode 100644 index 00000000..c7970e6a --- /dev/null +++ b/tests/policy/suite1/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Policy - Suite 1 diff --git a/tests/policy/suite1/configpolicy_vCPE.template b/tests/policy/suite1/configpolicy_vCPE.template new file mode 100644 index 00000000..e3e3a2d0 --- /dev/null +++ b/tests/policy/suite1/configpolicy_vCPE.template @@ -0,0 +1,6 @@ +{ +"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/suite1/configpolicy_vCPE_R1.template b/tests/policy/suite1/configpolicy_vCPE_R1.template new file mode 100644 index 00000000..77653c3f --- /dev/null +++ b/tests/policy/suite1/configpolicy_vCPE_R1.template @@ -0,0 +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}", + "onapName": "DCAE", + "priority": "5" +} diff --git a/tests/policy/suite1/configpolicy_vDNS.template b/tests/policy/suite1/configpolicy_vDNS.template new file mode 100644 index 00000000..ab1d2e0d --- /dev/null +++ b/tests/policy/suite1/configpolicy_vDNS.template @@ -0,0 +1,6 @@ +{ +"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/suite1/configpolicy_vDNS_R1.template b/tests/policy/suite1/configpolicy_vDNS_R1.template new file mode 100644 index 00000000..185a7c72 --- /dev/null +++ b/tests/policy/suite1/configpolicy_vDNS_R1.template @@ -0,0 +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}", + "onapName": "DCAE", + "priority": "5" +} diff --git a/tests/policy/suite1/configpolicy_vFW.template b/tests/policy/suite1/configpolicy_vFW.template new file mode 100644 index 00000000..39e99e7b --- /dev/null +++ b/tests/policy/suite1/configpolicy_vFW.template @@ -0,0 +1,6 @@ +{ +"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/suite1/configpolicy_vFW_R1.template b/tests/policy/suite1/configpolicy_vFW_R1.template new file mode 100644 index 00000000..067ed07f --- /dev/null +++ b/tests/policy/suite1/configpolicy_vFW_R1.template @@ -0,0 +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}", + "onapName": "DCAE", + "priority": "5" +} diff --git a/tests/policy/suite1/createpolicy.template b/tests/policy/suite1/createpolicy.template new file mode 100644 index 00000000..7c693e84 --- /dev/null +++ b/tests/policy/suite1/createpolicy.template @@ -0,0 +1,21 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "policyDescription": "Create BRMS Param policy", + "attributes": { + "RULE": { + "templateName": "ClosedLoopDemo_closedLoopControlName", + "aaiNamedQueryUUID": "2", + "aaiPassword": "2", + "aaiPatternMatch": "2", + "aaiURL": "2", + "actor": "2", + "appcTopic": "2", + "closedLoopControlName": "2", + "msoPassword": "2", + "msoURL": "2", + "msoUsername": "2", + "aaiUsername": "3" + } + } +} diff --git a/tests/policy/suite1/deletepolicy.template b/tests/policy/suite1/deletepolicy.template new file mode 100644 index 00000000..55510102 --- /dev/null +++ b/tests/policy/suite1/deletepolicy.template @@ -0,0 +1,5 @@ +{ + "pdpGroup": "default", + "policyComponent": "PDP", + "policyName": "${policy_name}" +} diff --git a/tests/policy/suite1/getconfigpolicy.template b/tests/policy/suite1/getconfigpolicy.template new file mode 100644 index 00000000..611e65d0 --- /dev/null +++ b/tests/policy/suite1/getconfigpolicy.template @@ -0,0 +1,8 @@ +{ + "configAttributes" : { + }, + "configName" : ".*", + "ecompName" : "DCAE", + "policyName" : "${config_policy_name}", + "unique" : false +}
\ No newline at end of file diff --git a/tests/policy/suite1/getoofpolicy.template b/tests/policy/suite1/getoofpolicy.template new file mode 100644 index 00000000..37fe0471 --- /dev/null +++ b/tests/policy/suite1/getoofpolicy.template @@ -0,0 +1,6 @@ +{ + "configAttributes" : { + }, + "policyName" : "${oof_policy_name}", + "unique" : false +} diff --git a/tests/policy/suite1/global_properties.robot b/tests/policy/suite1/global_properties.robot new file mode 100644 index 00000000..60826bbc --- /dev/null +++ b/tests/policy/suite1/global_properties.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation store all properties that can change or are used in multiple places here +... format is all caps with underscores between words and prepended with GLOBAL +... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. + + +*** Variables *** +${GLOBAL_APPLICATION_ID} robot-ete +${GLOBAL_MSO_STATUS_PATH} /ecomp/mso/infra/orchestrationRequests/v2/ +${GLOBAL_SELENIUM_BROWSER} chrome +${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary +${GLOBAL_SELENIUM_DELAY} 0 +${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} 5 +${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} 15 +${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} orchestration +${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} volume +${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} compute +${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} network +${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE} image +${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} identity +${GLOBAL_AAI_CLOUD_OWNER} Rackspace +${GLOBAL_BUILD_NUMBER} 31 +${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt +# policy info - everything is from the private oam network (also called ecomp private network) +${GLOBAL_POLICY_SERVER_URL} https://%{PDP_IP}:8081 +${GLOBAL_POLICY_AUTH} dGVzdHBkcDphbHBoYTEyMw== +${GLOBAL_POLICY_CLIENTAUTH} cHl0aG9uOnRlc3Q= +${GLOBAL_POLICY_HEALTHCHECK_URL} https://%{POLICY_IP}:6969 +${GLOBAL_POLICY_USERNAME} healthcheck +${GLOBAL_POLICY_PASSWORD} zb!XztG34 diff --git a/tests/policy/suite1/json_templater.robot b/tests/policy/suite1/json_templater.robot new file mode 100644 index 00000000..a1cc7e35 --- /dev/null +++ b/tests/policy/suite1/json_templater.robot @@ -0,0 +1,21 @@ +*** 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/policy/suite1/oofpolicy_HPA_R1.template b/tests/policy/suite1/oofpolicy_HPA_R1.template new file mode 100644 index 00000000..3a170b20 --- /dev/null +++ b/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" +} diff --git a/tests/policy/suite1/opspolicy_VDNS.template b/tests/policy/suite1/opspolicy_VDNS.template new file mode 100644 index 00000000..801773d5 --- /dev/null +++ b/tests/policy/suite1/opspolicy_VDNS.template @@ -0,0 +1,26 @@ +{ + "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/suite1/opspolicy_VDNS_R1.template b/tests/policy/suite1/opspolicy_VDNS_R1.template new file mode 100644 index 00000000..92627cc2 --- /dev/null +++ b/tests/policy/suite1/opspolicy_VDNS_R1.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "policyDescription": "BRMS Param vDNS policy", + "policyScope": "com", + "attributes": { + "MATCHING": { + "controller" : "amsterdam" + }, + "RULE": { + "templateName": "ClosedLoopControlName", + "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0D%0A++trigger_policy%3A+unique-policy-id-1-scale-up%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-scale-up%0D%0A++++name%3A+Create+a+new+VF+Module%0D%0A++++description%3A%0D%0A++++actor%3A+SO%0D%0A++++recipe%3A+VF+Module+Create%0D%0A++++target%3A%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%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/suite1/opspolicy_VFW.template b/tests/policy/suite1/opspolicy_VFW.template new file mode 100644 index 00000000..224f5cf4 --- /dev/null +++ b/tests/policy/suite1/opspolicy_VFW.template @@ -0,0 +1,24 @@ +{ + "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/suite1/opspolicy_VFW_R1.template b/tests/policy/suite1/opspolicy_VFW_R1.template new file mode 100644 index 00000000..a93063f7 --- /dev/null +++ b/tests/policy/suite1/opspolicy_VFW_R1.template @@ -0,0 +1,16 @@ +{ + "policyConfigType": "BRMS_PARAM", + "policyName": "${policy_name}", + "policyDescription": "BRMS Param vFirewall policy", + "policyScope": "com", + "attributes": { + "MATCHING": { + "controller" : "amsterdam" + }, + "RULE": { + "templateName": "ClosedLoopControlName", + "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", + "controlLoopYaml": "controlLoop%3A%0D%0A++version%3A+2.0.0%0D%0A++controlLoopName%3A+ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0D%0A++trigger_policy%3A+unique-policy-id-1-modifyConfig%0D%0A++timeout%3A+1200%0D%0A++abatement%3A+false%0D%0A+%0D%0Apolicies%3A%0D%0A++-+id%3A+unique-policy-id-1-modifyConfig%0D%0A++++name%3A+modify+packet+gen+config%0D%0A++++description%3A%0D%0A++++actor%3A+APPC%0D%0A++++recipe%3A+ModifyConfig%0D%0A++++target%3A%0D%0A++++++%23+TBD+-+Cannot+be+known+until+instantiation+is+done%0D%0A++++++resourceID%3A+Eace933104d443b496b8.nodes.heat.vpg%0D%0A++++++type%3A+VNF%0D%0A++++retry%3A+0%0D%0A++++timeout%3A+300%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" + } + } +} diff --git a/tests/policy/suite1/opspolicy_vCPE.template b/tests/policy/suite1/opspolicy_vCPE.template new file mode 100644 index 00000000..c17a1bc6 --- /dev/null +++ b/tests/policy/suite1/opspolicy_vCPE.template @@ -0,0 +1,16 @@ +{ + "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/suite1/opspolicy_vCPE_R1.template b/tests/policy/suite1/opspolicy_vCPE_R1.template new file mode 100644 index 00000000..36695daa --- /dev/null +++ b/tests/policy/suite1/opspolicy_vCPE_R1.template @@ -0,0 +1,16 @@ +{ + "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++abatement%3A+true%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/suite1/opspolicy_vOLTE.template b/tests/policy/suite1/opspolicy_vOLTE.template new file mode 100644 index 00000000..e43a3e6f --- /dev/null +++ b/tests/policy/suite1/opspolicy_vOLTE.template @@ -0,0 +1,16 @@ +{ + "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/suite1/opspolicy_vOLTE_R1.template b/tests/policy/suite1/opspolicy_vOLTE_R1.template new file mode 100644 index 00000000..ff5fc42c --- /dev/null +++ b/tests/policy/suite1/opspolicy_vOLTE_R1.template @@ -0,0 +1,16 @@ +{ + "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++abatement%3A+false%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/suite1/policy_interface.robot b/tests/policy/suite1/policy_interface.robot new file mode 100644 index 00000000..79178708 --- /dev/null +++ b/tests/policy/suite1/policy_interface.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation The main interface for interacting with Policy. It handles low level stuff like managing the http request library and Policy required fields +Library eteutils/RequestsClientCert.py +#Library RequestsClientCert +Library RequestsLibrary +Library String +Library eteutils/JSONUtils.py +#Library JSONUtils +Library Collections +Resource global_properties.robot + +*** Variables *** +${POLICY_HEALTH_CHECK_PATH} /healthcheck + +*** Keywords *** + +Run Policy Health Check + [Documentation] Runs Policy Health check + ${auth}= Create List ${GLOBAL_POLICY_USERNAME} ${GLOBAL_POLICY_PASSWORD} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_HEALTHCHECK_URL} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy ${POLICY_HEALTH_CHECK_PATH} headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be True ${resp.json()['healthy']} + @{ITEMS}= Copy List ${resp.json()['details']} + :FOR ${ELEMENT} IN @{ITEMS} + \ Should Be Equal As Strings ${ELEMENT['code']} 200 + \ Should Be True ${ELEMENT['healthy']} + +Run Policy Put Request + [Documentation] Runs Policy Put request + [Arguments] ${data_path} ${data} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST + ${resp}= Put Request policy ${data_path} data=${data} headers=${headers} + Log Received response from policy ${resp.text} + [Return] ${resp} + +Run Policy Delete Request + [Documentation] Runs Policy Delete request + [Arguments] ${data_path} ${data} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} Environment=TEST + ${resp}= Delete Request policy ${data_path} data=${data} headers=${headers} + Log Received response from policy ${resp.text} + [Return] ${resp} + +Run Policy Get Configs Request + [Documentation] Runs Policy Get Configs request + [Arguments] ${data_path} ${data} + Log Creating session ${GLOBAL_POLICY_SERVER_URL} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_URL} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} + ${resp}= Post Request policy ${data_path} data=${data} headers=${headers} + Log Received response from policy ${resp.text} + [Return] ${resp}
\ No newline at end of file diff --git a/tests/policy/suite1/pushpolicy.template b/tests/policy/suite1/pushpolicy.template new file mode 100644 index 00000000..7e236e3d --- /dev/null +++ b/tests/policy/suite1/pushpolicy.template @@ -0,0 +1,5 @@ +{ + "policyName":"${policy_name}", + "policyType":"${policy_type}", + "pdpGroup":"default" +}
\ No newline at end of file diff --git a/tests/policy/suite1/sdncnamingpolicy_vFW.template b/tests/policy/suite1/sdncnamingpolicy_vFW.template new file mode 100644 index 00000000..d9c773d1 --- /dev/null +++ b/tests/policy/suite1/sdncnamingpolicy_vFW.template @@ -0,0 +1,11 @@ +{ + "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}", + "policyConfigType": "MicroService", + "onapName": "SDNC", + "riskLevel": "4", + "riskType": "test", + "guard": "false", + "priority": "4", + "description": "ONAP_VFW_NAMING_TIMESTAMP" +}
\ No newline at end of file diff --git a/tests/policy/suite1/sdncnamingpolicy_vPG.template b/tests/policy/suite1/sdncnamingpolicy_vPG.template new file mode 100644 index 00000000..9bae20a1 --- /dev/null +++ b/tests/policy/suite1/sdncnamingpolicy_vPG.template @@ -0,0 +1,11 @@ +{ + "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", + "riskType": "test", + "guard": "false", + "priority": "4", + "description": "ONAP_VPG_NAMING_TIMESTAMP" +}
\ No newline at end of file |