Fix parsing in closed loop policy checks 52/71752/1
authorGary Wu <gary.i.wu@huawei.com>
Fri, 2 Nov 2018 18:27:28 +0000 (11:27 -0700)
committerGary Wu <gary.i.wu@huawei.com>
Fri, 2 Nov 2018 18:27:28 +0000 (11:27 -0700)
Also added new tags to assist per-suite debugging.

Change-Id: Ice67dee685f2ee583ae54c0bba1ca7358f842da1
Issue-ID: INT-586
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
robot/resources/test_templates/closedloop_test_template.robot
robot/testsuites/closed-loop.robot

index f83ce5b..fe33e74 100644 (file)
@@ -55,7 +55,7 @@ VFW Policy
     Log    Suite name ${SUITE NAME} ${TEST NAME} ${PREV TEST NAME}
     Initialize VFW Policy
     ${stackname}=   Orchestrate VNF vFW closedloop
-    Policy Check Firewall Stack    ${stackname}    ${VFWPOLICYRATE}
+    Policy Check FirewallCL Stack    ${stackname}    ${VFWPOLICYRATE}
     Delete VNF
 
 VDNS Policy
@@ -85,22 +85,17 @@ Get Configs VFW Policy
 
        ${json}=    Parse Json    ${get_resp.content}
     ${config}=    Parse Json    ${json[0]["config"]}
+    ${thresholds}=    Get Variable Value      ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"]}
 
     # Extract object1 from Array
-    ${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 As Integers   ${Thresold_Value}    ${Expected_Threshold_1}
-    ${direction}=    Get Variable Value      ${config["content"]["thresholds"][0]["direction"]}
-    Should Be Equal   ${direction}    ${Expected_Direction_1}
+    Should Be Equal    ${thresholds[0]["severity"]}    ${Expected_Severity_1}
+    Should Be Equal As Integers   ${thresholds[0]["thresholdValue"]}    ${Expected_Threshold_1}
+    Should Be Equal   ${thresholds[0]["direction"]}    ${Expected_Direction_1}
 
     # Extract object2 from Array
-    ${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 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}
+    Should Be Equal    ${thresholds[1]["severity"]}    ${Expected_Severity_2}
+    Should Be Equal As Integers   ${thresholds[1]["thresholdValue"]}    ${Expected_Threshold_2}
+    Should Be Equal   ${thresholds[1]["direction"]}    ${Expected_Direction_2}
 
 Get Configs VDNS Policy
     [Documentation]    Get Config Policy for VDNS
@@ -111,14 +106,12 @@ Get Configs VDNS Policy
        Should Be Equal As Strings      ${get_resp.status_code}         200
     ${json}=    Parse Json    ${get_resp.content}
     ${config}=    Parse Json    ${json[0]["config"]}
+    ${thresholds}=    Get Variable Value      ${config["content"]["tca_policy"]["metricsPerEventName"][0]["thresholds"]}
 
     # Extract object1 from Array
-    ${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}
+    Should Be Equal    ${thresholds[0]["severity"]}    ${Expected_Severity_2}
+    Should Be Equal As Integers   ${thresholds[0]["thresholdValue"]}    ${Expected_Threshold_1}
+    Should Be Equal   ${thresholds[0]["direction"]}    ${Expected_Direction_3}
 
 Teardown Closed Loop
     [Documentation]   Tear down a closed loop test case
index 7e19301..26700e8 100644 (file)
@@ -8,10 +8,10 @@ Test Teardown    Teardown Closed Loop
 *** Test Cases ***
 
 VFW Closed Loop Test
-    [TAGS]    ete    closedloop
+    [TAGS]    ete    closedloop    vfwcl
     VFW Policy
 VDNS Closed Loop Test
-    [TAGS]    ete    closedloop
+    [TAGS]    ete    closedloop    vdnscl
     VDNS Policy
 VFWCL Closed Loop Test
     [TAGS]    vfwclosedloop