Fixes for tcagen2 and repush vFWCL policies 21/116221/1
authorBrian Freeman <bf1936@att.com>
Tue, 8 Dec 2020 14:14:37 +0000 (09:14 -0500)
committerBrian Freeman <bf1936@att.com>
Tue, 8 Dec 2020 14:21:28 +0000 (09:21 -0500)
Issue-ID: INT-1803
Change-Id: Ica53cee26bd19b663bb49ecfc4750fe3cfe32e8c
Signed-off-by: Brian Freeman <bf1936@att.com>
robot/assets/templates/policy/vFirewall_policy_operational_content_input.jinja
robot/resources/demo_preload.robot
robot/resources/policy_interface.robot
robot/testsuites/closed-loop.robot

index be0d3ce..205456b 100644 (file)
@@ -42,7 +42,7 @@
                                 "failure_guard": "final_failure_guard"
                             }
                         ],
-                        "controllerName": "frankfurt"
+                        "controllerName": "usecases"
                     }
                 }
             }
index 8a18b4e..3083cc4 100644 (file)
@@ -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}
index 21d61b6..b8ecf45 100644 (file)
@@ -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
index de30af2..3c8e708 100644 (file)
@@ -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