From 64c82051fae901cfd7f0cbd42061bbe38a18c3f4 Mon Sep 17 00:00:00 2001 From: Brian Freeman Date: Tue, 8 Dec 2020 09:14:37 -0500 Subject: Fixes for tcagen2 and repush vFWCL policies Issue-ID: INT-1803 Change-Id: Ica53cee26bd19b663bb49ecfc4750fe3cfe32e8c Signed-off-by: Brian Freeman --- ...Firewall_policy_operational_content_input.jinja | 2 +- robot/resources/demo_preload.robot | 3 +- robot/resources/policy_interface.robot | 50 +++++++++++++++++++++- robot/testsuites/closed-loop.robot | 14 +++++- 4 files changed, 63 insertions(+), 6 deletions(-) (limited to 'robot') diff --git a/robot/assets/templates/policy/vFirewall_policy_operational_content_input.jinja b/robot/assets/templates/policy/vFirewall_policy_operational_content_input.jinja index be0d3ce7..205456bc 100644 --- a/robot/assets/templates/policy/vFirewall_policy_operational_content_input.jinja +++ b/robot/assets/templates/policy/vFirewall_policy_operational_content_input.jinja @@ -42,7 +42,7 @@ "failure_guard": "final_failure_guard" } ], - "controllerName": "frankfurt" + "controllerName": "usecases" } } } diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot index 8a18b4e7..3083cc44 100644 --- a/robot/resources/demo_preload.robot +++ b/robot/resources/demo_preload.robot @@ -241,10 +241,9 @@ Instantiate Demo VNF \ ${generic_vnf}= Get From Dictionary ${generic_vnfs} ${vf_module} \ ${model_invariant_id}= Set Variable If '${vf_module_label}' in '${vf_module}' ${generic_vnf['model-invariant-id']} ${model_invariant_id} Log ModelInvariantID=${model_invariant_id} - ${status} ${value}= Run Keyword And Ignore Error Update vVFWCL Policy ${model_invariant_id} + ${status} ${value}= Run Keyword And Ignore Error Update vFWCL Operational and Monitoring Policies ${model_invariant_id} ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name} - Save For Delete [Documentation] Create a variable file to be loaded for save for delete [Arguments] ${tenant_id} ${tenant_name} ${vvg_server_id} ${customer_name} ${service_instance_id} ${stack_name} ${catalog_service_id} ${catalog_resource_ids} diff --git a/robot/resources/policy_interface.robot b/robot/resources/policy_interface.robot index 21d61b61..b8ecf45f 100644 --- a/robot/resources/policy_interface.robot +++ b/robot/resources/policy_interface.robot @@ -47,6 +47,17 @@ Run Policy Pap Get Request Log Received response from Policy Pap ${resp.text} [Return] ${resp} +Run Policy Api Get Request + [Documentation] Runs Policy Api Get request + [Arguments] ${data_path} + ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} + Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy ${data_path} headers=${headers} + Log Received response from policy API ${resp.text} + [Return] ${resp} + Run Policy Api Post Request [Documentation] Runs Policy Api Post request [Arguments] ${data_path} ${data} @@ -96,7 +107,10 @@ Update vVFWCL Policy Validate the vFWCL Policy ${resp}= Run Policy Pap Get Request /policy/pap/v1/pdps - Log Received response from policy ${resp.text} + Log Received response from policy PAP ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + ${resp}= Run Policy Api Get Request /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2 + Log Received response from policy API policytypes ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 Create vFirewall Monitoring Policy @@ -117,6 +131,17 @@ Create vFirewall Operational Policy Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['version']} +Update vFWCL Operational and Monitoring Policies + [Documentation] Undeploy, Delete and Create Operational and Monitoring policies for vFWCL + [Arguments] ${model_invariant_id} + Run Keyword And Ignore Error Run Undeploy vFW Monitoring Policy + Run Keyword And Ignore Error Run Undeploy vFW Operational Policy + # Need to wait a little for undeploy + Validate the vFWCL Policy + Run Keyword and Ignore Error Run Delete vFW Monitoring Policy + Run Keyword And Ignore Error Run Delete vFW Operational Policy + Update vVFWCL Policy ${model_invariant_id} + Push vFirewall Policies To PDP Group [Arguments] ${op_policy_version} ${dict}= Create Dictionary OP_POLICY_VERSION=${op_policy_version} @@ -174,6 +199,29 @@ Run Undeploy Policy Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 +Run Undeploy vFW Monitoring Policy + [Documentation] Runs Policy PAP Undeploy vFW Monitoring Policy from PDP Groups + #[Arguments] ${policy_name} + ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} + Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_PAP_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Delete Request policy /policy/pap/v1/pdps/policies/onap.vfirewall.tca headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + + +Run Delete vFW Monitoring Policy + [Documentation] Runs Policy API Undeploy a Monitoring Policy + #[Arguments] ${policy_name} + ${auth}= Create List ${POLICY_HEALTHCHECK_USERNAME} ${POLICY_HEALTHCHECK_PASSWORD} + ${session}= Create Session policy ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} auth=${auth} + Log Creating session ${GLOBAL_POLICY_SERVER_PROTOCOL}://${POLICY_API_IP}:${GLOBAL_POLICY_HEALTHCHECK_PORT} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Delete Request policy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.vfirewall.tca/versions/1.0.0 headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Run Delete Policy Request [Documentation] Runs Policy Delete request diff --git a/robot/testsuites/closed-loop.robot b/robot/testsuites/closed-loop.robot index de30af2c..3c8e7083 100644 --- a/robot/testsuites/closed-loop.robot +++ b/robot/testsuites/closed-loop.robot @@ -19,10 +19,20 @@ VFWCL Closed Loop Test [TAGS] vfwclosedloop Log ${EMPTY} VFWCL High Test ${PACKET_GENERATOR_HOST} + Sleep 60 VFWCL Low Test ${PACKET_GENERATOR_HOST} [Teardown] VFWCL Set To Medium ${PACKET_GENERATOR_HOST} -VFWCL Repush Operation Policy +VFWCL Repush Monitoring And Operational Policies [TAGS] repushpolicy - Run Keyword And Ignore Error Undeploy Policy operational.modifyconfig + Validate the vFWCL Policy + Run Keyword And Ignore Error Run Undeploy vFW Monitoring Policy + Validate the vFWCL Policy + Run Keyword and Ignore Error Run Delete vFW Monitoring Policy + Validate the vFWCL Policy + Run Keyword And Ignore Error Run Undeploy vFW Operational Policy + Validate the vFWCL Policy + Run Keyword And Ignore Error Run Delete vFW Operational Policy + Validate the vFWCL Policy Update vVFWCL Policy ${MODEL_INVARIANT_ID} + Validate the vFWCL Policy -- cgit 1.2.3-korg