Merge "Fix robot preload VNF issue"
[testsuite.git] / robot / resources / test_templates / closedloop_test_template.robot
index 6930e56..f83ce5b 100644 (file)
@@ -1,9 +1,11 @@
 *** Settings ***
 Documentation    Policy Closed Loop Test cases
 
-Resource          ../policy_interface.robot
+Resource        ../policy_interface.robot
 Resource        ../stack_validation/policy_check_vfw.robot
+Resource        ../stack_validation/packet_generator_interface.robot
 Resource        vnf_orchestration_test_template.robot
+
 Library    String
 Library    HttpLibrary.HTTP
 LIbrary    Process
@@ -88,7 +90,7 @@ Get Configs VFW Policy
     ${severity}=    Get Variable Value      ${config["content"]["thresholds"][0]["severity"]}
     Should Be Equal    ${severity}    ${Expected_Severity_1}
     ${Thresold_Value}=    Get Variable Value      ${config["content"]["thresholds"][0]["thresholdValue"]}
-    Should Be Equal   ${Thresold_Value}    ${Expected_Threshold_1}
+    Should Be Equal As Integers   ${Thresold_Value}    ${Expected_Threshold_1}
     ${direction}=    Get Variable Value      ${config["content"]["thresholds"][0]["direction"]}
     Should Be Equal   ${direction}    ${Expected_Direction_1}
 
@@ -96,13 +98,13 @@ Get Configs VFW Policy
     ${severity_1}=    Get Variable Value      ${config["content"]["thresholds"][1]["severity"]}
     Should Be Equal    ${severity_1}    ${Expected_Severity_2}
     ${Thresold_Value_1}=    Get Variable Value      ${config["content"]["thresholds"][1]["thresholdValue"]}
-    Should Be Equal   ${Thresold_Value_1}    ${Expected_Threshold_2}
+    Should Be Equal As Integers   ${Thresold_Value_1}    ${Expected_Threshold_2}
     ${direction_1}=    Get Variable Value      ${config["content"]["thresholds"][1]["direction"]}
     Should Be Equal   ${direction_1}    ${Expected_Direction_2}
 
 Get Configs VDNS Policy
     [Documentation]    Get Config Policy for VDNS
-    ${getconfigpolicy}=    Catenate    .*vLoadBalancer*
+    ${getconfigpolicy}=    Catenate    .*MicroServicevDNS*
     ${configpolicy_name}=    Create Dictionary    config_policy_name=${getconfigpolicy}
     ${output} =     Fill JSON Template File     ${GECONFIG_VFW_TEMPLATE}    ${configpolicy_name}
     ${get_resp} =    Run Policy Get Configs Request    ${RESOURCE_PATH_GET_CONFIG}   ${output}
@@ -111,11 +113,11 @@ Get Configs VDNS Policy
     ${config}=    Parse Json    ${json[0]["config"]}
 
     # Extract object1 from Array
-    ${severity}=    Get Variable Value      ${config["content"]["thresholds"][0]["severity"]}
-    Should Be Equal    ${severity}    ${Expected_Severity_3}
-    ${Thresold_Value}=    Get Variable Value      ${config["content"]["thresholds"][0]["thresholdValue"]}
-    Should Be Equal   ${Thresold_Value}    ${Expected_Threshold_3}
-    ${direction}=    Get Variable Value      ${config["content"]["thresholds"][0]["direction"]}
+    ${severity}=    Get Variable Value      ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"][0]["severity"]}
+    Should Be Equal    ${severity}    ${Expected_Severity_2}
+    ${Thresold_Value}=    Get Variable Value      ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"][0]["thresholdValue"]}
+    Should Be Equal As Integers   ${Thresold_Value}    ${Expected_Threshold_1}
+    ${direction}=    Get Variable Value      ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"][0]["direction"]}
     Should Be Equal   ${direction}    ${Expected_Direction_3}
 
 Teardown Closed Loop
@@ -192,7 +194,7 @@ Orchestrate VNF vFW closedloop
        [Documentation]    VNF Orchestration for vFW
        Log    VNF Orchestration flow TEST NAME=${TEST NAME}
        Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}    SharedNode    OwnerType    v1    CloudZone
-       ${stack_name}    ${service}=  Orchestrate VNF   ETE_CLP    vFW      vFW   ${TENANT_NAME}
+       ${stack_name}    ${service}=  Orchestrate VNF   ETE_CLP    vFWCL      vFWCL   ${TENANT_NAME}
        [Return]  ${stack_name}
 
  Orchestrate VNF vDNS closedloop
@@ -201,3 +203,30 @@ Orchestrate VNF vFW closedloop
        Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}   SharedNode    OwnerType    v1    CloudZone
        ${stack_name}    ${service}=  Orchestrate VNF   ETE_CLP    vLB      vLB   ${TENANT_NAME}
        [Return]  ${stack_name}
+
+VFWCL High Test
+       [Documentation]    Test Control Loop for High Traffic
+        [Arguments]    ${pkg_host}
+       Enable Streams    ${pkg_host}   10
+       :FOR    ${i}    IN RANGE    8
+       \   Sleep  15s
+       \   ${resp}=   Get List Of Enabled Streams   ${pkg_host}
+        \   ${stream_count}=   Evaluate  len(${resp['sample-plugin']['pg-streams']['pg-stream']})
+        \   Log To Console   Number of steam: ${stream_count}
+        \   Exit For Loop If   '${stream_count}'=='5' 
+        Should Be Equal As Integers  ${stream_count}   5
+
+VFWCL Low Test
+       [Documentation]    Test Control Loop for Low Traffic
+        [Arguments]    ${pkg_host}
+       Enable Streams    ${pkg_host}   1
+       Get List Of Enabled Streams   ${pkg_host}
+       :FOR    ${i}    IN RANGE    8
+       \   Sleep  15s
+       \   ${resp}=   Get List Of Enabled Streams   ${pkg_host}
+        \   ${stream_count}=   Evaluate  len(${resp['sample-plugin']['pg-streams']['pg-stream']})
+        \   Log To Console   Number of steam: ${stream_count}
+        \   Exit For Loop If   '${stream_count}'=='5' 
+        Should Be Equal As Integers  ${stream_count}   5
+
+